王士厅
@@ -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 + if (seconds < 60) {
  508 + return '0时1分'
  509 + }
  510 + let time = ''
  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) {
@@ -320,7 +320,7 @@ export struct SearchComponent { @@ -320,7 +320,7 @@ export struct SearchComponent {
320 .cancelButton({ 320 .cancelButton({
321 style: CancelButtonStyle.INVISIBLE 321 style: CancelButtonStyle.INVISIBLE
322 }) 322 })
323 - .caretStyle({ color: Color.Pink }) 323 + .caretStyle({ color: $r('app.color.main_red') })
324 ///监听搜索框变化 324 ///监听搜索框变化
325 .onTextSelectionChange((selectionStart: number) =>{ 325 .onTextSelectionChange((selectionStart: number) =>{
326 this.searchTextNum = selectionStart; 326 this.searchTextNum = selectionStart;
@@ -74,7 +74,7 @@ export struct SearchResultComponent { @@ -74,7 +74,7 @@ export struct SearchResultComponent {
74 //缺省图 74 //缺省图
75 if(this.isConnectNetwork){ 75 if(this.isConnectNetwork){
76 EmptyComponent({emptyType:4}) 76 EmptyComponent({emptyType:4})
77 - .height(`${this.calcHeight(612)}lpx`) 77 + .height('70%')
78 .width('100%') 78 .width('100%')
79 }else{ 79 }else{
80 EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { 80 EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
@@ -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) {