Showing
25 changed files
with
114 additions
and
85 deletions
| 1 | -import { | ||
| 2 | - NetworkUtil, | ||
| 3 | - Logger, | ||
| 4 | - NetworkType, | ||
| 5 | - SPHelper, | ||
| 6 | -} from 'wdKit'; | 1 | +import { NetworkUtil, Logger, NetworkType, SPHelper, } from 'wdKit'; |
| 7 | import { ResponseDTO } from 'wdNetwork'; | 2 | import { ResponseDTO } from 'wdNetwork'; |
| 8 | import { | 3 | import { |
| 9 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| @@ -68,7 +63,7 @@ export struct MultiPictureDetailPageComponent { | @@ -68,7 +63,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 68 | }) | 63 | }) |
| 69 | // 注册监听网络连接 | 64 | // 注册监听网络连接 |
| 70 | let netStatus = NetworkUtil.isNetConnected() | 65 | let netStatus = NetworkUtil.isNetConnected() |
| 71 | - if(netStatus) { | 66 | + if (netStatus) { |
| 72 | // 有网络 | 67 | // 有网络 |
| 73 | this.getContentDetailData() | 68 | this.getContentDetailData() |
| 74 | } else { | 69 | } else { |
| @@ -270,8 +265,12 @@ export struct MultiPictureDetailPageComponent { | @@ -270,8 +265,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 270 | .height(px2vp(this.titleHeight) + 64) | 265 | .height(px2vp(this.titleHeight) + 64) |
| 271 | 266 | ||
| 272 | } | 267 | } |
| 273 | - if(this.netStatus !== undefined) { | ||
| 274 | - EmptyComponent({ emptyType: $netStatus, emptyButton:true, retry: () => {this.getContentDetailData()}}) | 268 | + if (this.netStatus !== undefined) { |
| 269 | + EmptyComponent({ | ||
| 270 | + emptyType: this.netStatus, emptyButton: true, retry: () => { | ||
| 271 | + this.getContentDetailData() | ||
| 272 | + } | ||
| 273 | + }) | ||
| 275 | .id('e_empty_content') | 274 | .id('e_empty_content') |
| 276 | .alignRules({ | 275 | .alignRules({ |
| 277 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 276 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| @@ -307,35 +306,37 @@ export struct MultiPictureDetailPageComponent { | @@ -307,35 +306,37 @@ export struct MultiPictureDetailPageComponent { | ||
| 307 | 306 | ||
| 308 | getContentDetailData() { | 307 | getContentDetailData() { |
| 309 | try { | 308 | try { |
| 310 | - PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 311 | - if (!resDTO || !resDTO.data) { | ||
| 312 | - Logger.error(TAG, 'fetchDetailData is empty'); | ||
| 313 | - return | ||
| 314 | - } | ||
| 315 | - if (resDTO.code != 0) { | ||
| 316 | - Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 317 | - return | ||
| 318 | - } | ||
| 319 | - this.netStatus = undefined | ||
| 320 | - this.contentDetailData = resDTO.data?.[0]; | ||
| 321 | - // this.contentDetailData.photoList = [] | ||
| 322 | - if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | ||
| 323 | - // 暂无内容 | ||
| 324 | - this.netStatus = 0 | ||
| 325 | - Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) | ||
| 326 | - } | ||
| 327 | - Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | ||
| 328 | - // 未登录,跳转登录 | ||
| 329 | - const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 330 | - if (user_id) { | ||
| 331 | - this.getInteractBrowsOperate() | ||
| 332 | - this.getBatchAttentionStatus() | ||
| 333 | - } | ||
| 334 | - }).catch((err: Error) => { | ||
| 335 | - Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | ||
| 336 | - // 内容获取失败 | ||
| 337 | - this.netStatus = 9 | ||
| 338 | - }) | 309 | + PageRepository.fetchDetailData(this.relId, this.contentId, this.relType) |
| 310 | + .then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 311 | + if (!resDTO || !resDTO.data) { | ||
| 312 | + Logger.error(TAG, 'fetchDetailData is empty'); | ||
| 313 | + return | ||
| 314 | + } | ||
| 315 | + if (resDTO.code != 0) { | ||
| 316 | + Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 317 | + return | ||
| 318 | + } | ||
| 319 | + this.netStatus = undefined | ||
| 320 | + this.contentDetailData = resDTO.data?.[0]; | ||
| 321 | + // this.contentDetailData.photoList = [] | ||
| 322 | + if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | ||
| 323 | + // 暂无内容 | ||
| 324 | + this.netStatus = 0 | ||
| 325 | + Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) | ||
| 326 | + } | ||
| 327 | + Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | ||
| 328 | + // 未登录,跳转登录 | ||
| 329 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 330 | + if (user_id) { | ||
| 331 | + this.getInteractBrowsOperate() | ||
| 332 | + this.getBatchAttentionStatus() | ||
| 333 | + } | ||
| 334 | + }) | ||
| 335 | + .catch((err: Error) => { | ||
| 336 | + Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | ||
| 337 | + // 内容获取失败 | ||
| 338 | + this.netStatus = 9 | ||
| 339 | + }) | ||
| 339 | } catch (exception) { | 340 | } catch (exception) { |
| 340 | 341 | ||
| 341 | } | 342 | } |
| @@ -46,13 +46,13 @@ export const enum WDViewDefaultType { | @@ -46,13 +46,13 @@ export const enum WDViewDefaultType { | ||
| 46 | /** | 46 | /** |
| 47 | * 空数据/无数据 | 47 | * 空数据/无数据 |
| 48 | */ | 48 | */ |
| 49 | -@Preview | 49 | +// @Preview |
| 50 | @Component | 50 | @Component |
| 51 | export struct EmptyComponent { | 51 | export struct EmptyComponent { |
| 52 | // private emptySize: SizeOptions = {}; | 52 | // private emptySize: SizeOptions = {}; |
| 53 | @State emptyWidth: string | number = CommonConstants.FULL_PARENT; | 53 | @State emptyWidth: string | number = CommonConstants.FULL_PARENT; |
| 54 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; | 54 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; |
| 55 | - @Link emptyType: number | 55 | + @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default |
| 56 | @State emptyButton: boolean = false | 56 | @State emptyButton: boolean = false |
| 57 | @State timeNum: number = 10 | 57 | @State timeNum: number = 10 |
| 58 | /** | 58 | /** |
| 1 | import { LiveDetailsBean } from 'wdBean/Index'; | 1 | import { LiveDetailsBean } from 'wdBean/Index'; |
| 2 | import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; | 2 | import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; |
| 3 | -import componentUtils from '@ohos.arkui.componentUtils'; | ||
| 4 | - | 3 | + |
| 5 | const TAG = 'PlayerComponent' | 4 | const TAG = 'PlayerComponent' |
| 6 | 5 | ||
| 7 | @Component | 6 | @Component |
| 8 | export struct PlayerComponent { | 7 | export struct PlayerComponent { |
| 9 | private playerController?: WDPlayerController; | 8 | private playerController?: WDPlayerController; |
| 10 | - // playerController: WDPlayerController = new WDPlayerController(); | ||
| 11 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | 9 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean |
| 10 | + @Consume @Watch('pageShowChange') pageShow: number | ||
| 11 | + @Consume @Watch('pageHideChange') pageHide: number | ||
| 12 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 12 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 13 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 13 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 14 | @State imgUrl: string = '' | 14 | @State imgUrl: string = '' |
| @@ -16,6 +16,14 @@ export struct PlayerComponent { | @@ -16,6 +16,14 @@ export struct PlayerComponent { | ||
| 16 | @State liveStreamType: number | null = -1 | 16 | @State liveStreamType: number | null = -1 |
| 17 | @State playUrl: string = '' | 17 | @State playUrl: string = '' |
| 18 | 18 | ||
| 19 | + pageShowChange() { | ||
| 20 | + this.playerController?.play() | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + pageHideChange() { | ||
| 24 | + this.playerController?.pause() | ||
| 25 | + } | ||
| 26 | + | ||
| 19 | aboutToAppear(): void { | 27 | aboutToAppear(): void { |
| 20 | console.log(TAG, 'aboutToAppear') | 28 | console.log(TAG, 'aboutToAppear') |
| 21 | if (this.playerController) { | 29 | if (this.playerController) { |
| 1 | -import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; | 1 | +import { ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; |
| 2 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | 2 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' |
| 3 | -import { ResponseDTO } from 'wdNetwork/Index'; | ||
| 4 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' | 3 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' |
| 5 | -// import { Test } from './Test' | ||
| 6 | -import router from '@ohos.router'; | ||
| 7 | -import window from '@ohos.window'; | 4 | +import { |
| 5 | + WDViewDefaultType, | ||
| 6 | + EmptyComponent | ||
| 7 | +} from '../../../../../wdComponent/src/main/ets/components/view/EmptyComponent' | ||
| 8 | import { | 8 | import { |
| 9 | batchContentDetailParams, | 9 | batchContentDetailParams, |
| 10 | compListItem, | 10 | compListItem, |
| 11 | contentListParams, | 11 | contentListParams, |
| 12 | - contentsItem, | ||
| 13 | getRecCompInfoParams | 12 | getRecCompInfoParams |
| 14 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 13 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 15 | import { Logger, WindowModel } from 'wdKit/Index'; | 14 | import { Logger, WindowModel } from 'wdKit/Index'; |
| 16 | -import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 17 | import { PictureLoading } from './PictureLoading'; | 15 | import { PictureLoading } from './PictureLoading'; |
| 18 | 16 | ||
| 19 | interface loadMoreData { | 17 | interface loadMoreData { |
| @@ -23,8 +21,6 @@ interface loadMoreData { | @@ -23,8 +21,6 @@ interface loadMoreData { | ||
| 23 | } | 21 | } |
| 24 | 22 | ||
| 25 | const TAG = 'VideoChannelDetail' | 23 | const TAG = 'VideoChannelDetail' |
| 26 | -let timer: number = -1 | ||
| 27 | - | ||
| 28 | const storage = LocalStorage.getShared(); | 24 | const storage = LocalStorage.getShared(); |
| 29 | 25 | ||
| 30 | @Entry(storage) | 26 | @Entry(storage) |
| @@ -54,6 +50,7 @@ export struct VideoChannelDetail { | @@ -54,6 +50,7 @@ export struct VideoChannelDetail { | ||
| 54 | @State interactDataList: InteractDataDTO[] = [] | 50 | @State interactDataList: InteractDataDTO[] = [] |
| 55 | @State totalCount: number = 0 | 51 | @State totalCount: number = 0 |
| 56 | @State isMouted: boolean = false | 52 | @State isMouted: boolean = false |
| 53 | + @State isRequestError: boolean = false | ||
| 57 | 54 | ||
| 58 | pageShowChange() { | 55 | pageShowChange() { |
| 59 | if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { | 56 | if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { |
| @@ -149,6 +146,7 @@ export struct VideoChannelDetail { | @@ -149,6 +146,7 @@ export struct VideoChannelDetail { | ||
| 149 | } | 146 | } |
| 150 | 147 | ||
| 151 | await ContentDetailRequest.getRecCompInfo(params).then(res => { | 148 | await ContentDetailRequest.getRecCompInfo(params).then(res => { |
| 149 | + this.isRequestError = false | ||
| 152 | console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '') | 150 | console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '') |
| 153 | 151 | ||
| 154 | this.totalCount = res.data?.totalCount || 0 | 152 | this.totalCount = res.data?.totalCount || 0 |
| @@ -182,6 +180,9 @@ export struct VideoChannelDetail { | @@ -182,6 +180,9 @@ export struct VideoChannelDetail { | ||
| 182 | this.isMouted = true | 180 | this.isMouted = true |
| 183 | }, 500) | 181 | }, 500) |
| 184 | 182 | ||
| 183 | + }).catch(() => { | ||
| 184 | + // 获取内容失败请重试 | ||
| 185 | + this.isRequestError = true | ||
| 185 | }) | 186 | }) |
| 186 | } | 187 | } |
| 187 | 188 | ||
| @@ -211,41 +212,52 @@ export struct VideoChannelDetail { | @@ -211,41 +212,52 @@ export struct VideoChannelDetail { | ||
| 211 | 212 | ||
| 212 | build() { | 213 | build() { |
| 213 | Column() { | 214 | Column() { |
| 214 | - PictureLoading().visibility(this.isMouted ? Visibility.None : Visibility.Visible) | ||
| 215 | - Swiper(this.swiperController) { | ||
| 216 | - ForEach(this.data, (item: ContentDetailDTO, index: number) => { | ||
| 217 | - Column() { | ||
| 218 | - DetailPlayShortVideoPage({ | ||
| 219 | - contentDetailData: item, | ||
| 220 | - currentIndex: this.currentIndex, | ||
| 221 | - index: index, | ||
| 222 | - interactData: this.interactDataList[index] | ||
| 223 | - }) | ||
| 224 | - }.width('100%') | ||
| 225 | - .height('100%') | ||
| 226 | - }, (item: ContentDetailDTO) => item.newsId + '') | ||
| 227 | - } | ||
| 228 | - .visibility(this.isMouted ? Visibility.Visible : Visibility.None) | ||
| 229 | - .cachedCount(-1) | ||
| 230 | - .indicator(false) | ||
| 231 | - .vertical(true) | ||
| 232 | - .loop(false) | ||
| 233 | - .width('100%') | ||
| 234 | - .height('100%') | ||
| 235 | - // 扩展至所有非安全区域 | ||
| 236 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 237 | - .onChange((index: number) => { | ||
| 238 | - this.currentIndex = index | ||
| 239 | - console.info('onChange==', index.toString()) | ||
| 240 | - | ||
| 241 | - if (this.currentIndex === this.data.length - 1) { | ||
| 242 | - this.pageNum++ | ||
| 243 | - this.refreshTime = new Date().getTime() | ||
| 244 | - this.loadStrategy = 'push_up' | ||
| 245 | - this.getRecCompInfo() | 215 | + if (this.isRequestError) { |
| 216 | + EmptyComponent({ | ||
| 217 | + emptyType: WDViewDefaultType.WDViewDefaultType_NoVideo, | ||
| 218 | + emptyButton: true, | ||
| 219 | + retry: () => { | ||
| 220 | + this.getRecCompInfo() | ||
| 221 | + } | ||
| 222 | + }) | ||
| 223 | + } else { | ||
| 224 | + | ||
| 225 | + PictureLoading().visibility(this.isMouted ? Visibility.None : Visibility.Visible) | ||
| 226 | + Swiper(this.swiperController) { | ||
| 227 | + ForEach(this.data, (item: ContentDetailDTO, index: number) => { | ||
| 228 | + Column() { | ||
| 229 | + DetailPlayShortVideoPage({ | ||
| 230 | + contentDetailData: item, | ||
| 231 | + currentIndex: this.currentIndex, | ||
| 232 | + index: index, | ||
| 233 | + interactData: this.interactDataList[index] | ||
| 234 | + }) | ||
| 235 | + }.width('100%') | ||
| 236 | + .height('100%') | ||
| 237 | + }, (item: ContentDetailDTO) => item.newsId + '') | ||
| 246 | } | 238 | } |
| 247 | - }) | 239 | + .visibility(this.isMouted ? Visibility.Visible : Visibility.None) |
| 240 | + .cachedCount(-1) | ||
| 241 | + .indicator(false) | ||
| 242 | + .vertical(true) | ||
| 243 | + .loop(false) | ||
| 244 | + .width('100%') | ||
| 245 | + .height('100%') | ||
| 246 | + // 扩展至所有非安全区域 | ||
| 247 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 248 | + .onChange((index: number) => { | ||
| 249 | + this.currentIndex = index | ||
| 250 | + console.info('onChange==', index.toString()) | ||
| 251 | + | ||
| 252 | + if (this.currentIndex === this.data.length - 1) { | ||
| 253 | + this.pageNum++ | ||
| 254 | + this.refreshTime = new Date().getTime() | ||
| 255 | + this.loadStrategy = 'push_up' | ||
| 256 | + this.getRecCompInfo() | ||
| 257 | + } | ||
| 258 | + }) | ||
| 248 | 259 | ||
| 260 | + } | ||
| 249 | } | 261 | } |
| 250 | .width('100%') | 262 | .width('100%') |
| 251 | .height('100%') | 263 | .height('100%') |
| @@ -9,6 +9,14 @@ | @@ -9,6 +9,14 @@ | ||
| 9 | "value": "14fp" | 9 | "value": "14fp" |
| 10 | }, | 10 | }, |
| 11 | { | 11 | { |
| 12 | + "name": "font_size_12", | ||
| 13 | + "value": "12fp" | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + "name": "normal_text_size", | ||
| 17 | + "value": "16fp" | ||
| 18 | + }, | ||
| 19 | + { | ||
| 12 | "name": "title_popup_image_size", | 20 | "name": "title_popup_image_size", |
| 13 | "value": "24vp" | 21 | "value": "24vp" |
| 14 | }, | 22 | }, |
58.9 KB
57.5 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_collection.png
0 → 100644
67.4 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_comment.png
0 → 100644
59.7 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_comment1.png
0 → 100644
58.5 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_content.png
0 → 100644
65.4 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_content1.png
0 → 100644
64.3 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_end.png
0 → 100644
65.9 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_favorites1.png
0 → 100644
66.7 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_limiting.png
0 → 100644
58.7 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_limiting1.png
0 → 100644
55.8 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_liver.png
0 → 100644
57.6 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_master1.png
0 → 100644
56.6 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_message.png
0 → 100644
61 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_message1.png
0 → 100644
60.3 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_net.png
0 → 100644
52 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_net1.png
0 → 100644
47.6 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_no_result.png
0 → 100644
60.9 KB
-
Please register or login to post a comment