wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  列表页面lottie动画crash问题修复。下拉刷新动画使用优化
  feat:1)搜索页面,切换关键字搜索,tab变化
  fix(18674): 功能缺陷-必修-【uat】人民号>推荐>北京专题,专题样式问题,看视频
  fix(19113): 直播暂停,重新播放后应重新拉取最新直播流,现状:暂停处续播
  feat:1)Logger.debug日志中添加一个动态的prefix参数据,方便打印完整的日志信息
... ... @@ -40,15 +40,10 @@ export class Logger {
Logger.domain = domain;
}
static debug(prefixStr?:string,...args: string[]) {
static debug(...args: string[]) {
if (!Logger.isDebug) {
return
}
if(prefixStr){
Logger.prefix = prefixStr
}else {
Logger.prefix = 'SightApp';
}
Logger.logContent(LogLevel.DEBUG, ...args)
}
... ... @@ -90,55 +85,68 @@ export class Logger {
static logContent(level: LogLevel, ...args: string[]) {
let msg = Logger.getMsg(...args)
let tag = Logger.getTag(...args)
let length = msg.length
if (length < Logger.CHUNK_SIZE) {
// 不超限,保持原来的打印
Logger.print(level, ...args)
Logger.print(tag, level, ...args)
} else {
// 超限,分段打印
for (let i = 0; i < length; i += Logger.CHUNK_SIZE) {
let count = Math.min(length - i, Logger.CHUNK_SIZE);
Logger.printExt(level, msg.substring(i, i + count));
Logger.printExt(tag, level, msg.substring(i, i + count));
}
}
}
static print(level: LogLevel, ...msg: string[]) {
static print(tag: string, level: LogLevel, ...msg: string[]) {
let prefix = Logger.prefix
if (tag) {
prefix = tag
}
switch (level) {
case LogLevel.DEBUG:
hilog.debug(Logger.domain, Logger.prefix, Logger.format, msg);
hilog.debug(Logger.domain, prefix, Logger.format, msg);
break
case LogLevel.INFO:
hilog.info(Logger.domain, Logger.prefix, Logger.format, msg);
hilog.info(Logger.domain, prefix, Logger.format, msg);
break
case LogLevel.WARN:
hilog.warn(Logger.domain, Logger.prefix, Logger.format, msg);
hilog.warn(Logger.domain, prefix, Logger.format, msg);
break
case LogLevel.ERROR:
hilog.error(Logger.domain, Logger.prefix, Logger.format, msg);
hilog.error(Logger.domain, prefix, Logger.format, msg);
break
case LogLevel.FATAL:
hilog.fatal(Logger.domain, Logger.prefix, Logger.format, msg);
hilog.fatal(Logger.domain, prefix, Logger.format, msg);
break
}
}
static printExt(level: LogLevel, msg: string) {
static printExt(tag: string, level: LogLevel, msg: string) {
let prefix = Logger.prefix
if (tag) {
prefix = tag
}
switch (level) {
case LogLevel.DEBUG:
hilog.debug(Logger.domain, Logger.prefix, Logger.format_ext, msg);
hilog.debug(Logger.domain, prefix, Logger.format_ext, msg);
break
case LogLevel.INFO:
hilog.info(Logger.domain, Logger.prefix, Logger.format_ext, msg);
hilog.info(Logger.domain, prefix, Logger.format_ext, msg);
break
case LogLevel.WARN:
hilog.warn(Logger.domain, Logger.prefix, Logger.format_ext, msg);
hilog.warn(Logger.domain, prefix, Logger.format_ext, msg);
break
case LogLevel.ERROR:
hilog.error(Logger.domain, Logger.prefix, Logger.format_ext, msg);
hilog.error(Logger.domain, prefix, Logger.format_ext, msg);
break
case LogLevel.FATAL:
hilog.fatal(Logger.domain, Logger.prefix, Logger.format_ext, msg);
hilog.fatal(Logger.domain, prefix, Logger.format_ext, msg);
break
}
}
... ... @@ -153,6 +161,20 @@ export class Logger {
})
return msg.substring(2, msg.length);
}
static getTag(...args: string[]): string {
if (args == null || args.length <= 0) {
return '';
}
if (args.length > 1) {
return args[0]
} else {
return ''
}
}
}
// export default new Logger('SightApp', 0xFF00)
\ No newline at end of file
... ...
... ... @@ -85,8 +85,8 @@ export default struct CustomLayout {
name: this.animateName,
path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
this.animateItem.goToAndStop(1)
}
this.animateItem.goToAndStop(1)
let total = CustomLayout.REFRESH_HEIGHT
let progress = offset * 100 / total
this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true);
... ... @@ -103,9 +103,6 @@ export default struct CustomLayout {
path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
}
// this.animateItem2.isLoaded
// TODO 是否拦截重复触发
this.animateItem2.goToAndPlay(1)
}
getFramesByProgress(progress: number): number {
... ...
... ... @@ -18,14 +18,18 @@ export struct CustomPullToRefresh {
.setAnimDuration(500);
private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true)
private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings)
private refreshingSettings: RenderingContextSettings = new RenderingContextSettings(true)
private refreshingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshingSettings)
private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true)
private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings)
private refreshAnimation: AnimationItem | null = null;
private refreshingAnimation: AnimationItem | null = null;
private loadMoreAnimation: AnimationItem | null = null;
private refreshAnimName: string = "refresh";
private refreshingAnimName: string = "refreshing";
private loadMoreAnimName: string = "loadMore";
private refreshAnimationDestroy = true
private refreshingAnimationDestroy = true
// refresh-1,refreshing-2,refreshed-3,idle-4
@State @Watch('stateChange') private refreshState: number = 4;
... ... @@ -120,9 +124,23 @@ export struct CustomPullToRefresh {
})
.onDisAppear(() => {
lottie.destroy(this.refreshAnimName);
})
.visibility(this.refreshState == 1 ? Visibility.Visible : Visibility.Hidden)
Canvas(this.refreshingContext)
.width(60)
.height(60)
.backgroundColor(Color.Transparent)
.onReady(() => {
// 可在此生命回调周期中加载动画,可以保证动画尺寸正确
//抗锯齿的设置
this.refreshContext.imageSmoothingEnabled = true;
this.refreshContext.imageSmoothingQuality = 'medium'
})
.onDisAppear(() => {
lottie.destroy(this.refreshingAnimName);
})
.visibility((this.refreshState == 1 || this.refreshState == 2) ? Visibility.Visible : Visibility.Hidden)
.visibility(this.refreshState == 2 ? Visibility.Visible : Visibility.Hidden)
Text('已更新至最新')
.fontSize(14)
... ... @@ -175,10 +193,7 @@ export struct CustomPullToRefresh {
}
private refreshAnim(percent: number) {
if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshAnimName ||
this.refreshAnimationDestroy) {
this.refreshAnimation?.destroy(this.refreshAnimName)
this.refreshAnimation?.destroy(this.refreshingAnimName)
if (this.refreshAnimation == null || this.refreshAnimationDestroy) {
this.refreshAnimation = lottie.loadAnimation({
container: this.refreshContext,
renderer: 'canvas', // canvas 渲染模式
... ... @@ -212,21 +227,19 @@ export struct CustomPullToRefresh {
}
private refreshingAnim() {
// Logger.error('zzzz', 'animate2, 1')
// 先销毁之前的动画
if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshingAnimName ||
this.refreshAnimationDestroy) {
this.refreshAnimation?.destroy(this.refreshAnimName)
this.refreshAnimation?.destroy(this.refreshingAnimName)
this.refreshAnimation = lottie.loadAnimation({
container: this.refreshContext,
if (this.refreshingAnimation == null || this.refreshingAnimationDestroy) {
this.refreshingAnimation?.destroy(this.refreshingAnimName)
this.refreshingAnimation = lottie.loadAnimation({
container: this.refreshingContext,
renderer: 'canvas', // canvas 渲染模式
loop: 10,
autoplay: true,
name: this.refreshingAnimName,
path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
this.addRefreshAnimListener()
this.refreshingAnimationDestroy = false
this.addRefreshingAnimListener()
}
// Logger.error('zzzz', 'animate2, 2')
}
... ... @@ -242,6 +255,13 @@ export struct CustomPullToRefresh {
});
}
private addRefreshingAnimListener() {
this.refreshingAnimation?.addEventListener('destroy', (args: Object): void => {
// Logger.error('zzzz', "lottie destroy");
this.refreshingAnimationDestroy = true
});
}
loadMoreAnimate() {
if (this.loadMoreAnimation == null) {
this.loadMoreAnimation = lottie.loadAnimation({
... ...
... ... @@ -142,7 +142,7 @@ export struct SearchResultComponent {
SearchResultContentComponent({ keywords: this.searchText, searchType: item ,sameSearch:this.sameSearch,isCurrentShow:this.currentIndex === index})
}.tabBar(this.TabBuilder(index, item))
.layoutWeight(1)
}, (item: string, index: number) => index.toString())
}, (item: string) => item)
}
.vertical(false)
.barMode(BarMode.Fixed)
... ...
... ... @@ -57,10 +57,10 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
liveToMore() {
if (!!this.compDTO.dataSourceType) {
if (this.compDTO.dataSourceType === 'OBJECT_POS') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
return;
}
// if (this.compDTO.dataSourceType === 'OBJECT_POS') {
// ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
// return;
// }
if (this.compDTO.linkUrl) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
... ...
... ... @@ -5,11 +5,25 @@
*/
export class SearchResultCountItem{
/*
"allTotal":0,
"activityTotal":0,
"cmsTotal":0,
"trueTotal":0,
"pageSize":1,
"keyword":"wuhuhuan",
"totalCount":0,
"pageNum":1,
"videoTotal":0,
"rmhTotal":5
*/
keyword:string ='' //搜索关键字
allTotal: number = 0 //所有tab总量
cmsTotal: number = 0 //精选总量
rmhTotal: number = 0 //人民号总量
videoTotal: number = 0 //视频总量
activityTotal: number = 0 //活动数据总量
}
\ No newline at end of file
... ...
... ... @@ -370,6 +370,7 @@ export struct PlayUIComponent {
this.playerController?.pause()
} else {
this.isPlayStatus = true
this.playerController?.firstPlay(this.liveUrl)
this.playerController?.play()
}
})
... ...