王士厅

fix: 视频频道、点播视频详情页、图集详情页断网缺省图逻辑优化

@@ -237,7 +237,6 @@ export struct MultiPictureDetailItemComponent { @@ -237,7 +237,6 @@ export struct MultiPictureDetailItemComponent {
237 .indicator(false) 237 .indicator(false)
238 .displayCount(1) 238 .displayCount(1)
239 .loop(false) 239 .loop(false)
240 - .zIndex(10)  
241 .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => { 240 .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
242 console.info("onGestureSwipe current offset: " + extraInfo.currentOffset) 241 console.info("onGestureSwipe current offset: " + extraInfo.currentOffset)
243 this.currentOffset = Math.abs(extraInfo.currentOffset) 242 this.currentOffset = Math.abs(extraInfo.currentOffset)
1 import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; 1 import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
2 -import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit'; 2 +import { NetworkUtil, WindowModel } from 'wdKit';
3 import { ContentDetailRequest } from 'wdDetailPlayApi/Index' 3 import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
4 import { ResponseDTO } from 'wdNetwork/Index'; 4 import { ResponseDTO } from 'wdNetwork/Index';
5 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' 5 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
@@ -48,8 +48,9 @@ export struct DetailVideoListPage { @@ -48,8 +48,9 @@ export struct DetailVideoListPage {
48 @State isShowAudioCom: boolean = false 48 @State isShowAudioCom: boolean = false
49 @StorageLink('GestureLoadStrategy') GestureLoadStrategy: number = 0 49 @StorageLink('GestureLoadStrategy') GestureLoadStrategy: number = 0
50 50
51 - async aboutToAppear(): Promise<void> { 51 + async getDetail() {
52 // 注册监听网络连接 52 // 注册监听网络连接
  53 + this.netStatus = undefined
53 let netStatus = NetworkUtil.isNetConnected() 54 let netStatus = NetworkUtil.isNetConnected()
54 if (netStatus) { 55 if (netStatus) {
55 this.openFullScreen() 56 this.openFullScreen()
@@ -69,7 +70,10 @@ export struct DetailVideoListPage { @@ -69,7 +70,10 @@ export struct DetailVideoListPage {
69 // 无网络 70 // 无网络
70 this.netStatus = 1 71 this.netStatus = 1
71 } 72 }
  73 + }
72 74
  75 + aboutToAppear() {
  76 + this.getDetail()
73 } 77 }
74 78
75 aboutToDisappear(): void { 79 aboutToDisappear(): void {
@@ -233,7 +237,7 @@ export struct DetailVideoListPage { @@ -233,7 +237,7 @@ export struct DetailVideoListPage {
233 if (this.netStatus !== undefined) { 237 if (this.netStatus !== undefined) {
234 EmptyComponent({ 238 EmptyComponent({
235 emptyType: 1, emptyButton: true, isBlack: true, retry: () => { 239 emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
236 - this.getContentDetail(this.contentId, this.relId, this.relType) 240 + this.getDetail()
237 } 241 }
238 }) 242 })
239 .id('e_empty_content') 243 .id('e_empty_content')
@@ -244,7 +248,7 @@ export struct DetailVideoListPage { @@ -244,7 +248,7 @@ export struct DetailVideoListPage {
244 } else if (this.isOffLine) { 248 } else if (this.isOffLine) {
245 EmptyComponent({ 249 EmptyComponent({
246 emptyType: 15, emptyButton: true, retry: () => { 250 emptyType: 15, emptyButton: true, retry: () => {
247 - this.getContentDetail(this.contentId, this.relId, this.relType) 251 + this.getDetail()
248 } 252 }
249 }) 253 })
250 .id('e_empty_content') 254 .id('e_empty_content')
@@ -9,7 +9,7 @@ import { @@ -9,7 +9,7 @@ import {
9 contentListParams, 9 contentListParams,
10 getRecCompInfoParams 10 getRecCompInfoParams
11 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; 11 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
12 -import { Logger, WindowModel, DateTimeUtils } from 'wdKit/Index'; 12 +import { NetworkUtil, Logger, WindowModel, DateTimeUtils } from 'wdKit/Index';
13 import { PictureLoading } from './PictureLoading'; 13 import { PictureLoading } from './PictureLoading';
14 import { DisplayDirection } from 'wdConstant/Index'; 14 import { DisplayDirection } from 'wdConstant/Index';
15 import { window } from '@kit.ArkUI'; 15 import { window } from '@kit.ArkUI';
@@ -61,7 +61,8 @@ export struct VideoChannelDetail { @@ -61,7 +61,8 @@ export struct VideoChannelDetail {
61 @State interactDataList: InteractDataDTO[] = [] 61 @State interactDataList: InteractDataDTO[] = []
62 @State totalCount: number = 0 62 @State totalCount: number = 0
63 @State isMouted: boolean = false 63 @State isMouted: boolean = false
64 - @State isRequestError: boolean = false 64 + @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
  65 + @State isOffLine: boolean = false // 存储视频下线状态用来展示缺省图
65 @State isRequesting: boolean = false 66 @State isRequesting: boolean = false
66 pageShowTime: number = 0; 67 pageShowTime: number = 0;
67 pageHideTime: number = 0; 68 pageHideTime: number = 0;
@@ -120,10 +121,23 @@ export struct VideoChannelDetail { @@ -120,10 +121,23 @@ export struct VideoChannelDetail {
120 } 121 }
121 } 122 }
122 123
123 - aboutToAppear() { 124 + getDetail() {
  125 + // 注册监听网络连接
  126 + this.netStatus = undefined
  127 + let netStatus = NetworkUtil.isNetConnected()
  128 + if (netStatus) {
124 this.openFullScreen() 129 this.openFullScreen()
125 // 根据视频频道传参查询视频楼层信息 130 // 根据视频频道传参查询视频楼层信息
126 this.getRecCompInfo() 131 this.getRecCompInfo()
  132 +
  133 + } else {
  134 + // 无网络
  135 + this.netStatus = 1
  136 + }
  137 + }
  138 +
  139 + aboutToAppear() {
  140 + this.getDetail()
127 Logger.info(TAG, 'aboutToAppear'); 141 Logger.info(TAG, 'aboutToAppear');
128 } 142 }
129 143
@@ -193,7 +207,7 @@ export struct VideoChannelDetail { @@ -193,7 +207,7 @@ export struct VideoChannelDetail {
193 } 207 }
194 208
195 await ContentDetailRequest.getRecCompInfo(params).then(async res => { 209 await ContentDetailRequest.getRecCompInfo(params).then(async res => {
196 - this.isRequestError = false 210 + this.isOffLine = res.data == null ? true : false
197 console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '') 211 console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
198 212
199 this.totalCount = res.data?.totalCount || 0 213 this.totalCount = res.data?.totalCount || 0
@@ -229,7 +243,6 @@ export struct VideoChannelDetail { @@ -229,7 +243,6 @@ export struct VideoChannelDetail {
229 243
230 }).catch(() => { 244 }).catch(() => {
231 // 获取内容失败请重试 245 // 获取内容失败请重试
232 - this.isRequestError = true  
233 this.isRequesting = false 246 this.isRequesting = false
234 }) 247 })
235 } 248 }
@@ -272,11 +285,17 @@ export struct VideoChannelDetail { @@ -272,11 +285,17 @@ export struct VideoChannelDetail {
272 285
273 build() { 286 build() {
274 Stack({ alignContent: Alignment.Center }) { 287 Stack({ alignContent: Alignment.Center }) {
275 - if (this.isRequestError) { 288 + if (this.netStatus !== undefined) {
  289 + EmptyComponent({
  290 + emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
  291 + this.getDetail()
  292 + }
  293 + })
  294 + } else if (this.isOffLine) {
276 EmptyComponent({ 295 EmptyComponent({
277 emptyType: WDViewDefaultType.WDViewDefaultType_NoVideo, 296 emptyType: WDViewDefaultType.WDViewDefaultType_NoVideo,
278 retry: () => { 297 retry: () => {
279 - this.getRecCompInfo() 298 + this.getDetail()
280 } 299 }
281 }) 300 })
282 } else { 301 } else {
@@ -72,13 +72,9 @@ export struct MultiPictureDetailPageComponent { @@ -72,13 +72,9 @@ export struct MultiPictureDetailPageComponent {
72 this.listScroller.scrollEdge(Edge.Top) 72 this.listScroller.scrollEdge(Edge.Top)
73 } 73 }
74 74
75 - async aboutToAppear() {  
76 - //注册字体  
77 - // font.registerFont({  
78 - // familyName: 'BebasNeueBold',  
79 - // familySrc: $rawfile('font/BebasNeueBold.otf')  
80 - // }) 75 + getDetail() {
81 // 注册监听网络连接 76 // 注册监听网络连接
  77 + this.netStatus = undefined
82 let netStatus = NetworkUtil.isNetConnected() 78 let netStatus = NetworkUtil.isNetConnected()
83 if (netStatus) { 79 if (netStatus) {
84 // 有网络 80 // 有网络
@@ -87,6 +83,15 @@ export struct MultiPictureDetailPageComponent { @@ -87,6 +83,15 @@ export struct MultiPictureDetailPageComponent {
87 // 无网络 83 // 无网络
88 this.netStatus = 1 84 this.netStatus = 1
89 } 85 }
  86 + }
  87 +
  88 + aboutToAppear() {
  89 + //注册字体
  90 + // font.registerFont({
  91 + // familyName: 'BebasNeueBold',
  92 + // familySrc: $rawfile('font/BebasNeueBold.otf')
  93 + // })
  94 + this.getDetail()
90 this.contentTrackingDict() 95 this.contentTrackingDict()
91 } 96 }
92 97
@@ -316,7 +321,6 @@ export struct MultiPictureDetailPageComponent { @@ -316,7 +321,6 @@ export struct MultiPictureDetailPageComponent {
316 center: { anchor: "__container__", align: VerticalAlign.Center }, 321 center: { anchor: "__container__", align: VerticalAlign.Center },
317 middle: { anchor: "__container__", align: HorizontalAlign.Center } 322 middle: { anchor: "__container__", align: HorizontalAlign.Center }
318 }) 323 })
319 - .zIndex(1)  
320 .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => { 324 .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => {
321 this.swiperIndex = targetIndex 325 this.swiperIndex = targetIndex
322 this.scroller.scrollEdge(Edge.Top) 326 this.scroller.scrollEdge(Edge.Top)
@@ -503,7 +507,7 @@ export struct MultiPictureDetailPageComponent { @@ -503,7 +507,7 @@ export struct MultiPictureDetailPageComponent {
503 noNet() { 507 noNet() {
504 EmptyComponent({ 508 EmptyComponent({
505 emptyType: 1, emptyButton: true, isBlack: true, retry: () => { 509 emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
506 - this.getContentDetailData() 510 + this.getDetail()
507 } 511 }
508 }) 512 })
509 .id('e_empty_content') 513 .id('e_empty_content')
@@ -512,13 +516,14 @@ export struct MultiPictureDetailPageComponent { @@ -512,13 +516,14 @@ export struct MultiPictureDetailPageComponent {
512 middle: { anchor: "__container__", align: HorizontalAlign.Center } 516 middle: { anchor: "__container__", align: HorizontalAlign.Center }
513 }) 517 })
514 .backgroundColor(Color.Black) 518 .backgroundColor(Color.Black)
  519 + .zIndex(10)
515 } 520 }
516 521
517 @Builder 522 @Builder
518 offLine() { 523 offLine() {
519 EmptyComponent({ 524 EmptyComponent({
520 emptyType: 15, emptyButton: true, retry: () => { 525 emptyType: 15, emptyButton: true, retry: () => {
521 - this.getContentDetailData 526 + this.getDetail()
522 } 527 }
523 }) 528 })
524 .id('e_empty_content') 529 .id('e_empty_content')
@@ -527,6 +532,7 @@ export struct MultiPictureDetailPageComponent { @@ -527,6 +532,7 @@ export struct MultiPictureDetailPageComponent {
527 middle: { anchor: "__container__", align: HorizontalAlign.Center } 532 middle: { anchor: "__container__", align: HorizontalAlign.Center }
528 }) 533 })
529 .backgroundColor(Color.Black) 534 .backgroundColor(Color.Black)
  535 + .zIndex(10)
530 } 536 }
531 537
532 getContentDetailData() { 538 getContentDetailData() {
@@ -575,7 +581,7 @@ export struct MultiPictureDetailPageComponent { @@ -575,7 +581,7 @@ export struct MultiPictureDetailPageComponent {
575 } 581 }
576 }) 582 })
577 .catch((err: Error) => { 583 .catch((err: Error) => {
578 - Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); 584 + console.log(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
579 // 内容获取失败 585 // 内容获取失败
580 this.netStatus = 9 586 this.netStatus = 9
581 this.operationButtonList = [] 587 this.operationButtonList = []