Showing
7 changed files
with
39 additions
and
16 deletions
| @@ -245,7 +245,6 @@ export class HttpUrlUtils { | @@ -245,7 +245,6 @@ export class HttpUrlUtils { | ||
| 245 | * pageSize=20&pageNum=1&topicId=10000009445 | 245 | * pageSize=20&pageNum=1&topicId=10000009445 |
| 246 | * */ | 246 | * */ |
| 247 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; | 247 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; |
| 248 | - static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; | ||
| 249 | /** | 248 | /** |
| 250 | * 直播回顾 | 249 | * 直播回顾 |
| 251 | * */ | 250 | * */ |
| 1 | -import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils } from 'wdKit'; | 1 | +import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils, |
| 2 | + NetworkUtil } from 'wdKit'; | ||
| 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 3 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 3 | import { ContentDetailDTO,postBatchAttentionStatusParams, | 4 | import { ContentDetailDTO,postBatchAttentionStatusParams, |
| 4 | PhotoListBean, | 5 | PhotoListBean, |
| @@ -27,6 +28,8 @@ import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' | @@ -27,6 +28,8 @@ import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' | ||
| 27 | import router from '@ohos.router'; | 28 | import router from '@ohos.router'; |
| 28 | import { publishCommentModel } from './comment/model/PublishCommentModel'; | 29 | import { publishCommentModel } from './comment/model/PublishCommentModel'; |
| 29 | import { CommentComponent } from './comment/view/CommentComponent'; | 30 | import { CommentComponent } from './comment/view/CommentComponent'; |
| 31 | +import { EmptyComponent } from './view/EmptyComponent'; | ||
| 32 | +import { detailedSkeleton } from './skeleton/detailSkeleton'; | ||
| 30 | 33 | ||
| 31 | const TAG = 'DynamicDetailComponent' | 34 | const TAG = 'DynamicDetailComponent' |
| 32 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 35 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| @@ -55,6 +58,8 @@ export struct DynamicDetailComponent { | @@ -55,6 +58,8 @@ export struct DynamicDetailComponent { | ||
| 55 | private mJumpInfo: ContentDTO = {} as ContentDTO; | 58 | private mJumpInfo: ContentDTO = {} as ContentDTO; |
| 56 | 59 | ||
| 57 | @State publishTime: string = '' | 60 | @State publishTime: string = '' |
| 61 | + @State isNetConnected: boolean = true | ||
| 62 | + @State isPageEnd: boolean = false | ||
| 58 | 63 | ||
| 59 | 64 | ||
| 60 | async aboutToAppear() { | 65 | async aboutToAppear() { |
| @@ -89,6 +94,18 @@ export struct DynamicDetailComponent { | @@ -89,6 +94,18 @@ export struct DynamicDetailComponent { | ||
| 89 | .height($r('app.float.margin_7')) | 94 | .height($r('app.float.margin_7')) |
| 90 | .padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) | 95 | .padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) |
| 91 | Stack({ alignContent: Alignment.Bottom }) { | 96 | Stack({ alignContent: Alignment.Bottom }) { |
| 97 | + if (!this.isNetConnected) { | ||
| 98 | + EmptyComponent({ | ||
| 99 | + emptyType: 1, | ||
| 100 | + emptyButton: true, | ||
| 101 | + retry: () => { | ||
| 102 | + this.getContentDetailData() | ||
| 103 | + } | ||
| 104 | + }).padding({ bottom: 200 }) | ||
| 105 | + } else { | ||
| 106 | + if (!this.isPageEnd) { | ||
| 107 | + detailedSkeleton() | ||
| 108 | + }else{ | ||
| 92 | Scroll(this.scroller) { | 109 | Scroll(this.scroller) { |
| 93 | Column() { | 110 | Column() { |
| 94 | //号主信息 | 111 | //号主信息 |
| @@ -411,6 +428,8 @@ export struct DynamicDetailComponent { | @@ -411,6 +428,8 @@ export struct DynamicDetailComponent { | ||
| 411 | .padding({ bottom: 76 }) | 428 | .padding({ bottom: 76 }) |
| 412 | .scrollBar(BarState.Off) | 429 | .scrollBar(BarState.Off) |
| 413 | .alignSelf(ItemAlign.Start) | 430 | .alignSelf(ItemAlign.Start) |
| 431 | + } | ||
| 432 | + } | ||
| 414 | //底部交互区 | 433 | //底部交互区 |
| 415 | OperRowListView({ contentDetailData: this.contentDetailData | 434 | OperRowListView({ contentDetailData: this.contentDetailData |
| 416 | ,interactData:this.interactDataDTO | 435 | ,interactData:this.interactDataDTO |
| @@ -436,8 +455,10 @@ export struct DynamicDetailComponent { | @@ -436,8 +455,10 @@ export struct DynamicDetailComponent { | ||
| 436 | * 请求(动态)详情页数据 | 455 | * 请求(动态)详情页数据 |
| 437 | * */ | 456 | * */ |
| 438 | private async getContentDetailData() { | 457 | private async getContentDetailData() { |
| 458 | + this.isNetConnected = NetworkUtil.isNetConnected() | ||
| 439 | try { | 459 | try { |
| 440 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | 460 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) |
| 461 | + this.isPageEnd = true; | ||
| 441 | this.contentDetailData = data[0]; | 462 | this.contentDetailData = data[0]; |
| 442 | let dateTime = | 463 | let dateTime = |
| 443 | DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | 464 | DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); |
| @@ -446,6 +467,7 @@ export struct DynamicDetailComponent { | @@ -446,6 +467,7 @@ export struct DynamicDetailComponent { | ||
| 446 | console.log('动态详情',JSON.stringify(this.contentDetailData)) | 467 | console.log('动态详情',JSON.stringify(this.contentDetailData)) |
| 447 | } catch (exception) { | 468 | } catch (exception) { |
| 448 | console.log('请求失败',JSON.stringify(exception)) | 469 | console.log('请求失败',JSON.stringify(exception)) |
| 470 | + this.isPageEnd = true; | ||
| 449 | } | 471 | } |
| 450 | this.getBatchAttentionStatus() | 472 | this.getBatchAttentionStatus() |
| 451 | this.getInteractDataStatus() | 473 | this.getInteractDataStatus() |
| @@ -13,12 +13,9 @@ import { image } from '@kit.ImageKit'; | @@ -13,12 +13,9 @@ import { image } from '@kit.ImageKit'; | ||
| 13 | import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils'; | 13 | import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils'; |
| 14 | import { effectKit } from '@kit.ArkGraphics2D'; | 14 | import { effectKit } from '@kit.ArkGraphics2D'; |
| 15 | import { window } from '@kit.ArkUI'; | 15 | import { window } from '@kit.ArkUI'; |
| 16 | -import DailyPaperTopicModel from '../../model/DailyPaperTopicModel' | ||
| 17 | 16 | ||
| 18 | const TAG = 'MorningEveningPaperComponent'; | 17 | const TAG = 'MorningEveningPaperComponent'; |
| 19 | 18 | ||
| 20 | -const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包含中文年月日 | ||
| 21 | - | ||
| 22 | @Entry | 19 | @Entry |
| 23 | @Component | 20 | @Component |
| 24 | export struct MorningEveningPaperComponent { | 21 | export struct MorningEveningPaperComponent { |
| @@ -106,17 +103,12 @@ export struct MorningEveningPaperComponent { | @@ -106,17 +103,12 @@ export struct MorningEveningPaperComponent { | ||
| 106 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | 103 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) |
| 107 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | 104 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) |
| 108 | 105 | ||
| 109 | - let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String | 106 | + const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String |
| 110 | console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId) | 107 | console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId) |
| 111 | const currentTime = new Date().getTime() | 108 | const currentTime = new Date().getTime() |
| 112 | Logger.info(TAG, "currentTime = " + currentTime) | 109 | Logger.info(TAG, "currentTime = " + currentTime) |
| 113 | Logger.info(TAG, `currentTime = ${currentTime}`) | 110 | Logger.info(TAG, `currentTime = ${currentTime}`) |
| 114 | try { | 111 | try { |
| 115 | - let dailyPaperTopicBean = await DailyPaperTopicModel.getDailyPaperTopic() | ||
| 116 | - if (dailyPaperTopicBean) { | ||
| 117 | - dailyPaperTopicPageId = '' + dailyPaperTopicBean.id | ||
| 118 | - Logger.info(TAG, "pageID = " + dailyPaperTopicPageId) | ||
| 119 | - } | ||
| 120 | 112 | ||
| 121 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) | 113 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) |
| 122 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" | 114 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" |
| @@ -157,7 +149,10 @@ export struct MorningEveningPaperComponent { | @@ -157,7 +149,10 @@ export struct MorningEveningPaperComponent { | ||
| 157 | async setComponentBgColor(imageUrl: string) { | 149 | async setComponentBgColor(imageUrl: string) { |
| 158 | // 图片转换为PixelMap对象 | 150 | // 图片转换为PixelMap对象 |
| 159 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); | 151 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); |
| 160 | - const imageSource: image.ImageSource | undefined = await getPicture(imageUrl); | 152 | + Logger.debug(TAG, "compInfoBean compStyle = " + imageUrl) |
| 153 | + | ||
| 154 | + const imageSource: image.ImageSource | undefined = await getPicture(imageUrl) | ||
| 155 | + | ||
| 161 | if (imageSource) { | 156 | if (imageSource) { |
| 162 | this.pickColor(imageSource) | 157 | this.pickColor(imageSource) |
| 163 | 158 | ||
| @@ -172,6 +167,8 @@ export struct MorningEveningPaperComponent { | @@ -172,6 +167,8 @@ export struct MorningEveningPaperComponent { | ||
| 172 | const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource); | 167 | const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource); |
| 173 | effectKit.createColorPicker(pixelMap, (err, colorPicker) => { | 168 | effectKit.createColorPicker(pixelMap, (err, colorPicker) => { |
| 174 | let color = colorPicker.getMainColorSync(); | 169 | let color = colorPicker.getMainColorSync(); |
| 170 | + Logger.debug(TAG, "compInfoBean compStyle = " + color) | ||
| 171 | + | ||
| 175 | // 将取色器选取的color示例转换为十六进制颜色代码 | 172 | // 将取色器选取的color示例转换为十六进制颜色代码 |
| 176 | this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16); | 173 | this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16); |
| 177 | Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor) | 174 | Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor) |
| @@ -212,7 +209,7 @@ export struct MorningEveningPaperComponent { | @@ -212,7 +209,7 @@ export struct MorningEveningPaperComponent { | ||
| 212 | }) | 209 | }) |
| 213 | } | 210 | } |
| 214 | } | 211 | } |
| 215 | - // .backgroundColor('#FFF1F3F5') | 212 | + // .backgroundColor('#fff7b348') |
| 216 | // .backgroundColor(Color.Blue) | 213 | // .backgroundColor(Color.Blue) |
| 217 | .height('100%') | 214 | .height('100%') |
| 218 | 215 |
| @@ -200,7 +200,7 @@ export class PageRepository { | @@ -200,7 +200,7 @@ export class PageRepository { | ||
| 200 | * topicId:专题id | 200 | * topicId:专题id |
| 201 | * */ | 201 | * */ |
| 202 | static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) { | 202 | static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) { |
| 203 | - let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH; | 203 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMP_PATH; |
| 204 | url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId=" | 204 | url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId=" |
| 205 | + pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize; | 205 | + pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize; |
| 206 | Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url) | 206 | Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url) |
| @@ -391,7 +391,7 @@ export class PageRepository { | @@ -391,7 +391,7 @@ export class PageRepository { | ||
| 391 | * */ | 391 | * */ |
| 392 | static fetchBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: | 392 | static fetchBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: |
| 393 | string, channelId: string) { | 393 | string, channelId: string) { |
| 394 | - let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH; | 394 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMP_PATH; |
| 395 | url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}` | 395 | url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}` |
| 396 | Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url) | 396 | Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url) |
| 397 | return WDHttp.get<ResponseDTO<CompInfoBean>>(url) | 397 | return WDHttp.get<ResponseDTO<CompInfoBean>>(url) |
| @@ -90,7 +90,7 @@ export async function image2PixelMap(icon: string): Promise<image.PixelMap> { | @@ -90,7 +90,7 @@ export async function image2PixelMap(icon: string): Promise<image.PixelMap> { | ||
| 90 | // 假设http和image是之前正确导入或定义的模块 | 90 | // 假设http和image是之前正确导入或定义的模块 |
| 91 | export async function getPicture(imageUrl: string): Promise<image.ImageSource | undefined> { | 91 | export async function getPicture(imageUrl: string): Promise<image.ImageSource | undefined> { |
| 92 | // const url: string = 'https://rmrbcmsonline.peopleapp.com/upload/image/202312/rmrb_86691703594454.png'; | 92 | // const url: string = 'https://rmrbcmsonline.peopleapp.com/upload/image/202312/rmrb_86691703594454.png'; |
| 93 | - const url: string = 'https://rmrbcmsonline.peopleapp.com/upload/image/201912/rmrb_24141576767688.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'; | 93 | + const url: string = imageUrl; |
| 94 | 94 | ||
| 95 | return new Promise((resolve, reject) => { | 95 | return new Promise((resolve, reject) => { |
| 96 | http.createHttp().request(url, (error: BusinessError, data: http.HttpResponse) => { | 96 | http.createHttp().request(url, (error: BusinessError, data: http.HttpResponse) => { |
| @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index'; | @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index'; | ||
| 2 | import { StringUtils } from 'wdKit/Index'; | 2 | import { StringUtils } from 'wdKit/Index'; |
| 3 | import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | 3 | import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; |
| 4 | import { PlayUIComponent } from './PlayUIComponent'; | 4 | import { PlayUIComponent } from './PlayUIComponent'; |
| 5 | +import { Logger } from 'wdKit/Index'; | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export struct TopPlayComponent { | 8 | export struct TopPlayComponent { |
| @@ -39,6 +40,7 @@ export struct TopPlayComponent { | @@ -39,6 +40,7 @@ export struct TopPlayComponent { | ||
| 39 | } | 40 | } |
| 40 | // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); | 41 | // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); |
| 41 | if (StringUtils.isNotEmpty(playUrl)) { | 42 | if (StringUtils.isNotEmpty(playUrl)) { |
| 43 | + Logger.debug('TopPlayComponent', `${playUrl}`) | ||
| 42 | this.playerController?.firstPlay(playUrl); | 44 | this.playerController?.firstPlay(playUrl); |
| 43 | } | 45 | } |
| 44 | } | 46 | } |
| @@ -202,10 +202,13 @@ export struct PlayerRightView { | @@ -202,10 +202,13 @@ export struct PlayerRightView { | ||
| 202 | .borderRadius(12) | 202 | .borderRadius(12) |
| 203 | .position({ x: '50%', y: '100%' }) | 203 | .position({ x: '50%', y: '100%' }) |
| 204 | .markAnchor({ x: '50%', y: '50%' }) | 204 | .markAnchor({ x: '50%', y: '50%' }) |
| 205 | + .visibility(this.followStatus == '1' ? Visibility.None : Visibility.Visible) | ||
| 205 | .onClick(() => { | 206 | .onClick(() => { |
| 206 | // TODO:关注动画 | 207 | // TODO:关注动画 |
| 207 | this.handleAccention() | 208 | this.handleAccention() |
| 208 | }) | 209 | }) |
| 210 | + | ||
| 211 | + | ||
| 209 | } | 212 | } |
| 210 | .height(48) | 213 | .height(48) |
| 211 | .width('100%') | 214 | .width('100%') |
-
Please register or login to post a comment