Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix |> 20476 图文详情页,视频播放完成后的重播按钮,不应半透明 fix: 19347 卡片来源显示规则-来源过长时,不符合省略优先级 fix |> 19826 搜索结果,点击内容,提示内容不存在,页面会闪黑边,见比对视频 ref |> 直播详情直播间和大家聊,以及竖屏直播结束页面头像添加占位图 Revert "ref |> 横屏直播详情无回放时,不展示参与人数" fix |> 稿件详情页-GIF动图评论不展示 ref |> 热门评论最后一条与分割线间距过小,见截图 fix |> 20506 人民号频道,切换推荐和关注tab,选中tab标题不应上抬。
Showing
9 changed files
with
132 additions
and
42 deletions
| @@ -315,8 +315,7 @@ export struct WdWebLocalComponent { | @@ -315,8 +315,7 @@ export struct WdWebLocalComponent { | ||
| 315 | 315 | ||
| 316 | Text('重播').fontColor(Color.White).fontSize(14) | 316 | Text('重播').fontColor(Color.White).fontSize(14) |
| 317 | } | 317 | } |
| 318 | - .backgroundColor(Color.Black) | ||
| 319 | - .opacity(0.5) | 318 | + .backgroundColor("#80000000") |
| 320 | .justifyContent(FlexAlign.Center) | 319 | .justifyContent(FlexAlign.Center) |
| 321 | .width(this.positionWidth) | 320 | .width(this.positionWidth) |
| 322 | .height(this.positionHeight) | 321 | .height(this.positionHeight) |
| @@ -3,6 +3,8 @@ import { CommonConstants, CompStyle } from 'wdConstant/Index'; | @@ -3,6 +3,8 @@ import { CommonConstants, CompStyle } from 'wdConstant/Index'; | ||
| 3 | import { DateTimeUtils, Logger } from 'wdKit/Index'; | 3 | import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 4 | import router from '@ohos.router' | 4 | import router from '@ohos.router' |
| 5 | import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed'; | 5 | import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed'; |
| 6 | +import measure from '@ohos.measure' | ||
| 7 | +import display from '@ohos.display'; | ||
| 6 | 8 | ||
| 7 | @Reusable | 9 | @Reusable |
| 8 | @Component | 10 | @Component |
| @@ -20,10 +22,13 @@ export struct CardSourceInfo { | @@ -20,10 +22,13 @@ export struct CardSourceInfo { | ||
| 20 | @State authorMarked: boolean = false; | 22 | @State authorMarked: boolean = false; |
| 21 | @State authorArr: textItem[] = [] | 23 | @State authorArr: textItem[] = [] |
| 22 | 24 | ||
| 25 | + @State onlyShowCornerAndSource: boolean = false; | ||
| 26 | + | ||
| 23 | aboutToAppear(): void { | 27 | aboutToAppear(): void { |
| 24 | this.processText(); | 28 | this.processText(); |
| 25 | 29 | ||
| 26 | this.titleInit(); | 30 | this.titleInit(); |
| 31 | + this.calcContentSpace(); | ||
| 27 | } | 32 | } |
| 28 | 33 | ||
| 29 | titleInit() { | 34 | titleInit() { |
| @@ -171,6 +176,48 @@ export struct CardSourceInfo { | @@ -171,6 +176,48 @@ export struct CardSourceInfo { | ||
| 171 | return flag; | 176 | return flag; |
| 172 | } | 177 | } |
| 173 | 178 | ||
| 179 | + getContentSize(textContent: string, fontSize: number ) { | ||
| 180 | + return px2vp(Number(measure.measureTextSize({ | ||
| 181 | + textContent, | ||
| 182 | + fontSize | ||
| 183 | + }).width)) | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + calcContentSpace() { | ||
| 187 | + if (this.isLimited()) return; | ||
| 188 | + | ||
| 189 | + const screenWidth = px2vp(display.getDefaultDisplaySync().width) | ||
| 190 | + let leftSpace = screenWidth; | ||
| 191 | + | ||
| 192 | + const souceSize = this.getContentSize(this.displayText, 12); | ||
| 193 | + const cornerSize = this.getContentSize(this.contentDTO.cornerMark || this.contentDTO.corner, 12); | ||
| 194 | + const dotSize = 11; | ||
| 195 | + const timeSize = this.getContentSize(this.handleTimeStr(), 12); | ||
| 196 | + | ||
| 197 | + const commentNum = this.getContentDtoBean()?.interactData?.commentNum | ||
| 198 | + let commentSize = 0; | ||
| 199 | + if (commentNum) { | ||
| 200 | + commentSize = this.getContentSize(`${this.handlerNum(commentNum.toString())}评`, 12); | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + if (this.contentDTO.cornerMark || this.contentDTO.corner) { | ||
| 204 | + leftSpace = leftSpace - cornerSize | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + if (this.showTime()) { | ||
| 208 | + leftSpace = leftSpace - dotSize - timeSize | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + if (!this.isEllipsisActive) { | ||
| 212 | + leftSpace = leftSpace - dotSize - commentSize | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + if (leftSpace < souceSize) { | ||
| 216 | + this.onlyShowCornerAndSource = true; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + } | ||
| 220 | + | ||
| 174 | build() { | 221 | build() { |
| 175 | Column(){ | 222 | Column(){ |
| 176 | Flex({ justifyContent: FlexAlign.Start, direction: FlexDirection.Row }) { | 223 | Flex({ justifyContent: FlexAlign.Start, direction: FlexDirection.Row }) { |
| @@ -192,47 +239,50 @@ export struct CardSourceInfo { | @@ -192,47 +239,50 @@ export struct CardSourceInfo { | ||
| 192 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 239 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 193 | } | 240 | } |
| 194 | 241 | ||
| 195 | - // 点 | ||
| 196 | - if (this.showDot()) { | ||
| 197 | - | ||
| 198 | - Image($r("app.media.point")) | ||
| 199 | - .width(11) | ||
| 200 | - .height(11) | ||
| 201 | - .visibility(!this.isEllipsisActive ? Visibility.Visible : Visibility.Hidden) | 242 | + if (!this.onlyShowCornerAndSource) { |
| 243 | + // 点 | ||
| 244 | + if (this.showDot()) { | ||
| 202 | 245 | ||
| 203 | - } | 246 | + Image($r("app.media.point")) |
| 247 | + .width(11) | ||
| 248 | + .height(11) | ||
| 249 | + .visibility(!this.isEllipsisActive ? Visibility.Visible : Visibility.Hidden) | ||
| 204 | 250 | ||
| 205 | - // 发布日期 | ||
| 206 | - if (this.showTime()) { | ||
| 207 | - Text(this.handleTimeStr()) | ||
| 208 | - .fontSize(12) | ||
| 209 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 210 | - .flexShrink(0) | ||
| 211 | - .margin({ right: 4 }) | ||
| 212 | - .visibility(!this.isEllipsisActive ? Visibility.Visible : Visibility.Hidden) | ||
| 213 | - } | 251 | + } |
| 214 | 252 | ||
| 215 | - // 评论数 | ||
| 216 | - // if (!this.contentDTO.cornerMark && !this.contentDTO.corner && !this.isEllipsisActive) { | ||
| 217 | - if (!this.isEllipsisActive) { | ||
| 218 | - if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && | ||
| 219 | - this.showCommentNum()) { | ||
| 220 | - Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`) | 253 | + // 发布日期 |
| 254 | + if (this.showTime()) { | ||
| 255 | + Text(this.handleTimeStr()) | ||
| 221 | .fontSize(12) | 256 | .fontSize(12) |
| 222 | .fontColor($r("app.color.color_B0B0B0")) | 257 | .fontColor($r("app.color.color_B0B0B0")) |
| 223 | .flexShrink(0) | 258 | .flexShrink(0) |
| 224 | - } else { | 259 | + .margin({ right: 4 }) |
| 260 | + .visibility(!this.isEllipsisActive ? Visibility.Visible : Visibility.Hidden) | ||
| 261 | + } | ||
| 225 | 262 | ||
| 226 | - if (this.contentDTO.objectType !=='2' && this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) { | ||
| 227 | - Text(`${this.handlerNum(this.contentDTO.interactData?.commentNum.toString())}评`) | 263 | + // 评论数 |
| 264 | + // if (!this.contentDTO.cornerMark && !this.contentDTO.corner && !this.isEllipsisActive) { | ||
| 265 | + if (!this.isEllipsisActive) { | ||
| 266 | + if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && | ||
| 267 | + this.showCommentNum()) { | ||
| 268 | + Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`) | ||
| 228 | .fontSize(12) | 269 | .fontSize(12) |
| 229 | .fontColor($r("app.color.color_B0B0B0")) | 270 | .fontColor($r("app.color.color_B0B0B0")) |
| 230 | .flexShrink(0) | 271 | .flexShrink(0) |
| 231 | - } | 272 | + } else { |
| 232 | 273 | ||
| 274 | + if (this.contentDTO.objectType !=='2' && this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) { | ||
| 275 | + Text(`${this.handlerNum(this.contentDTO.interactData?.commentNum.toString())}评`) | ||
| 276 | + .fontSize(12) | ||
| 277 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 278 | + .flexShrink(0) | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + } | ||
| 233 | } | 282 | } |
| 234 | } | 283 | } |
| 235 | 284 | ||
| 285 | + | ||
| 236 | } | 286 | } |
| 237 | .width(CommonConstants.FULL_WIDTH) | 287 | .width(CommonConstants.FULL_WIDTH) |
| 238 | 288 | ||
| @@ -260,6 +310,7 @@ export struct CardSourceInfo { | @@ -260,6 +310,7 @@ export struct CardSourceInfo { | ||
| 260 | } | 310 | } |
| 261 | .width(CommonConstants.FULL_WIDTH) | 311 | .width(CommonConstants.FULL_WIDTH) |
| 262 | .margin({ top: this.viewShowData ? 8 : 0 }) | 312 | .margin({ top: this.viewShowData ? 8 : 0 }) |
| 313 | + .clip(true) | ||
| 263 | 314 | ||
| 264 | } | 315 | } |
| 265 | 316 | ||
| @@ -268,13 +319,17 @@ export struct CardSourceInfo { | @@ -268,13 +319,17 @@ export struct CardSourceInfo { | ||
| 268 | * @returns | 319 | * @returns |
| 269 | */ | 320 | */ |
| 270 | private getContentDtoBean(): ContentDTO { | 321 | private getContentDtoBean(): ContentDTO { |
| 322 | + let content = new ContentDTO | ||
| 271 | if (this.compDTO == undefined) { | 323 | if (this.compDTO == undefined) { |
| 272 | - return this.contentDTO | 324 | + content = this.contentDTO |
| 273 | } | 325 | } |
| 274 | if (this.compDTO.operDataList.length == 0) { | 326 | if (this.compDTO.operDataList.length == 0) { |
| 275 | - return this.contentDTO | 327 | + content = this.contentDTO |
| 328 | + } | ||
| 329 | + if (!content) { | ||
| 330 | + content = this.compDTO.operDataList[0] | ||
| 276 | } | 331 | } |
| 277 | - return this.compDTO.operDataList[0] | 332 | + return content; |
| 278 | } | 333 | } |
| 279 | 334 | ||
| 280 | /** | 335 | /** |
| @@ -11,6 +11,8 @@ import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | @@ -11,6 +11,8 @@ import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | ||
| 11 | import { InfomationCardClick } from '../../utils/infomationCardClick'; | 11 | import { InfomationCardClick } from '../../utils/infomationCardClick'; |
| 12 | import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; | 12 | import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; |
| 13 | import router from '@ohos.router' | 13 | import router from '@ohos.router' |
| 14 | +import { ToastUtils } from 'wdKit'; | ||
| 15 | +import MinePageDatasModel from '../../model/MinePageDatasModel'; | ||
| 14 | 16 | ||
| 15 | const TAG: string = 'Card2Component' | 17 | const TAG: string = 'Card2Component' |
| 16 | /** | 18 | /** |
| @@ -140,7 +142,22 @@ export struct Card2Component { | @@ -140,7 +142,22 @@ export struct Card2Component { | ||
| 140 | this.clicked = true; | 142 | this.clicked = true; |
| 141 | } | 143 | } |
| 142 | persistentStorage(this.contentDTO.objectId); | 144 | persistentStorage(this.contentDTO.objectId); |
| 143 | - ProcessUtils.processPage(this.contentDTO) | 145 | + this.jumpDetail() |
| 146 | + }) | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 是否需要判断某种类型才需要判断内容是否存在的场景,目前测试没发现问题 | ||
| 151 | + */ | ||
| 152 | + jumpDetail(){ | ||
| 153 | + MinePageDatasModel.getAssertDetailData(this.contentDTO.relId,this.contentDTO.objectId,this.contentDTO.relType).then((value) => { | ||
| 154 | + if(value == "1"){ | ||
| 155 | + ProcessUtils.processPage(this.contentDTO) | ||
| 156 | + }else{ | ||
| 157 | + ToastUtils.shortToast("内容不存在") | ||
| 158 | + } | ||
| 159 | + }).catch((err: Error) => { | ||
| 160 | + console.log(TAG, JSON.stringify(err)) | ||
| 144 | }) | 161 | }) |
| 145 | } | 162 | } |
| 146 | } | 163 | } |
| @@ -131,6 +131,7 @@ export struct CommentComponent { | @@ -131,6 +131,7 @@ export struct CommentComponent { | ||
| 131 | 131 | ||
| 132 | Column() { | 132 | Column() { |
| 133 | if (showGapLine) { | 133 | if (showGapLine) { |
| 134 | + Blank().height(12) | ||
| 134 | Divider().strokeWidth(6).color('#f5f5f5') | 135 | Divider().strokeWidth(6).color('#f5f5f5') |
| 135 | } | 136 | } |
| 136 | 137 | ||
| @@ -493,7 +494,11 @@ struct ChildCommentItem { | @@ -493,7 +494,11 @@ struct ChildCommentItem { | ||
| 493 | .onClick(() => { | 494 | .onClick(() => { |
| 494 | this.replyComment() | 495 | this.replyComment() |
| 495 | }) | 496 | }) |
| 496 | - | 497 | + if (this.item.commentPics.length > 0) { |
| 498 | + Image(this.item.commentPics) | ||
| 499 | + .width(88).height(88) | ||
| 500 | + .margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: 95}) | ||
| 501 | + } | ||
| 497 | 502 | ||
| 498 | commentFooterView({ | 503 | commentFooterView({ |
| 499 | item: this.item, | 504 | item: this.item, |
| @@ -712,6 +717,12 @@ struct commentHeaderView { | @@ -712,6 +717,12 @@ struct commentHeaderView { | ||
| 712 | this.replyComment() | 717 | this.replyComment() |
| 713 | }) | 718 | }) |
| 714 | 719 | ||
| 720 | + if (this.item.commentPics.length > 0) { | ||
| 721 | + Image(this.item.commentPics) | ||
| 722 | + .width(88).height(88) | ||
| 723 | + .margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: 60}) | ||
| 724 | + } | ||
| 725 | + | ||
| 715 | commentFooterView({ | 726 | commentFooterView({ |
| 716 | item: this.item, | 727 | item: this.item, |
| 717 | dialogController: this.dialogController, | 728 | dialogController: this.dialogController, |
| @@ -260,7 +260,7 @@ export struct TopNavigationComponentNew { | @@ -260,7 +260,7 @@ export struct TopNavigationComponentNew { | ||
| 260 | buildTabBarItems(mourningCheckFn: (channelId: string) => boolean) { | 260 | buildTabBarItems(mourningCheckFn: (channelId: string) => boolean) { |
| 261 | ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | 261 | ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { |
| 262 | ListItem() { | 262 | ListItem() { |
| 263 | - this.tabBarBuilder(navItem, index) | 263 | + this.tabBarBuilder(navItem, index,true) |
| 264 | } | 264 | } |
| 265 | .grayscale(mourningCheckFn(`${navItem.channelId}`) ? 1 : 0) | 265 | .grayscale(mourningCheckFn(`${navItem.channelId}`) ? 1 : 0) |
| 266 | }); | 266 | }); |
| @@ -374,7 +374,7 @@ export struct TopNavigationComponentNew { | @@ -374,7 +374,7 @@ export struct TopNavigationComponentNew { | ||
| 374 | * @param index | 374 | * @param index |
| 375 | */ | 375 | */ |
| 376 | @Builder | 376 | @Builder |
| 377 | - tabBarBuilder(item: TopNavDTO, index: number) { | 377 | + tabBarBuilder(item: TopNavDTO, index: number,isRmh:boolean = false) { |
| 378 | Column() { | 378 | Column() { |
| 379 | 379 | ||
| 380 | if (item.iconUrl && item.iconCUrl) { | 380 | if (item.iconUrl && item.iconCUrl) { |
| @@ -398,11 +398,17 @@ export struct TopNavigationComponentNew { | @@ -398,11 +398,17 @@ export struct TopNavigationComponentNew { | ||
| 398 | }) | 398 | }) |
| 399 | .maxLines(this.MAX_LINE) | 399 | .maxLines(this.MAX_LINE) |
| 400 | .id(index.toString()) | 400 | .id(index.toString()) |
| 401 | - if (this.currentTopNavSelectedIndex === index) { | 401 | + if(isRmh){ |
| 402 | Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor(""))) | 402 | Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor(""))) |
| 403 | .width(20) | 403 | .width(20) |
| 404 | .height(3) | 404 | .height(3) |
| 405 | - | 405 | + .visibility(this.currentTopNavSelectedIndex === index?Visibility.Visible:Visibility.Hidden) |
| 406 | + }else{ | ||
| 407 | + if (this.currentTopNavSelectedIndex === index) { | ||
| 408 | + Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor(""))) | ||
| 409 | + .width(20) | ||
| 410 | + .height(3) | ||
| 411 | + } | ||
| 406 | } | 412 | } |
| 407 | } | 413 | } |
| 408 | 414 |
| @@ -18,8 +18,8 @@ export struct TabChatItemComponent { | @@ -18,8 +18,8 @@ export struct TabChatItemComponent { | ||
| 18 | 18 | ||
| 19 | build() { | 19 | build() { |
| 20 | Row() { | 20 | Row() { |
| 21 | - Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') : | ||
| 22 | - this.item.senderUserAvatarUrl) | 21 | + Image(this.item.senderUserAvatarUrl) |
| 22 | + .alt($r('app.media.default_head')) | ||
| 23 | .borderRadius(90) | 23 | .borderRadius(90) |
| 24 | .width(24) | 24 | .width(24) |
| 25 | .height(24) | 25 | .height(24) |
| @@ -16,7 +16,8 @@ export struct TabLiveItemComponent { | @@ -16,7 +16,8 @@ export struct TabLiveItemComponent { | ||
| 16 | build() { | 16 | build() { |
| 17 | Column() { | 17 | Column() { |
| 18 | Row() { | 18 | Row() { |
| 19 | - Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') : this.item.senderUserAvatarUrl) | 19 | + Image(this.item.senderUserAvatarUrl) |
| 20 | + .alt($r('app.media.default_head')) | ||
| 20 | .borderRadius(90) | 21 | .borderRadius(90) |
| 21 | .width(24) | 22 | .width(24) |
| 22 | .height(24) | 23 | .height(24) |
| @@ -258,7 +258,7 @@ export struct PlayUIComponent { | @@ -258,7 +258,7 @@ export struct PlayUIComponent { | ||
| 258 | .fontWeight(400) | 258 | .fontWeight(400) |
| 259 | .fontColor(Color.White) | 259 | .fontColor(Color.White) |
| 260 | 260 | ||
| 261 | - if (this.liveRoomDataBean.pv > 0 && !StringUtils.isEmpty(this.liveUrl)) { | 261 | + if (this.liveRoomDataBean.pv > 0) { |
| 262 | Image($r('app.media.icon_live_player_status_end')) | 262 | Image($r('app.media.icon_live_player_status_end')) |
| 263 | .width(12) | 263 | .width(12) |
| 264 | .height(12) | 264 | .height(12) |
| @@ -164,6 +164,7 @@ export struct PlayerEndView { | @@ -164,6 +164,7 @@ export struct PlayerEndView { | ||
| 164 | .borderRadius(4) | 164 | .borderRadius(4) |
| 165 | if (this.contentDetailData.rmhInfo != null) { | 165 | if (this.contentDetailData.rmhInfo != null) { |
| 166 | Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) | 166 | Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) |
| 167 | + .alt($r('app.media.default_head')) | ||
| 167 | .width(80) | 168 | .width(80) |
| 168 | .height(80) | 169 | .height(80) |
| 169 | .borderRadius(40) | 170 | .borderRadius(40) |
-
Please register or login to post a comment