Showing
7 changed files
with
323 additions
and
153 deletions
| @@ -329,6 +329,11 @@ export class HttpUrlUtils { | @@ -329,6 +329,11 @@ export class HttpUrlUtils { | ||
| 329 | */ | 329 | */ |
| 330 | static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; | 330 | static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; |
| 331 | 331 | ||
| 332 | + /** | ||
| 333 | + * 直播详情-直播人数 | ||
| 334 | + */ | ||
| 335 | + static readonly LIVE_ROOM_BATCH_ALL_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/batch/all"; | ||
| 336 | + | ||
| 332 | static getHost(): string { | 337 | static getHost(): string { |
| 333 | return HostManager.getHost(); | 338 | return HostManager.getHost(); |
| 334 | } | 339 | } |
| @@ -746,4 +751,12 @@ export class HttpUrlUtils { | @@ -746,4 +751,12 @@ export class HttpUrlUtils { | ||
| 746 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | 751 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; |
| 747 | return url; | 752 | return url; |
| 748 | } | 753 | } |
| 754 | + | ||
| 755 | + //获取直播人数 | ||
| 756 | + static getLiveRoomBatchAllDataUrl() { | ||
| 757 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_BATCH_ALL_DATA_PATH | ||
| 758 | + return url | ||
| 759 | + } | ||
| 760 | + | ||
| 761 | + | ||
| 749 | } | 762 | } |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { ContentDTO, LiveRoomDataBean } from 'wdBean'; |
| 2 | import { ProcessUtils } from 'wdRouter'; | 2 | import { ProcessUtils } from 'wdRouter'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import PageViewModel from '../../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 5 | -import RefreshLayout from '../page/RefreshLayout'; | ||
| 6 | -import { RefreshLayoutBean } from '../page/RefreshLayoutBean'; | ||
| 7 | -import PageModel from '../../viewmodel/PageModel'; | ||
| 8 | -import { DateTimeUtils, LazyDataSource } from 'wdKit/Index'; | 5 | +import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index'; |
| 9 | import { router } from '@kit.ArkUI'; | 6 | import { router } from '@kit.ArkUI'; |
| 7 | +import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | ||
| 8 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 9 | +import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | ||
| 10 | +import { EmptyComponent } from '../view/EmptyComponent'; | ||
| 11 | +import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 12 | +import LoadMoreLayout from '../page/LoadMoreLayout' | ||
| 10 | 13 | ||
| 11 | const TAG: string = 'LiveMorePage'; | 14 | const TAG: string = 'LiveMorePage'; |
| 12 | 15 | ||
| @@ -21,60 +24,22 @@ const TAG: string = 'LiveMorePage'; | @@ -21,60 +24,22 @@ const TAG: string = 'LiveMorePage'; | ||
| 21 | @Entry | 24 | @Entry |
| 22 | @Component | 25 | @Component |
| 23 | struct LiveMorePage { | 26 | struct LiveMorePage { |
| 24 | - @State private pageModel: PageModel = new PageModel(); | ||
| 25 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 27 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 26 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 28 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 27 | type: number = 1; | 29 | type: number = 1; |
| 28 | - currentPage: number = 1; | ||
| 29 | pageSize: number = 20; | 30 | pageSize: number = 20; |
| 30 | operDataList: ContentDTO[] = []; | 31 | operDataList: ContentDTO[] = []; |
| 31 | title: string = '直播列表' | 32 | title: string = '直播列表' |
| 32 | @State contentDTO: ContentDTO = new ContentDTO(); | 33 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 33 | - // appStyle: '15', | ||
| 34 | - // coverType: 1, | ||
| 35 | - // objectType: '9', | ||
| 36 | - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 37 | - // fullColumnImgUrls: [ | ||
| 38 | - // { | ||
| 39 | - // landscape: 2, | ||
| 40 | - // size: 1, | ||
| 41 | - // url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 42 | - // weight: 1170 | ||
| 43 | - // } | ||
| 44 | - // ], | ||
| 45 | - // newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们', | ||
| 46 | - // publishTime: '1712993333000', | ||
| 47 | - // rmhInfo: { | ||
| 48 | - // authIcon: '', | ||
| 49 | - // authTitle: '', | ||
| 50 | - // authTitle2: '', | ||
| 51 | - // banControl: 0, | ||
| 52 | - // cnIsAttention: 1, | ||
| 53 | - // rmhDesc: '中共武汉市委机关报长江日报官方人民号', | ||
| 54 | - // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 55 | - // rmhId: '4255270', | ||
| 56 | - // rmhName: '长江日报', | ||
| 57 | - // userId: '513696944662469', | ||
| 58 | - // userType: '3' | ||
| 59 | - // }, | ||
| 60 | - // videoInfo: { | ||
| 61 | - // firstFrameImageUri: '', | ||
| 62 | - // videoDuration: 12, | ||
| 63 | - // // videoLandscape: 2, | ||
| 64 | - // videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4' | ||
| 65 | - // }, | ||
| 66 | - // photoNum: '9', | ||
| 67 | - // voiceInfo: { | ||
| 68 | - // voiceDuration: 12 | ||
| 69 | - // } | ||
| 70 | - // } as ContentDTO; | ||
| 71 | - | 34 | + @State private hasMore: boolean = true |
| 35 | + @State private currentPage: number = 1 | ||
| 36 | + @State private isLoading: boolean = false | ||
| 37 | + @State viewType: ViewType = ViewType.LOADING | ||
| 38 | + private scroller: Scroller = new Scroller() | ||
| 39 | + @State liveRoomList: LiveRoomDataBean[] = [] | ||
| 72 | aboutToAppear(): void { | 40 | aboutToAppear(): void { |
| 73 | - PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => { | ||
| 74 | - // this.operDataList = [] | ||
| 75 | - // this.operDataList.push(...liveReviewDTO.list) | ||
| 76 | - this.data.push(...liveReviewDTO.list) | ||
| 77 | - }) | 41 | + this.currentPage = 1 |
| 42 | + this.getData() | ||
| 78 | } | 43 | } |
| 79 | 44 | ||
| 80 | build() { | 45 | build() { |
| @@ -88,48 +53,78 @@ struct LiveMorePage { | @@ -88,48 +53,78 @@ struct LiveMorePage { | ||
| 88 | Column() { | 53 | Column() { |
| 89 | this.TabbarNormal() | 54 | this.TabbarNormal() |
| 90 | 55 | ||
| 91 | - this.ListLayout() | 56 | + if (this.viewType == ViewType.LOADING) { |
| 57 | + this.LoadingLayout() | ||
| 58 | + } else if (this.viewType == ViewType.ERROR) { | ||
| 59 | + ErrorComponent() | ||
| 60 | + .onTouch(() => { | ||
| 61 | + if (this.viewType === ViewType.ERROR) { | ||
| 62 | + this.getData() | ||
| 63 | + } | ||
| 64 | + }) | ||
| 65 | + } else if (this.viewType == ViewType.EMPTY) { | ||
| 66 | + EmptyComponent() | ||
| 67 | + } else { | ||
| 68 | + CustomPullToRefresh({ | ||
| 69 | + alldata: this.data, | ||
| 70 | + scroller: this.scroller, | ||
| 71 | + hasMore: false, | ||
| 72 | + customList: () => { | ||
| 73 | + this.ListLayout() | ||
| 74 | + }, | ||
| 75 | + onRefresh: (resolve) => { | ||
| 76 | + this.currentPage = 1 | ||
| 77 | + this.getData(resolve) | ||
| 78 | + }, | ||
| 79 | + }) | ||
| 80 | + } | ||
| 92 | } | 81 | } |
| 93 | .padding({ | 82 | .padding({ |
| 94 | left: $r('app.float.card_comp_pagePadding_lf'), | 83 | left: $r('app.float.card_comp_pagePadding_lf'), |
| 95 | right: $r('app.float.card_comp_pagePadding_lf'), | 84 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 96 | bottom: $r('app.float.card_comp_pagePadding_tb') | 85 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 97 | }) | 86 | }) |
| 98 | - .onClick((event: ClickEvent) => { | 87 | + .onClick(() => { |
| 99 | ProcessUtils.processPage(this.contentDTO) | 88 | ProcessUtils.processPage(this.contentDTO) |
| 100 | }) | 89 | }) |
| 101 | } | 90 | } |
| 102 | 91 | ||
| 103 | @Builder | 92 | @Builder |
| 93 | + LoadingLayout() { | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + @Builder | ||
| 104 | ListLayout() { | 98 | ListLayout() { |
| 105 | - List() { | 99 | + List({scroller: this.scroller}) { |
| 106 | // 下拉刷新 | 100 | // 下拉刷新 |
| 107 | - ListItem() { | ||
| 108 | - RefreshLayout({ | ||
| 109 | - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 110 | - this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 111 | - }) | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - LazyForEach(this.data, (contentDTO: ContentDTO, contentIndex: number) => { | 101 | + LazyForEach(this.data, (contentDTO: ContentDTO) => { |
| 115 | ListItem() { | 102 | ListItem() { |
| 116 | - // Column() { | ||
| 117 | - // CompParser({ compDTO: compDTO, compIndex: compIndex }); | ||
| 118 | - // } | ||
| 119 | this.buildItem(contentDTO) | 103 | this.buildItem(contentDTO) |
| 120 | } | 104 | } |
| 121 | }, | 105 | }, |
| 122 | (contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString() | 106 | (contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString() |
| 123 | ) | 107 | ) |
| 108 | + // 加载更多 | ||
| 109 | + ListItem() { | ||
| 110 | + if (this.hasMore && this.data && this.data.totalCount() > 0) { | ||
| 111 | + LoadMoreLayout({ isVisible: this.hasMore }) | ||
| 112 | + } else if (!this.hasMore && !this.isLoading) { | ||
| 113 | + PeopleShipNoMoreData() | ||
| 114 | + } | ||
| 115 | + } | ||
| 124 | } | 116 | } |
| 125 | .scrollBar(BarState.Off) | 117 | .scrollBar(BarState.Off) |
| 118 | + .edgeEffect(EdgeEffect.None) | ||
| 126 | .cachedCount(8) | 119 | .cachedCount(8) |
| 127 | - .height(CommonConstants.FULL_PARENT) | ||
| 128 | - .onScrollIndex((start: number, end: number) => { | ||
| 129 | - // Listen to the first index of the current list. | ||
| 130 | - this.pageModel.startIndex = start; | ||
| 131 | - // 包含了 头尾item,判断时需要考虑+2 | ||
| 132 | - this.pageModel.endIndex = end; | 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 | + } | ||
| 133 | }) | 128 | }) |
| 134 | } | 129 | } |
| 135 | 130 | ||
| @@ -148,22 +143,45 @@ struct LiveMorePage { | @@ -148,22 +143,45 @@ struct LiveMorePage { | ||
| 148 | .margin({ top: 16, bottom: 8 }) | 143 | .margin({ top: 16, bottom: 8 }) |
| 149 | .alignSelf(ItemAlign.Start) | 144 | .alignSelf(ItemAlign.Start) |
| 150 | Stack() { | 145 | Stack() { |
| 151 | - Image(item.fullColumnImgUrls[0].url) | ||
| 152 | - .width('100%') | ||
| 153 | - .height(196) | ||
| 154 | - .borderRadius(4) | ||
| 155 | - this.LiveImage() | ||
| 156 | - | 146 | + if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) { |
| 147 | + Image(item.fullColumnImgUrls[0].url) | ||
| 148 | + .width('100%') | ||
| 149 | + .height(196) | ||
| 150 | + .borderRadius(4) | ||
| 151 | + } | ||
| 152 | + this.LiveImage(item) | ||
| 157 | } | 153 | } |
| 158 | .alignContent(Alignment.BottomEnd) | 154 | .alignContent(Alignment.BottomEnd) |
| 159 | 155 | ||
| 160 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.publishTimestamp))) | ||
| 161 | - .fontSize(13) | ||
| 162 | - .maxLines(1) | ||
| 163 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 164 | - .margin({ top: 8, bottom: 8 }) | ||
| 165 | - .align(Alignment.Start) | ||
| 166 | - .width('100%') | 156 | + Row() { |
| 157 | + if (item.rmhInfo && item.rmhInfo.rmhName) { | ||
| 158 | + Text(item.rmhInfo.rmhName) | ||
| 159 | + .fontSize(12) | ||
| 160 | + .fontWeight(400) | ||
| 161 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 162 | + .fontFamily('PingFang SC-Medium') | ||
| 163 | + .maxLines(1) | ||
| 164 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 165 | + .align(Alignment.Start) | ||
| 166 | + | ||
| 167 | + Image($r('app.media.point_live_icon')) | ||
| 168 | + .objectFit(ImageFit.Auto) | ||
| 169 | + .interpolation(ImageInterpolation.High) | ||
| 170 | + .width(16) | ||
| 171 | + .height(16) | ||
| 172 | + .margin(2) | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.publishTimestamp))) | ||
| 176 | + .fontSize(12) | ||
| 177 | + .maxLines(1) | ||
| 178 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 179 | + .align(Alignment.Start) | ||
| 180 | + .width('100%') | ||
| 181 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 182 | + } | ||
| 183 | + .margin({ top: 8, bottom: 8 }) | ||
| 184 | + | ||
| 167 | 185 | ||
| 168 | Divider() | 186 | Divider() |
| 169 | .strokeWidth(1) | 187 | .strokeWidth(1) |
| @@ -198,10 +216,10 @@ struct LiveMorePage { | @@ -198,10 +216,10 @@ struct LiveMorePage { | ||
| 198 | Text(this.title)// .height('42lpx') | 216 | Text(this.title)// .height('42lpx') |
| 199 | .maxLines(1) | 217 | .maxLines(1) |
| 200 | .id("title") | 218 | .id("title") |
| 201 | - .fontSize('35lpx') | 219 | + .fontSize('18vp') |
| 202 | .fontWeight(400) | 220 | .fontWeight(400) |
| 203 | .fontColor($r('app.color.color_222222')) | 221 | .fontColor($r('app.color.color_222222')) |
| 204 | - .lineHeight('42lpx') | 222 | + .lineHeight('22vp') |
| 205 | .alignRules({ | 223 | .alignRules({ |
| 206 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 224 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 207 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 225 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| @@ -212,17 +230,141 @@ struct LiveMorePage { | @@ -212,17 +230,141 @@ struct LiveMorePage { | ||
| 212 | } | 230 | } |
| 213 | 231 | ||
| 214 | @Builder | 232 | @Builder |
| 215 | - LiveImage() { | 233 | + LiveImage(item: ContentDTO) { |
| 216 | Row() { | 234 | Row() { |
| 217 | - Image($r('app.media.icon_live_status_running')) | ||
| 218 | - .width(22) | ||
| 219 | - .height(18) | 235 | + Image($r('app.media.icon_live_new_running')) |
| 236 | + .width(14) | ||
| 237 | + .height(14) | ||
| 238 | + .margin({ | ||
| 239 | + right: '2vp' | ||
| 240 | + }) | ||
| 220 | Text('直播中') | 241 | Text('直播中') |
| 221 | - .fontSize('11fp') | 242 | + .fontSize('12vp') |
| 222 | .fontWeight(400) | 243 | .fontWeight(400) |
| 223 | .fontColor(Color.White) | 244 | .fontColor(Color.White) |
| 245 | + .margin({ | ||
| 246 | + right: '5vp' | ||
| 247 | + }) | ||
| 248 | + Divider() | ||
| 249 | + .vertical(true) | ||
| 250 | + .strokeWidth(1) | ||
| 251 | + .height('12vp') | ||
| 252 | + .margin({ top: 2, bottom: 2 }) | ||
| 253 | + .color(Color.White) | ||
| 254 | + if (this.getLiveRoomNumber(item).length > 0) { | ||
| 255 | + Text(this.getLiveRoomNumber(item)) | ||
| 256 | + .fontSize('12vp') | ||
| 257 | + .fontWeight(400) | ||
| 258 | + .fontColor(Color.White) | ||
| 259 | + .margin({ | ||
| 260 | + left: '5vp' | ||
| 261 | + }) | ||
| 262 | + } | ||
| 224 | } | 263 | } |
| 225 | - .backgroundColor('#4D000000') | 264 | + .justifyContent(FlexAlign.End) |
| 226 | .margin({ right: 8, bottom: 8 }) | 265 | .margin({ right: 8, bottom: 8 }) |
| 227 | } | 266 | } |
| 267 | + | ||
| 268 | + private async getData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 269 | + if (this.isLoading) { | ||
| 270 | + if (resolve) { | ||
| 271 | + resolve('已更新至最新') | ||
| 272 | + } | ||
| 273 | + return | ||
| 274 | + } | ||
| 275 | + this.isLoading = true | ||
| 276 | + try { | ||
| 277 | + const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize) | ||
| 278 | + | ||
| 279 | + if (liveReviewDTO && liveReviewDTO.list && liveReviewDTO.list.length > 0) { | ||
| 280 | + if (liveReviewDTO.list.length === this.pageSize) { | ||
| 281 | + this.hasMore = true; | ||
| 282 | + } else { | ||
| 283 | + this.hasMore = false; | ||
| 284 | + } | ||
| 285 | + if (this.currentPage == 1) { | ||
| 286 | + this.data.clear() | ||
| 287 | + } | ||
| 288 | + this.data.push(...liveReviewDTO.list) | ||
| 289 | + this.getLiveRoomDataInfo(liveReviewDTO.list) | ||
| 290 | + } else { | ||
| 291 | + this.hasMore = false; | ||
| 292 | + } | ||
| 293 | + this.resolveEnd(true, resolve) | ||
| 294 | + if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { | ||
| 295 | + this.viewType = ViewType.EMPTY | ||
| 296 | + } | ||
| 297 | + }catch (exception) { | ||
| 298 | + this.resolveEnd(false, resolve) | ||
| 299 | + } | ||
| 300 | + // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { | ||
| 301 | + // // this.operDataList = [] | ||
| 302 | + // // this.operDataList.push(...liveReviewDTO.list) | ||
| 303 | + // this.data.push(...liveReviewDTO.list) | ||
| 304 | + // | ||
| 305 | + // // this.getAppointmentInfo() | ||
| 306 | + // }) | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 310 | + if (resolve) { | ||
| 311 | + if (this.currentPage == 1 && isTop) { | ||
| 312 | + resolve('已更新至最新') | ||
| 313 | + }else { | ||
| 314 | + resolve('') | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + if (this.currentPage == 1 && !isTop) { | ||
| 318 | + this.viewType = ViewType.ERROR | ||
| 319 | + } else { | ||
| 320 | + this.viewType = ViewType.LOADED | ||
| 321 | + } | ||
| 322 | + this.isLoading = false | ||
| 323 | + } | ||
| 324 | + | ||
| 325 | + private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 326 | + let idList: string[] = [] | ||
| 327 | + list.forEach(item => { | ||
| 328 | + idList.push(item.objectId) | ||
| 329 | + }); | ||
| 330 | + return idList.join(',') | ||
| 331 | + } | ||
| 332 | + // 获取评论数 | ||
| 333 | + async getLiveRoomDataInfo(list: ContentDTO[]) { | ||
| 334 | + const reserveIds = this.getLiveDetailIds(list) | ||
| 335 | + Logger.debug(TAG,'是否预约数据:' +` ${reserveIds}`) | ||
| 336 | + PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | ||
| 337 | + Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) | ||
| 338 | + if (result && result.length > 0) { | ||
| 339 | + this.liveRoomList.push(...result) | ||
| 340 | + this.data.reloadData() | ||
| 341 | + } | ||
| 342 | + }).catch(() =>{ | ||
| 343 | + // this.data.push(...list) | ||
| 344 | + }) | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + // 判断是否预约 | ||
| 348 | + getLiveRoomNumber(item: ContentDTO): string { | ||
| 349 | + const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { | ||
| 350 | + return element.liveId.toString() == item.objectId | ||
| 351 | + }) | ||
| 352 | + if (objc && objc.pv && objc.pv > 0) { | ||
| 353 | + return this.computeShowNum(objc.pv) | ||
| 354 | + } | ||
| 355 | + return '' | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + private computeShowNum(count: number): string { | ||
| 359 | + if (count >= 10000) { | ||
| 360 | + let num = ( count / 10000).toFixed(1) | ||
| 361 | + if (Number(num.substring(num.length-1)) == 0) { | ||
| 362 | + num = num.substring(0, num.length-2) | ||
| 363 | + } | ||
| 364 | + return num + '万人参加' | ||
| 365 | + } | ||
| 366 | + return `${count}人参加` | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + | ||
| 228 | } | 370 | } |
| @@ -107,7 +107,7 @@ struct ReserveMorePage { | @@ -107,7 +107,7 @@ struct ReserveMorePage { | ||
| 107 | .edgeEffect(EdgeEffect.None) | 107 | .edgeEffect(EdgeEffect.None) |
| 108 | .scrollBar(BarState.Off) | 108 | .scrollBar(BarState.Off) |
| 109 | .backgroundColor('#F5F5F5') | 109 | .backgroundColor('#F5F5F5') |
| 110 | - .layoutWeight(1) | 110 | + .height('calc(100% - 44vp)') |
| 111 | .onReachEnd(() => { | 111 | .onReachEnd(() => { |
| 112 | Logger.debug(TAG, "触底了"); | 112 | Logger.debug(TAG, "触底了"); |
| 113 | if(!this.isLoading && this.hasMore){ | 113 | if(!this.isLoading && this.hasMore){ |
| @@ -144,61 +144,44 @@ struct ReserveMorePage { | @@ -144,61 +144,44 @@ struct ReserveMorePage { | ||
| 144 | .margin({ top: 4, left: 12, right: 12 }) | 144 | .margin({ top: 4, left: 12, right: 12 }) |
| 145 | .alignSelf(ItemAlign.Start) | 145 | .alignSelf(ItemAlign.Start) |
| 146 | Row() { | 146 | Row() { |
| 147 | - Row() { | ||
| 148 | - Image($r('app.media.reserve_play_icon')) | ||
| 149 | - .width(20) | ||
| 150 | - .height(20) | ||
| 151 | - .margin({ left: 10, top: 2, bottom: 2, right: 6 }) | ||
| 152 | - | ||
| 153 | - // Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm")) | ||
| 154 | - Text(this.getReserveDate(item.liveInfo.liveStartTime, 1)) | ||
| 155 | - .fontSize(12) | ||
| 156 | - .fontWeight(500) | ||
| 157 | - .fontColor('#ED2800') | ||
| 158 | - .fontFamily('PingFang SC-Medium') | ||
| 159 | - .maxLines(1) | ||
| 160 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 161 | - .margin({ top: 8, bottom: 8 }) | ||
| 162 | - .align(Alignment.Start) | ||
| 163 | - | ||
| 164 | - Image($r('app.media.point_icon')) | ||
| 165 | - .objectFit(ImageFit.Auto) | ||
| 166 | - .interpolation(ImageInterpolation.High) | ||
| 167 | - .width(6) | ||
| 168 | - .height(16) | ||
| 169 | - .margin(2) | ||
| 170 | - | ||
| 171 | - Text(this.getReserveDate(item.liveInfo.liveStartTime, 2)) | ||
| 172 | - .fontSize(12) | ||
| 173 | - .fontWeight(500) | ||
| 174 | - .fontColor('#ED2800') | ||
| 175 | - .fontFamily('PingFang SC-Medium') | ||
| 176 | - .maxLines(1) | ||
| 177 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 178 | - .margin({ top: 8, bottom: 8, right: 10 }) | ||
| 179 | - .align(Alignment.Start) | 147 | + if (item.liveInfo && item.liveInfo.liveStartTime) { |
| 148 | + Row() { | ||
| 149 | + Image($r('app.media.reserve_play_icon')) | ||
| 150 | + .width(20) | ||
| 151 | + .height(20) | ||
| 152 | + .margin({ left: 10, top: 2, bottom: 2, right: 6 }) | ||
| 153 | + | ||
| 154 | + Text(this.getReserveDate(item.liveInfo.liveStartTime, 1)) | ||
| 155 | + .fontSize(12) | ||
| 156 | + .fontWeight(500) | ||
| 157 | + .fontColor('#ED2800') | ||
| 158 | + .fontFamily('PingFang SC-Medium') | ||
| 159 | + .maxLines(1) | ||
| 160 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 161 | + .margin({ top: 8, bottom: 8 }) | ||
| 162 | + .align(Alignment.Start) | ||
| 163 | + | ||
| 164 | + Image($r('app.media.point_icon')) | ||
| 165 | + .objectFit(ImageFit.Auto) | ||
| 166 | + .interpolation(ImageInterpolation.High) | ||
| 167 | + .width(6) | ||
| 168 | + .height(16) | ||
| 169 | + .margin(2) | ||
| 170 | + | ||
| 171 | + Text(this.getReserveDate(item.liveInfo.liveStartTime, 2)) | ||
| 172 | + .fontSize(12) | ||
| 173 | + .fontWeight(500) | ||
| 174 | + .fontColor('#ED2800') | ||
| 175 | + .fontFamily('PingFang SC-Medium') | ||
| 176 | + .maxLines(1) | ||
| 177 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 178 | + .margin({ top: 8, bottom: 8, right: 10 }) | ||
| 179 | + .align(Alignment.Start) | ||
| 180 | + } | ||
| 181 | + .backgroundColor('#F5F5F5') | ||
| 182 | + .margin(12) | ||
| 180 | } | 183 | } |
| 181 | - .backgroundColor('#F5F5F5') | ||
| 182 | - .margin(12) | ||
| 183 | - | ||
| 184 | - // Flex({ justifyContent: FlexAlign.Center }) { | ||
| 185 | - // Text(this.isAppointmentLive ? '已预约' : '预约') | ||
| 186 | - // .fontSize(12) | ||
| 187 | - // .fontWeight(400) | ||
| 188 | - // .fontFamily('PingFang SC-Regular') | ||
| 189 | - // .width(52) | ||
| 190 | - // .height(24) | ||
| 191 | - // .fontColor(Color.White) | ||
| 192 | - // .textAlign(TextAlign.Center) | ||
| 193 | - // .onClick(() => { | ||
| 194 | - // this.liveAppointment(item) | ||
| 195 | - // }) | ||
| 196 | - // } | ||
| 197 | - // .width(52) | ||
| 198 | - // .backgroundColor('#ED2800') | ||
| 199 | - // .borderRadius(3) | ||
| 200 | - // ReserveMoreAttentionComponent({reserveItem: this.getAttentionItem(item), }) | ||
| 201 | - // .margin({ right: 12 }) | 184 | + // 预约 |
| 202 | Row() { | 185 | Row() { |
| 203 | LoadingProgress() | 186 | LoadingProgress() |
| 204 | .width(20) | 187 | .width(20) |
| @@ -522,9 +505,5 @@ struct ReserveMorePage { | @@ -522,9 +505,5 @@ struct ReserveMorePage { | ||
| 522 | } | 505 | } |
| 523 | } | 506 | } |
| 524 | 507 | ||
| 525 | - async liveAppointment(item: ContentDTO) { | ||
| 526 | - const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false) | ||
| 527 | - } | ||
| 528 | - | ||
| 529 | 508 | ||
| 530 | } | 509 | } |
| @@ -24,7 +24,8 @@ import { | @@ -24,7 +24,8 @@ import { | ||
| 24 | postInteractAccentionOperateParams, | 24 | postInteractAccentionOperateParams, |
| 25 | postRecommendListParams, | 25 | postRecommendListParams, |
| 26 | GoldenPositionExtraBean, | 26 | GoldenPositionExtraBean, |
| 27 | - FeedbackTypeBean | 27 | + FeedbackTypeBean, |
| 28 | + LiveRoomDataBean | ||
| 28 | } from 'wdBean'; | 29 | } from 'wdBean'; |
| 29 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 30 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 30 | import { ArrayList } from '@kit.ArkTS'; | 31 | import { ArrayList } from '@kit.ArkTS'; |
| @@ -470,4 +471,13 @@ export class PageRepository { | @@ -470,4 +471,13 @@ export class PageRepository { | ||
| 470 | url = url + "?dictCode=" + "CN_OPINION_TYPE"; | 471 | url = url + "?dictCode=" + "CN_OPINION_TYPE"; |
| 471 | return WDHttp.get<ResponseDTO<FeedbackTypeBean[]>>(url) | 472 | return WDHttp.get<ResponseDTO<FeedbackTypeBean[]>>(url) |
| 472 | }; | 473 | }; |
| 474 | + | ||
| 475 | + /** | ||
| 476 | + * 获取更多直播间人数 | ||
| 477 | + * */ | ||
| 478 | + static fetchLiveRoomBatchAllUrl(ids: string) { | ||
| 479 | + let url = HttpUrlUtils.getLiveRoomBatchAllDataUrl() | ||
| 480 | + url = url + "?liveIdList=" + ids; | ||
| 481 | + return WDHttp.get<ResponseDTO<LiveRoomDataBean[]>>(url) | ||
| 482 | + }; | ||
| 473 | } | 483 | } |
| @@ -10,7 +10,8 @@ import { | @@ -10,7 +10,8 @@ import { | ||
| 10 | PageInfoBean, | 10 | PageInfoBean, |
| 11 | PageInfoDTO, | 11 | PageInfoDTO, |
| 12 | GoldenPositionExtraBean, | 12 | GoldenPositionExtraBean, |
| 13 | - NavigationDetailDTO | 13 | + NavigationDetailDTO, |
| 14 | + LiveRoomDataBean | ||
| 14 | } from 'wdBean'; | 15 | } from 'wdBean'; |
| 15 | 16 | ||
| 16 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 17 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; |
| @@ -439,6 +440,31 @@ export class PageViewModel extends BaseViewModel { | @@ -439,6 +440,31 @@ export class PageViewModel extends BaseViewModel { | ||
| 439 | }) | 440 | }) |
| 440 | }) | 441 | }) |
| 441 | } | 442 | } |
| 443 | + | ||
| 444 | + async getLiveRoomBatchInfo(ids: string): Promise<LiveRoomDataBean[]> { | ||
| 445 | + return new Promise<LiveRoomDataBean[]>((success, error) => { | ||
| 446 | + Logger.info(TAG, `getLiveRoomBatchInfo pageInfo start`); | ||
| 447 | + PageRepository.fetchLiveRoomBatchAllUrl(ids).then((resDTO: ResponseDTO<LiveRoomDataBean[]>) => { | ||
| 448 | + if (!resDTO || !resDTO.data) { | ||
| 449 | + Logger.error(TAG, 'getLiveRoomBatchInfo then navResDTO is empty'); | ||
| 450 | + error('resDTO is empty'); | ||
| 451 | + return | ||
| 452 | + } | ||
| 453 | + if (resDTO.code != 0) { | ||
| 454 | + Logger.error(TAG, `getLiveRoomBatchInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 455 | + error('resDTO Response Code is failure'); | ||
| 456 | + return | ||
| 457 | + } | ||
| 458 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 459 | + Logger.info(TAG, "getLiveRoomBatchInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 460 | + success(resDTO.data); | ||
| 461 | + }).catch((err: Error) => { | ||
| 462 | + Logger.error(TAG, `getLiveRoomBatchInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 463 | + error(err); | ||
| 464 | + }) | ||
| 465 | + }) | ||
| 466 | + } | ||
| 467 | + | ||
| 442 | } | 468 | } |
| 443 | 469 | ||
| 444 | 470 |
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_live_new_running.png
0 → 100644
1.35 KB
495 Bytes
-
Please register or login to post a comment