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参数据,方便打印完整的日志信息
Showing
7 changed files
with
96 additions
and
42 deletions
| @@ -40,15 +40,10 @@ export class Logger { | @@ -40,15 +40,10 @@ export class Logger { | ||
| 40 | Logger.domain = domain; | 40 | Logger.domain = domain; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | - static debug(prefixStr?:string,...args: string[]) { | 43 | + static debug(...args: string[]) { |
| 44 | if (!Logger.isDebug) { | 44 | if (!Logger.isDebug) { |
| 45 | return | 45 | return |
| 46 | } | 46 | } |
| 47 | - if(prefixStr){ | ||
| 48 | - Logger.prefix = prefixStr | ||
| 49 | - }else { | ||
| 50 | - Logger.prefix = 'SightApp'; | ||
| 51 | - } | ||
| 52 | Logger.logContent(LogLevel.DEBUG, ...args) | 47 | Logger.logContent(LogLevel.DEBUG, ...args) |
| 53 | } | 48 | } |
| 54 | 49 | ||
| @@ -90,55 +85,68 @@ export class Logger { | @@ -90,55 +85,68 @@ export class Logger { | ||
| 90 | 85 | ||
| 91 | static logContent(level: LogLevel, ...args: string[]) { | 86 | static logContent(level: LogLevel, ...args: string[]) { |
| 92 | let msg = Logger.getMsg(...args) | 87 | let msg = Logger.getMsg(...args) |
| 88 | + let tag = Logger.getTag(...args) | ||
| 93 | let length = msg.length | 89 | let length = msg.length |
| 94 | if (length < Logger.CHUNK_SIZE) { | 90 | if (length < Logger.CHUNK_SIZE) { |
| 95 | // 不超限,保持原来的打印 | 91 | // 不超限,保持原来的打印 |
| 96 | - Logger.print(level, ...args) | 92 | + Logger.print(tag, level, ...args) |
| 97 | } else { | 93 | } else { |
| 98 | // 超限,分段打印 | 94 | // 超限,分段打印 |
| 99 | for (let i = 0; i < length; i += Logger.CHUNK_SIZE) { | 95 | for (let i = 0; i < length; i += Logger.CHUNK_SIZE) { |
| 100 | let count = Math.min(length - i, Logger.CHUNK_SIZE); | 96 | let count = Math.min(length - i, Logger.CHUNK_SIZE); |
| 101 | - Logger.printExt(level, msg.substring(i, i + count)); | 97 | + Logger.printExt(tag, level, msg.substring(i, i + count)); |
| 102 | } | 98 | } |
| 103 | } | 99 | } |
| 104 | } | 100 | } |
| 105 | 101 | ||
| 106 | - static print(level: LogLevel, ...msg: string[]) { | 102 | + static print(tag: string, level: LogLevel, ...msg: string[]) { |
| 103 | + | ||
| 104 | + let prefix = Logger.prefix | ||
| 105 | + if (tag) { | ||
| 106 | + prefix = tag | ||
| 107 | + } | ||
| 108 | + | ||
| 107 | switch (level) { | 109 | switch (level) { |
| 108 | case LogLevel.DEBUG: | 110 | case LogLevel.DEBUG: |
| 109 | - hilog.debug(Logger.domain, Logger.prefix, Logger.format, msg); | 111 | + hilog.debug(Logger.domain, prefix, Logger.format, msg); |
| 110 | break | 112 | break |
| 111 | case LogLevel.INFO: | 113 | case LogLevel.INFO: |
| 112 | - hilog.info(Logger.domain, Logger.prefix, Logger.format, msg); | 114 | + hilog.info(Logger.domain, prefix, Logger.format, msg); |
| 113 | break | 115 | break |
| 114 | case LogLevel.WARN: | 116 | case LogLevel.WARN: |
| 115 | - hilog.warn(Logger.domain, Logger.prefix, Logger.format, msg); | 117 | + hilog.warn(Logger.domain, prefix, Logger.format, msg); |
| 116 | break | 118 | break |
| 117 | case LogLevel.ERROR: | 119 | case LogLevel.ERROR: |
| 118 | - hilog.error(Logger.domain, Logger.prefix, Logger.format, msg); | 120 | + hilog.error(Logger.domain, prefix, Logger.format, msg); |
| 119 | break | 121 | break |
| 120 | case LogLevel.FATAL: | 122 | case LogLevel.FATAL: |
| 121 | - hilog.fatal(Logger.domain, Logger.prefix, Logger.format, msg); | 123 | + hilog.fatal(Logger.domain, prefix, Logger.format, msg); |
| 122 | break | 124 | break |
| 123 | } | 125 | } |
| 124 | } | 126 | } |
| 125 | 127 | ||
| 126 | - static printExt(level: LogLevel, msg: string) { | 128 | + static printExt(tag: string, level: LogLevel, msg: string) { |
| 129 | + | ||
| 130 | + let prefix = Logger.prefix | ||
| 131 | + if (tag) { | ||
| 132 | + prefix = tag | ||
| 133 | + } | ||
| 134 | + | ||
| 127 | switch (level) { | 135 | switch (level) { |
| 128 | case LogLevel.DEBUG: | 136 | case LogLevel.DEBUG: |
| 129 | - hilog.debug(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 137 | + hilog.debug(Logger.domain, prefix, Logger.format_ext, msg); |
| 130 | break | 138 | break |
| 131 | case LogLevel.INFO: | 139 | case LogLevel.INFO: |
| 132 | - hilog.info(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 140 | + hilog.info(Logger.domain, prefix, Logger.format_ext, msg); |
| 133 | break | 141 | break |
| 134 | case LogLevel.WARN: | 142 | case LogLevel.WARN: |
| 135 | - hilog.warn(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 143 | + hilog.warn(Logger.domain, prefix, Logger.format_ext, msg); |
| 136 | break | 144 | break |
| 137 | case LogLevel.ERROR: | 145 | case LogLevel.ERROR: |
| 138 | - hilog.error(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 146 | + hilog.error(Logger.domain, prefix, Logger.format_ext, msg); |
| 139 | break | 147 | break |
| 140 | case LogLevel.FATAL: | 148 | case LogLevel.FATAL: |
| 141 | - hilog.fatal(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 149 | + hilog.fatal(Logger.domain, prefix, Logger.format_ext, msg); |
| 142 | break | 150 | break |
| 143 | } | 151 | } |
| 144 | } | 152 | } |
| @@ -153,6 +161,20 @@ export class Logger { | @@ -153,6 +161,20 @@ export class Logger { | ||
| 153 | }) | 161 | }) |
| 154 | return msg.substring(2, msg.length); | 162 | return msg.substring(2, msg.length); |
| 155 | } | 163 | } |
| 164 | + | ||
| 165 | + static getTag(...args: string[]): string { | ||
| 166 | + if (args == null || args.length <= 0) { | ||
| 167 | + return ''; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + if (args.length > 1) { | ||
| 171 | + | ||
| 172 | + return args[0] | ||
| 173 | + } else { | ||
| 174 | + return '' | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + } | ||
| 156 | } | 178 | } |
| 157 | 179 | ||
| 158 | // export default new Logger('SightApp', 0xFF00) | 180 | // export default new Logger('SightApp', 0xFF00) |
| @@ -85,8 +85,8 @@ export default struct CustomLayout { | @@ -85,8 +85,8 @@ export default struct CustomLayout { | ||
| 85 | name: this.animateName, | 85 | name: this.animateName, |
| 86 | path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | 86 | path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 |
| 87 | }) | 87 | }) |
| 88 | + this.animateItem.goToAndStop(1) | ||
| 88 | } | 89 | } |
| 89 | - this.animateItem.goToAndStop(1) | ||
| 90 | let total = CustomLayout.REFRESH_HEIGHT | 90 | let total = CustomLayout.REFRESH_HEIGHT |
| 91 | let progress = offset * 100 / total | 91 | let progress = offset * 100 / total |
| 92 | this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true); | 92 | this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true); |
| @@ -103,9 +103,6 @@ export default struct CustomLayout { | @@ -103,9 +103,6 @@ export default struct CustomLayout { | ||
| 103 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | 103 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 |
| 104 | }) | 104 | }) |
| 105 | } | 105 | } |
| 106 | - // this.animateItem2.isLoaded | ||
| 107 | - // TODO 是否拦截重复触发 | ||
| 108 | - this.animateItem2.goToAndPlay(1) | ||
| 109 | } | 106 | } |
| 110 | 107 | ||
| 111 | getFramesByProgress(progress: number): number { | 108 | getFramesByProgress(progress: number): number { |
| @@ -18,14 +18,18 @@ export struct CustomPullToRefresh { | @@ -18,14 +18,18 @@ export struct CustomPullToRefresh { | ||
| 18 | .setAnimDuration(500); | 18 | .setAnimDuration(500); |
| 19 | private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true) | 19 | private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true) |
| 20 | private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings) | 20 | private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings) |
| 21 | + private refreshingSettings: RenderingContextSettings = new RenderingContextSettings(true) | ||
| 22 | + private refreshingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshingSettings) | ||
| 21 | private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true) | 23 | private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true) |
| 22 | private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings) | 24 | private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings) |
| 23 | private refreshAnimation: AnimationItem | null = null; | 25 | private refreshAnimation: AnimationItem | null = null; |
| 26 | + private refreshingAnimation: AnimationItem | null = null; | ||
| 24 | private loadMoreAnimation: AnimationItem | null = null; | 27 | private loadMoreAnimation: AnimationItem | null = null; |
| 25 | private refreshAnimName: string = "refresh"; | 28 | private refreshAnimName: string = "refresh"; |
| 26 | private refreshingAnimName: string = "refreshing"; | 29 | private refreshingAnimName: string = "refreshing"; |
| 27 | private loadMoreAnimName: string = "loadMore"; | 30 | private loadMoreAnimName: string = "loadMore"; |
| 28 | private refreshAnimationDestroy = true | 31 | private refreshAnimationDestroy = true |
| 32 | + private refreshingAnimationDestroy = true | ||
| 29 | // refresh-1,refreshing-2,refreshed-3,idle-4 | 33 | // refresh-1,refreshing-2,refreshed-3,idle-4 |
| 30 | @State @Watch('stateChange') private refreshState: number = 4; | 34 | @State @Watch('stateChange') private refreshState: number = 4; |
| 31 | 35 | ||
| @@ -120,9 +124,23 @@ export struct CustomPullToRefresh { | @@ -120,9 +124,23 @@ export struct CustomPullToRefresh { | ||
| 120 | }) | 124 | }) |
| 121 | .onDisAppear(() => { | 125 | .onDisAppear(() => { |
| 122 | lottie.destroy(this.refreshAnimName); | 126 | lottie.destroy(this.refreshAnimName); |
| 127 | + }) | ||
| 128 | + .visibility(this.refreshState == 1 ? Visibility.Visible : Visibility.Hidden) | ||
| 129 | + | ||
| 130 | + Canvas(this.refreshingContext) | ||
| 131 | + .width(60) | ||
| 132 | + .height(60) | ||
| 133 | + .backgroundColor(Color.Transparent) | ||
| 134 | + .onReady(() => { | ||
| 135 | + // 可在此生命回调周期中加载动画,可以保证动画尺寸正确 | ||
| 136 | + //抗锯齿的设置 | ||
| 137 | + this.refreshContext.imageSmoothingEnabled = true; | ||
| 138 | + this.refreshContext.imageSmoothingQuality = 'medium' | ||
| 139 | + }) | ||
| 140 | + .onDisAppear(() => { | ||
| 123 | lottie.destroy(this.refreshingAnimName); | 141 | lottie.destroy(this.refreshingAnimName); |
| 124 | }) | 142 | }) |
| 125 | - .visibility((this.refreshState == 1 || this.refreshState == 2) ? Visibility.Visible : Visibility.Hidden) | 143 | + .visibility(this.refreshState == 2 ? Visibility.Visible : Visibility.Hidden) |
| 126 | 144 | ||
| 127 | Text('已更新至最新') | 145 | Text('已更新至最新') |
| 128 | .fontSize(14) | 146 | .fontSize(14) |
| @@ -175,10 +193,7 @@ export struct CustomPullToRefresh { | @@ -175,10 +193,7 @@ export struct CustomPullToRefresh { | ||
| 175 | } | 193 | } |
| 176 | 194 | ||
| 177 | private refreshAnim(percent: number) { | 195 | private refreshAnim(percent: number) { |
| 178 | - if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshAnimName || | ||
| 179 | - this.refreshAnimationDestroy) { | ||
| 180 | - this.refreshAnimation?.destroy(this.refreshAnimName) | ||
| 181 | - this.refreshAnimation?.destroy(this.refreshingAnimName) | 196 | + if (this.refreshAnimation == null || this.refreshAnimationDestroy) { |
| 182 | this.refreshAnimation = lottie.loadAnimation({ | 197 | this.refreshAnimation = lottie.loadAnimation({ |
| 183 | container: this.refreshContext, | 198 | container: this.refreshContext, |
| 184 | renderer: 'canvas', // canvas 渲染模式 | 199 | renderer: 'canvas', // canvas 渲染模式 |
| @@ -212,21 +227,19 @@ export struct CustomPullToRefresh { | @@ -212,21 +227,19 @@ export struct CustomPullToRefresh { | ||
| 212 | } | 227 | } |
| 213 | 228 | ||
| 214 | private refreshingAnim() { | 229 | private refreshingAnim() { |
| 215 | - // Logger.error('zzzz', 'animate2, 1') | ||
| 216 | // 先销毁之前的动画 | 230 | // 先销毁之前的动画 |
| 217 | - if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshingAnimName || | ||
| 218 | - this.refreshAnimationDestroy) { | ||
| 219 | - this.refreshAnimation?.destroy(this.refreshAnimName) | ||
| 220 | - this.refreshAnimation?.destroy(this.refreshingAnimName) | ||
| 221 | - this.refreshAnimation = lottie.loadAnimation({ | ||
| 222 | - container: this.refreshContext, | 231 | + if (this.refreshingAnimation == null || this.refreshingAnimationDestroy) { |
| 232 | + this.refreshingAnimation?.destroy(this.refreshingAnimName) | ||
| 233 | + this.refreshingAnimation = lottie.loadAnimation({ | ||
| 234 | + container: this.refreshingContext, | ||
| 223 | renderer: 'canvas', // canvas 渲染模式 | 235 | renderer: 'canvas', // canvas 渲染模式 |
| 224 | loop: 10, | 236 | loop: 10, |
| 225 | autoplay: true, | 237 | autoplay: true, |
| 226 | name: this.refreshingAnimName, | 238 | name: this.refreshingAnimName, |
| 227 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | 239 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 |
| 228 | }) | 240 | }) |
| 229 | - this.addRefreshAnimListener() | 241 | + this.refreshingAnimationDestroy = false |
| 242 | + this.addRefreshingAnimListener() | ||
| 230 | } | 243 | } |
| 231 | // Logger.error('zzzz', 'animate2, 2') | 244 | // Logger.error('zzzz', 'animate2, 2') |
| 232 | } | 245 | } |
| @@ -242,6 +255,13 @@ export struct CustomPullToRefresh { | @@ -242,6 +255,13 @@ export struct CustomPullToRefresh { | ||
| 242 | }); | 255 | }); |
| 243 | } | 256 | } |
| 244 | 257 | ||
| 258 | + private addRefreshingAnimListener() { | ||
| 259 | + this.refreshingAnimation?.addEventListener('destroy', (args: Object): void => { | ||
| 260 | + // Logger.error('zzzz', "lottie destroy"); | ||
| 261 | + this.refreshingAnimationDestroy = true | ||
| 262 | + }); | ||
| 263 | + } | ||
| 264 | + | ||
| 245 | loadMoreAnimate() { | 265 | loadMoreAnimate() { |
| 246 | if (this.loadMoreAnimation == null) { | 266 | if (this.loadMoreAnimation == null) { |
| 247 | this.loadMoreAnimation = lottie.loadAnimation({ | 267 | this.loadMoreAnimation = lottie.loadAnimation({ |
| @@ -142,7 +142,7 @@ export struct SearchResultComponent { | @@ -142,7 +142,7 @@ export struct SearchResultComponent { | ||
| 142 | SearchResultContentComponent({ keywords: this.searchText, searchType: item ,sameSearch:this.sameSearch,isCurrentShow:this.currentIndex === index}) | 142 | SearchResultContentComponent({ keywords: this.searchText, searchType: item ,sameSearch:this.sameSearch,isCurrentShow:this.currentIndex === index}) |
| 143 | }.tabBar(this.TabBuilder(index, item)) | 143 | }.tabBar(this.TabBuilder(index, item)) |
| 144 | .layoutWeight(1) | 144 | .layoutWeight(1) |
| 145 | - }, (item: string, index: number) => index.toString()) | 145 | + }, (item: string) => item) |
| 146 | } | 146 | } |
| 147 | .vertical(false) | 147 | .vertical(false) |
| 148 | .barMode(BarMode.Fixed) | 148 | .barMode(BarMode.Fixed) |
| @@ -57,10 +57,10 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -57,10 +57,10 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 57 | 57 | ||
| 58 | liveToMore() { | 58 | liveToMore() { |
| 59 | if (!!this.compDTO.dataSourceType) { | 59 | if (!!this.compDTO.dataSourceType) { |
| 60 | - if (this.compDTO.dataSourceType === 'OBJECT_POS') { | ||
| 61 | - ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | ||
| 62 | - return; | ||
| 63 | - } | 60 | + // if (this.compDTO.dataSourceType === 'OBJECT_POS') { |
| 61 | + // ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | ||
| 62 | + // return; | ||
| 63 | + // } | ||
| 64 | if (this.compDTO.linkUrl) { | 64 | if (this.compDTO.linkUrl) { |
| 65 | let taskAction: Action = { | 65 | let taskAction: Action = { |
| 66 | type: 'JUMP_H5_BY_WEB_VIEW', | 66 | type: 'JUMP_H5_BY_WEB_VIEW', |
| @@ -5,11 +5,25 @@ | @@ -5,11 +5,25 @@ | ||
| 5 | */ | 5 | */ |
| 6 | export class SearchResultCountItem{ | 6 | export class SearchResultCountItem{ |
| 7 | 7 | ||
| 8 | + /* | ||
| 9 | + "allTotal":0, | ||
| 10 | + "activityTotal":0, | ||
| 11 | + "cmsTotal":0, | ||
| 12 | + "trueTotal":0, | ||
| 13 | + "pageSize":1, | ||
| 14 | + "keyword":"wuhuhuan", | ||
| 15 | + "totalCount":0, | ||
| 16 | + "pageNum":1, | ||
| 17 | + "videoTotal":0, | ||
| 18 | + "rmhTotal":5 | ||
| 19 | + */ | ||
| 8 | 20 | ||
| 21 | + keyword:string ='' //搜索关键字 | ||
| 9 | allTotal: number = 0 //所有tab总量 | 22 | allTotal: number = 0 //所有tab总量 |
| 10 | cmsTotal: number = 0 //精选总量 | 23 | cmsTotal: number = 0 //精选总量 |
| 11 | rmhTotal: number = 0 //人民号总量 | 24 | rmhTotal: number = 0 //人民号总量 |
| 12 | videoTotal: number = 0 //视频总量 | 25 | videoTotal: number = 0 //视频总量 |
| 13 | activityTotal: number = 0 //活动数据总量 | 26 | activityTotal: number = 0 //活动数据总量 |
| 14 | 27 | ||
| 28 | + | ||
| 15 | } | 29 | } |
| @@ -370,6 +370,7 @@ export struct PlayUIComponent { | @@ -370,6 +370,7 @@ export struct PlayUIComponent { | ||
| 370 | this.playerController?.pause() | 370 | this.playerController?.pause() |
| 371 | } else { | 371 | } else { |
| 372 | this.isPlayStatus = true | 372 | this.isPlayStatus = true |
| 373 | + this.playerController?.firstPlay(this.liveUrl) | ||
| 373 | this.playerController?.play() | 374 | this.playerController?.play() |
| 374 | } | 375 | } |
| 375 | }) | 376 | }) |
-
Please register or login to post a comment