Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix |> 修复竖屏直播结束页展示,和安卓不一致问题 fix: 【生产】搜索页面,点击热门搜索词后,搜索结果页,缺少评论和点赞按钮。
Showing
5 changed files
with
110 additions
and
67 deletions
| @@ -503,6 +503,31 @@ export class DateTimeUtils { | @@ -503,6 +503,31 @@ export class DateTimeUtils { | ||
| 503 | } | 503 | } |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | + static liveDurationSecondToTime(seconds: number) { | ||
| 507 | + let time = '' | ||
| 508 | + if (seconds < 60) { | ||
| 509 | + return '0时0分' | ||
| 510 | + } | ||
| 511 | + let days = Math.floor(seconds/this.SECONDS_IN_DAY) | ||
| 512 | + | ||
| 513 | + let hours = Math.floor(seconds%this.SECONDS_IN_DAY/this.SECONDS_IN_HOUR) | ||
| 514 | + | ||
| 515 | + let minutes = Math.floor(seconds%this.SECONDS_IN_DAY%this.SECONDS_IN_HOUR/this.SECONDS_IN_MINUTE) | ||
| 516 | + | ||
| 517 | + if (days > 0) { | ||
| 518 | + time = time + days.toString()+"天" | ||
| 519 | + } | ||
| 520 | + | ||
| 521 | + if (hours > 0 || minutes > 0) { | ||
| 522 | + time = time + hours.toString() + "时" | ||
| 523 | + } | ||
| 524 | + | ||
| 525 | + if (minutes > 0 || (days == 0 && hours > 0)) { | ||
| 526 | + time = time + minutes.toString() + "分" | ||
| 527 | + } | ||
| 528 | + return time | ||
| 529 | + } | ||
| 530 | + | ||
| 506 | static padding(num: string) { | 531 | static padding(num: string) { |
| 507 | let length = 2; | 532 | let length = 2; |
| 508 | for (let len = (num.toString()).length; len < length; len = num.length) { | 533 | for (let len = (num.toString()).length; len < length; len = num.length) { |
| @@ -54,7 +54,11 @@ export struct CardParser { | @@ -54,7 +54,11 @@ export struct CardParser { | ||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | build() { | 56 | build() { |
| 57 | - this.contentBuilder(this.contentDTO); | 57 | + Column() { |
| 58 | + // Text('CardParser') | ||
| 59 | + // Text(JSON.stringify(this.contentDTO.appStyle)) | ||
| 60 | + this.contentBuilder(this.contentDTO); | ||
| 61 | + } | ||
| 58 | } | 62 | } |
| 59 | 63 | ||
| 60 | @Builder | 64 | @Builder |
| @@ -23,6 +23,8 @@ export struct CarderInteraction { | @@ -23,6 +23,8 @@ export struct CarderInteraction { | ||
| 23 | @State likeBean: Record<string, string> = {} | 23 | @State likeBean: Record<string, string> = {} |
| 24 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 24 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 25 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 25 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 26 | + @State isShowComment: boolean = false // 是否显示评论 | ||
| 27 | + @State isShowLike: boolean = false // 是否显示点赞 | ||
| 26 | @Provide pageName: string = TrackConstants.PageName.DynamicDetail | 28 | @Provide pageName: string = TrackConstants.PageName.DynamicDetail |
| 27 | @Provide pageId: string = TrackConstants.PageName.DynamicDetail | 29 | @Provide pageId: string = TrackConstants.PageName.DynamicDetail |
| 28 | 30 | ||
| @@ -35,13 +37,19 @@ export struct CarderInteraction { | @@ -35,13 +37,19 @@ export struct CarderInteraction { | ||
| 35 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' | 37 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' |
| 36 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' | 38 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' |
| 37 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | 39 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' |
| 38 | - this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1' | 40 | + this.contentDTO.shareFlag = this.contentDTO.shareFlag ? this.contentDTO.shareFlag : '1' |
| 39 | console.log('是否显示分享',this.contentDTO.shareFlag) | 41 | console.log('是否显示分享',this.contentDTO.shareFlag) |
| 40 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 42 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 41 | this.likesStyle = this.contentDetailData.likesStyle | 43 | this.likesStyle = this.contentDetailData.likesStyle |
| 42 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false | 44 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false |
| 45 | + this.isShowComment = this.buildDisplayComment() | ||
| 46 | + this.isShowLike = this.buildDisplayLike() | ||
| 47 | + // console.log(TAG, 'this.isShowComment', this.isShowComment) | ||
| 48 | + // console.log(TAG, 'this.isShowLike', this.isShowLike) | ||
| 49 | + // console.log(TAG, 'router.getState().name', router.getState().name) | ||
| 43 | } | 50 | } |
| 44 | 51 | ||
| 52 | + | ||
| 45 | build() { | 53 | build() { |
| 46 | Row() { | 54 | Row() { |
| 47 | if(this.contentDetailData?.shareInfo?.shareOpen === 1){ | 55 | if(this.contentDetailData?.shareInfo?.shareOpen === 1){ |
| @@ -61,10 +69,14 @@ export struct CarderInteraction { | @@ -61,10 +69,14 @@ export struct CarderInteraction { | ||
| 61 | } | 69 | } |
| 62 | 70 | ||
| 63 | if(this.contentDetailData?.openComment == 1 || router.getState().name === 'PeopleShipHomePage'){ | 71 | if(this.contentDetailData?.openComment == 1 || router.getState().name === 'PeopleShipHomePage'){ |
| 64 | - if (this.buildDisplayComment()) this.commentLayout() | 72 | + if (this.isShowComment) { |
| 73 | + this.commentLayout() | ||
| 74 | + } | ||
| 65 | } | 75 | } |
| 66 | 76 | ||
| 67 | - if(this.buildDisplayLike()) this.builderLike() | 77 | + if(this.isShowLike) { |
| 78 | + this.builderLike() | ||
| 79 | + } | ||
| 68 | } | 80 | } |
| 69 | .width('100%') | 81 | .width('100%') |
| 70 | .margin({ top: 11 }) | 82 | .margin({ top: 11 }) |
| @@ -99,12 +111,10 @@ export struct CarderInteraction { | @@ -99,12 +111,10 @@ export struct CarderInteraction { | ||
| 99 | @Builder | 111 | @Builder |
| 100 | builderLike() { | 112 | builderLike() { |
| 101 | Row() { | 113 | Row() { |
| 102 | - if (this.likeBean?.contentId) { | ||
| 103 | - LikeComponent({ | ||
| 104 | - data: this.likeBean, | ||
| 105 | - componentType: 3 | ||
| 106 | - }) | ||
| 107 | - } | 114 | + LikeComponent({ |
| 115 | + data: this.likeBean, | ||
| 116 | + componentType: 3 | ||
| 117 | + }) | ||
| 108 | } | 118 | } |
| 109 | .visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible) | 119 | .visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible) |
| 110 | } | 120 | } |
| @@ -117,7 +127,8 @@ export struct CarderInteraction { | @@ -117,7 +127,8 @@ export struct CarderInteraction { | ||
| 117 | let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, | 127 | let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, |
| 118 | this.contentDTO.relType) | 128 | this.contentDTO.relType) |
| 119 | this.contentDetailData = data[0]; | 129 | this.contentDetailData = data[0]; |
| 120 | - console.log('动态详情', JSON.stringify(this.contentDetailData)) | 130 | + // console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData)) |
| 131 | + // console.log(TAG, 'this.contentDetailData.rmhInfo', JSON.stringify(this.contentDetailData.rmhInfo)) | ||
| 121 | } catch (exception) { | 132 | } catch (exception) { |
| 122 | console.log('请求失败', JSON.stringify(exception)) | 133 | console.log('请求失败', JSON.stringify(exception)) |
| 123 | } | 134 | } |
| @@ -125,32 +136,27 @@ export struct CarderInteraction { | @@ -125,32 +136,27 @@ export struct CarderInteraction { | ||
| 125 | 136 | ||
| 126 | ///是否展示评论 | 137 | ///是否展示评论 |
| 127 | buildDisplayComment(): boolean { | 138 | buildDisplayComment(): boolean { |
| 128 | - let isDisplay = false | ||
| 129 | - if (this.contentDTO.rmhInfo) { | ||
| 130 | - if (this.contentDTO.rmhInfo.cnIsComment === 1 && this.contentDTO.openComment === 1) { | ||
| 131 | - isDisplay = true | ||
| 132 | - } | ||
| 133 | - }else { | ||
| 134 | - if (this.contentDTO.openComment === 1) { | ||
| 135 | - isDisplay = true | ||
| 136 | - } | 139 | + // console.log(TAG, 'buildDisplayComment this.contentDetailData', JSON.stringify(this.contentDetailData)) |
| 140 | + // console.log(TAG, 'buildDisplayComment this.contentDetailData.rmhInfo', JSON.stringify(this.contentDetailData.rmhInfo)) | ||
| 141 | + const hasRmhInfo = this.contentDetailData && this.contentDetailData.rmhInfo; | ||
| 142 | + | ||
| 143 | + if (hasRmhInfo) { | ||
| 144 | + return this.contentDetailData?.rmhInfo!.cnlsComment === 1 && this.contentDetailData.openComment === 1; | ||
| 137 | } | 145 | } |
| 138 | - return isDisplay | 146 | + |
| 147 | + return this.contentDetailData?.openComment === 1; | ||
| 139 | } | 148 | } |
| 140 | 149 | ||
| 141 | ///是否展示点赞 | 150 | ///是否展示点赞 |
| 142 | buildDisplayLike(): boolean { | 151 | buildDisplayLike(): boolean { |
| 143 | - let isDisplay = false | ||
| 144 | - if (this.contentDTO.rmhInfo) { | ||
| 145 | - if (this.contentDTO.rmhInfo.cnIsLike === 1 && this.contentDTO.openLikes === 1) { | ||
| 146 | - isDisplay = true | ||
| 147 | - } | ||
| 148 | - }else { | ||
| 149 | - if (this.contentDTO.openLikes === 1) { | ||
| 150 | - isDisplay = true | ||
| 151 | - } | 152 | + // console.log(TAG, 'buildDisplayLike this.contentDetailData', JSON.stringify(this.contentDetailData)) |
| 153 | + // console.log(TAG, 'buildDisplayLike this.contentDetailData.rmhInfo', JSON.stringify(this.contentDetailData.rmhInfo)) | ||
| 154 | + const hasRmhInfo = this.contentDetailData && this.contentDetailData.rmhInfo; | ||
| 155 | + | ||
| 156 | + if (hasRmhInfo) { | ||
| 157 | + return this.contentDetailData?.rmhInfo!.cnlsLike === 1 && this.contentDetailData.openLikes === 1; | ||
| 152 | } | 158 | } |
| 153 | - return isDisplay | 159 | + return this.contentDetailData?.openLikes === 1; |
| 154 | } | 160 | } |
| 155 | 161 | ||
| 156 | } | 162 | } |
| @@ -72,6 +72,7 @@ export struct CompParser { | @@ -72,6 +72,7 @@ export struct CompParser { | ||
| 72 | 72 | ||
| 73 | build() { | 73 | build() { |
| 74 | Column() { | 74 | Column() { |
| 75 | + // Text('CompParser') | ||
| 75 | // Text(JSON.stringify(this.compDTO.compStyle)) | 76 | // Text(JSON.stringify(this.compDTO.compStyle)) |
| 76 | this.componentBuilder(); | 77 | this.componentBuilder(); |
| 77 | } | 78 | } |
| @@ -20,12 +20,18 @@ export struct PlayerEndView { | @@ -20,12 +20,18 @@ export struct PlayerEndView { | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 23 | + this.calculateLiveDuration() | ||
| 24 | + this.getBatchAttentionStatus() | ||
| 25 | + } | ||
| 26 | + calculateLiveDuration() { | ||
| 23 | const sn = | 27 | const sn = |
| 24 | DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) | 28 | DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) |
| 25 | - const en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) | 29 | + let en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) |
| 30 | + if (this.contentDetailData.liveInfo?.endTime == null) { | ||
| 31 | + en = DateTimeUtils.getTimeStamp() | ||
| 32 | + } | ||
| 26 | const sd = DateTimeUtils.getDuration(sn, en) | 33 | const sd = DateTimeUtils.getDuration(sn, en) |
| 27 | - this.duration = DateTimeUtils.secondToTime(sd / 1000) | ||
| 28 | - this.getBatchAttentionStatus() | 34 | + this.duration = DateTimeUtils.liveDurationSecondToTime(sd / 1000) |
| 29 | } | 35 | } |
| 30 | 36 | ||
| 31 | /** | 37 | /** |
| @@ -84,21 +90,22 @@ export struct PlayerEndView { | @@ -84,21 +90,22 @@ export struct PlayerEndView { | ||
| 84 | 90 | ||
| 85 | Stack() { | 91 | Stack() { |
| 86 | Column() { | 92 | Column() { |
| 87 | - Text(this.contentDetailData?.rmhInfo?.rmhName) | ||
| 88 | - .fontWeight(400) | ||
| 89 | - .fontSize(18) | ||
| 90 | - .fontColor(Color.White) | ||
| 91 | - .padding({ top: 52 }) | ||
| 92 | - Text(this.contentDetailData?.rmhInfo?.rmhDesc || '') | ||
| 93 | - .fontWeight(400) | ||
| 94 | - .fontSize(13) | ||
| 95 | - .fontColor('#B2FFFFFF') | ||
| 96 | - .padding({ top: 8 }) | ||
| 97 | - | 93 | + if (this.contentDetailData.rmhInfo != null) { |
| 94 | + Text(this.contentDetailData?.rmhInfo?.rmhName) | ||
| 95 | + .fontWeight(400) | ||
| 96 | + .fontSize(18) | ||
| 97 | + .fontColor(Color.White) | ||
| 98 | + .padding({ top: 52 }) | ||
| 99 | + Text(this.contentDetailData?.rmhInfo?.rmhDesc || '') | ||
| 100 | + .fontWeight(400) | ||
| 101 | + .fontSize(13) | ||
| 102 | + .fontColor('#B2FFFFFF') | ||
| 103 | + .padding({ top: 8 }) | ||
| 104 | + } | ||
| 98 | Row() { | 105 | Row() { |
| 99 | Column() { | 106 | Column() { |
| 100 | Text(this.duration).fontWeight(600).fontSize(24).fontColor(Color.White) | 107 | Text(this.duration).fontWeight(600).fontSize(24).fontColor(Color.White) |
| 101 | - Text('时长').fontWeight(400).fontSize(13).fontColor(Color.White) | 108 | + Text('直播时长').fontWeight(400).fontSize(13).fontColor(Color.White) |
| 102 | } | 109 | } |
| 103 | 110 | ||
| 104 | Text('').width(1).height(32).margin({ left: 36, right: 36 }).backgroundColor('#33FFFFFF') | 111 | Text('').width(1).height(32).margin({ left: 36, right: 36 }).backgroundColor('#33FFFFFF') |
| @@ -110,30 +117,30 @@ export struct PlayerEndView { | @@ -110,30 +117,30 @@ export struct PlayerEndView { | ||
| 110 | Text('观看人数').fontWeight(400).fontSize(13).fontColor(Color.White) | 117 | Text('观看人数').fontWeight(400).fontSize(13).fontColor(Color.White) |
| 111 | } | 118 | } |
| 112 | } | 119 | } |
| 113 | - .padding({ top: 16 }) | ||
| 114 | - | ||
| 115 | - Row() { | ||
| 116 | - Text(this.followStatus == '0' ? '关注' : '已关注') | ||
| 117 | - .fontWeight(400) | ||
| 118 | - .fontSize(16) | ||
| 119 | - .fontColor(Color.White) | ||
| 120 | - .padding({ | ||
| 121 | - top: 8, | ||
| 122 | - bottom: 8, | ||
| 123 | - left: 122, | ||
| 124 | - right: 122 | ||
| 125 | - }) | ||
| 126 | - .backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey) | ||
| 127 | - .borderRadius(4) | ||
| 128 | - .onClick(() => { | ||
| 129 | - this.handleAccention() | ||
| 130 | - }) | 120 | + .padding({ top: this.contentDetailData.rmhInfo == null ? 26 : 16 }) |
| 121 | + if (this.contentDetailData.rmhInfo != null) { | ||
| 122 | + Row() { | ||
| 123 | + Text(this.followStatus == '0' ? '关注' : '已关注') | ||
| 124 | + .fontWeight(400) | ||
| 125 | + .fontSize(16) | ||
| 126 | + .fontColor(Color.White) | ||
| 127 | + .padding({ | ||
| 128 | + top: 8, | ||
| 129 | + bottom: 8, | ||
| 130 | + left: 122, | ||
| 131 | + right: 122 | ||
| 132 | + }) | ||
| 133 | + .backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey) | ||
| 134 | + .borderRadius(4) | ||
| 135 | + .onClick(() => { | ||
| 136 | + this.handleAccention() | ||
| 137 | + }) | ||
| 138 | + } | ||
| 139 | + .padding({ top: 24 }) | ||
| 131 | } | 140 | } |
| 132 | - .padding({ top: 24 }) | ||
| 133 | - | ||
| 134 | } | 141 | } |
| 135 | .width(307) | 142 | .width(307) |
| 136 | - .height(254) | 143 | + .height(this.contentDetailData.rmhInfo == null ? 100 : 254) |
| 137 | .backgroundColor('#999999') | 144 | .backgroundColor('#999999') |
| 138 | .borderRadius(4) | 145 | .borderRadius(4) |
| 139 | if (this.contentDetailData.rmhInfo != null) { | 146 | if (this.contentDetailData.rmhInfo != null) { |
-
Please register or login to post a comment