Showing
4 changed files
with
31 additions
and
25 deletions
| @@ -12,7 +12,7 @@ export struct MultiPictureDetailItemComponent { | @@ -12,7 +12,7 @@ export struct MultiPictureDetailItemComponent { | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | async aboutToAppear() { | 14 | async aboutToAppear() { |
| 15 | - Logger.info(TAG, 'pictures preview') | 15 | + // Logger.info(TAG, 'pictures preview') |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | build() { | 18 | build() { |
| 1 | -import { Logger, SPHelper } from 'wdKit'; | 1 | +import { |
| 2 | + NetworkUtil, | ||
| 3 | + Logger, | ||
| 4 | + NetworkType, | ||
| 5 | + SPHelper, | ||
| 6 | +} from 'wdKit'; | ||
| 2 | import { ResponseDTO } from 'wdNetwork'; | 7 | import { ResponseDTO } from 'wdNetwork'; |
| 3 | import { | 8 | import { |
| 4 | ContentDetailDTO, | 9 | ContentDetailDTO, |
| @@ -61,7 +66,15 @@ export struct MultiPictureDetailPageComponent { | @@ -61,7 +66,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 61 | familyName: 'BebasNeue_Regular', | 66 | familyName: 'BebasNeue_Regular', |
| 62 | familySrc: $rawfile('font/BebasNeue_Regular.otf') | 67 | familySrc: $rawfile('font/BebasNeue_Regular.otf') |
| 63 | }) | 68 | }) |
| 69 | + // 注册监听网络连接 | ||
| 70 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 71 | + if(netStatus) { | ||
| 72 | + // 有网络 | ||
| 64 | this.getContentDetailData() | 73 | this.getContentDetailData() |
| 74 | + } else { | ||
| 75 | + // 无网络 | ||
| 76 | + this.netStatus = 1 | ||
| 77 | + } | ||
| 65 | } | 78 | } |
| 66 | 79 | ||
| 67 | aboutToDisappear() { | 80 | aboutToDisappear() { |
| @@ -73,7 +86,7 @@ export struct MultiPictureDetailPageComponent { | @@ -73,7 +86,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 73 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { | 86 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { |
| 74 | Swiper(this.swiperController) { | 87 | Swiper(this.swiperController) { |
| 75 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { | 88 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { |
| 76 | - Swiper(this.swiperController) { | 89 | + Swiper(this.swiperControllerItem) { |
| 77 | MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 90 | MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) |
| 78 | } | 91 | } |
| 79 | .width('100%') | 92 | .width('100%') |
| @@ -256,16 +269,15 @@ export struct MultiPictureDetailPageComponent { | @@ -256,16 +269,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 256 | }) | 269 | }) |
| 257 | .height(px2vp(this.titleHeight) + 64) | 270 | .height(px2vp(this.titleHeight) + 64) |
| 258 | 271 | ||
| 259 | - } else { | 272 | + } |
| 260 | if(this.netStatus !== undefined) { | 273 | if(this.netStatus !== undefined) { |
| 261 | - EmptyComponent({ emptyType: this.netStatus}) | 274 | + EmptyComponent({ emptyType: $netStatus, emptyButton:true, retry: () => {this.getContentDetailData()}}) |
| 262 | .id('e_empty_content') | 275 | .id('e_empty_content') |
| 263 | .alignRules({ | 276 | .alignRules({ |
| 264 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 277 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 265 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 278 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 266 | }) | 279 | }) |
| 267 | } | 280 | } |
| 268 | - } | ||
| 269 | OperRowListView({ | 281 | OperRowListView({ |
| 270 | contentDetailData: this.contentDetailData, | 282 | contentDetailData: this.contentDetailData, |
| 271 | }) | 283 | }) |
| @@ -293,12 +305,9 @@ export struct MultiPictureDetailPageComponent { | @@ -293,12 +305,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 293 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 305 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 294 | } | 306 | } |
| 295 | 307 | ||
| 296 | - private getContentDetailData() { | 308 | + getContentDetailData() { |
| 297 | try { | 309 | try { |
| 298 | - PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 299 | - // Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`); | ||
| 300 | - // Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`); | ||
| 301 | - // Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`); | 310 | + PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { |
| 302 | if (!resDTO || !resDTO.data) { | 311 | if (!resDTO || !resDTO.data) { |
| 303 | Logger.error(TAG, 'fetchDetailData is empty'); | 312 | Logger.error(TAG, 'fetchDetailData is empty'); |
| 304 | return | 313 | return |
| @@ -307,29 +316,25 @@ export struct MultiPictureDetailPageComponent { | @@ -307,29 +316,25 @@ export struct MultiPictureDetailPageComponent { | ||
| 307 | Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | 316 | Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); |
| 308 | return | 317 | return |
| 309 | } | 318 | } |
| 319 | + this.netStatus = undefined | ||
| 310 | this.contentDetailData = resDTO.data?.[0]; | 320 | this.contentDetailData = resDTO.data?.[0]; |
| 321 | + // this.contentDetailData.photoList = [] | ||
| 311 | if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 322 | if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| 323 | + // 暂无内容 | ||
| 312 | this.netStatus = 0 | 324 | this.netStatus = 0 |
| 325 | + Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) | ||
| 313 | } | 326 | } |
| 314 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | 327 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) |
| 315 | - if (HttpUrlUtils.getUserId()) { | 328 | + // 未登录,跳转登录 |
| 329 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 330 | + if (user_id) { | ||
| 316 | this.getInteractBrowsOperate() | 331 | this.getInteractBrowsOperate() |
| 317 | this.getBatchAttentionStatus() | 332 | this.getBatchAttentionStatus() |
| 318 | } | 333 | } |
| 319 | }).catch((err: Error) => { | 334 | }).catch((err: Error) => { |
| 320 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | 335 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); |
| 321 | - /*// 请求失败处理 | ||
| 322 | - if (err.response) { | ||
| 323 | - // 请求已发出,但服务器响应的状态码不在2xx范围内 | ||
| 324 | - console.error('请求失败,状态码:', err.response.status); | ||
| 325 | - console.error('响应数据:', err.response.data); | ||
| 326 | - } else if (err.request) { | ||
| 327 | - // 请求已发出,但无响应(例如:网络故障) | ||
| 328 | - console.error('请求已发出,但无响应:', err.request); | ||
| 329 | - } else { | ||
| 330 | - // 发生了其他类型的错误(如配置错误或拒绝权限等) | ||
| 331 | - console.error('请求发生错误:', err.message); | ||
| 332 | - }*/ | 336 | + // 内容获取失败 |
| 337 | + this.netStatus = 9 | ||
| 333 | }) | 338 | }) |
| 334 | } catch (exception) { | 339 | } catch (exception) { |
| 335 | 340 |
| @@ -52,7 +52,7 @@ export struct EmptyComponent { | @@ -52,7 +52,7 @@ 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 | - @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; | 55 | + @Link emptyType: number |
| 56 | @State emptyButton: boolean = false | 56 | @State emptyButton: boolean = false |
| 57 | @State timeNum: number = 10 | 57 | @State timeNum: number = 10 |
| 58 | /** | 58 | /** |
| @@ -113,6 +113,7 @@ export struct AudioDialog { | @@ -113,6 +113,7 @@ export struct AudioDialog { | ||
| 113 | if (this.playerController) { | 113 | if (this.playerController) { |
| 114 | // this.onConfirm() | 114 | // this.onConfirm() |
| 115 | this.playerController.switchPlayOrPause() | 115 | this.playerController.switchPlayOrPause() |
| 116 | + this.AudioSuspension.playerController.get().switchPlayOrPause() | ||
| 116 | this.currentStatus = this.playerController.getStatus() | 117 | this.currentStatus = this.playerController.getStatus() |
| 117 | } | 118 | } |
| 118 | }) | 119 | }) |
-
Please register or login to post a comment