wangliang_wd

feat:优化早晚报图片仅WiFi显示问题

@@ -9,6 +9,7 @@ import { TrackConstants, @@ -9,6 +9,7 @@ import { TrackConstants,
9 import { WDShare } from 'wdShare/Index'; 9 import { WDShare } from 'wdShare/Index';
10 import { hasClicked, persistentStorage } from '../../utils/persistentStorage'; 10 import { hasClicked, persistentStorage } from '../../utils/persistentStorage';
11 import { LottieView } from '../lottie/LottieView'; 11 import { LottieView } from '../lottie/LottieView';
  12 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
12 13
13 const TAG: string = 'CardView'; 14 const TAG: string = 'CardView';
14 15
@@ -398,6 +399,7 @@ export struct PaperSingleColumn999CardView { @@ -398,6 +399,7 @@ export struct PaperSingleColumn999CardView {
398 @State isRead: boolean = false;//已读状态 399 @State isRead: boolean = false;//已读状态
399 @State interactData: InteractDataDTO = new InteractDataDTO 400 @State interactData: InteractDataDTO = new InteractDataDTO
400 @Consume @Watch('onChangeCommentList') commentList: InteractDataDTO[] 401 @Consume @Watch('onChangeCommentList') commentList: InteractDataDTO[]
  402 + @State loadImg: boolean = false;
401 403
402 getPublishTime(): string { 404 getPublishTime(): string {
403 const publishTimestamp = parseInt(this.item?.publishTime) 405 const publishTimestamp = parseInt(this.item?.publishTime)
@@ -441,7 +443,7 @@ export struct PaperSingleColumn999CardView { @@ -441,7 +443,7 @@ export struct PaperSingleColumn999CardView {
441 .margin({ left: 16, right: 16, top: 16 }) 443 .margin({ left: 16, right: 16, top: 16 })
442 if (this.item?.coverUrl) { 444 if (this.item?.coverUrl) {
443 Stack({ alignContent: Alignment.BottomEnd }) { 445 Stack({ alignContent: Alignment.BottomEnd }) {
444 - Image(this.item?.coverUrl) 446 + Image(this.loadImg?this.item?.coverUrl:'')
445 .borderRadius(5) 447 .borderRadius(5)
446 .objectFit(ImageFit.Fill) 448 .objectFit(ImageFit.Fill)
447 .aspectRatio(319 / 179) ///图片设计比例 449 .aspectRatio(319 / 179) ///图片设计比例
@@ -624,7 +626,8 @@ export struct PaperSingleColumn999CardView { @@ -624,7 +626,8 @@ export struct PaperSingleColumn999CardView {
624 }) 626 })
625 } 627 }
626 628
627 - aboutToAppear(): void { 629 + async aboutToAppear(): Promise<void> {
  630 + this.loadImg = await onlyWifiLoadImg();
628 this.onChangeCommentList() 631 this.onChangeCommentList()
629 this.isRead = hasClicked(this.item.objectId, '') 632 this.isRead = hasClicked(this.item.objectId, '')
630 } 633 }