张善主

fix(详情页):动态详情页缺省页/骨架图

@@ -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()
@@ -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)