Showing
15 changed files
with
672 additions
and
676 deletions
| @@ -8,6 +8,7 @@ import { RmhInfoDTO } from '../detail/RmhInfoDTO'; | @@ -8,6 +8,7 @@ import { RmhInfoDTO } from '../detail/RmhInfoDTO'; | ||
| 8 | import { commentInfo } from './commentInfo'; | 8 | import { commentInfo } from './commentInfo'; |
| 9 | import { BaseDTO } from '../component/BaseDTO'; | 9 | import { BaseDTO } from '../component/BaseDTO'; |
| 10 | import { LiveRoomDataBean } from '../live/LiveRoomDataBean'; | 10 | import { LiveRoomDataBean } from '../live/LiveRoomDataBean'; |
| 11 | +import { ReserveItemBean } from '../live/ReserveItemBean'; | ||
| 11 | 12 | ||
| 12 | export class ContentShareInfoDTO { | 13 | export class ContentShareInfoDTO { |
| 13 | shareTitle: string = '' | 14 | shareTitle: string = '' |
| @@ -67,8 +68,8 @@ export class ContentDTO implements BaseDTO { | @@ -67,8 +68,8 @@ export class ContentDTO implements BaseDTO { | ||
| 67 | vImageUrl: string = ''; | 68 | vImageUrl: string = ''; |
| 68 | screenType: string = ''; | 69 | screenType: string = ''; |
| 69 | source: string = ''; | 70 | source: string = ''; |
| 70 | - objectId: string = ''; | ||
| 71 | objectType: string = ''; | 71 | objectType: string = ''; |
| 72 | + objectId: string = ''; | ||
| 72 | objectLevel: string = ''; | 73 | objectLevel: string = ''; |
| 73 | channelId: string = ''; | 74 | channelId: string = ''; |
| 74 | relId: string = ''; | 75 | relId: string = ''; |
| @@ -115,7 +116,11 @@ export class ContentDTO implements BaseDTO { | @@ -115,7 +116,11 @@ export class ContentDTO implements BaseDTO { | ||
| 115 | //本地字段:时间轴专题页节点组件时间;【如果开启模糊则显示时间->左右;0:否,1:是】 | 116 | //本地字段:时间轴专题页节点组件时间;【如果开启模糊则显示时间->左右;0:否,1:是】 |
| 116 | timeBlurred:number = 0 | 117 | timeBlurred:number = 0 |
| 117 | top:number = 0 | 118 | top:number = 0 |
| 119 | + // 直播预约状态 | ||
| 120 | + reserveItemBean : ReserveItemBean = new ReserveItemBean(-1,this.relId,false) | ||
| 118 | 121 | ||
| 122 | + // keyGenerator相关字符串,用于刷新list布局 | ||
| 123 | + timestamp: String = '1' | ||
| 119 | // 自定义参数,用于跳转对应页面时 传递targetLayout参数用 | 124 | // 自定义参数,用于跳转对应页面时 传递targetLayout参数用 |
| 120 | customParamTargetLayout?: string | 125 | customParamTargetLayout?: string |
| 121 | 126 |
| @@ -19,6 +19,7 @@ import { SearchContentComponent } from './cardview/SearchContentComponent'; | @@ -19,6 +19,7 @@ import { SearchContentComponent } from './cardview/SearchContentComponent'; | ||
| 19 | import { DateTimeUtils } from 'wdKit/Index'; | 19 | import { DateTimeUtils } from 'wdKit/Index'; |
| 20 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; | 20 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; |
| 21 | import { LiveBigImage02Component } from './cardview/LiveBigImage02Component'; | 21 | import { LiveBigImage02Component } from './cardview/LiveBigImage02Component'; |
| 22 | +import { LiveBigImage01Component } from './cardview/LiveBigImage01Component'; | ||
| 22 | 23 | ||
| 23 | /** | 24 | /** |
| 24 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 25 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| @@ -26,13 +27,13 @@ import { LiveBigImage02Component } from './cardview/LiveBigImage02Component'; | @@ -26,13 +27,13 @@ import { LiveBigImage02Component } from './cardview/LiveBigImage02Component'; | ||
| 26 | */ | 27 | */ |
| 27 | @Component | 28 | @Component |
| 28 | export struct CardParser { | 29 | export struct CardParser { |
| 29 | - | ||
| 30 | @State pageId: string = ''; | 30 | @State pageId: string = ''; |
| 31 | @State pageName: string = ''; | 31 | @State pageName: string = ''; |
| 32 | @State contentDTO: ContentDTO = new ContentDTO(); | 32 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 33 | + @State compIndex: number = 0; | ||
| 33 | @ObjectLink compDTO: CompDTO | 34 | @ObjectLink compDTO: CompDTO |
| 34 | - pageShowTime:number = 0; | ||
| 35 | - pageHideTime:number = 0; | 35 | + pageShowTime: number = 0; |
| 36 | + pageHideTime: number = 0; | ||
| 36 | 37 | ||
| 37 | aboutToAppear(): void { | 38 | aboutToAppear(): void { |
| 38 | console.log('CardParser-', JSON.stringify(this.contentDTO)) | 39 | console.log('CardParser-', JSON.stringify(this.contentDTO)) |
| @@ -46,8 +47,9 @@ export struct CardParser { | @@ -46,8 +47,9 @@ export struct CardParser { | ||
| 46 | onPageHide(): void { | 47 | onPageHide(): void { |
| 47 | this.pageHideTime = DateTimeUtils.getTimeStamp() | 48 | this.pageHideTime = DateTimeUtils.getTimeStamp() |
| 48 | let duration = 0 | 49 | let duration = 0 |
| 49 | - duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 50 | - TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) | 50 | + duration = Math.floor((this.pageHideTime - this.pageShowTime) / 1000) |
| 51 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal, | ||
| 52 | + TrackConstants.PageName.Customer_Personal, duration) | ||
| 51 | } | 53 | } |
| 52 | 54 | ||
| 53 | build() { | 55 | build() { |
| @@ -58,41 +60,136 @@ export struct CardParser { | @@ -58,41 +60,136 @@ export struct CardParser { | ||
| 58 | contentBuilder(contentDTO: ContentDTO) { | 60 | contentBuilder(contentDTO: ContentDTO) { |
| 59 | // Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 61 | // Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 60 | if (!!contentDTO.contentText) { | 62 | if (!!contentDTO.contentText) { |
| 61 | - SearchContentComponent({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 63 | + SearchContentComponent({ |
| 64 | + contentDTO, | ||
| 65 | + compDTO: this.compDTO, | ||
| 66 | + pageId: this.pageId, | ||
| 67 | + pageName: this.pageName | ||
| 68 | + }) | ||
| 62 | } else { | 69 | } else { |
| 63 | if (contentDTO.appStyle === CompStyle.Card_02) { | 70 | if (contentDTO.appStyle === CompStyle.Card_02) { |
| 64 | - Card2Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName }) | 71 | + Card2Component({ |
| 72 | + compDTO: this.compDTO, | ||
| 73 | + contentDTO, | ||
| 74 | + pageId: this.pageId, | ||
| 75 | + pageName: this.pageName | ||
| 76 | + }) | ||
| 65 | } else if (contentDTO.appStyle === CompStyle.Card_03) { | 77 | } else if (contentDTO.appStyle === CompStyle.Card_03) { |
| 66 | - Card3Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName }) | ||
| 67 | - }else if (contentDTO.appStyle === CompStyle.Card_04) { | ||
| 68 | - Card4Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName }) | ||
| 69 | - } else if (contentDTO.appStyle === CompStyle.Card_05) { | ||
| 70 | - Card5Component({ compDTO: this.compDTO, contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, pageId: this.pageId, pageName: this.pageName}) | ||
| 71 | - } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle.Card_13 ) { | ||
| 72 | - Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO, pageId: this.pageId, pageName: this.pageName }) | 78 | + Card3Component({ |
| 79 | + compDTO: this.compDTO, | ||
| 80 | + contentDTO, | ||
| 81 | + pageId: this.pageId, | ||
| 82 | + pageName: this.pageName | ||
| 83 | + }) | ||
| 84 | + } else if (contentDTO.appStyle === CompStyle.Card_04) { | ||
| 85 | + Card4Component({ | ||
| 86 | + compDTO: this.compDTO, | ||
| 87 | + contentDTO, | ||
| 88 | + pageId: this.pageId, | ||
| 89 | + pageName: this.pageName | ||
| 90 | + }) | ||
| 91 | + } else if (contentDTO.appStyle === CompStyle.Card_05) { | ||
| 92 | + Card5Component({ | ||
| 93 | + compDTO: this.compDTO, | ||
| 94 | + contentDTO, | ||
| 95 | + titleShowPolicy: this.compDTO.titleShowPolicy, | ||
| 96 | + pageId: this.pageId, | ||
| 97 | + pageName: this.pageName | ||
| 98 | + }) | ||
| 99 | + } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle.Card_13) { | ||
| 100 | + Card6Component({ | ||
| 101 | + compDTO: this.compDTO, | ||
| 102 | + contentDTO: this.contentDTO, | ||
| 103 | + pageId: this.pageId, | ||
| 104 | + pageName: this.pageName | ||
| 105 | + }) | ||
| 73 | } else if (contentDTO.appStyle === CompStyle.Card_10) { | 106 | } else if (contentDTO.appStyle === CompStyle.Card_10) { |
| 74 | - Card10Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName }) | 107 | + Card10Component({ |
| 108 | + compDTO: this.compDTO, | ||
| 109 | + contentDTO, | ||
| 110 | + pageId: this.pageId, | ||
| 111 | + pageName: this.pageName | ||
| 112 | + }) | ||
| 75 | } else if (contentDTO.appStyle === CompStyle.Card_11) { | 113 | } else if (contentDTO.appStyle === CompStyle.Card_11) { |
| 76 | - Card11Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName }) | 114 | + Card11Component({ |
| 115 | + compDTO: this.compDTO, | ||
| 116 | + contentDTO, | ||
| 117 | + pageId: this.pageId, | ||
| 118 | + pageName: this.pageName | ||
| 119 | + }) | ||
| 77 | } else if (contentDTO.appStyle === CompStyle.Card_12) { | 120 | } else if (contentDTO.appStyle === CompStyle.Card_12) { |
| 78 | - Card12Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName }) | 121 | + Card12Component({ |
| 122 | + compDTO: this.compDTO, | ||
| 123 | + contentDTO, | ||
| 124 | + pageId: this.pageId, | ||
| 125 | + pageName: this.pageName | ||
| 126 | + }) | ||
| 79 | } else if (contentDTO.appStyle === CompStyle.Card_14) { | 127 | } else if (contentDTO.appStyle === CompStyle.Card_14) { |
| 80 | - Card14Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 128 | + Card14Component({ |
| 129 | + contentDTO, | ||
| 130 | + compDTO: this.compDTO, | ||
| 131 | + pageId: this.pageId, | ||
| 132 | + pageName: this.pageName | ||
| 133 | + }) | ||
| 81 | } else if (contentDTO.appStyle === CompStyle.Card_15) { | 134 | } else if (contentDTO.appStyle === CompStyle.Card_15) { |
| 82 | - Card15Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 135 | + Card15Component({ |
| 136 | + contentDTO, | ||
| 137 | + compDTO: this.compDTO, | ||
| 138 | + pageId: this.pageId, | ||
| 139 | + pageName: this.pageName | ||
| 140 | + }) | ||
| 83 | } else if (contentDTO.appStyle === CompStyle.Card_16) { | 141 | } else if (contentDTO.appStyle === CompStyle.Card_16) { |
| 84 | - Card16Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 142 | + Card16Component({ |
| 143 | + contentDTO, | ||
| 144 | + compDTO: this.compDTO, | ||
| 145 | + pageId: this.pageId, | ||
| 146 | + pageName: this.pageName | ||
| 147 | + }) | ||
| 85 | } else if (contentDTO.appStyle === CompStyle.Card_17) { | 148 | } else if (contentDTO.appStyle === CompStyle.Card_17) { |
| 86 | - Card17Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName }) | 149 | + Card17Component({ |
| 150 | + compDTO: this.compDTO, | ||
| 151 | + contentDTO, | ||
| 152 | + pageId: this.pageId, | ||
| 153 | + pageName: this.pageName | ||
| 154 | + }) | ||
| 87 | } else if (contentDTO.appStyle === CompStyle.Card_19) { | 155 | } else if (contentDTO.appStyle === CompStyle.Card_19) { |
| 88 | - Card19Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 156 | + Card19Component({ |
| 157 | + contentDTO, | ||
| 158 | + compDTO: this.compDTO, | ||
| 159 | + pageId: this.pageId, | ||
| 160 | + pageName: this.pageName | ||
| 161 | + }) | ||
| 89 | } else if (contentDTO.appStyle === CompStyle.Card_20) { | 162 | } else if (contentDTO.appStyle === CompStyle.Card_20) { |
| 90 | - Card20Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 163 | + Card20Component({ |
| 164 | + contentDTO, | ||
| 165 | + compDTO: this.compDTO, | ||
| 166 | + pageId: this.pageId, | ||
| 167 | + pageName: this.pageName | ||
| 168 | + }) | ||
| 91 | } else if (contentDTO.appStyle === CompStyle.Card_21) { | 169 | } else if (contentDTO.appStyle === CompStyle.Card_21) { |
| 92 | - Card21Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 170 | + Card21Component({ |
| 171 | + contentDTO, | ||
| 172 | + compDTO: this.compDTO, | ||
| 173 | + pageId: this.pageId, | ||
| 174 | + pageName: this.pageName | ||
| 175 | + }) | ||
| 176 | + } else if (contentDTO.appStyle === CompStyle.Card_Comp_Live_Big_Image_01) { | ||
| 177 | + LiveBigImage01Component({ | ||
| 178 | + contentDTO: contentDTO, | ||
| 179 | + compDTO: this.compDTO, | ||
| 180 | + pageId: this.pageId, | ||
| 181 | + pageName: this.pageName, | ||
| 182 | + index: this.compIndex | ||
| 183 | + }) | ||
| 93 | } else if (contentDTO.appStyle === CompStyle.Card_Comp_Live_Big_Image_02) { | 184 | } else if (contentDTO.appStyle === CompStyle.Card_Comp_Live_Big_Image_02) { |
| 94 | - LiveBigImage02Component({ contentDTO:contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | ||
| 95 | - }else { | 185 | + LiveBigImage02Component({ |
| 186 | + contentDTO: contentDTO, | ||
| 187 | + compDTO: this.compDTO, | ||
| 188 | + pageId: this.pageId, | ||
| 189 | + pageName: this.pageName | ||
| 190 | + | ||
| 191 | + }) | ||
| 192 | + } else { | ||
| 96 | // todo:组件未实现 / Component Not Implemented | 193 | // todo:组件未实现 / Component Not Implemented |
| 97 | // Text(contentDTO.appStyle) | 194 | // Text(contentDTO.appStyle) |
| 98 | // .width(CommonConstants.FULL_PARENT) | 195 | // .width(CommonConstants.FULL_PARENT) |
| @@ -58,7 +58,7 @@ export struct CompParser { | @@ -58,7 +58,7 @@ export struct CompParser { | ||
| 58 | this.compDTO.operDataList = this.noneAudioItems; | 58 | this.compDTO.operDataList = this.noneAudioItems; |
| 59 | } | 59 | } |
| 60 | // 金刚卡屏蔽音频类型稿件 | 60 | // 金刚卡屏蔽音频类型稿件 |
| 61 | - if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | 61 | + if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { |
| 62 | this.audioItems = this.compDTO.operDataList.filter(item => { | 62 | this.audioItems = this.compDTO.operDataList.filter(item => { |
| 63 | return item.objectType === '13' || item.linkUrl.includes('audiotopic') | 63 | return item.objectType === '13' || item.linkUrl.includes('audiotopic') |
| 64 | }) | 64 | }) |
| @@ -96,9 +96,17 @@ export struct CompParser { | @@ -96,9 +96,17 @@ export struct CompParser { | ||
| 96 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 96 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 97 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) { | 97 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) { |
| 98 | if (this.compDTO.operDataList.length > 1) { | 98 | if (this.compDTO.operDataList.length > 1) { |
| 99 | - HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 99 | + HorizontalStrokeCardThreeTwoRadioForMoreComponent({ |
| 100 | + compDTO: this.compDTO, | ||
| 101 | + pageId: this.pageId, | ||
| 102 | + pageName: this.pageName | ||
| 103 | + }) | ||
| 100 | } else { | 104 | } else { |
| 101 | - HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 105 | + HorizontalStrokeCardThreeTwoRadioForOneComponent({ |
| 106 | + compDTO: this.compDTO, | ||
| 107 | + pageId: this.pageId, | ||
| 108 | + pageName: this.pageName | ||
| 109 | + }) | ||
| 102 | } | 110 | } |
| 103 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 111 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 104 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) { | 112 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) { |
| @@ -113,7 +121,12 @@ export struct CompParser { | @@ -113,7 +121,12 @@ export struct CompParser { | ||
| 113 | // Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 121 | // Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) |
| 114 | } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 | 122 | } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 |
| 115 | 123 | ||
| 116 | - ZhGridLayout02NewsContent({ compDTO: this.compDTO, operDataList: this.compDTO.operDataList, pageId: this.pageId, pageName: this.pageName }) | 124 | + ZhGridLayout02NewsContent({ |
| 125 | + compDTO: this.compDTO, | ||
| 126 | + operDataList: this.compDTO.operDataList, | ||
| 127 | + pageId: this.pageId, | ||
| 128 | + pageName: this.pageName | ||
| 129 | + }) | ||
| 117 | 130 | ||
| 118 | } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | 131 | } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { |
| 119 | ZhGridLayout03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 132 | ZhGridLayout03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| @@ -139,24 +152,39 @@ export struct CompParser { | @@ -139,24 +152,39 @@ export struct CompParser { | ||
| 139 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 152 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 140 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | 153 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) { |
| 141 | // 大图卡 | 154 | // 大图卡 |
| 142 | - Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName }) | 155 | + Card2Component({ |
| 156 | + compDTO: this.compDTO, | ||
| 157 | + contentDTO: this.compDTO.operDataList[0], | ||
| 158 | + pageId: this.pageId, | ||
| 159 | + pageName: this.pageName | ||
| 160 | + }) | ||
| 143 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 161 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 144 | } else if (this.compDTO.compStyle === CompStyle.Card_09) { | 162 | } else if (this.compDTO.compStyle === CompStyle.Card_09) { |
| 145 | //时间链卡 | 163 | //时间链卡 |
| 146 | Card9Component({ | 164 | Card9Component({ |
| 147 | compDTO: this.compDTO, | 165 | compDTO: this.compDTO, |
| 148 | - contentDTO:this.compDTO.operDataList[0], | 166 | + contentDTO: this.compDTO.operDataList[0], |
| 149 | pageId: this.pageId, | 167 | pageId: this.pageId, |
| 150 | pageName: this.pageName | 168 | pageName: this.pageName |
| 151 | }) | 169 | }) |
| 152 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 170 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 153 | - } else if(this.compDTO.compStyle === CompStyle.Card_13){ | ||
| 154 | - Card6Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName }) | 171 | + } else if (this.compDTO.compStyle === CompStyle.Card_13) { |
| 172 | + Card6Component({ | ||
| 173 | + compDTO: this.compDTO, | ||
| 174 | + contentDTO: this.compDTO.operDataList[0], | ||
| 175 | + pageId: this.pageId, | ||
| 176 | + pageName: this.pageName | ||
| 177 | + }) | ||
| 155 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 178 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 156 | - } else if(this.compDTO.compStyle === CompStyle.Card_03){ | ||
| 157 | - Card3Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName }) | 179 | + } else if (this.compDTO.compStyle === CompStyle.Card_03) { |
| 180 | + Card3Component({ | ||
| 181 | + compDTO: this.compDTO, | ||
| 182 | + contentDTO: this.compDTO.operDataList[0], | ||
| 183 | + pageId: this.pageId, | ||
| 184 | + pageName: this.pageName | ||
| 185 | + }) | ||
| 158 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 186 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 159 | - }else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) { | 187 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) { |
| 160 | ZhSingleColumn04({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 188 | ZhSingleColumn04({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| 161 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 189 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 162 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | 190 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) { |
| @@ -170,7 +198,13 @@ export struct CompParser { | @@ -170,7 +198,13 @@ export struct CompParser { | ||
| 170 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 0, right: 0 }) | 198 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 0, right: 0 }) |
| 171 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 199 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 172 | } else if (!Number.isNaN(Number(this.compDTO.compStyle)) || this.compDTO.compType === 'appStyle') { | 200 | } else if (!Number.isNaN(Number(this.compDTO.compStyle)) || this.compDTO.compType === 'appStyle') { |
| 173 | - CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }); | 201 | + CardParser({ |
| 202 | + contentDTO: this.compDTO.operDataList[0], | ||
| 203 | + compDTO: this.compDTO, | ||
| 204 | + pageId: this.pageId, | ||
| 205 | + pageName: this.pageName, | ||
| 206 | + compIndex: this.compIndex | ||
| 207 | + }); | ||
| 174 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 208 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 175 | } else { | 209 | } else { |
| 176 | // Text(this.compDTO.compStyle) | 210 | // Text(this.compDTO.compStyle) |
sight_harmony/features/wdComponent/src/main/ets/components/cardview/LiveBigImage01Component.ets
0 → 100644
| 1 | +import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 2 | +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 3 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 4 | +import { hasClicked } from '../../utils/persistentStorage'; | ||
| 5 | +import { ToastUtils } from 'wdKit/Index'; | ||
| 6 | +import { router } from '@kit.ArkUI'; | ||
| 7 | +import { TrackConstants, Tracking, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; | ||
| 8 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 9 | +import { LiveModel } from '../../viewmodel/LiveModel'; | ||
| 10 | + | ||
| 11 | +const TAG: string = 'LiveBigImage01Component'; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 本地样式卡:直播预约卡 | ||
| 15 | + */ | ||
| 16 | +@Component | ||
| 17 | +export struct LiveBigImage01Component { | ||
| 18 | + @ObjectLink compDTO: CompDTO | ||
| 19 | + @State pageId: string = ''; | ||
| 20 | + @State pageName: string = ''; | ||
| 21 | + @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 22 | + @State loadImg: boolean = false; | ||
| 23 | + @State clicked: boolean = false; | ||
| 24 | + index: number = 0 | ||
| 25 | + @State isLoadingAttention: boolean = false | ||
| 26 | + | ||
| 27 | + async aboutToAppear() { | ||
| 28 | + const curRouter = router.getState().name; | ||
| 29 | + this.clicked = hasClicked(this.contentDTO.objectId, curRouter) | ||
| 30 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + build() { | ||
| 34 | + Column() { | ||
| 35 | + Stack() { | ||
| 36 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls[0]?.url : '') | ||
| 37 | + .width('100%') | ||
| 38 | + .aspectRatio(16 / 9) | ||
| 39 | + .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : $r('app.color.color_33A3A3A3')) | ||
| 40 | + .objectFit(ImageFit.Contain) | ||
| 41 | + .borderWidth(0.5) | ||
| 42 | + .borderColor($r('app.color.color_0D000000')) | ||
| 43 | + .borderRadius({ | ||
| 44 | + topLeft: '4vp', | ||
| 45 | + topRight: '4vp' | ||
| 46 | + }) | ||
| 47 | + this.LiveImage() | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + } | ||
| 52 | + .alignContent(Alignment.BottomEnd) | ||
| 53 | + | ||
| 54 | + Text(this.contentDTO.newsTitle) | ||
| 55 | + .fontSize(17) | ||
| 56 | + .maxLines(2) | ||
| 57 | + .lineHeight(25) | ||
| 58 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 59 | + .margin({ top: 4, left: 12, right: 12 }) | ||
| 60 | + .alignSelf(ItemAlign.Start) | ||
| 61 | + Row() { | ||
| 62 | + if (this.contentDTO.liveInfo && this.contentDTO.liveInfo.liveStartTime) { | ||
| 63 | + Row() { | ||
| 64 | + Image($r('app.media.reserve_play_icon')) | ||
| 65 | + .width(20) | ||
| 66 | + .height(20) | ||
| 67 | + .margin({ | ||
| 68 | + left: 10, | ||
| 69 | + top: 2, | ||
| 70 | + bottom: 2, | ||
| 71 | + right: 6 | ||
| 72 | + }) | ||
| 73 | + | ||
| 74 | + Text(this.getReserveDate(this.contentDTO.liveInfo.liveStartTime, 1)) | ||
| 75 | + .fontSize(12) | ||
| 76 | + .fontWeight(500) | ||
| 77 | + .fontColor('#ED2800') | ||
| 78 | + .fontFamily('PingFang SC-Medium') | ||
| 79 | + .maxLines(1) | ||
| 80 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 81 | + .margin({ top: 8, bottom: 8 }) | ||
| 82 | + .align(Alignment.Start) | ||
| 83 | + | ||
| 84 | + Image($r('app.media.point_icon')) | ||
| 85 | + .objectFit(ImageFit.Auto) | ||
| 86 | + .interpolation(ImageInterpolation.High) | ||
| 87 | + .width(6) | ||
| 88 | + .height(16) | ||
| 89 | + .margin(2) | ||
| 90 | + | ||
| 91 | + Text(this.getReserveDate(this.contentDTO.liveInfo.liveStartTime, 2)) | ||
| 92 | + .fontSize(12) | ||
| 93 | + .fontWeight(500) | ||
| 94 | + .fontColor('#ED2800') | ||
| 95 | + .fontFamily('PingFang SC-Medium') | ||
| 96 | + .maxLines(1) | ||
| 97 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 98 | + .margin({ top: 8, bottom: 8, right: 10 }) | ||
| 99 | + .align(Alignment.Start) | ||
| 100 | + } | ||
| 101 | + .backgroundColor('#F5F5F5') | ||
| 102 | + .margin(12) | ||
| 103 | + } | ||
| 104 | + // 预约 | ||
| 105 | + Row() { | ||
| 106 | + LoadingProgress() | ||
| 107 | + .width(20) | ||
| 108 | + .height(20) | ||
| 109 | + .color(!this.isReserved() ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) | ||
| 110 | + .visibility((this.isLoadingAttention) ? Visibility.Visible : | ||
| 111 | + Visibility.None) | ||
| 112 | + | ||
| 113 | + Text(!this.isReserved() ? '预约' : '已预约') | ||
| 114 | + .fontSize($r('app.float.vp_12')) | ||
| 115 | + .fontWeight(500) | ||
| 116 | + .fontColor(!this.isReserved() ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) | ||
| 117 | + .width('100%') | ||
| 118 | + .height('100%') | ||
| 119 | + .textAlign(TextAlign.Center) | ||
| 120 | + .visibility((this.isLoadingAttention) ? Visibility.None : | ||
| 121 | + Visibility.Visible) | ||
| 122 | + .margin({ | ||
| 123 | + right: '10vp' | ||
| 124 | + }) | ||
| 125 | + .textShadow({ | ||
| 126 | + radius: 2, | ||
| 127 | + color: 'rgba(0,0,0,0.3)', | ||
| 128 | + offsetY: 2 | ||
| 129 | + }) | ||
| 130 | + .backgroundColor(!this.isReserved() ? $r('app.color.color_ED2800') : $r('app.color.color_F5F5F5')) | ||
| 131 | + .borderRadius(3) | ||
| 132 | + | ||
| 133 | + } | ||
| 134 | + .onClick(() => { | ||
| 135 | + this.bookAndCancel(this.contentDTO) | ||
| 136 | + }) | ||
| 137 | + .justifyContent(FlexAlign.Center) | ||
| 138 | + .alignItems(VerticalAlign.Center) | ||
| 139 | + .borderRadius(3) | ||
| 140 | + .width('52vp') | ||
| 141 | + .height('24vp') | ||
| 142 | + .margin({ right: 12 }) | ||
| 143 | + | ||
| 144 | + } | ||
| 145 | + .width('100%') | ||
| 146 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 147 | + | ||
| 148 | + } | ||
| 149 | + .borderRadius(4) | ||
| 150 | + .backgroundColor(Color.White) | ||
| 151 | + .width('calc(100% - 24vp)') | ||
| 152 | + .margin({ | ||
| 153 | + left: '12vp', | ||
| 154 | + right: '12vp', | ||
| 155 | + top: this.index == 0 ? '12vp' : '8vp' | ||
| 156 | + }) | ||
| 157 | + .onClick(() => { | ||
| 158 | + | ||
| 159 | + // 内容点击埋点 | ||
| 160 | + TrackingContent.common(TrackConstants.EventType.Click, | ||
| 161 | + this.pageId, | ||
| 162 | + this.pageId, | ||
| 163 | + TrackParamConvert.program(this.contentDTO)) | ||
| 164 | + | ||
| 165 | + ProcessUtils.processPage(this.contentDTO) | ||
| 166 | + }) | ||
| 167 | + .onVisibleAreaChange([0, 1], (isVisiable: boolean, ratio: number) => { | ||
| 168 | + if (isVisiable) { | ||
| 169 | + // 内容曝光埋点 | ||
| 170 | + TrackingContent.common(TrackConstants.EventType.Show, | ||
| 171 | + this.pageId, | ||
| 172 | + this.pageId, | ||
| 173 | + TrackParamConvert.program(this.contentDTO)) | ||
| 174 | + } | ||
| 175 | + }) | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + @Builder | ||
| 179 | + LiveImage() { | ||
| 180 | + Row() { | ||
| 181 | + Image($r('app.media.reserve_new_icon')) | ||
| 182 | + .width(14) | ||
| 183 | + .height(14) | ||
| 184 | + .margin({ | ||
| 185 | + right: 3 | ||
| 186 | + }) | ||
| 187 | + Text('预约') | ||
| 188 | + .fontSize('12vp') | ||
| 189 | + .fontWeight(400) | ||
| 190 | + .fontColor(Color.White) | ||
| 191 | + .textShadow({ | ||
| 192 | + radius: 2, | ||
| 193 | + color: 'rgba(0,0,0,0.3)', | ||
| 194 | + offsetY: 2 | ||
| 195 | + }) | ||
| 196 | + } | ||
| 197 | + .backgroundColor(Color.Transparent) | ||
| 198 | + .margin({ right: 8, bottom: 8 }) | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + getReserveDate(eventDateTimeString: string, type: number): string { | ||
| 202 | + // 解析事件的日期和时间 | ||
| 203 | + const eventDateTime = new Date(eventDateTimeString); | ||
| 204 | + const currentDateTime = new Date(); | ||
| 205 | + | ||
| 206 | + // 截取事件时间的小时和分钟(假设事件时间是按照24小时制) | ||
| 207 | + const eventHour = eventDateTime.getHours(); | ||
| 208 | + const eventMinutes = eventDateTime.getMinutes(); | ||
| 209 | + const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数 | ||
| 210 | + if (type === 1) { | ||
| 211 | + // 判断是否是今天 | ||
| 212 | + const eventDate = eventDateTime.setHours(0, 0, 0, 0); | ||
| 213 | + const currentDate = currentDateTime.setHours(0, 0, 0, 0); | ||
| 214 | + if (eventDate === currentDate) { | ||
| 215 | + return `今天`; | ||
| 216 | + } else { | ||
| 217 | + const month = eventDateTime.getMonth() + 1; | ||
| 218 | + const date = eventDateTime.getDate(); | ||
| 219 | + return `${month}月${date}日`; | ||
| 220 | + } | ||
| 221 | + } else { | ||
| 222 | + return `${eventTimeStr}`; | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + // 预约/取消预约 | ||
| 227 | + async bookAndCancel(item: ContentDTO) { | ||
| 228 | + | ||
| 229 | + // 未登录,跳转登录 | ||
| 230 | + if (!HttpUtils.getUserId()) { | ||
| 231 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 232 | + return | ||
| 233 | + } | ||
| 234 | + if (!this.isLoadingAttention) { | ||
| 235 | + this.isLoadingAttention = true | ||
| 236 | + const reserveItem = item.reserveItemBean | ||
| 237 | + if (reserveItem) { | ||
| 238 | + this.isLoadingAttention = true | ||
| 239 | + try { | ||
| 240 | + | ||
| 241 | + // 埋点 | ||
| 242 | + Tracking.event(!reserveItem.subscribe ? "live_subscribe_click" : "cancel_live_subscribe_click", | ||
| 243 | + TrackParamConvert.program(item)) | ||
| 244 | + | ||
| 245 | + const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(), | ||
| 246 | + !reserveItem.subscribe); | ||
| 247 | + if (res.code == 0) { | ||
| 248 | + ToastUtils.shortToast(!reserveItem.subscribe ? '预约成功' : '取消预约成功') | ||
| 249 | + reserveItem.subscribe = !reserveItem.subscribe ? true : false | ||
| 250 | + } | ||
| 251 | + this.isLoadingAttention = false | ||
| 252 | + } catch (e) { | ||
| 253 | + this.isLoadingAttention = false | ||
| 254 | + } | ||
| 255 | + } else { | ||
| 256 | + this.isLoadingAttention = false | ||
| 257 | + } | ||
| 258 | + } | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + // 判断是否预约 | ||
| 262 | + isReserved() { | ||
| 263 | + | ||
| 264 | + if (this.compDTO.operDataList[0].reserveItemBean == undefined) { | ||
| 265 | + return false | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + return this.compDTO.operDataList[0].reserveItemBean.subscribe | ||
| 269 | + } | ||
| 270 | +} |
| @@ -2,12 +2,11 @@ import { CompDTO, ContentDTO } from 'wdBean'; | @@ -2,12 +2,11 @@ import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 2 | import { ProcessUtils } from 'wdRouter'; | 2 | import { ProcessUtils } from 'wdRouter'; |
| 3 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 3 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 4 | import { hasClicked, persistentStorage } from '../../utils/persistentStorage'; | 4 | import { hasClicked, persistentStorage } from '../../utils/persistentStorage'; |
| 5 | -import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed'; | ||
| 6 | import { DateTimeUtils } from 'wdKit/Index'; | 5 | import { DateTimeUtils } from 'wdKit/Index'; |
| 7 | import { LottieView } from '../lottie/LottieView'; | 6 | import { LottieView } from '../lottie/LottieView'; |
| 8 | import { router } from '@kit.ArkUI'; | 7 | import { router } from '@kit.ArkUI'; |
| 9 | 8 | ||
| 10 | -const TAG: string = 'Card6Component-Card13Component'; | 9 | +const TAG: string = 'LiveBigImage02Component'; |
| 11 | 10 | ||
| 12 | /** | 11 | /** |
| 13 | * 本地样式卡:直播大图卡 | 12 | * 本地样式卡:直播大图卡 |
| @@ -23,7 +23,7 @@ struct LiveMorePage { | @@ -23,7 +23,7 @@ struct LiveMorePage { | ||
| 23 | //常见标题 | 23 | //常见标题 |
| 24 | CommonPageTitle({ title: this.title }) | 24 | CommonPageTitle({ title: this.title }) |
| 25 | // 通用模板组件 | 25 | // 通用模板组件 |
| 26 | - TemplatePageComponent({ pageDataSourceType: TemplatePageConstant.LIVE_HORIZONTAL_CARD }) | 26 | + TemplatePageComponent({ pageDataSourceType: TemplatePageConstant.LIVE_HORIZONTAL_PAGE }) |
| 27 | 27 | ||
| 28 | } | 28 | } |
| 29 | .height('100%') | 29 | .height('100%') |
| 1 | -import { ArrayList } from '@kit.ArkTS' | ||
| 2 | -import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean/Index' | 1 | +import { CompDTO, ContentDTO, LiveRoomDataBean, ReserveBean, ReserveItemBean } from 'wdBean/Index' |
| 3 | import { DateTimeUtils, Logger } from 'wdKit/Index' | 2 | import { DateTimeUtils, Logger } from 'wdKit/Index' |
| 3 | +import { HttpUtils } from 'wdNetwork/Index' | ||
| 4 | +import { LiveModel } from '../../../viewmodel/LiveModel' | ||
| 4 | import PageViewModel from '../../../viewmodel/PageViewModel' | 5 | import PageViewModel from '../../../viewmodel/PageViewModel' |
| 6 | + | ||
| 5 | const TAG: string = 'BaseTemplateHelp' | 7 | const TAG: string = 'BaseTemplateHelp' |
| 6 | 8 | ||
| 7 | 9 | ||
| 8 | export class BasePageHelp { | 10 | export class BasePageHelp { |
| 9 | - | ||
| 10 | /** | 11 | /** |
| 11 | - * 请求获取直播房间的动态数据 | ||
| 12 | - * @param list | 12 | + * 批查直播预约数据 |
| 13 | + * @param compList | ||
| 13 | */ | 14 | */ |
| 15 | + async getAppointmentInfo(compList: CompDTO[]) { | ||
| 16 | + if (HttpUtils.getUserId()) { | ||
| 17 | + | ||
| 18 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 19 | + Logger.debug(TAG, 'getAppointmentInfo-->'+time) | ||
| 20 | + const reserveBean = this.transformToLiveDetailsBeans(compList) | ||
| 21 | + LiveModel.getAppointmentStatus(reserveBean).then((result) => { | ||
| 22 | + Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`) | ||
| 23 | + if (result && result.length > 0) { | ||
| 24 | + for (let item of result) { | ||
| 25 | + for (let compItem of compList) { | ||
| 26 | + if (item.liveId.toString() == compItem.operDataList[0].objectId) { | ||
| 27 | + compItem.operDataList[0].reserveItemBean = item | ||
| 28 | + compItem.timestamp = time | ||
| 29 | + break | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + }).catch(() => { | ||
| 35 | + }) | ||
| 36 | + } else { | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + // 这个函数遍历liveReviewDTO.list并转换为LiveDetailsBean数组 | ||
| 42 | + transformToLiveDetailsBeans(compList: CompDTO[]): ReserveBean[] { | ||
| 43 | + | ||
| 44 | + let list: ContentDTO[] = [] | ||
| 45 | + | ||
| 46 | + compList.forEach(compBean => { | ||
| 47 | + if (compBean.operDataList && compBean.operDataList.length > 0) { | ||
| 48 | + list.push(compBean.operDataList[0]) | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + }) | ||
| 52 | + | ||
| 53 | + const liveDetailsBeans: ReserveBean[] = []; | ||
| 54 | + list.forEach(item => { | ||
| 55 | + liveDetailsBeans.push({ | ||
| 56 | + relationId: item.relId, | ||
| 57 | + liveId: item.objectId, | ||
| 58 | + }); | ||
| 59 | + }); | ||
| 60 | + return liveDetailsBeans | ||
| 61 | + } | ||
| 62 | + | ||
| 14 | /** | 63 | /** |
| 15 | - * 直播回看的批查数据 | ||
| 16 | - * @param list | 64 | + * 请求获取直播房间的动态数据 |
| 17 | * @param compList | 65 | * @param compList |
| 18 | */ | 66 | */ |
| 19 | - getLiveRoomDataInfo(compList: CompDTO[]) { | 67 | + |
| 68 | + getLiveRoomDataInfo(compList: CompDTO[]) { | ||
| 20 | 69 | ||
| 21 | let list: ContentDTO[] = [] | 70 | let list: ContentDTO[] = [] |
| 22 | compList.forEach((comp: CompDTO) => { | 71 | compList.forEach((comp: CompDTO) => { |
| 23 | - list.push(...comp.operDataList) | 72 | + list.push(...comp.operDataList) |
| 24 | }) | 73 | }) |
| 25 | let time = DateTimeUtils.getTimeStamp().toString() | 74 | let time = DateTimeUtils.getTimeStamp().toString() |
| 26 | 75 | ||
| @@ -48,6 +97,7 @@ export class BasePageHelp { | @@ -48,6 +97,7 @@ export class BasePageHelp { | ||
| 48 | }).catch(() => { | 97 | }).catch(() => { |
| 49 | }) | 98 | }) |
| 50 | } | 99 | } |
| 100 | + | ||
| 51 | /** | 101 | /** |
| 52 | * 获取业务内容 objectId 集合穿 如1,2,3 | 102 | * 获取业务内容 objectId 集合穿 如1,2,3 |
| 53 | * @param pageContentList | 103 | * @param pageContentList |
| 1 | -import { CompDTO, ContentDTO } from 'wdBean/Index' | ||
| 2 | -import { LazyDataSource, Logger } from 'wdKit/Index' | 1 | +import { CompDTO, ContentDTO, ReserveItemBean } from 'wdBean/Index' |
| 2 | +import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, Logger } from 'wdKit/Index' | ||
| 3 | import { CompParser } from '../../CompParser' | 3 | import { CompParser } from '../../CompParser' |
| 4 | import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' | 4 | import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' |
| 5 | import { PeopleShipNoMoreData } from '../../reusable/PeopleShipNoMoreData' | 5 | import { PeopleShipNoMoreData } from '../../reusable/PeopleShipNoMoreData' |
| @@ -23,7 +23,6 @@ const TAG: string = 'TemplatePageComponent'; | @@ -23,7 +23,6 @@ const TAG: string = 'TemplatePageComponent'; | ||
| 23 | */ | 23 | */ |
| 24 | @Component | 24 | @Component |
| 25 | export default struct TemplatePageComponent { | 25 | export default struct TemplatePageComponent { |
| 26 | - | ||
| 27 | // 模板页面的数据驱动对象 | 26 | // 模板页面的数据驱动对象 |
| 28 | @State private templatePage: TemplatePageModel = new TemplatePageModel | 27 | @State private templatePage: TemplatePageModel = new TemplatePageModel |
| 29 | // 此内容主要因CustomPullToRefresh需要,目前没任何业务意义要求 | 28 | // 此内容主要因CustomPullToRefresh需要,目前没任何业务意义要求 |
| @@ -32,7 +31,7 @@ export default struct TemplatePageComponent { | @@ -32,7 +31,7 @@ export default struct TemplatePageComponent { | ||
| 32 | private templateScroller: Scroller = new Scroller() | 31 | private templateScroller: Scroller = new Scroller() |
| 33 | //识别不同页面的业务类型 | 32 | //识别不同页面的业务类型 |
| 34 | pageDataSourceType: string = '' | 33 | pageDataSourceType: string = '' |
| 35 | - | 34 | + @State listColor: Resource = $r('app.color.color_fff') |
| 36 | // 埋点字段 | 35 | // 埋点字段 |
| 37 | pageId: string = '' | 36 | pageId: string = '' |
| 38 | pageName: string = '' | 37 | pageName: string = '' |
| @@ -40,6 +39,38 @@ export default struct TemplatePageComponent { | @@ -40,6 +39,38 @@ export default struct TemplatePageComponent { | ||
| 40 | async aboutToAppear() { | 39 | async aboutToAppear() { |
| 41 | Logger.debug(TAG, 'aboutToAppear') | 40 | Logger.debug(TAG, 'aboutToAppear') |
| 42 | this.requestPageData() | 41 | this.requestPageData() |
| 42 | + | ||
| 43 | + // 登录成功 | ||
| 44 | + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | ||
| 45 | + Logger.debug(TAG, 'receiveEvent-----LOGIN_SUCCESS----------') | ||
| 46 | + this.templatePage.isEmitter = true | ||
| 47 | + this.templatePage.currentPage = 1 | ||
| 48 | + this.requestPageData() | ||
| 49 | + }) | ||
| 50 | + | ||
| 51 | + // 获取预约 | ||
| 52 | + EmitterUtils.receiveEvent(EmitterEventId.LIVE_ROOM_SUBSCRIBE, (str?: string) => { | ||
| 53 | + Logger.debug(TAG, 'receiveEvent LIVE_ROOM_SUBSCRIBE: ' + str) | ||
| 54 | + if (str) { | ||
| 55 | + // 跳转指定频道场景,传参底导id、频道id | ||
| 56 | + const model: ReserveItemBean = JSON.parse(str) | ||
| 57 | + Logger.debug(TAG, '是否关注元数据0:' + ` ${model.liveId}`) | ||
| 58 | + | ||
| 59 | + for (let compItem of this.templatePage.compList.getDataArray()) { | ||
| 60 | + let compBean = compItem as CompDTO | ||
| 61 | + if (compBean.operDataList && compBean.operDataList[0]) { | ||
| 62 | + let liveStr = new String(model.liveId) | ||
| 63 | + if (compBean.operDataList[0].objectId == liveStr) { | ||
| 64 | + compBean.operDataList[0].reserveItemBean.subscribe = model.subscribe | ||
| 65 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 66 | + compBean.timestamp = time | ||
| 67 | + break | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + }) | ||
| 43 | } | 74 | } |
| 44 | 75 | ||
| 45 | aboutToDisappear(): void { | 76 | aboutToDisappear(): void { |
| @@ -51,6 +82,7 @@ export default struct TemplatePageComponent { | @@ -51,6 +82,7 @@ export default struct TemplatePageComponent { | ||
| 51 | this.LoadingLayout() | 82 | this.LoadingLayout() |
| 52 | } else if (this.templatePage.pageCompType === TemplatePageStateType.LOADED) { | 83 | } else if (this.templatePage.pageCompType === TemplatePageStateType.LOADED) { |
| 53 | 84 | ||
| 85 | + | ||
| 54 | CustomPullToRefresh({ | 86 | CustomPullToRefresh({ |
| 55 | alldata: this.pageData, | 87 | alldata: this.pageData, |
| 56 | scroller: this.templateScroller, | 88 | scroller: this.templateScroller, |
| @@ -63,7 +95,7 @@ export default struct TemplatePageComponent { | @@ -63,7 +95,7 @@ export default struct TemplatePageComponent { | ||
| 63 | this.templatePage.resolve = resolve | 95 | this.templatePage.resolve = resolve |
| 64 | this.requestPageData(resolve) | 96 | this.requestPageData(resolve) |
| 65 | }, | 97 | }, |
| 66 | - }) | 98 | + }).backgroundColor(this.listColor) |
| 67 | 99 | ||
| 68 | } else { | 100 | } else { |
| 69 | EmptyComponent({ | 101 | EmptyComponent({ |
| @@ -10,7 +10,12 @@ export class TemplatePageConstant { | @@ -10,7 +10,12 @@ export class TemplatePageConstant { | ||
| 10 | /** | 10 | /** |
| 11 | * 直播中 | 11 | * 直播中 |
| 12 | */ | 12 | */ |
| 13 | - public static LIVE_HORIZONTAL_CARD: string = "LIVE_HORIZONTAL_CARD" | 13 | + public static LIVE_HORIZONTAL_PAGE: string = "live_horizontal_page" |
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 直播预告 | ||
| 17 | + */ | ||
| 18 | + public static LIVE_PORTEND_PAGE :string = 'live_portend_page' | ||
| 14 | 19 | ||
| 15 | 20 | ||
| 16 | } | 21 | } |
| 1 | import { CompDTO } from 'wdBean/Index'; | 1 | import { CompDTO } from 'wdBean/Index'; |
| 2 | import { CompStyle } from 'wdConstant/Index'; | 2 | import { CompStyle } from 'wdConstant/Index'; |
| 3 | -import { NetworkUtil } from 'wdKit/Index'; | 3 | +import { DateTimeUtils, NetworkUtil } from 'wdKit/Index'; |
| 4 | import PageViewModel from '../../../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../../../viewmodel/PageViewModel'; |
| 5 | import { WDViewDefaultType } from '../../view/EmptyComponent'; | 5 | import { WDViewDefaultType } from '../../view/EmptyComponent'; |
| 6 | import { BasePageHelp } from './BasePageHelp'; | 6 | import { BasePageHelp } from './BasePageHelp'; |
| @@ -51,9 +51,16 @@ export class TemplatePageHelp extends BasePageHelp { | @@ -51,9 +51,16 @@ export class TemplatePageHelp extends BasePageHelp { | ||
| 51 | */ | 51 | */ |
| 52 | private treatDiffBusinessDataSource() { | 52 | private treatDiffBusinessDataSource() { |
| 53 | 53 | ||
| 54 | - if (this.pageModel.pageDataSourceType === TemplatePageConstant.LIVE_HORIZONTAL_CARD) { | 54 | + if (this.pageModel.isLoading) { |
| 55 | + return | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + if (this.pageModel.pageDataSourceType === TemplatePageConstant.LIVE_HORIZONTAL_PAGE) { | ||
| 55 | // 直播列表 | 59 | // 直播列表 |
| 56 | this.requestLiveListData(this.pageModel.resolve) | 60 | this.requestLiveListData(this.pageModel.resolve) |
| 61 | + } else if (this.pageModel.pageDataSourceType === TemplatePageConstant.LIVE_PORTEND_PAGE) { | ||
| 62 | + // 直播预告 | ||
| 63 | + this.requestLivePortendData(this.pageModel.resolve) | ||
| 57 | } | 64 | } |
| 58 | 65 | ||
| 59 | } | 66 | } |
| @@ -76,21 +83,22 @@ export class TemplatePageHelp extends BasePageHelp { | @@ -76,21 +83,22 @@ export class TemplatePageHelp extends BasePageHelp { | ||
| 76 | this.pageModel.hasMore = false | 83 | this.pageModel.hasMore = false |
| 77 | } | 84 | } |
| 78 | 85 | ||
| 79 | - | ||
| 80 | // 依据业务请求获取的数据,转换成compDTO数据 | 86 | // 依据业务请求获取的数据,转换成compDTO数据 |
| 87 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 81 | let pageContentList: CompDTO[] = [] // 收集页面组件、稿件和本地组件容器 | 88 | let pageContentList: CompDTO[] = [] // 收集页面组件、稿件和本地组件容器 |
| 82 | for (let contentDto of liveReviewDTO.list) { | 89 | for (let contentDto of liveReviewDTO.list) { |
| 83 | let compDTO: CompDTO = new CompDTO() | 90 | let compDTO: CompDTO = new CompDTO() |
| 84 | compDTO.compType = 'appStyle' | 91 | compDTO.compType = 'appStyle' |
| 85 | contentDto.appStyle = CompStyle.Card_Comp_Live_Big_Image_02 | 92 | contentDto.appStyle = CompStyle.Card_Comp_Live_Big_Image_02 |
| 93 | + if (this.pageModel.isEmitter) { | ||
| 94 | + contentDto.timestamp = time | ||
| 95 | + } | ||
| 86 | compDTO.operDataList.push(contentDto) | 96 | compDTO.operDataList.push(contentDto) |
| 87 | pageContentList.push(compDTO) | 97 | pageContentList.push(compDTO) |
| 88 | } | 98 | } |
| 89 | 99 | ||
| 90 | // 推送数据到懒加载机制 | 100 | // 推送数据到懒加载机制 |
| 91 | this.pushDataToPage(pageContentList) | 101 | this.pushDataToPage(pageContentList) |
| 92 | - // 完成业务请求加载 | ||
| 93 | - this.pageModel.isLoading = false | ||
| 94 | // 批查 | 102 | // 批查 |
| 95 | this.allCompBatchRequest(pageContentList) | 103 | this.allCompBatchRequest(pageContentList) |
| 96 | 104 | ||
| @@ -104,10 +112,66 @@ export class TemplatePageHelp extends BasePageHelp { | @@ -104,10 +112,66 @@ export class TemplatePageHelp extends BasePageHelp { | ||
| 104 | } | 112 | } |
| 105 | 113 | ||
| 106 | this.resolveEnd(resolve) | 114 | this.resolveEnd(resolve) |
| 115 | + // 完成业务请求加载 | ||
| 116 | + this.pageModel.isLoading = false | ||
| 107 | } | 117 | } |
| 108 | 118 | ||
| 109 | 119 | ||
| 110 | /** | 120 | /** |
| 121 | + * 请求直播预告数据 | ||
| 122 | + */ | ||
| 123 | + private async requestLivePortendData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 124 | + | ||
| 125 | + this.pageModel.isLoading = true | ||
| 126 | + | ||
| 127 | + const liveReviewDTO = await PageViewModel.getLiveMoreUrl(2, this.pageModel.currentPage, this.pageModel.pageSize) | ||
| 128 | + | ||
| 129 | + if (liveReviewDTO && liveReviewDTO.list && liveReviewDTO.list.length > 0) { | ||
| 130 | + | ||
| 131 | + if (liveReviewDTO.list.length === this.pageModel.pageSize) { | ||
| 132 | + this.pageModel.hasMore = true | ||
| 133 | + } else { | ||
| 134 | + this.pageModel.hasMore = false | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + // 依据业务请求获取的数据,转换成compDTO数据 | ||
| 138 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 139 | + let pageContentList: CompDTO[] = [] // 收集页面组件、稿件和本地组件容器 | ||
| 140 | + for (let contentDto of liveReviewDTO.list) { | ||
| 141 | + let compDTO: CompDTO = new CompDTO() | ||
| 142 | + compDTO.compType = 'appStyle' | ||
| 143 | + contentDto.appStyle = CompStyle.Card_Comp_Live_Big_Image_01 | ||
| 144 | + if (this.pageModel.isEmitter) { | ||
| 145 | + contentDto.timestamp = time | ||
| 146 | + } | ||
| 147 | + compDTO.operDataList.push(contentDto) | ||
| 148 | + | ||
| 149 | + pageContentList.push(compDTO) | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + // 推送数据到懒加载机制 | ||
| 153 | + this.pushDataToPage(pageContentList) | ||
| 154 | + | ||
| 155 | + // 批查直播预约状态 | ||
| 156 | + this.getAppointmentInfo(pageContentList) | ||
| 157 | + | ||
| 158 | + | ||
| 159 | + } else { | ||
| 160 | + | ||
| 161 | + this.pageModel.hasMore = false | ||
| 162 | + if (this.pageModel.currentPage === 1) { | ||
| 163 | + // 无业务数据 | ||
| 164 | + this.pageNoHaveData() | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + this.resolveEnd(resolve) | ||
| 169 | + | ||
| 170 | + // 完成业务请求加载 | ||
| 171 | + this.pageModel.isLoading = false | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + /** | ||
| 111 | * 处理页面批查业务方法 | 175 | * 处理页面批查业务方法 |
| 112 | * @param list | 176 | * @param list |
| 113 | */ | 177 | */ |
| @@ -116,21 +180,6 @@ export class TemplatePageHelp extends BasePageHelp { | @@ -116,21 +180,6 @@ export class TemplatePageHelp extends BasePageHelp { | ||
| 116 | // 获取直播房间的动态数据 | 180 | // 获取直播房间的动态数据 |
| 117 | this.getLiveRoomDataInfo(compList) | 181 | this.getLiveRoomDataInfo(compList) |
| 118 | 182 | ||
| 119 | - // 测试数据 | ||
| 120 | - // setTimeout(() => { | ||
| 121 | - // let time = DateTimeUtils.getTimeStamp().toString() | ||
| 122 | - // let index = 1 | ||
| 123 | - // let compBean = compList[index] as CompDTO | ||
| 124 | - // let contentBean = compBean.operDataList[0] | ||
| 125 | - // contentBean.newsTitle = '熬阿斯蒂芬' | ||
| 126 | - // //comp.operDataList[0].newsTitle = '测试111' | ||
| 127 | - // let liveRoomBean: LiveRoomDataBean = {} as LiveRoomDataBean; | ||
| 128 | - // liveRoomBean.pv = 6555 | ||
| 129 | - // contentBean.liveRoomDataBean = liveRoomBean | ||
| 130 | - // compBean.timestamp = time | ||
| 131 | - // Logger.debug("ZZZXXXXX", | ||
| 132 | - // "-----setTimeout--------->" + time) | ||
| 133 | - // }, 4 * 1000) | ||
| 134 | } | 183 | } |
| 135 | 184 | ||
| 136 | 185 | ||
| @@ -145,11 +194,11 @@ export class TemplatePageHelp extends BasePageHelp { | @@ -145,11 +194,11 @@ export class TemplatePageHelp extends BasePageHelp { | ||
| 145 | this.pageModel.compList.clear() | 194 | this.pageModel.compList.clear() |
| 146 | } | 195 | } |
| 147 | // 懒加载,推送数据 | 196 | // 懒加载,推送数据 |
| 148 | - for (let contentDto of pageContentList) { | ||
| 149 | - this.pageModel.compList.push(contentDto) | ||
| 150 | - } | 197 | + this.pageModel.compList.push(...pageContentList) |
| 151 | //完成业务数据请求 | 198 | //完成业务数据请求 |
| 152 | this.pageModel.pageCompType = TemplatePageStateType.LOADED | 199 | this.pageModel.pageCompType = TemplatePageStateType.LOADED |
| 200 | + this.pageModel.haveDataShow = true | ||
| 201 | + | ||
| 153 | } | 202 | } |
| 154 | 203 | ||
| 155 | 204 |
| @@ -21,16 +21,18 @@ export default class TemplatePageModel { | @@ -21,16 +21,18 @@ export default class TemplatePageModel { | ||
| 21 | * 识别不同页面的业务类型 | 21 | * 识别不同页面的业务类型 |
| 22 | */ | 22 | */ |
| 23 | pageDataSourceType: string = '' | 23 | pageDataSourceType: string = '' |
| 24 | - | ||
| 25 | // 页码 | 24 | // 页码 |
| 26 | currentPage: number = 1 | 25 | currentPage: number = 1 |
| 27 | // 一页最多信息量 | 26 | // 一页最多信息量 |
| 28 | pageSize: number = 20 | 27 | pageSize: number = 20 |
| 29 | // 是否支持加载更多数据 | 28 | // 是否支持加载更多数据 |
| 30 | - hasMore:boolean = false | 29 | + hasMore: boolean = false |
| 31 | // 是否正在请求数据 | 30 | // 是否正在请求数据 |
| 32 | isLoading: boolean = false | 31 | isLoading: boolean = false |
| 33 | - | 32 | + // 页面已有数据展示 |
| 33 | + haveDataShow: boolean = false | ||
| 34 | + // 接收Emitter事件,需要刷新界面,此时就需要对展示业务进行驱动更新 | ||
| 35 | + isEmitter: boolean = false | ||
| 34 | /** | 36 | /** |
| 35 | * 此字段可驱动组件展示不同业务的组件, | 37 | * 此字段可驱动组件展示不同业务的组件, |
| 36 | */ | 38 | */ |
| @@ -39,6 +41,5 @@ export default class TemplatePageModel { | @@ -39,6 +41,5 @@ export default class TemplatePageModel { | ||
| 39 | * 异常状态 ——> 记录在获取数据中的不同状态,如无数据、无网络等情况 | 41 | * 异常状态 ——> 记录在获取数据中的不同状态,如无数据、无网络等情况 |
| 40 | */ | 42 | */ |
| 41 | noNormalState: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default | 43 | noNormalState: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default |
| 42 | - | ||
| 43 | resolve?: (value: string | PromiseLike<string>) => void | 44 | resolve?: (value: string | PromiseLike<string>) => void |
| 44 | } | 45 | } |
| 1 | -import { ContentDTO, ReserveBean, ReserveItemBean } from 'wdBean/Index'; | ||
| 2 | -import { ProcessUtils } from 'wdRouter/Index'; | ||
| 3 | -import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 4 | -import { Logger, EmitterEventId, EmitterUtils, ToastUtils } from 'wdKit/Index'; | ||
| 5 | -import { router } from '@kit.ArkUI'; | ||
| 6 | -import { LiveModel } from '../../viewmodel/LiveModel'; | ||
| 7 | -import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | ||
| 8 | -import { EmptyComponent } from '../view/EmptyComponent'; | ||
| 9 | -import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 10 | -import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 11 | -import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | ||
| 12 | -import { HttpUtils } from 'wdNetwork/Index'; | ||
| 13 | -import { WDRouterPage, WDRouterRule } from 'wdRouter' | ||
| 14 | -import { LazyDataSource } from 'wdKit/Index'; | ||
| 15 | -import LoadMoreLayout from '../page/LoadMoreLayout' | ||
| 16 | -import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 17 | -import { TrackConstants, Tracking, TrackingContent, TrackingPageBrowse, TrackParamConvert } from 'wdTracking/Index'; | 1 | +import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; |
| 2 | +import CommonPageTitle from '../page/CommonPageTitle'; | ||
| 3 | +import TemplatePageComponent from '../page/template/TemplatePageComponent'; | ||
| 4 | +import { TemplatePageConstant } from '../page/template/TemplatePageConstant'; | ||
| 18 | 5 | ||
| 19 | const TAG: string = 'ReserveMorePage'; | 6 | const TAG: string = 'ReserveMorePage'; |
| 20 | 7 | ||
| @@ -29,58 +16,27 @@ const TAG: string = 'ReserveMorePage'; | @@ -29,58 +16,27 @@ const TAG: string = 'ReserveMorePage'; | ||
| 29 | @Entry | 16 | @Entry |
| 30 | @Component | 17 | @Component |
| 31 | struct ReserveMorePage { | 18 | struct ReserveMorePage { |
| 32 | - @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | ||
| 33 | - private reserveList: ReserveItemBean[] = [] | ||
| 34 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 19 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 35 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 20 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 36 | - type: number = 2; | ||
| 37 | - pageSize: number = 20; | ||
| 38 | title: string = '直播预告' | 21 | title: string = '直播预告' |
| 39 | - //是否预约过直播 | ||
| 40 | - @State isAppointmentLive: boolean = false | ||
| 41 | - @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 42 | - @State private hasMore: boolean = true | ||
| 43 | - @State private currentPage: number = 1 | ||
| 44 | - @State private isLoading: boolean = false | ||
| 45 | - @State viewType: ViewType = ViewType.LOADING | ||
| 46 | - private scroller: Scroller = new Scroller() | ||
| 47 | - @State reservedIds: string[] = [] | ||
| 48 | - @State isShow: boolean = false | ||
| 49 | - @State private liveId: string = '' | ||
| 50 | - @State isLoadingAttention: boolean = false | ||
| 51 | - @State loadImg: boolean = false; | 22 | + |
| 52 | private pageId: string = TrackConstants.PageName.Live_Appointment_List | 23 | private pageId: string = TrackConstants.PageName.Live_Appointment_List |
| 53 | private pageName: string = TrackConstants.PageName.Live_Appointment_List | 24 | private pageName: string = TrackConstants.PageName.Live_Appointment_List |
| 54 | private pageShowStartTime: number = 0 | 25 | private pageShowStartTime: number = 0 |
| 55 | 26 | ||
| 56 | build() { | 27 | build() { |
| 57 | Column() { | 28 | Column() { |
| 58 | - this.TabbarNormal() | ||
| 59 | - if (this.viewType == ViewType.LOADING) { | ||
| 60 | - this.LoadingLayout() | ||
| 61 | - } else if (this.viewType == ViewType.ERROR) { | ||
| 62 | - ErrorComponent() | ||
| 63 | - .onTouch(() => { | ||
| 64 | - if (this.viewType === ViewType.ERROR) { | ||
| 65 | - this.getData() | ||
| 66 | - } | ||
| 67 | - }) | ||
| 68 | - } else if (this.viewType == ViewType.EMPTY) { | ||
| 69 | - EmptyComponent() | ||
| 70 | - } else { | ||
| 71 | - CustomPullToRefresh({ | ||
| 72 | - alldata: this.data, | ||
| 73 | - scroller: this.scroller, | ||
| 74 | - hasMore: false, | ||
| 75 | - customList: () => { | ||
| 76 | - this.ListLayout() | ||
| 77 | - }, | ||
| 78 | - onRefresh: (resolve) => { | ||
| 79 | - this.currentPage = 1 | ||
| 80 | - this.getData(resolve) | ||
| 81 | - }, | ||
| 82 | - }).backgroundColor($r('app.color.color_F5F5F5')) | ||
| 83 | - } | 29 | + |
| 30 | + //常见标题 | ||
| 31 | + CommonPageTitle({ title: this.title }) | ||
| 32 | + // 通用模板组件 | ||
| 33 | + TemplatePageComponent({ | ||
| 34 | + pageDataSourceType: TemplatePageConstant.LIVE_PORTEND_PAGE, | ||
| 35 | + listColor: $r('app.color.color_F5F5F5'), | ||
| 36 | + pageId: this.pageId, | ||
| 37 | + pageName: this.pageName | ||
| 38 | + }) | ||
| 39 | + | ||
| 84 | 40 | ||
| 85 | }.height('100%').backgroundColor('#FFFFFF').padding({ | 41 | }.height('100%').backgroundColor('#FFFFFF').padding({ |
| 86 | top: px2vp(this.topSafeHeight), | 42 | top: px2vp(this.topSafeHeight), |
| @@ -93,300 +49,9 @@ struct ReserveMorePage { | @@ -93,300 +49,9 @@ struct ReserveMorePage { | ||
| 93 | LoadingLayout() { | 49 | LoadingLayout() { |
| 94 | } | 50 | } |
| 95 | 51 | ||
| 96 | - @Builder | ||
| 97 | - ListLayout() { | ||
| 98 | - List({ scroller: this.scroller }) { | ||
| 99 | - // 下拉刷新 | ||
| 100 | - LazyForEach(this.data, (contentDTO: ContentDTO, index: number) => { | ||
| 101 | - ListItem() { | ||
| 102 | - this.buildItem(contentDTO, index) | ||
| 103 | - } | ||
| 104 | - }, | ||
| 105 | - (contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString() | ||
| 106 | - ) | ||
| 107 | - // 加载更多 | ||
| 108 | - ListItem() { | ||
| 109 | - if (this.hasMore && this.data && this.data.totalCount() > 0) { | ||
| 110 | - LoadMoreLayout({ isVisible: this.hasMore }) | ||
| 111 | - } else if (!this.hasMore && !this.isLoading) { | ||
| 112 | - PeopleShipNoMoreData() | ||
| 113 | - } | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | - .cachedCount(8) | ||
| 117 | - .edgeEffect(EdgeEffect.None) | ||
| 118 | - .scrollBar(BarState.Off) | ||
| 119 | - .backgroundColor('#F5F5F5') | ||
| 120 | - .height('calc(100% - 44vp)') | ||
| 121 | - .onReachEnd(() => { | ||
| 122 | - Logger.debug(TAG, "触底了"); | ||
| 123 | - if (!this.isLoading && this.hasMore) { | ||
| 124 | - //加载分页数据 | ||
| 125 | - this.currentPage++; | ||
| 126 | - this.getData() | ||
| 127 | - } | ||
| 128 | - }) | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - /** | ||
| 132 | - * 组件项 | ||
| 133 | - * | ||
| 134 | - * @param programmeBean item 组件项, 上面icon,下面标题 | ||
| 135 | - */ | ||
| 136 | - @Builder | ||
| 137 | - buildItem(item: ContentDTO, index: number) { | ||
| 138 | - Column() { | ||
| 139 | - Stack() { | ||
| 140 | - Image(this.loadImg ? item.fullColumnImgUrls[0]?.url : '') | ||
| 141 | - .width('100%') | ||
| 142 | - .aspectRatio(16 / 9) | ||
| 143 | - .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : $r('app.color.color_33A3A3A3')) | ||
| 144 | - .objectFit(ImageFit.Contain) | ||
| 145 | - .borderWidth(0.5) | ||
| 146 | - .borderColor($r('app.color.color_0D000000')) | ||
| 147 | - .borderRadius({ | ||
| 148 | - topLeft: '4vp', | ||
| 149 | - topRight: '4vp' | ||
| 150 | - }) | ||
| 151 | - this.LiveImage() | ||
| 152 | - | ||
| 153 | - } | ||
| 154 | - .alignContent(Alignment.BottomEnd) | ||
| 155 | - | ||
| 156 | - Text(item.newsTitle) | ||
| 157 | - .fontSize(17) | ||
| 158 | - .maxLines(2) | ||
| 159 | - .lineHeight(25) | ||
| 160 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 161 | - .margin({ top: 4, left: 12, right: 12 }) | ||
| 162 | - .alignSelf(ItemAlign.Start) | ||
| 163 | - Row() { | ||
| 164 | - if (item.liveInfo && item.liveInfo.liveStartTime) { | ||
| 165 | - Row() { | ||
| 166 | - Image($r('app.media.reserve_play_icon')) | ||
| 167 | - .width(20) | ||
| 168 | - .height(20) | ||
| 169 | - .margin({ | ||
| 170 | - left: 10, | ||
| 171 | - top: 2, | ||
| 172 | - bottom: 2, | ||
| 173 | - right: 6 | ||
| 174 | - }) | ||
| 175 | - | ||
| 176 | - Text(this.getReserveDate(item.liveInfo.liveStartTime, 1)) | ||
| 177 | - .fontSize(12) | ||
| 178 | - .fontWeight(500) | ||
| 179 | - .fontColor('#ED2800') | ||
| 180 | - .fontFamily('PingFang SC-Medium') | ||
| 181 | - .maxLines(1) | ||
| 182 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 183 | - .margin({ top: 8, bottom: 8 }) | ||
| 184 | - .align(Alignment.Start) | ||
| 185 | - | ||
| 186 | - Image($r('app.media.point_icon')) | ||
| 187 | - .objectFit(ImageFit.Auto) | ||
| 188 | - .interpolation(ImageInterpolation.High) | ||
| 189 | - .width(6) | ||
| 190 | - .height(16) | ||
| 191 | - .margin(2) | ||
| 192 | - | ||
| 193 | - Text(this.getReserveDate(item.liveInfo.liveStartTime, 2)) | ||
| 194 | - .fontSize(12) | ||
| 195 | - .fontWeight(500) | ||
| 196 | - .fontColor('#ED2800') | ||
| 197 | - .fontFamily('PingFang SC-Medium') | ||
| 198 | - .maxLines(1) | ||
| 199 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 200 | - .margin({ top: 8, bottom: 8, right: 10 }) | ||
| 201 | - .align(Alignment.Start) | ||
| 202 | - } | ||
| 203 | - .backgroundColor('#F5F5F5') | ||
| 204 | - .margin(12) | ||
| 205 | - } | ||
| 206 | - // 预约 | ||
| 207 | - Row() { | ||
| 208 | - LoadingProgress() | ||
| 209 | - .width(20) | ||
| 210 | - .height(20) | ||
| 211 | - .color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) | ||
| 212 | - .visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : | ||
| 213 | - Visibility.None) | ||
| 214 | - | ||
| 215 | - Text(!this.isReserved(item) ? '预约' : '已预约') | ||
| 216 | - .fontSize($r('app.float.vp_12')) | ||
| 217 | - .fontWeight(500) | ||
| 218 | - .fontColor(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) | ||
| 219 | - .width('100%') | ||
| 220 | - .height('100%') | ||
| 221 | - .textAlign(TextAlign.Center) | ||
| 222 | - .visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.None : | ||
| 223 | - Visibility.Visible) | ||
| 224 | - .margin({ | ||
| 225 | - right: '10vp' | ||
| 226 | - }) | ||
| 227 | - .textShadow({ | ||
| 228 | - radius: 2, | ||
| 229 | - color: 'rgba(0,0,0,0.3)', | ||
| 230 | - offsetY: 2 | ||
| 231 | - }) | ||
| 232 | - .backgroundColor(!this.isReserved(item) ? $r('app.color.color_ED2800') : $r('app.color.color_F5F5F5')) | ||
| 233 | - .borderRadius(3) | ||
| 234 | - | ||
| 235 | - } | ||
| 236 | - .onClick(() => { | ||
| 237 | - this.bookAndCancel(item) | ||
| 238 | - }) | ||
| 239 | - .justifyContent(FlexAlign.Center) | ||
| 240 | - .alignItems(VerticalAlign.Center) | ||
| 241 | - .borderRadius(3) | ||
| 242 | - .width('52vp') | ||
| 243 | - .height('24vp') | ||
| 244 | - .margin({ right: 12 }) | ||
| 245 | - | ||
| 246 | - } | ||
| 247 | - .width('100%') | ||
| 248 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 249 | - | ||
| 250 | - } | ||
| 251 | - .borderRadius(4) | ||
| 252 | - .backgroundColor(Color.White) | ||
| 253 | - .width('calc(100% - 24vp)') | ||
| 254 | - .margin({ | ||
| 255 | - left: '12vp', | ||
| 256 | - right: '12vp', | ||
| 257 | - top: index == 0 ? '12vp' : '8vp' | ||
| 258 | - }) | ||
| 259 | - .onClick(() => { | ||
| 260 | - | ||
| 261 | - // 内容点击埋点 | ||
| 262 | - TrackingContent.common(TrackConstants.EventType.Click, | ||
| 263 | - item.pageId, | ||
| 264 | - item.pageId, | ||
| 265 | - TrackParamConvert.program(item)) | ||
| 266 | - | ||
| 267 | - ProcessUtils.processPage(item) | ||
| 268 | - }) | ||
| 269 | - .onVisibleAreaChange([0, 1], (isVisiable: boolean, ratio: number) => { | ||
| 270 | - if (isVisiable) { | ||
| 271 | - // 内容曝光埋点 | ||
| 272 | - TrackingContent.common(TrackConstants.EventType.Show, | ||
| 273 | - item.pageId, | ||
| 274 | - item.pageId, | ||
| 275 | - TrackParamConvert.program(item)) | ||
| 276 | - } | ||
| 277 | - }) | ||
| 278 | - } | ||
| 279 | - | ||
| 280 | - /*导航栏*/ | ||
| 281 | - @Builder | ||
| 282 | - TabbarNormal() { | ||
| 283 | - RelativeContainer() { | ||
| 284 | - //标题栏目 | ||
| 285 | - Image($r('app.media.icon_arrow_left')) | ||
| 286 | - .width(24) | ||
| 287 | - .height(24) | ||
| 288 | - .objectFit(ImageFit.Auto) | ||
| 289 | - .id("back_icon") | ||
| 290 | - .margin({ | ||
| 291 | - left: '16vp' | ||
| 292 | - }) | ||
| 293 | - .alignRules({ | ||
| 294 | - center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 295 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 296 | - }) | ||
| 297 | - .onClick(() => { | ||
| 298 | - router.back() | ||
| 299 | - }) | ||
| 300 | - | ||
| 301 | - Text(this.title)// .height('42lpx') | ||
| 302 | - .maxLines(1) | ||
| 303 | - .id("title") | ||
| 304 | - .fontSize('18vp') | ||
| 305 | - .fontWeight(400) | ||
| 306 | - .fontColor($r('app.color.color_222222')) | ||
| 307 | - .lineHeight('22vp') | ||
| 308 | - .alignRules({ | ||
| 309 | - center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 310 | - middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 311 | - }) | ||
| 312 | - } | ||
| 313 | - .height(44) | ||
| 314 | - .width('100%').backgroundColor('#FFFFFF') | ||
| 315 | - | ||
| 316 | - } | ||
| 317 | - | ||
| 318 | - @Builder | ||
| 319 | - LiveImage() { | ||
| 320 | - Row() { | ||
| 321 | - Image($r('app.media.reserve_new_icon')) | ||
| 322 | - .width(14) | ||
| 323 | - .height(14) | ||
| 324 | - .margin({ | ||
| 325 | - right: 3 | ||
| 326 | - }) | ||
| 327 | - Text('预约') | ||
| 328 | - .fontSize('12vp') | ||
| 329 | - .fontWeight(400) | ||
| 330 | - .fontColor(Color.White) | ||
| 331 | - .textShadow({ | ||
| 332 | - radius: 2, | ||
| 333 | - color: 'rgba(0,0,0,0.3)', | ||
| 334 | - offsetY: 2 | ||
| 335 | - }) | ||
| 336 | - } | ||
| 337 | - .backgroundColor(Color.Transparent) | ||
| 338 | - .margin({ right: 8, bottom: 8 }) | ||
| 339 | - } | ||
| 340 | - | ||
| 341 | - async aboutToAppear(): Promise<void> { | ||
| 342 | - this.loadImg = await onlyWifiLoadImg(); | ||
| 343 | - // PageViewModel.get | ||
| 344 | - this.currentPage = 1 | ||
| 345 | - this.getData() | ||
| 346 | - // 登录成功 | ||
| 347 | - EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | ||
| 348 | - this.currentPage = 1 | ||
| 349 | - this.getData() | ||
| 350 | - }) | ||
| 351 | - | ||
| 352 | - // 获取预约 | ||
| 353 | - EmitterUtils.receiveEvent(EmitterEventId.LIVE_ROOM_SUBSCRIBE, (str?: string) => { | ||
| 354 | - Logger.debug(TAG, 'receiveEvent LIVE_ROOM_SUBSCRIBE: ' + str) | ||
| 355 | - if (str) { | ||
| 356 | - // 跳转指定频道场景,传参底导id、频道id | ||
| 357 | - const model: ReserveItemBean = JSON.parse(str) | ||
| 358 | - Logger.debug(TAG, '是否关注元数据0:' + ` ${model.liveId}`) | ||
| 359 | - if (model && model.liveId && this.reserveList) { | ||
| 360 | - // 修改源数据 | ||
| 361 | - this.reserveList.forEach((element) => { | ||
| 362 | - if (element.liveId == model.liveId) { | ||
| 363 | - if (element && element.subscribe != model.subscribe) { | ||
| 364 | - Logger.debug(TAG, '是否关注元数据2:' + ` ${JSON.stringify(element.subscribe)}`) | ||
| 365 | - element.subscribe = !element.subscribe | ||
| 366 | - Logger.debug(TAG, '是否关注元数据3:' + ` ${JSON.stringify(element.subscribe)}`) | ||
| 367 | - this.isShow = true | ||
| 368 | - if (element.subscribe) { | ||
| 369 | - this.reservedIds.push(element.liveId.toString()) | ||
| 370 | - } else { | ||
| 371 | - const num = this.reservedIds.indexOf(element.liveId.toString()) | ||
| 372 | - if (num >= 0 && num < this.reservedIds.length) { | ||
| 373 | - this.reservedIds.splice(num, 1) | ||
| 374 | - } | ||
| 375 | - } | ||
| 376 | - } | ||
| 377 | - } | ||
| 378 | - }) | ||
| 379 | - } | ||
| 380 | - } | ||
| 381 | - }) | ||
| 382 | - } | ||
| 383 | 52 | ||
| 384 | onPageShow(): void { | 53 | onPageShow(): void { |
| 385 | this.pageShowStartTime = Date.now() | 54 | this.pageShowStartTime = Date.now() |
| 386 | - if (this.isShow) { | ||
| 387 | - this.data.reloadData() | ||
| 388 | - this.isShow = false | ||
| 389 | - } | ||
| 390 | } | 55 | } |
| 391 | 56 | ||
| 392 | onPageHide(): void { | 57 | onPageHide(): void { |
| @@ -394,221 +59,4 @@ struct ReserveMorePage { | @@ -394,221 +59,4 @@ struct ReserveMorePage { | ||
| 394 | TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId, this.pageName, duration) | 59 | TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId, this.pageName, duration) |
| 395 | } | 60 | } |
| 396 | 61 | ||
| 397 | - private async getData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 398 | - if (this.isLoading) { | ||
| 399 | - if (resolve) { | ||
| 400 | - resolve('已更新至最新') | ||
| 401 | - } | ||
| 402 | - return | ||
| 403 | - } | ||
| 404 | - this.isLoading = true | ||
| 405 | - try { | ||
| 406 | - const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize) | ||
| 407 | - | ||
| 408 | - if (liveReviewDTO && liveReviewDTO.list && liveReviewDTO.list.length > 0) { | ||
| 409 | - if (liveReviewDTO.list.length === this.pageSize) { | ||
| 410 | - this.hasMore = true; | ||
| 411 | - } else { | ||
| 412 | - this.hasMore = false; | ||
| 413 | - } | ||
| 414 | - if (this.currentPage == 1) { | ||
| 415 | - this.data.clear() | ||
| 416 | - this.reserveList = [] | ||
| 417 | - this.reservedIds = [] | ||
| 418 | - } | ||
| 419 | - | ||
| 420 | - liveReviewDTO.list.forEach((content) => { | ||
| 421 | - content.pageId = this.pageId | ||
| 422 | - }) | ||
| 423 | - this.data.push(...liveReviewDTO.list) | ||
| 424 | - //批量查询关注状态 | ||
| 425 | - this.getAppointmentInfo(liveReviewDTO.list) | ||
| 426 | - } else { | ||
| 427 | - this.hasMore = false; | ||
| 428 | - } | ||
| 429 | - this.resolveEnd(true, resolve) | ||
| 430 | - if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { | ||
| 431 | - this.viewType = ViewType.EMPTY | ||
| 432 | - } | ||
| 433 | - } catch (exception) { | ||
| 434 | - this.resolveEnd(false, resolve) | ||
| 435 | - } | ||
| 436 | - // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { | ||
| 437 | - // // this.operDataList = [] | ||
| 438 | - // // this.operDataList.push(...liveReviewDTO.list) | ||
| 439 | - // this.data.push(...liveReviewDTO.list) | ||
| 440 | - // | ||
| 441 | - // // this.getAppointmentInfo() | ||
| 442 | - // }) | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | - private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 446 | - if (resolve) { | ||
| 447 | - if (this.currentPage == 1 && isTop) { | ||
| 448 | - resolve('已更新至最新') | ||
| 449 | - } else { | ||
| 450 | - resolve('') | ||
| 451 | - } | ||
| 452 | - } | ||
| 453 | - if (this.currentPage == 1 && !isTop) { | ||
| 454 | - this.viewType = ViewType.ERROR | ||
| 455 | - } else { | ||
| 456 | - this.viewType = ViewType.LOADED | ||
| 457 | - } | ||
| 458 | - this.isLoading = false | ||
| 459 | - } | ||
| 460 | - | ||
| 461 | - async getAppointmentInfo(list: ContentDTO[]) { | ||
| 462 | - if (HttpUtils.getUserId()) { | ||
| 463 | - const reserveBean = this.transformToLiveDetailsBeans(list) | ||
| 464 | - Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(reserveBean)}`) | ||
| 465 | - LiveModel.getAppointmentStatus(reserveBean).then((result) => { | ||
| 466 | - Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`) | ||
| 467 | - if (result && result.length > 0) { | ||
| 468 | - this.reserveList.push(...result) | ||
| 469 | - // this.reserveStatus = res; | ||
| 470 | - result.map((item: ReserveItemBean) => { | ||
| 471 | - if (item.subscribe) { | ||
| 472 | - this.reservedIds.push(item.liveId.toString()) | ||
| 473 | - } | ||
| 474 | - }) | ||
| 475 | - } | ||
| 476 | - }).catch(() => { | ||
| 477 | - // this.data.push(...list) | ||
| 478 | - }) | ||
| 479 | - } else { | ||
| 480 | - // this.data.push(...list) | ||
| 481 | - | ||
| 482 | - } | ||
| 483 | - } | ||
| 484 | - | ||
| 485 | - // 判断是否预约 | ||
| 486 | - isReserved(item: ContentDTO) { | ||
| 487 | - return this.reservedIds.includes(item.objectId) | ||
| 488 | - } | ||
| 489 | - | ||
| 490 | - getAttentionItem(item: ContentDTO) { | ||
| 491 | - const objc = this.reserveList.find((element: ReserveItemBean) => { | ||
| 492 | - return element.liveId.toString() == item.objectId | ||
| 493 | - }) | ||
| 494 | - return objc | ||
| 495 | - } | ||
| 496 | - | ||
| 497 | - // 这个函数遍历liveReviewDTO.list并转换为LiveDetailsBean数组 | ||
| 498 | - transformToLiveDetailsBeans(list: ContentDTO[]): ReserveBean[] { | ||
| 499 | - const liveDetailsBeans: ReserveBean[] = []; | ||
| 500 | - list.forEach(item => { | ||
| 501 | - liveDetailsBeans.push({ | ||
| 502 | - relationId: item.relId, | ||
| 503 | - liveId: item.objectId, | ||
| 504 | - }); | ||
| 505 | - }); | ||
| 506 | - return liveDetailsBeans | ||
| 507 | - } | ||
| 508 | - | ||
| 509 | - // 预约/取消预约 | ||
| 510 | - async bookAndCancel(item: ContentDTO) { | ||
| 511 | - | ||
| 512 | - // 未登录,跳转登录 | ||
| 513 | - if (!HttpUtils.getUserId()) { | ||
| 514 | - WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 515 | - return | ||
| 516 | - } | ||
| 517 | - if (!this.isLoadingAttention && this.liveId.length == 0) { | ||
| 518 | - this.isLoadingAttention = true | ||
| 519 | - this.liveId = item.objectId | ||
| 520 | - const reserveItem = this.getAttentionItem(item) | ||
| 521 | - if (reserveItem) { | ||
| 522 | - this.isLoadingAttention = true | ||
| 523 | - this.liveId = reserveItem.liveId.toString() | ||
| 524 | - try { | ||
| 525 | - | ||
| 526 | - // 埋点 | ||
| 527 | - Tracking.event(!reserveItem.subscribe ? "live_subscribe_click" : "cancel_live_subscribe_click", | ||
| 528 | - TrackParamConvert.program(item)) | ||
| 529 | - | ||
| 530 | - const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(), | ||
| 531 | - !reserveItem.subscribe); | ||
| 532 | - if (res.code == 0) { | ||
| 533 | - ToastUtils.shortToast(!reserveItem.subscribe ? '预约成功' : '取消预约成功') | ||
| 534 | - // 修改源数据 | ||
| 535 | - this.reserveList.forEach((element) => { | ||
| 536 | - if (element.liveId.toString() == item.objectId) { | ||
| 537 | - Logger.debug(TAG, '是否关注元数据:' + ` ${JSON.stringify(element.subscribe)}`) | ||
| 538 | - element.subscribe = !element.subscribe | ||
| 539 | - Logger.debug(TAG, '是否关注元数据1:' + ` ${JSON.stringify(element.subscribe)}`) | ||
| 540 | - if (element.subscribe) { | ||
| 541 | - this.reservedIds.push(element.liveId.toString()) | ||
| 542 | - } else { | ||
| 543 | - const num = this.reservedIds.indexOf(element.liveId.toString()) | ||
| 544 | - if (num >= 0 && num < this.reservedIds.length) { | ||
| 545 | - this.reservedIds.splice(num, 1) | ||
| 546 | - } | ||
| 547 | - } | ||
| 548 | - } | ||
| 549 | - }) | ||
| 550 | - | ||
| 551 | - } | ||
| 552 | - this.isLoadingAttention = false | ||
| 553 | - this.liveId = '' | ||
| 554 | - } catch (e) { | ||
| 555 | - this.liveId = '' | ||
| 556 | - this.isLoadingAttention = false | ||
| 557 | - } | ||
| 558 | - } else { | ||
| 559 | - this.liveId = '' | ||
| 560 | - this.isLoadingAttention = false | ||
| 561 | - } | ||
| 562 | - } | ||
| 563 | - } | ||
| 564 | - | ||
| 565 | - getReserveDate(eventDateTimeString: string, type: number): string { | ||
| 566 | - // 解析事件的日期和时间 | ||
| 567 | - const eventDateTime = new Date(eventDateTimeString); | ||
| 568 | - const currentDateTime = new Date(); | ||
| 569 | - | ||
| 570 | - // 截取事件时间的小时和分钟(假设事件时间是按照24小时制) | ||
| 571 | - const eventHour = eventDateTime.getHours(); | ||
| 572 | - const eventMinutes = eventDateTime.getMinutes(); | ||
| 573 | - const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数 | ||
| 574 | - if (type === 1) { | ||
| 575 | - // 判断是否是今天 | ||
| 576 | - const eventDate = eventDateTime.setHours(0, 0, 0, 0); | ||
| 577 | - const currentDate = currentDateTime.setHours(0, 0, 0, 0); | ||
| 578 | - if (eventDate === currentDate) { | ||
| 579 | - return `今天`; | ||
| 580 | - } else { | ||
| 581 | - const month = eventDateTime.getMonth() + 1; | ||
| 582 | - const date = eventDateTime.getDate(); | ||
| 583 | - return `${month}月${date}日`; | ||
| 584 | - } | ||
| 585 | - } else { | ||
| 586 | - return `${eventTimeStr}`; | ||
| 587 | - } | ||
| 588 | - } | ||
| 589 | - | ||
| 590 | - // getReserveDate(eventDateTimeString: string, type: number): string { | ||
| 591 | - // // 解析事件的日期和时间 | ||
| 592 | - // const eventDateTime = new Date(eventDateTimeString); | ||
| 593 | - // const currentDateTime = new Date(); | ||
| 594 | - // | ||
| 595 | - // // 截取事件时间的小时和分钟(假设事件时间是按照24小时制) | ||
| 596 | - // const eventHour = eventDateTime.getHours(); | ||
| 597 | - // const eventMinutes = eventDateTime.getMinutes(); | ||
| 598 | - // const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数 | ||
| 599 | - // | ||
| 600 | - // if (type === 1) { | ||
| 601 | - // // 如果是今天 | ||
| 602 | - // if (eventDateTime.setHours(0,0,0,0) === currentDateTime.setHours(0,0,0,0)) { | ||
| 603 | - // return `今天`; | ||
| 604 | - // } else { | ||
| 605 | - // // 如果事件不在今天 | ||
| 606 | - // const month = eventDateTime.getMonth() + 1; // 月份从0开始 | ||
| 607 | - // const date = eventDateTime.getDate(); | ||
| 608 | - // return `${month}月${date}日`; | ||
| 609 | - // } | ||
| 610 | - // } else { | ||
| 611 | - // return `${eventTimeStr}`; | ||
| 612 | - // } | ||
| 613 | - // } | ||
| 614 | } | 62 | } |
| @@ -270,18 +270,20 @@ export class PageViewModel extends BaseViewModel { | @@ -270,18 +270,20 @@ export class PageViewModel extends BaseViewModel { | ||
| 270 | * @param pageSize | 270 | * @param pageSize |
| 271 | * @returns | 271 | * @returns |
| 272 | */ | 272 | */ |
| 273 | - async getLiveMoreUrl(type: number, pageNum: number, pageSize: number): Promise<LiveReviewDTO> { | ||
| 274 | - return new Promise<LiveReviewDTO>((success, error) => { | 273 | + async getLiveMoreUrl(type: number, pageNum: number, pageSize: number): Promise<LiveReviewDTO | null> { |
| 274 | + return new Promise<LiveReviewDTO| null>((success, error) => { | ||
| 275 | Logger.info(TAG, `getLiveMoreUrl pageInfo start`); | 275 | Logger.info(TAG, `getLiveMoreUrl pageInfo start`); |
| 276 | PageRepository.fetchLiveMoreUrl(type, pageNum, pageSize).then((resDTO: ResponseDTO<LiveReviewDTO>) => { | 276 | PageRepository.fetchLiveMoreUrl(type, pageNum, pageSize).then((resDTO: ResponseDTO<LiveReviewDTO>) => { |
| 277 | if (!resDTO || !resDTO.data) { | 277 | if (!resDTO || !resDTO.data) { |
| 278 | Logger.error(TAG, 'getLiveMoreUrl then navResDTO is empty'); | 278 | Logger.error(TAG, 'getLiveMoreUrl then navResDTO is empty'); |
| 279 | - error('resDTO is empty'); | 279 | + //error('resDTO is empty'); |
| 280 | + success(null); | ||
| 280 | return | 281 | return |
| 281 | } | 282 | } |
| 282 | if (resDTO.code != 0) { | 283 | if (resDTO.code != 0) { |
| 283 | Logger.error(TAG, `getLiveMoreUrl then code:${resDTO.code}, message:${resDTO.message}`); | 284 | Logger.error(TAG, `getLiveMoreUrl then code:${resDTO.code}, message:${resDTO.message}`); |
| 284 | - error('resDTO Response Code is failure'); | 285 | + //error('resDTO Response Code is failure'); |
| 286 | + success(null); | ||
| 285 | return | 287 | return |
| 286 | } | 288 | } |
| 287 | // let navResStr = JSON.stringify(navResDTO); | 289 | // let navResStr = JSON.stringify(navResDTO); |
| @@ -289,7 +291,8 @@ export class PageViewModel extends BaseViewModel { | @@ -289,7 +291,8 @@ export class PageViewModel extends BaseViewModel { | ||
| 289 | success(resDTO.data); | 291 | success(resDTO.data); |
| 290 | }).catch((err: Error) => { | 292 | }).catch((err: Error) => { |
| 291 | Logger.error(TAG, `getLiveMoreUrl catch, error.name : ${err.name}, error.message:${err.message}`); | 293 | Logger.error(TAG, `getLiveMoreUrl catch, error.name : ${err.name}, error.message:${err.message}`); |
| 292 | - error(err); | 294 | + //error(err); |
| 295 | + success(null); | ||
| 293 | }) | 296 | }) |
| 294 | }) | 297 | }) |
| 295 | } | 298 | } |
| 1 | import { DateFormatUtil, WDAliPlayerController } from 'wdPlayer/Index' | 1 | import { DateFormatUtil, WDAliPlayerController } from 'wdPlayer/Index' |
| 2 | -import { LiveRoomDataBean } from 'wdBean/Index' | 2 | +import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index' |
| 3 | import { WindowModel } from 'wdKit/Index' | 3 | import { WindowModel } from 'wdKit/Index' |
| 4 | import { window } from '@kit.ArkUI' | 4 | import { window } from '@kit.ArkUI' |
| 5 | import { DisplayDirection } from 'wdConstant/Index' | 5 | import { DisplayDirection } from 'wdConstant/Index' |
| @@ -15,7 +15,7 @@ export struct PlayerVideoControlComponent { | @@ -15,7 +15,7 @@ export struct PlayerVideoControlComponent { | ||
| 15 | //是否处于播放状态中 | 15 | //是否处于播放状态中 |
| 16 | @State isPlayStatus: boolean = true | 16 | @State isPlayStatus: boolean = true |
| 17 | @Consume displayDirection: DisplayDirection | 17 | @Consume displayDirection: DisplayDirection |
| 18 | - | 18 | + @Consume contentDetailData: ContentDetailDTO |
| 19 | 19 | ||
| 20 | aboutToAppear(): void { | 20 | aboutToAppear(): void { |
| 21 | if (this.playerController) { | 21 | if (this.playerController) { |
| @@ -39,23 +39,26 @@ export struct PlayerVideoControlComponent { | @@ -39,23 +39,26 @@ export struct PlayerVideoControlComponent { | ||
| 39 | getBottomUIComponent() { | 39 | getBottomUIComponent() { |
| 40 | Row() { | 40 | Row() { |
| 41 | this.playOrPauseBtn() | 41 | this.playOrPauseBtn() |
| 42 | - Text(this.currentTime) | ||
| 43 | - .fontColor(Color.White) | ||
| 44 | - .fontWeight(600) | ||
| 45 | - .fontSize('12fp') | ||
| 46 | - .margin({ | ||
| 47 | - left: 16 | ||
| 48 | - }) | ||
| 49 | - | ||
| 50 | - this.playProgressView() | ||
| 51 | 42 | ||
| 52 | - Text(this.totalTime) | ||
| 53 | - .fontColor(Color.White) | ||
| 54 | - .fontWeight(600) | ||
| 55 | - .fontSize('12fp') | ||
| 56 | - .margin({ | ||
| 57 | - right: 16 | ||
| 58 | - }) | 43 | + if(this.contentDetailData.liveInfo?.liveState == 'running'){ |
| 44 | + Blank().layoutWeight(1) | ||
| 45 | + }else{ | ||
| 46 | + Text(this.currentTime) | ||
| 47 | + .fontColor(Color.White) | ||
| 48 | + .fontWeight(600) | ||
| 49 | + .fontSize('12fp') | ||
| 50 | + .margin({ | ||
| 51 | + left: 16 | ||
| 52 | + }) | ||
| 53 | + this.playProgressView() | ||
| 54 | + Text(this.totalTime) | ||
| 55 | + .fontColor(Color.White) | ||
| 56 | + .fontWeight(600) | ||
| 57 | + .fontSize('12fp') | ||
| 58 | + .margin({ | ||
| 59 | + right: 16 | ||
| 60 | + }) | ||
| 61 | + } | ||
| 59 | //全屏按钮 | 62 | //全屏按钮 |
| 60 | Image($r('app.media.icon_live_player_full_screen')) | 63 | Image($r('app.media.icon_live_player_full_screen')) |
| 61 | .height(32) | 64 | .height(32) |
-
Please register or login to post a comment