Showing
1 changed file
with
49 additions
and
47 deletions
| @@ -5,10 +5,10 @@ import { ResponseDTO } from 'wdNetwork/Index'; | @@ -5,10 +5,10 @@ import { ResponseDTO } from 'wdNetwork/Index'; | ||
| 5 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' | 5 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' |
| 6 | import router from '@ohos.router'; | 6 | import router from '@ohos.router'; |
| 7 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 7 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 8 | -import { WindowModel } from 'wdKit'; | ||
| 9 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 10 | import { window } from '@kit.ArkUI'; | 9 | import { window } from '@kit.ArkUI'; |
| 11 | -import { EmptyComponent } from 'wdComponent/Index'; | 10 | +import { EmptyComponent } from '../../../../../wdComponent/src/main/ets/components/view/EmptyComponent'; |
| 11 | + | ||
| 12 | const storage = LocalStorage.getShared(); | 12 | const storage = LocalStorage.getShared(); |
| 13 | const TAG = 'DetailVideoListPage' | 13 | const TAG = 'DetailVideoListPage' |
| 14 | 14 | ||
| @@ -39,23 +39,23 @@ export struct DetailVideoListPage { | @@ -39,23 +39,23 @@ export struct DetailVideoListPage { | ||
| 39 | if (netStatus) { | 39 | if (netStatus) { |
| 40 | this.openFullScreen() | 40 | this.openFullScreen() |
| 41 | 41 | ||
| 42 | - const action: Action = router.getParams() as Action | ||
| 43 | - if (action) { | ||
| 44 | - this.contentId = action.params?.contentID || '' | ||
| 45 | - if (action.params && action.params.extra) { | ||
| 46 | - this.relId = action.params.extra.relId || '' | ||
| 47 | - this.relType = action.params.extra.relType || '' | 42 | + const action: Action = router.getParams() as Action |
| 43 | + if (action) { | ||
| 44 | + this.contentId = action.params?.contentID || '' | ||
| 45 | + if (action.params && action.params.extra) { | ||
| 46 | + this.relId = action.params.extra.relId || '' | ||
| 47 | + this.relType = action.params.extra.relType || '' | ||
| 48 | + } | ||
| 49 | + await this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 48 | } | 50 | } |
| 49 | - await this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 50 | - } | ||
| 51 | - await this.queryVideoList() | ||
| 52 | - console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) | ||
| 53 | - | 51 | + await this.queryVideoList() |
| 52 | + console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) | ||
| 53 | + | ||
| 54 | } else { | 54 | } else { |
| 55 | // 无网络 | 55 | // 无网络 |
| 56 | this.netStatus = 1 | 56 | this.netStatus = 1 |
| 57 | } | 57 | } |
| 58 | - | 58 | + |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | aboutToDisappear(): void { | 61 | aboutToDisappear(): void { |
| @@ -174,10 +174,10 @@ export struct DetailVideoListPage { | @@ -174,10 +174,10 @@ export struct DetailVideoListPage { | ||
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | build() { | 176 | build() { |
| 177 | - if (this.netStatus !== undefined) { | 177 | + if (this.netStatus !== undefined) { |
| 178 | EmptyComponent({ | 178 | EmptyComponent({ |
| 179 | emptyType: this.netStatus, emptyButton: true, retry: () => { | 179 | emptyType: this.netStatus, emptyButton: true, retry: () => { |
| 180 | - this.getContentDetail() | 180 | + this.getContentDetail(this.contentId, this.relId, this.relType) |
| 181 | } | 181 | } |
| 182 | }) | 182 | }) |
| 183 | .id('e_empty_content') | 183 | .id('e_empty_content') |
| @@ -185,40 +185,42 @@ export struct DetailVideoListPage { | @@ -185,40 +185,42 @@ export struct DetailVideoListPage { | ||
| 185 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 185 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 186 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 186 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 187 | }) | 187 | }) |
| 188 | - } | ||
| 189 | - Column() { | ||
| 190 | - Swiper(this.swiperController) { | ||
| 191 | - ForEach(this.data, (item: ContentDetailDTO, index: number) => { | ||
| 192 | - DetailPlayShortVideoPage({ | ||
| 193 | - contentDetailData: item, | ||
| 194 | - currentIndex: this.currentIndex, | ||
| 195 | - index: index, | ||
| 196 | - interactData: this.interactDataList[index] | ||
| 197 | - }) | ||
| 198 | - }, (item: ContentDetailDTO) => item.newsId + '') | 188 | + } else { |
| 189 | + | ||
| 190 | + Column() { | ||
| 191 | + Swiper(this.swiperController) { | ||
| 192 | + ForEach(this.data, (item: ContentDetailDTO, index: number) => { | ||
| 193 | + DetailPlayShortVideoPage({ | ||
| 194 | + contentDetailData: item, | ||
| 195 | + currentIndex: this.currentIndex, | ||
| 196 | + index: index, | ||
| 197 | + interactData: this.interactDataList[index] | ||
| 198 | + }) | ||
| 199 | + }, (item: ContentDetailDTO) => item.newsId + '') | ||
| 200 | + } | ||
| 201 | + .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || !this.showComment ? false : true) | ||
| 202 | + .indicator(false) | ||
| 203 | + .vertical(true) | ||
| 204 | + .loop(false) | ||
| 205 | + .width('100%') | ||
| 206 | + .height('100%') | ||
| 207 | + .displayCount(1, true) | ||
| 208 | + .onChange((index: number) => { | ||
| 209 | + this.currentIndex = index | ||
| 210 | + if (this.currentIndex === this.data.length - 1) { | ||
| 211 | + // TODO:下拉刷新“努力加载中” | ||
| 212 | + this.queryVideoList() | ||
| 213 | + } | ||
| 214 | + }) | ||
| 199 | } | 215 | } |
| 200 | - .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || !this.showComment ? false : true) | ||
| 201 | - .indicator(false) | ||
| 202 | - .vertical(true) | ||
| 203 | - .loop(false) | ||
| 204 | .width('100%') | 216 | .width('100%') |
| 205 | .height('100%') | 217 | .height('100%') |
| 206 | - .displayCount(1, true) | ||
| 207 | - .onChange((index: number) => { | ||
| 208 | - this.currentIndex = index | ||
| 209 | - if (this.currentIndex === this.data.length - 1) { | ||
| 210 | - // TODO:下拉刷新“努力加载中” | ||
| 211 | - this.queryVideoList() | ||
| 212 | - } | ||
| 213 | - }) | 218 | + .backgroundColor(Color.Black) |
| 219 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 220 | + | ||
| 221 | + // .padding({ | ||
| 222 | + // bottom: this.bottomSafeHeight + 'px' | ||
| 223 | + // }) | ||
| 214 | } | 224 | } |
| 215 | - .width('100%') | ||
| 216 | - .height('100%') | ||
| 217 | - .backgroundColor(Color.Black) | ||
| 218 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 219 | - | ||
| 220 | - // .padding({ | ||
| 221 | - // bottom: this.bottomSafeHeight + 'px' | ||
| 222 | - // }) | ||
| 223 | } | 225 | } |
| 224 | } | 226 | } |
-
Please register or login to post a comment