fix |> 修复竖屏直播结束页展示,和安卓不一致问题
1.没有人民号信息时,不展示关注按钮 2.直播时长显示已调整为和安卓显示规则保持一致
Showing
2 changed files
with
41 additions
and
9 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) { |
| @@ -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,6 +90,7 @@ export struct PlayerEndView { | @@ -84,6 +90,7 @@ export struct PlayerEndView { | ||
| 84 | 90 | ||
| 85 | Stack() { | 91 | Stack() { |
| 86 | Column() { | 92 | Column() { |
| 93 | + if (this.contentDetailData.rmhInfo != null) { | ||
| 87 | Text(this.contentDetailData?.rmhInfo?.rmhName) | 94 | Text(this.contentDetailData?.rmhInfo?.rmhName) |
| 88 | .fontWeight(400) | 95 | .fontWeight(400) |
| 89 | .fontSize(18) | 96 | .fontSize(18) |
| @@ -94,11 +101,11 @@ export struct PlayerEndView { | @@ -94,11 +101,11 @@ export struct PlayerEndView { | ||
| 94 | .fontSize(13) | 101 | .fontSize(13) |
| 95 | .fontColor('#B2FFFFFF') | 102 | .fontColor('#B2FFFFFF') |
| 96 | .padding({ top: 8 }) | 103 | .padding({ top: 8 }) |
| 97 | - | 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,8 +117,8 @@ export struct PlayerEndView { | @@ -110,8 +117,8 @@ 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 | - | 120 | + .padding({ top: this.contentDetailData.rmhInfo == null ? 26 : 16 }) |
| 121 | + if (this.contentDetailData.rmhInfo != null) { | ||
| 115 | Row() { | 122 | Row() { |
| 116 | Text(this.followStatus == '0' ? '关注' : '已关注') | 123 | Text(this.followStatus == '0' ? '关注' : '已关注') |
| 117 | .fontWeight(400) | 124 | .fontWeight(400) |
| @@ -130,10 +137,10 @@ export struct PlayerEndView { | @@ -130,10 +137,10 @@ export struct PlayerEndView { | ||
| 130 | }) | 137 | }) |
| 131 | } | 138 | } |
| 132 | .padding({ top: 24 }) | 139 | .padding({ top: 24 }) |
| 133 | - | 140 | + } |
| 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