wuyanan

fix |> 修复竖屏直播结束页展示,和安卓不一致问题

1.没有人民号信息时,不展示关注按钮
2.直播时长显示已调整为和安卓显示规则保持一致
... ... @@ -503,6 +503,31 @@ export class DateTimeUtils {
}
}
static liveDurationSecondToTime(seconds: number) {
let time = ''
if (seconds < 60) {
return '0时0分'
}
let days = Math.floor(seconds/this.SECONDS_IN_DAY)
let hours = Math.floor(seconds%this.SECONDS_IN_DAY/this.SECONDS_IN_HOUR)
let minutes = Math.floor(seconds%this.SECONDS_IN_DAY%this.SECONDS_IN_HOUR/this.SECONDS_IN_MINUTE)
if (days > 0) {
time = time + days.toString()+"天"
}
if (hours > 0 || minutes > 0) {
time = time + hours.toString() + "时"
}
if (minutes > 0 || (days == 0 && hours > 0)) {
time = time + minutes.toString() + "分"
}
return time
}
static padding(num: string) {
let length = 2;
for (let len = (num.toString()).length; len < length; len = num.length) {
... ...
... ... @@ -20,12 +20,18 @@ export struct PlayerEndView {
}
aboutToAppear(): void {
this.calculateLiveDuration()
this.getBatchAttentionStatus()
}
calculateLiveDuration() {
const sn =
DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
const en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
let en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
if (this.contentDetailData.liveInfo?.endTime == null) {
en = DateTimeUtils.getTimeStamp()
}
const sd = DateTimeUtils.getDuration(sn, en)
this.duration = DateTimeUtils.secondToTime(sd / 1000)
this.getBatchAttentionStatus()
this.duration = DateTimeUtils.liveDurationSecondToTime(sd / 1000)
}
/**
... ... @@ -84,6 +90,7 @@ export struct PlayerEndView {
Stack() {
Column() {
if (this.contentDetailData.rmhInfo != null) {
Text(this.contentDetailData?.rmhInfo?.rmhName)
.fontWeight(400)
.fontSize(18)
... ... @@ -94,11 +101,11 @@ export struct PlayerEndView {
.fontSize(13)
.fontColor('#B2FFFFFF')
.padding({ top: 8 })
}
Row() {
Column() {
Text(this.duration).fontWeight(600).fontSize(24).fontColor(Color.White)
Text('时长').fontWeight(400).fontSize(13).fontColor(Color.White)
Text('直播时长').fontWeight(400).fontSize(13).fontColor(Color.White)
}
Text('').width(1).height(32).margin({ left: 36, right: 36 }).backgroundColor('#33FFFFFF')
... ... @@ -110,8 +117,8 @@ export struct PlayerEndView {
Text('观看人数').fontWeight(400).fontSize(13).fontColor(Color.White)
}
}
.padding({ top: 16 })
.padding({ top: this.contentDetailData.rmhInfo == null ? 26 : 16 })
if (this.contentDetailData.rmhInfo != null) {
Row() {
Text(this.followStatus == '0' ? '关注' : '已关注')
.fontWeight(400)
... ... @@ -130,10 +137,10 @@ export struct PlayerEndView {
})
}
.padding({ top: 24 })
}
}
.width(307)
.height(254)
.height(this.contentDetailData.rmhInfo == null ? 100 : 254)
.backgroundColor('#999999')
.borderRadius(4)
if (this.contentDetailData.rmhInfo != null) {
... ...