王士厅

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

... ... @@ -237,7 +237,6 @@ export struct MultiPictureDetailItemComponent {
.indicator(false)
.displayCount(1)
.loop(false)
.zIndex(10)
.onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
console.info("onGestureSwipe current offset: " + extraInfo.currentOffset)
this.currentOffset = Math.abs(extraInfo.currentOffset)
... ...
import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit';
import { NetworkUtil, WindowModel } from 'wdKit';
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index';
import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
... ... @@ -48,8 +48,9 @@ export struct DetailVideoListPage {
@State isShowAudioCom: boolean = false
@StorageLink('GestureLoadStrategy') GestureLoadStrategy: number = 0
async aboutToAppear(): Promise<void> {
async getDetail() {
// 注册监听网络连接
this.netStatus = undefined
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.openFullScreen()
... ... @@ -69,7 +70,10 @@ export struct DetailVideoListPage {
// 无网络
this.netStatus = 1
}
}
aboutToAppear() {
this.getDetail()
}
aboutToDisappear(): void {
... ... @@ -233,7 +237,7 @@ export struct DetailVideoListPage {
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
this.getContentDetail(this.contentId, this.relId, this.relType)
this.getDetail()
}
})
.id('e_empty_content')
... ... @@ -244,7 +248,7 @@ export struct DetailVideoListPage {
} else if (this.isOffLine) {
EmptyComponent({
emptyType: 15, emptyButton: true, retry: () => {
this.getContentDetail(this.contentId, this.relId, this.relType)
this.getDetail()
}
})
.id('e_empty_content')
... ...
... ... @@ -9,7 +9,7 @@ import {
contentListParams,
getRecCompInfoParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { Logger, WindowModel, DateTimeUtils } from 'wdKit/Index';
import { NetworkUtil, Logger, WindowModel, DateTimeUtils } from 'wdKit/Index';
import { PictureLoading } from './PictureLoading';
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
... ... @@ -61,7 +61,8 @@ export struct VideoChannelDetail {
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
@State isMouted: boolean = false
@State isRequestError: boolean = false
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State isOffLine: boolean = false // 存储视频下线状态用来展示缺省图
@State isRequesting: boolean = false
pageShowTime: number = 0;
pageHideTime: number = 0;
... ... @@ -120,10 +121,23 @@ export struct VideoChannelDetail {
}
}
getDetail() {
// 注册监听网络连接
this.netStatus = undefined
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.openFullScreen()
// 根据视频频道传参查询视频楼层信息
this.getRecCompInfo()
} else {
// 无网络
this.netStatus = 1
}
}
aboutToAppear() {
this.openFullScreen()
// 根据视频频道传参查询视频楼层信息
this.getRecCompInfo()
this.getDetail()
Logger.info(TAG, 'aboutToAppear');
}
... ... @@ -193,7 +207,7 @@ export struct VideoChannelDetail {
}
await ContentDetailRequest.getRecCompInfo(params).then(async res => {
this.isRequestError = false
this.isOffLine = res.data == null ? true : false
console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
this.totalCount = res.data?.totalCount || 0
... ... @@ -229,7 +243,6 @@ export struct VideoChannelDetail {
}).catch(() => {
// 获取内容失败请重试
this.isRequestError = true
this.isRequesting = false
})
}
... ... @@ -272,11 +285,17 @@ export struct VideoChannelDetail {
build() {
Stack({ alignContent: Alignment.Center }) {
if (this.isRequestError) {
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
this.getDetail()
}
})
} else if (this.isOffLine) {
EmptyComponent({
emptyType: WDViewDefaultType.WDViewDefaultType_NoVideo,
retry: () => {
this.getRecCompInfo()
this.getDetail()
}
})
} else {
... ...
... ... @@ -72,13 +72,9 @@ export struct MultiPictureDetailPageComponent {
this.listScroller.scrollEdge(Edge.Top)
}
async aboutToAppear() {
//注册字体
// font.registerFont({
// familyName: 'BebasNeueBold',
// familySrc: $rawfile('font/BebasNeueBold.otf')
// })
getDetail() {
// 注册监听网络连接
this.netStatus = undefined
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
// 有网络
... ... @@ -87,6 +83,15 @@ export struct MultiPictureDetailPageComponent {
// 无网络
this.netStatus = 1
}
}
aboutToAppear() {
//注册字体
// font.registerFont({
// familyName: 'BebasNeueBold',
// familySrc: $rawfile('font/BebasNeueBold.otf')
// })
this.getDetail()
this.contentTrackingDict()
}
... ... @@ -316,7 +321,6 @@ export struct MultiPictureDetailPageComponent {
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.zIndex(1)
.onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => {
this.swiperIndex = targetIndex
this.scroller.scrollEdge(Edge.Top)
... ... @@ -503,7 +507,7 @@ export struct MultiPictureDetailPageComponent {
noNet() {
EmptyComponent({
emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
this.getContentDetailData()
this.getDetail()
}
})
.id('e_empty_content')
... ... @@ -512,13 +516,14 @@ export struct MultiPictureDetailPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.backgroundColor(Color.Black)
.zIndex(10)
}
@Builder
offLine() {
EmptyComponent({
emptyType: 15, emptyButton: true, retry: () => {
this.getContentDetailData
this.getDetail()
}
})
.id('e_empty_content')
... ... @@ -527,6 +532,7 @@ export struct MultiPictureDetailPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.backgroundColor(Color.Black)
.zIndex(10)
}
getContentDetailData() {
... ... @@ -575,7 +581,7 @@ export struct MultiPictureDetailPageComponent {
}
})
.catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
console.log(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
this.operationButtonList = []
... ...