王士厅
... ... @@ -503,6 +503,31 @@ export class DateTimeUtils {
}
}
static liveDurationSecondToTime(seconds: number) {
if (seconds < 60) {
return '0时1分'
}
let time = ''
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) {
... ...
... ... @@ -320,7 +320,7 @@ export struct SearchComponent {
.cancelButton({
style: CancelButtonStyle.INVISIBLE
})
.caretStyle({ color: Color.Pink })
.caretStyle({ color: $r('app.color.main_red') })
///监听搜索框变化
.onTextSelectionChange((selectionStart: number) =>{
this.searchTextNum = selectionStart;
... ...
... ... @@ -74,7 +74,7 @@ export struct SearchResultComponent {
//缺省图
if(this.isConnectNetwork){
EmptyComponent({emptyType:4})
.height(`${this.calcHeight(612)}lpx`)
.height('70%')
.width('100%')
}else{
EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
... ...
... ... @@ -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,21 +90,22 @@ export struct PlayerEndView {
Stack() {
Column() {
Text(this.contentDetailData?.rmhInfo?.rmhName)
.fontWeight(400)
.fontSize(18)
.fontColor(Color.White)
.padding({ top: 52 })
Text(this.contentDetailData?.rmhInfo?.rmhDesc || '')
.fontWeight(400)
.fontSize(13)
.fontColor('#B2FFFFFF')
.padding({ top: 8 })
if (this.contentDetailData.rmhInfo != null) {
Text(this.contentDetailData?.rmhInfo?.rmhName)
.fontWeight(400)
.fontSize(18)
.fontColor(Color.White)
.padding({ top: 52 })
Text(this.contentDetailData?.rmhInfo?.rmhDesc || '')
.fontWeight(400)
.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,30 +117,30 @@ export struct PlayerEndView {
Text('观看人数').fontWeight(400).fontSize(13).fontColor(Color.White)
}
}
.padding({ top: 16 })
Row() {
Text(this.followStatus == '0' ? '关注' : '已关注')
.fontWeight(400)
.fontSize(16)
.fontColor(Color.White)
.padding({
top: 8,
bottom: 8,
left: 122,
right: 122
})
.backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey)
.borderRadius(4)
.onClick(() => {
this.handleAccention()
})
.padding({ top: this.contentDetailData.rmhInfo == null ? 26 : 16 })
if (this.contentDetailData.rmhInfo != null) {
Row() {
Text(this.followStatus == '0' ? '关注' : '已关注')
.fontWeight(400)
.fontSize(16)
.fontColor(Color.White)
.padding({
top: 8,
bottom: 8,
left: 122,
right: 122
})
.backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey)
.borderRadius(4)
.onClick(() => {
this.handleAccention()
})
}
.padding({ top: 24 })
}
.padding({ top: 24 })
}
.width(307)
.height(254)
.height(this.contentDetailData.rmhInfo == null ? 100 : 254)
.backgroundColor('#999999')
.borderRadius(4)
if (this.contentDetailData.rmhInfo != null) {
... ...