liyubing

fix:

1)无网络进入直播预告和直播列表页,未显示无网络缺省图
import { ContentDTO, LiveRoomDataBean } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index';
import { DateTimeUtils, LazyDataSource, Logger, NetworkUtil } from 'wdKit/Index';
import { router } from '@kit.ArkUI';
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import { EmptyComponent } from '../view/EmptyComponent';
import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import LoadMoreLayout from '../page/LoadMoreLayout';
import { LottieView } from '../../components/lottie/LottieView';
import dataPreferences from '@ohos.data.preferences';
import { BusinessError } from '@ohos.base';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { channelSkeleton } from '../skeleton/channelSkeleton';
const TAG: string = 'LiveMorePage';
... ... @@ -41,12 +42,13 @@ struct LiveMorePage {
@State private hasMore: boolean = true
@State private currentPage: number = 1
@State private isLoading: boolean = false
@State viewType: ViewType = ViewType.LOADING
private scroller: Scroller = new Scroller()
@State liveRoomList: LiveRoomDataBean[] = []
// 点击过的数据
@State clickDatas: Array<string> = []
@State loadImg: boolean = false;
@State viewType: ViewType = ViewType.LOADING
emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
async aboutToAppear(): Promise<void> {
await this.getPreferencesFromStorage()
... ... @@ -63,15 +65,14 @@ struct LiveMorePage {
this.TabbarNormal()
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
ErrorComponent()
.onTouch(() => {
if (this.viewType === ViewType.ERROR) {
this.getData()
}
})
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent()
} else if (this.viewType == ViewType.EMPTY || this.viewType == ViewType.ERROR) {
EmptyComponent({
emptyType: this.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
} else {
CustomPullToRefresh({
alldata: this.data,
... ... @@ -91,13 +92,15 @@ struct LiveMorePage {
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)
top: px2vp(this.topSafeHeight),
bottom: px2vp(this.bottomSafeHeight)
})
}
@Builder
LoadingLayout() {
channelSkeleton()
}
@Builder
... ... @@ -208,6 +211,7 @@ struct LiveMorePage {
/*导航栏*/
@Builder
TabbarNormal() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left'))
... ... @@ -223,7 +227,7 @@ struct LiveMorePage {
router.back()
})
Text(this.title)// .height('42lpx')
Text(this.title)
.maxLines(1)
.id("title")
.fontSize('18vp')
... ... @@ -298,6 +302,18 @@ struct LiveMorePage {
}
return
}
// 检测网络
let netStatus = NetworkUtil.isNetConnected()
if (!netStatus) {
this.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork
this.viewType = ViewType.ERROR
return
}
this.isLoading = true
try {
const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize)
... ... @@ -319,17 +335,12 @@ struct LiveMorePage {
this.resolveEnd(true, resolve)
if (liveReviewDTO.list.length == 0 && this.currentPage == 1) {
this.viewType = ViewType.EMPTY
this.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent
}
} catch (exception) {
this.resolveEnd(false, resolve)
}
// PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {
// // this.operDataList = []
// // this.operDataList.push(...liveReviewDTO.list)
// this.data.push(...liveReviewDTO.list)
//
// // this.getAppointmentInfo()
// })
}
private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) {
... ... @@ -341,7 +352,9 @@ struct LiveMorePage {
}
}
if (this.currentPage == 1 && !isTop) {
this.viewType = ViewType.ERROR
this.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent
} else {
this.viewType = ViewType.LOADED
}
... ...
import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
export struct DefaultPage {
@State type: number = 15
retry() {
console.log('daj点击了重试')
}
build() {
Row() {
EmptyComponent({
emptyType: this.type,
retry: () => {
this.retry()
}
})
// .height('612lpx')
// .width('100%')
}
}
}
\ No newline at end of file
... ... @@ -96,17 +96,11 @@ export struct EmptyComponent {
}
}
onPageShow(): void {
this.createTimer()
}
aboutToAppear(): void {
this.createTimer()
}
onPageHide(): void {
this.destroyTimer()
}
aboutToDisappear() {
this.destroyTimer()
... ...