Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: 来源超过16个字符时隐藏时间和评论 下划线 手动暂停直播后,app进入后台后,在回到前台场景,不自动恢复播放,和 iOS 保持一致
Showing
4 changed files
with
41 additions
and
7 deletions
| @@ -214,6 +214,8 @@ export struct CompParser { | @@ -214,6 +214,8 @@ export struct CompParser { | ||
| 214 | } else { | 214 | } else { |
| 215 | Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | 215 | Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) |
| 216 | } | 216 | } |
| 217 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | ||
| 218 | + Divider().strokeWidth(1).color('#f5f5f5').width('103%').padding({ left: 16, right: 16 }).margin({left: -6}) | ||
| 217 | } else if (this.compDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { | 219 | } else if (this.compDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { |
| 218 | // 大专题 | 220 | // 大专题 |
| 219 | if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { | 221 | if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { |
| @@ -231,7 +233,7 @@ export struct CompParser { | @@ -231,7 +233,7 @@ export struct CompParser { | ||
| 231 | ) { | 233 | ) { |
| 232 | Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | 234 | Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) |
| 233 | } else { | 235 | } else { |
| 234 | - Divider().strokeWidth(1).color('#f5f5f5').width('103%').padding({ left: 16, right: 16 }).margin({left: -6}) | 236 | + Divider().strokeWidth(1).color('#f5f5f5').width('103%').padding({ left: 16, right: 16 }).margin({left: -6,top:8}) |
| 235 | } | 237 | } |
| 236 | } else { | 238 | } else { |
| 237 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 239 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 1 | import { CompDTO, ContentDTO } from 'wdBean' | 1 | import { CompDTO, ContentDTO } from 'wdBean' |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | -import { DateTimeUtils } from 'wdKit/Index'; | 3 | +import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 4 | import router from '@ohos.router' | 4 | import router from '@ohos.router' |
| 5 | 5 | ||
| 6 | @Reusable | 6 | @Reusable |
| @@ -12,8 +12,24 @@ export struct CardSourceInfo { | @@ -12,8 +12,24 @@ export struct CardSourceInfo { | ||
| 12 | isCompInnerSource: boolean = false | 12 | isCompInnerSource: boolean = false |
| 13 | // 是否有展示的信息,如来源,标签、时间、评论 | 13 | // 是否有展示的信息,如来源,标签、时间、评论 |
| 14 | @State viewShowData: boolean = true | 14 | @State viewShowData: boolean = true |
| 15 | + private maxLength: number = 16; | ||
| 16 | + @State private isEllipsisActive: boolean = false; | ||
| 17 | + @State private displayText: string = ''; | ||
| 15 | 18 | ||
| 16 | aboutToAppear(): void { | 19 | aboutToAppear(): void { |
| 20 | + this.processText(); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + processText() { | ||
| 24 | + const sourceText = this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source; | ||
| 25 | + if (sourceText.length > this.maxLength) { | ||
| 26 | + this.displayText = sourceText.substring(0, this.maxLength) + '...'; | ||
| 27 | + this.isEllipsisActive = true; | ||
| 28 | + } else { | ||
| 29 | + this.displayText = sourceText; | ||
| 30 | + this.isEllipsisActive = false; | ||
| 31 | + } | ||
| 32 | + //Logger.warn(`cj2024 sourceText displayText=${this.displayText} isEllipsisActive=${this.isEllipsisActive}`) | ||
| 17 | } | 33 | } |
| 18 | 34 | ||
| 19 | aboutToReuse(params: Record<string, object>): void { | 35 | aboutToReuse(params: Record<string, object>): void { |
| @@ -110,7 +126,7 @@ export struct CardSourceInfo { | @@ -110,7 +126,7 @@ export struct CardSourceInfo { | ||
| 110 | 126 | ||
| 111 | // 来源信息 | 127 | // 来源信息 |
| 112 | if (this.contentDTO.rmhPlatform === 1 || this.contentDTO.source) { | 128 | if (this.contentDTO.rmhPlatform === 1 || this.contentDTO.source) { |
| 113 | - Text(this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source) | 129 | + Text(this.displayText) |
| 114 | .fontSize($r("app.float.font_size_11")) | 130 | .fontSize($r("app.float.font_size_11")) |
| 115 | .fontColor($r("app.color.color_B0B0B0")) | 131 | .fontColor($r("app.color.color_B0B0B0")) |
| 116 | .maxLines(1) | 132 | .maxLines(1) |
| @@ -134,11 +150,12 @@ export struct CardSourceInfo { | @@ -134,11 +150,12 @@ export struct CardSourceInfo { | ||
| 134 | Image($r("app.media.point")) | 150 | Image($r("app.media.point")) |
| 135 | .width(11) | 151 | .width(11) |
| 136 | .height(11) | 152 | .height(11) |
| 153 | + .visibility(!this.isEllipsisActive ? Visibility.Visible : Visibility.Hidden) | ||
| 137 | 154 | ||
| 138 | } | 155 | } |
| 139 | 156 | ||
| 140 | // 发布日期 | 157 | // 发布日期 |
| 141 | - if (this.showTime()) { | 158 | + if (this.showTime() && !this.isEllipsisActive) { |
| 142 | Text(this.handleTimeStr()) | 159 | Text(this.handleTimeStr()) |
| 143 | .fontSize($r("app.float.font_size_11")) | 160 | .fontSize($r("app.float.font_size_11")) |
| 144 | .fontColor($r("app.color.color_B0B0B0")) | 161 | .fontColor($r("app.color.color_B0B0B0")) |
| @@ -147,7 +164,7 @@ export struct CardSourceInfo { | @@ -147,7 +164,7 @@ export struct CardSourceInfo { | ||
| 147 | } | 164 | } |
| 148 | 165 | ||
| 149 | // 评论数 | 166 | // 评论数 |
| 150 | - if (!this.contentDTO.cornerMark && !this.contentDTO.corner) { | 167 | + if (!this.contentDTO.cornerMark && !this.contentDTO.corner && !this.isEllipsisActive) { |
| 151 | if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && | 168 | if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && |
| 152 | this.showCommentNum()) { | 169 | this.showCommentNum()) { |
| 153 | Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`) | 170 | Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`) |
| @@ -30,8 +30,9 @@ export struct PlayUIComponent { | @@ -30,8 +30,9 @@ export struct PlayUIComponent { | ||
| 30 | // 当前播放资源的状态 | 30 | // 当前播放资源的状态 |
| 31 | @Consume playSourceState: number | 31 | @Consume playSourceState: number |
| 32 | 32 | ||
| 33 | + manualClickPauseOrPlayBack?:(manualClickPauseOrPlay: boolean) => void | ||
| 34 | + | ||
| 33 | onChangeMenuVisible() { | 35 | onChangeMenuVisible() { |
| 34 | - this.isPlayStatus = !this.isPlayStatus | ||
| 35 | if (!this.contentDetailData || !this.contentDetailData.liveInfo || | 36 | if (!this.contentDetailData || !this.contentDetailData.liveInfo || |
| 36 | this.contentDetailData?.liveInfo?.liveState === 'wait') { | 37 | this.contentDetailData?.liveInfo?.liveState === 'wait') { |
| 37 | return | 38 | return |
| @@ -398,12 +399,18 @@ export struct PlayUIComponent { | @@ -398,12 +399,18 @@ export struct PlayUIComponent { | ||
| 398 | if (this.isPlayStatus) { | 399 | if (this.isPlayStatus) { |
| 399 | this.isPlayStatus = false | 400 | this.isPlayStatus = false |
| 400 | this.playerController?.pause() | 401 | this.playerController?.pause() |
| 402 | + if (this.manualClickPauseOrPlayBack) { | ||
| 403 | + this.manualClickPauseOrPlayBack(true) | ||
| 404 | + } | ||
| 401 | } else { | 405 | } else { |
| 402 | this.isPlayStatus = true | 406 | this.isPlayStatus = true |
| 403 | if (this.contentDetailData.liveInfo?.liveState == 'running') { | 407 | if (this.contentDetailData.liveInfo?.liveState == 'running') { |
| 404 | this.playerController?.firstPlay(this.liveUrl) | 408 | this.playerController?.firstPlay(this.liveUrl) |
| 405 | } | 409 | } |
| 406 | this.playerController?.play() | 410 | this.playerController?.play() |
| 411 | + if (this.manualClickPauseOrPlayBack) { | ||
| 412 | + this.manualClickPauseOrPlayBack(false) | ||
| 413 | + } | ||
| 407 | } | 414 | } |
| 408 | }) | 415 | }) |
| 409 | } | 416 | } |
| @@ -40,7 +40,13 @@ export struct TopPlayComponent { | @@ -40,7 +40,13 @@ export struct TopPlayComponent { | ||
| 40 | @Consume @Watch('pageHideChange') pageHide: number | 40 | @Consume @Watch('pageHideChange') pageHide: number |
| 41 | init: boolean = false | 41 | init: boolean = false |
| 42 | @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息 | 42 | @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息 |
| 43 | + ///是否是手动点击暂停,手动暂停的,页面重新出现时,不自动恢复播放 | ||
| 44 | + manualClickPauseOrPlay: boolean = false | ||
| 43 | pageShowChange() { | 45 | pageShowChange() { |
| 46 | + if (this.manualClickPauseOrPlay) { | ||
| 47 | + return | ||
| 48 | + } | ||
| 49 | + | ||
| 44 | this.playerController?.play() | 50 | this.playerController?.play() |
| 45 | } | 51 | } |
| 46 | 52 | ||
| @@ -263,7 +269,9 @@ export struct TopPlayComponent { | @@ -263,7 +269,9 @@ export struct TopPlayComponent { | ||
| 263 | PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible) | 269 | PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible) |
| 264 | 270 | ||
| 265 | // 视频播放器上的控制面板和信息 | 271 | // 视频播放器上的控制面板和信息 |
| 266 | - PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl }) | 272 | + PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl,manualClickPauseOrPlayBack:(manualClickPauseOrPlay: boolean) => { |
| 273 | + this.manualClickPauseOrPlay = manualClickPauseOrPlay; | ||
| 274 | + }}) | ||
| 267 | 275 | ||
| 268 | // 直播结束 | 276 | // 直播结束 |
| 269 | Text('直播已结束') | 277 | Text('直播已结束') |
-
Please register or login to post a comment