douaojie

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card5Component.ets
Showing 33 changed files with 455 additions and 441 deletions
@@ -27,35 +27,51 @@ export struct PaperTitleComponent { @@ -27,35 +27,51 @@ export struct PaperTitleComponent {
27 27
28 Row() { 28 Row() {
29 // 在 29 * 18 的矩形框中绘制一个三角形,起点(0, 0),经过(0, 18),经过(20, 18),终点(29, 0) 29 // 在 29 * 18 的矩形框中绘制一个三角形,起点(0, 0),经过(0, 18),经过(20, 18),终点(29, 0)
30 - Polygon({ width: 29, height: 18 })  
31 - .points([[0, 0], [0, 18], [20, 18], [29, 0]])// .fill(Color.White)  
32 - .fillOpacity(0.2)  
33 - .fill(Color.White) 30 + // Polygon({ width: 29, height: 18 })
  31 + // .points([[0, 0], [0, 18], [20, 18], [29, 0]])// .fill(Color.White)
  32 + // .fillOpacity(0.2)
  33 + // .fill(Color.White)
34 // .linearGradient({ 34 // .linearGradient({
35 // direction: GradientDirection.Right, 35 // direction: GradientDirection.Right,
36 // colors: [[0xffffff, 1.0], [0xffffff, 0.75], [0xffffff, 0.5], [0xffffff, 0.0], [0xffffff, 0.0]] 36 // colors: [[0xffffff, 1.0], [0xffffff, 0.75], [0xffffff, 0.5], [0xffffff, 0.0], [0xffffff, 0.0]]
37 // }) 37 // })
  38 + Row()
  39 + .width('29vp')
  40 + .height('18vp')
  41 + .clip(new Path({
  42 + commands: `M0 0 H${vp2px(29)} L${vp2px(20)} ${vp2px(18)} L0 ${vp2px(18)} Z`
  43 + }))
  44 + .linearGradient({
  45 + direction: GradientDirection.Right, // 渐变方向
  46 + repeating: false, // 渐变颜色是否重复
  47 + colors: [[0x1affffff, 0.0],[0x1affffff, 0.3], [0x33ffffff, 0.6], [0x4dffffff,1]] // 数组末尾元素占比小于1时满足重复着色效果
  48 + })
  49 +
38 Text(this.title ?? "") 50 Text(this.title ?? "")
39 - .margin({ left: 5 })  
40 - .fontSize(20) 51 + .margin({ left: 10 })
  52 + .fontSize(22)
41 .fontColor($r('app.color.white')) 53 .fontColor($r('app.color.white'))
  54 + .fontWeight(900)
42 .maxLines(1) 55 .maxLines(1)
43 56
  57 +
44 Text(this.subTitle ?? '')// Text('2024年\n1月16日') 58 Text(this.subTitle ?? '')// Text('2024年\n1月16日')
45 // .width(50) 59 // .width(50)
46 - .margin({ left: 5 })  
47 - .fontSize(8) 60 + .margin({ left: 6 })
  61 + .fontSize(10)
48 .fontColor($r('app.color.white')) 62 .fontColor($r('app.color.white'))
49 .maxLines(2) 63 .maxLines(2)
  64 + .textAlign(TextAlign.End)
50 this.rightDecorateBuilder() 65 this.rightDecorateBuilder()
51 // .linearGradient({ 66 // .linearGradient({
52 // direction: GradientDirection.Right, 67 // direction: GradientDirection.Right,
53 // colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x4Dffffff, 0.75], [0x1ffffff, 0.0]] 68 // colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x4Dffffff, 0.75], [0x1ffffff, 0.0]]
54 // }) 69 // })
55 - Image($r('app.media.bg_event_status_end'))  
56 - .height($r('app.float.top_arrow_size'))  
57 - .width(100)  
58 - .visibility(Visibility.None) 70 + // Image($r('app.media.bg_event_status_end'))
  71 + // .height($r('app.float.top_arrow_size'))
  72 + // .width(100)
  73 + // .visibility(Visibility.None)
  74 +
59 } 75 }
60 .height('100%') 76 .height('100%')
61 .alignItems(VerticalAlign.Center) 77 .alignItems(VerticalAlign.Center)
@@ -87,7 +103,7 @@ export struct PaperTitleComponent { @@ -87,7 +103,7 @@ export struct PaperTitleComponent {
87 center: { anchor: "__container__", align: VerticalAlign.Center } 103 center: { anchor: "__container__", align: VerticalAlign.Center }
88 }) 104 })
89 .id('img_share') 105 .id('img_share')
90 - .margin({ right: 13 }) 106 + .margin({ right: 16 })
91 .onClick(() => { 107 .onClick(() => {
92 ToastUtils.showToast('分享为公共方法,待开发', 1000) 108 ToastUtils.showToast('分享为公共方法,待开发', 1000)
93 }) 109 })
@@ -105,19 +121,32 @@ export struct PaperTitleComponent { @@ -105,19 +121,32 @@ export struct PaperTitleComponent {
105 121
106 @Builder 122 @Builder
107 rightDecorateBuilder() { 123 rightDecorateBuilder() {
108 - Row() {  
109 - Polygon({ width: 20, height: 18 })  
110 - .points([[8, 0], [0, 18], [20, 18], [20, 0]])// .fill(Color.White)  
111 - .fillOpacity(0.3)  
112 - .fill(Color.White)  
113 - Rect({ width: 80, height: 18 })// .fillOpacity(0.3)  
114 - .fill(Color.White)  
115 - .fillOpacity(0.01) 124 + Row()
  125 + .width('100vp')
  126 + .height('18vp')
  127 + .clip(new Path({
  128 + commands: `M${vp2px(9)} 0 H${vp2px(91)} V${vp2px(18)} L0 ${vp2px(18)} Z`
  129 + }))
116 .linearGradient({ 130 .linearGradient({
117 - direction: GradientDirection.Right,  
118 - colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x40ffffff, 0.25], [0x1ffffff, 0.0]] 131 + direction: GradientDirection.Right, // 渐变方向
  132 + repeating: false, // 渐变颜色是否重复
  133 + colors: [[0x4dffffff, 0.0], [0x33ffffff, 0.3], [0x1affffff,0.6], [0x03ffffff,1]] // 数组末尾元素占比小于1时满足重复着色效果
119 }) 134 })
120 - }  
121 - .margin({ left: 6 }) 135 + .margin({ left:8, right: 0})
  136 +
  137 + // Row() {
  138 + // Polygon({ width: 20, height: 18 })
  139 + // .points([[8, 0], [0, 18], [20, 18], [20, 0]])// .fill(Color.White)
  140 + // .fillOpacity(0.3)
  141 + // .fill(Color.White)
  142 + // Rect({ width: 80, height: 18 })// .fillOpacity(0.3)
  143 + // .fill(Color.White)
  144 + // .fillOpacity(0.01)
  145 + // .linearGradient({
  146 + // direction: GradientDirection.Right,
  147 + // colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x40ffffff, 0.25], [0x1ffffff, 0.0]]
  148 + // })
  149 + // }
  150 + // .margin({ left: 6 })
122 } 151 }
123 } 152 }
@@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter'; @@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter';
4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; 4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
6 import { Notes } from './notes'; 6 import { Notes } from './notes';
  7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 8
8 /** 9 /**
9 * 大专题卡--CompStyle: 10 10 * 大专题卡--CompStyle: 10
@@ -14,6 +15,11 @@ const TAG: string = 'Card10Component'; @@ -14,6 +15,11 @@ const TAG: string = 'Card10Component';
14 @Component 15 @Component
15 export struct Card10Component { 16 export struct Card10Component {
16 @State contentDTO: ContentDTO = {} as ContentDTO; 17 @State contentDTO: ContentDTO = {} as ContentDTO;
  18 + @State loadImg: boolean = false;
  19 +
  20 + async aboutToAppear(): Promise<void> {
  21 + this.loadImg = await onlyWifiLoadImg();
  22 + }
17 23
18 build() { 24 build() {
19 Column() { 25 Column() {
@@ -32,7 +38,8 @@ export struct Card10Component { @@ -32,7 +38,8 @@ export struct Card10Component {
32 } 38 }
33 // 大图 39 // 大图
34 Stack() { 40 Stack() {
35 - Image(this.contentDTO && this.contentDTO.coverUrl) 41 + Image(this.loadImg ? this.contentDTO?.coverUrl : '')
  42 + .backgroundColor(0xf5f5f5)
36 .width('100%') 43 .width('100%')
37 .borderRadius({ 44 .borderRadius({
38 topLeft: $r('app.float.image_border_radius'), 45 topLeft: $r('app.float.image_border_radius'),
@@ -117,7 +124,8 @@ export struct Card10Component { @@ -117,7 +124,8 @@ export struct Card10Component {
117 // 右侧图片 124 // 右侧图片
118 if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { 125 if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
119 Stack() { 126 Stack() {
120 - Image(item.fullColumnImgUrls[0].url) 127 + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
  128 + .backgroundColor(0xf5f5f5)
121 .width(117) 129 .width(117)
122 .height(78) 130 .height(78)
123 .objectFit(ImageFit.Cover) 131 .objectFit(ImageFit.Cover)
@@ -4,6 +4,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo' @@ -4,6 +4,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
4 import { CommonConstants } from 'wdConstant/Index'; 4 import { CommonConstants } from 'wdConstant/Index';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
6 import {CarderInteraction} from '../CarderInteraction' 6 import {CarderInteraction} from '../CarderInteraction'
  7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 8
8 const TAG = 'Card14Component'; 9 const TAG = 'Card14Component';
9 10
@@ -12,41 +13,11 @@ const TAG = 'Card14Component'; @@ -12,41 +13,11 @@ const TAG = 'Card14Component';
12 */ 13 */
13 @Component 14 @Component
14 export struct Card14Component { 15 export struct Card14Component {
15 - @State contentDTO: ContentDTO = {  
16 - appStyle: '20',  
17 - coverType: 1,  
18 - coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',  
19 - fullColumnImgUrls: [  
20 - {  
21 - landscape: 1,  
22 - size: 1,  
23 - url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',  
24 - weight: 1600  
25 - }  
26 - ],  
27 - newsTitle: '好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》',  
28 - rmhInfo: {  
29 - authIcon:  
30 - 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',  
31 - authTitle: '10后音乐人王烁然个人人民号',  
32 - authTitle2: '10后音乐人王烁然个人人民号',  
33 - banControl: 0,  
34 - cnIsAttention: 1,  
35 - rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',  
36 - rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',  
37 - rmhName: '王烁然',  
38 - userId: '522435359667845',  
39 - userType: '2'  
40 - },  
41 - objectType: '1',  
42 - videoInfo: {  
43 - firstFrameImageUri: '',  
44 - videoDuration: 37,  
45 - videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'  
46 - }  
47 - } as ContentDTO; 16 + @State contentDTO: ContentDTO = {} as ContentDTO;
  17 + @State loadImg: boolean = false;
48 18
49 - aboutToAppear(): void { 19 + async aboutToAppear(): Promise<void> {
  20 + this.loadImg = await onlyWifiLoadImg();
50 } 21 }
51 22
52 build() { 23 build() {
@@ -69,7 +40,8 @@ export struct Card14Component { @@ -69,7 +40,8 @@ export struct Card14Component {
69 .margin({right: 12}) 40 .margin({right: 12})
70 .flexBasis(214) 41 .flexBasis(214)
71 42
72 - Image(this.contentDTO.coverUrl) 43 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  44 + .backgroundColor(0xf5f5f5)
73 .flexBasis(117) 45 .flexBasis(117)
74 .height(78) 46 .height(78)
75 .borderRadius($r('app.float.image_border_radius')) 47 .borderRadius($r('app.float.image_border_radius'))
@@ -4,6 +4,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle' @@ -4,6 +4,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle'
4 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 4 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
5 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
6 import {CarderInteraction} from '../CarderInteraction' 6 import {CarderInteraction} from '../CarderInteraction'
  7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 8
8 const TAG: string = 'Card15Component'; 9 const TAG: string = 'Card15Component';
9 10
@@ -16,45 +17,13 @@ const TAG: string = 'Card15Component'; @@ -16,45 +17,13 @@ const TAG: string = 'Card15Component';
16 */ 17 */
17 @Component 18 @Component
18 export struct Card15Component { 19 export struct Card15Component {
19 - @State contentDTO: ContentDTO = {  
20 - // appStyle: '15',  
21 - // coverType: 1,  
22 - // objectType: '9',  
23 - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',  
24 - // fullColumnImgUrls: [  
25 - // {  
26 - // landscape: 2,  
27 - // size: 1,  
28 - // url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',  
29 - // weight: 1170  
30 - // }  
31 - // ],  
32 - // newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们',  
33 - // publishTime: '1712993333000',  
34 - // rmhInfo: {  
35 - // authIcon: '',  
36 - // authTitle: '',  
37 - // authTitle2: '',  
38 - // banControl: 0,  
39 - // cnIsAttention: 1,  
40 - // rmhDesc: '中共武汉市委机关报长江日报官方人民号',  
41 - // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',  
42 - // rmhId: '4255270',  
43 - // rmhName: '长江日报',  
44 - // userId: '513696944662469',  
45 - // userType: '3'  
46 - // },  
47 - // videoInfo: {  
48 - // firstFrameImageUri: '',  
49 - // videoDuration: 12,  
50 - // // videoLandscape: 2,  
51 - // videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4'  
52 - // },  
53 - // photoNum: '9',  
54 - // voiceInfo: {  
55 - // voiceDuration: 12  
56 - // }  
57 - } as ContentDTO; 20 + @State contentDTO: ContentDTO = {} as ContentDTO;
  21 + @State loadImg: boolean = false;
  22 +
  23 + async aboutToAppear(): Promise<void> {
  24 + this.loadImg = await onlyWifiLoadImg();
  25 + }
  26 +
58 27
59 build() { 28 build() {
60 Column() { 29 Column() {
@@ -71,7 +40,8 @@ export struct Card15Component { @@ -71,7 +40,8 @@ export struct Card15Component {
71 } 40 }
72 //大图 41 //大图
73 Stack() { 42 Stack() {
74 - Image(this.contentDTO.coverUrl) 43 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  44 + .backgroundColor(0xf5f5f5)
75 .borderRadius($r('app.float.image_border_radius')) 45 .borderRadius($r('app.float.image_border_radius'))
76 //播放状态+时长 46 //播放状态+时长
77 CardMediaInfo({ 47 CardMediaInfo({
@@ -4,6 +4,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo' @@ -4,6 +4,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
4 import { CommonConstants } from 'wdConstant/Index'; 4 import { CommonConstants } from 'wdConstant/Index';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
6 import {CarderInteraction} from '../CarderInteraction' 6 import {CarderInteraction} from '../CarderInteraction'
  7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 8
8 const TAG = 'Card16Component'; 9 const TAG = 'Card16Component';
9 10
@@ -18,8 +19,10 @@ interface fullColumnImgUrlItem { @@ -18,8 +19,10 @@ interface fullColumnImgUrlItem {
18 @Component 19 @Component
19 export struct Card16Component { 20 export struct Card16Component {
20 @State contentDTO: ContentDTO = {} as ContentDTO; 21 @State contentDTO: ContentDTO = {} as ContentDTO;
  22 + @State loadImg: boolean = false;
21 23
22 - aboutToAppear(): void { 24 + async aboutToAppear(): Promise<void> {
  25 + this.loadImg = await onlyWifiLoadImg();
23 } 26 }
24 27
25 build() { 28 build() {
@@ -41,7 +44,11 @@ export struct Card16Component { @@ -41,7 +44,11 @@ export struct Card16Component {
41 if (this.contentDTO.fullColumnImgUrls?.length > 0) { 44 if (this.contentDTO.fullColumnImgUrls?.length > 0) {
42 Flex() { 45 Flex() {
43 ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { 46 ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => {
44 - Image(item.url).flexBasis(113).height(75).margin({ right: index > 1 ? 0 : 2 }) 47 + Image(this.loadImg ? item.url : '')
  48 + .backgroundColor(0xf5f5f5)
  49 + .flexBasis(113)
  50 + .height(75)
  51 + .margin({ right: index > 1 ? 0 : 2 })
45 }) 52 })
46 } 53 }
47 } 54 }
@@ -70,6 +77,11 @@ interface radiusType { @@ -70,6 +77,11 @@ interface radiusType {
70 @Component 77 @Component
71 struct createImg { 78 struct createImg {
72 @Prop contentDTO: ContentDTO 79 @Prop contentDTO: ContentDTO
  80 + @State loadImg: boolean = false;
  81 +
  82 + async aboutToAppear(): Promise<void> {
  83 + this.loadImg = await onlyWifiLoadImg();
  84 + }
73 85
74 build() { 86 build() {
75 GridRow() { 87 GridRow() {
@@ -79,7 +91,8 @@ struct createImg { @@ -79,7 +91,8 @@ struct createImg {
79 span: { xs: 12 } 91 span: { xs: 12 }
80 }) { 92 }) {
81 Stack() { 93 Stack() {
82 - Image(this.contentDTO.coverUrl) 94 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  95 + .backgroundColor(0xf5f5f5)
83 .width(CommonConstants.FULL_WIDTH) 96 .width(CommonConstants.FULL_WIDTH)
84 .aspectRatio(16 / 9) 97 .aspectRatio(16 / 9)
85 .borderRadius($r('app.float.image_border_radius')) 98 .borderRadius($r('app.float.image_border_radius'))
@@ -93,7 +106,8 @@ struct createImg { @@ -93,7 +106,8 @@ struct createImg {
93 span: { xs: 6 } 106 span: { xs: 6 }
94 }) { 107 }) {
95 Stack() { 108 Stack() {
96 - Image(this.contentDTO.coverUrl) 109 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  110 + .backgroundColor(0xf5f5f5)
97 .width(CommonConstants.FULL_WIDTH) 111 .width(CommonConstants.FULL_WIDTH)
98 .borderRadius($r('app.float.image_border_radius')) 112 .borderRadius($r('app.float.image_border_radius'))
99 CardMediaInfo({ contentDTO: this.contentDTO }) 113 CardMediaInfo({ contentDTO: this.contentDTO })
@@ -5,6 +5,8 @@ import { DateTimeUtils } from 'wdKit'; @@ -5,6 +5,8 @@ import { DateTimeUtils } from 'wdKit';
5 import { WDRouterRule } from 'wdRouter'; 5 import { WDRouterRule } from 'wdRouter';
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 7 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  8 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  9 +
8 const TAG = 'Card17Component'; 10 const TAG = 'Card17Component';
9 11
10 /** 12 /**
@@ -14,6 +16,12 @@ const TAG = 'Card17Component'; @@ -14,6 +16,12 @@ const TAG = 'Card17Component';
14 export struct Card17Component { 16 export struct Card17Component {
15 @State compDTO: CompDTO = {} as CompDTO 17 @State compDTO: CompDTO = {} as CompDTO
16 @State contentDTO: ContentDTO = {} as ContentDTO; 18 @State contentDTO: ContentDTO = {} as ContentDTO;
  19 + @State loadImg: boolean = false;
  20 +
  21 + async aboutToAppear(): Promise<void> {
  22 + this.loadImg = await onlyWifiLoadImg();
  23 + }
  24 +
17 25
18 build() { 26 build() {
19 Column({ space: 8 }) { 27 Column({ space: 8 }) {
@@ -29,8 +37,8 @@ export struct Card17Component { @@ -29,8 +37,8 @@ export struct Card17Component {
29 // 三个图, 37 // 三个图,
30 GridRow({ gutter: 2 }) { 38 GridRow({ gutter: 2 }) {
31 GridCol({ span: { xs: 8 } }) { 39 GridCol({ span: { xs: 8 } }) {
32 - Image(this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'')  
33 - .backgroundColor('#f5f5f5') 40 + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'' : '')
  41 + .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
34 .width(CommonConstants.FULL_WIDTH) 42 .width(CommonConstants.FULL_WIDTH)
35 .aspectRatio(16 / 9) 43 .aspectRatio(16 / 9)
36 .borderRadius({ 44 .borderRadius({
@@ -40,8 +48,8 @@ export struct Card17Component { @@ -40,8 +48,8 @@ export struct Card17Component {
40 } 48 }
41 49
42 GridCol({ span: { xs: 4 } }) { 50 GridCol({ span: { xs: 4 } }) {
43 - Image(this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'')  
44 - .backgroundColor('#f5f5f5') 51 + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'' : '')
  52 + .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
45 .width(CommonConstants.FULL_WIDTH) 53 .width(CommonConstants.FULL_WIDTH)
46 .aspectRatio(16 / 9) 54 .aspectRatio(16 / 9)
47 .margin({ bottom: 1 }) 55 .margin({ bottom: 1 })
@@ -56,8 +64,8 @@ export struct Card17Component { @@ -56,8 +64,8 @@ export struct Card17Component {
56 } 64 }
57 65
58 GridCol({ span: { xs: 4 } }) { 66 GridCol({ span: { xs: 4 } }) {
59 - Image(this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'')  
60 - .backgroundColor('#f5f5f5') 67 + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'' : '')
  68 + .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
61 .width(CommonConstants.FULL_WIDTH) 69 .width(CommonConstants.FULL_WIDTH)
62 .aspectRatio(16 / 9) 70 .aspectRatio(16 / 9)
63 .margin({ top: 1 }) 71 .margin({ top: 1 })
@@ -3,6 +3,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle' @@ -3,6 +3,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle'
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { CommonConstants } from 'wdConstant/Index'; 4 import { CommonConstants } from 'wdConstant/Index';
5 import {CarderInteraction} from '../CarderInteraction' 5 import {CarderInteraction} from '../CarderInteraction'
  6 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
6 7
7 const TAG = 'Card19Component'; 8 const TAG = 'Card19Component';
8 9
@@ -12,69 +13,8 @@ const TAG = 'Card19Component'; @@ -12,69 +13,8 @@ const TAG = 'Card19Component';
12 @Component 13 @Component
13 export struct Card19Component { 14 export struct Card19Component {
14 @State contentDTO: ContentDTO = { 15 @State contentDTO: ContentDTO = {
15 - // appStyle: '19',  
16 - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
17 - // fullColumnImgUrls: [  
18 - // {  
19 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',  
20 - // height: 1500,  
21 - // landscape: 1,  
22 - // size: 1,  
23 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
24 - // weight: 2000  
25 - // },  
26 - // {  
27 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',  
28 - // height: 1500,  
29 - // landscape: 1,  
30 - // size: 1,  
31 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
32 - // weight: 2000  
33 - // },  
34 - // {  
35 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',  
36 - // height: 1280,  
37 - // landscape: 1,  
38 - // size: 1,  
39 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
40 - // weight: 1707  
41 - // },  
42 - // {  
43 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',  
44 - // height: 1280,  
45 - // landscape: 1,  
46 - // size: 1,  
47 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
48 - // weight: 1707  
49 - // }  
50 - // ],  
51 - // newsSummary: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',  
52 - // newsTitle: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',  
53 - // publishTime: '1711185754000',  
54 - // relType: '1',  
55 - // rmhInfo: {  
56 - // authIcon: '',  
57 - // authTitle: '',  
58 - // authTitle2: '',  
59 - // banControl: 0,  
60 - // cnIsAttention: 1,  
61 - // cnIsComment: 1,  
62 - // cnIsLike: 1,  
63 - // cnMainControl: 1,  
64 - // cnShareControl: 1,  
65 - // posterShareControl: 1,  
66 - // rmhDesc: '合肥市公安局官方人民号',  
67 - // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',  
68 - // rmhId: '4255290',  
69 - // rmhName: '合肥警方',  
70 - // userId: '513697181730757',  
71 - // userType: '2'  
72 - // }  
73 } as ContentDTO 16 } as ContentDTO
74 17
75 - aboutToAppear(): void {  
76 - }  
77 -  
78 build() { 18 build() {
79 Column() { 19 Column() {
80 // rmh信息 20 // rmh信息
@@ -132,13 +72,17 @@ struct createImg { @@ -132,13 +72,17 @@ struct createImg {
132 @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] 72 @Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
133 @State picWidth: number = 0; 73 @State picWidth: number = 0;
134 @State picHeight: number = 0; 74 @State picHeight: number = 0;
135 - aboutToAppear(): void { 75 + @State loadImg: boolean = false;
  76 +
  77 + async aboutToAppear(): Promise<void> {
  78 + this.loadImg = await onlyWifiLoadImg();
136 if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 79 if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
137 this.fullColumnImgUrls.splice(2,0, { 80 this.fullColumnImgUrls.splice(2,0, {
138 fullUrl: '' 81 fullUrl: ''
139 } as FullColumnImgUrlDTO) 82 } as FullColumnImgUrlDTO)
140 } 83 }
141 } 84 }
  85 +
142 caclImageRadius(index: number) { 86 caclImageRadius(index: number) {
143 let radius: radiusType = { 87 let radius: radiusType = {
144 topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, 88 topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
@@ -191,13 +135,14 @@ struct createImg { @@ -191,13 +135,14 @@ struct createImg {
191 alignContent: Alignment.BottomEnd 135 alignContent: Alignment.BottomEnd
192 }) { 136 }) {
193 if (this.getPicType() === 1) { 137 if (this.getPicType() === 1) {
194 - Image(item.fullUrl) 138 + Image(this.loadImg ? item.fullUrl : '')
  139 + .backgroundColor(0xf5f5f5)
195 .width('100%') 140 .width('100%')
196 // .height(172) 141 // .height(172)
197 .autoResize(true) 142 .autoResize(true)
198 .borderRadius(this.caclImageRadius(index)) 143 .borderRadius(this.caclImageRadius(index))
199 } else if (this.getPicType() === 2) { 144 } else if (this.getPicType() === 2) {
200 - Image(item.fullUrl) 145 + Image(this.loadImg ? item.fullUrl : '')
201 // .width('100%') 146 // .width('100%')
202 .height(305) 147 .height(305)
203 .autoResize(true) 148 .autoResize(true)
@@ -223,7 +168,8 @@ struct createImg { @@ -223,7 +168,8 @@ struct createImg {
223 GridCol({ 168 GridCol({
224 span: { xs: 8 } 169 span: { xs: 8 }
225 }) { 170 }) {
226 - Image(item.fullUrl) 171 + Image(this.loadImg ? item.fullUrl : '')
  172 + .backgroundColor(0xf5f5f5)
227 .width('100%') 173 .width('100%')
228 .borderRadius(this.caclImageRadius(index)) 174 .borderRadius(this.caclImageRadius(index))
229 .autoResize(true) 175 .autoResize(true)
@@ -238,7 +184,8 @@ struct createImg { @@ -238,7 +184,8 @@ struct createImg {
238 GridCol({ 184 GridCol({
239 span: { xs: 4 } 185 span: { xs: 4 }
240 }) { 186 }) {
241 - Image(item.fullUrl) 187 + Image(this.loadImg ? item.fullUrl : '')
  188 + .backgroundColor(0xf5f5f5)
242 .aspectRatio(1) 189 .aspectRatio(1)
243 .borderRadius(this.caclImageRadius(index)) 190 .borderRadius(this.caclImageRadius(index))
244 } 191 }
@@ -246,7 +193,8 @@ struct createImg { @@ -246,7 +193,8 @@ struct createImg {
246 GridCol({ 193 GridCol({
247 span: { sm: 4, lg: 3 } 194 span: { sm: 4, lg: 3 }
248 }) { 195 }) {
249 - Image(item.fullUrl) 196 + Image(this.loadImg ? item.fullUrl : '')
  197 + .backgroundColor(0xf5f5f5)
250 .aspectRatio(1) 198 .aspectRatio(1)
251 .borderRadius(this.caclImageRadius(index)) 199 .borderRadius(this.caclImageRadius(index))
252 } 200 }
@@ -4,6 +4,8 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo' @@ -4,6 +4,8 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
4 import { CommonConstants } from 'wdConstant/Index'; 4 import { CommonConstants } from 'wdConstant/Index';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
6 import {CarderInteraction} from '../CarderInteraction' 6 import {CarderInteraction} from '../CarderInteraction'
  7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  8 +
7 const TAG = 'Card20Component'; 9 const TAG = 'Card20Component';
8 10
9 /** 11 /**
@@ -12,37 +14,6 @@ const TAG = 'Card20Component'; @@ -12,37 +14,6 @@ const TAG = 'Card20Component';
12 @Component 14 @Component
13 export struct Card20Component { 15 export struct Card20Component {
14 @State contentDTO: ContentDTO = { 16 @State contentDTO: ContentDTO = {
15 - // appStyle: '20',  
16 - // coverType: 1,  
17 - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',  
18 - // fullColumnImgUrls: [  
19 - // {  
20 - // landscape: 1,  
21 - // size: 1,  
22 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',  
23 - // weight: 1600  
24 - // }  
25 - // ],  
26 - // newsTitle: '好玩!》',  
27 - // rmhInfo: {  
28 - // authIcon:  
29 - // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',  
30 - // authTitle: '10后音乐人王烁然个人人民号',  
31 - // authTitle2: '10后音乐人王烁然个人人民号',  
32 - // banControl: 0,  
33 - // cnIsAttention: 1,  
34 - // rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',  
35 - // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',  
36 - // rmhName: '王烁然',  
37 - // userId: '522435359667845',  
38 - // userType: '2'  
39 - // },  
40 - // objectType: '1',  
41 - // videoInfo: {  
42 - // firstFrameImageUri: '',  
43 - // videoDuration: 37,  
44 - // videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'  
45 - // }  
46 } as ContentDTO; 17 } as ContentDTO;
47 18
48 aboutToAppear(): void { 19 aboutToAppear(): void {
@@ -90,6 +61,12 @@ interface radiusType { @@ -90,6 +61,12 @@ interface radiusType {
90 @Component 61 @Component
91 struct createImg { 62 struct createImg {
92 @Prop contentDTO: ContentDTO 63 @Prop contentDTO: ContentDTO
  64 + @State loadImg: boolean = false;
  65 +
  66 + async aboutToAppear(): Promise<void> {
  67 + this.loadImg = await onlyWifiLoadImg();
  68 + }
  69 +
93 70
94 build() { 71 build() {
95 GridRow() { 72 GridRow() {
@@ -99,7 +76,8 @@ struct createImg { @@ -99,7 +76,8 @@ struct createImg {
99 span: { xs: 12 } 76 span: { xs: 12 }
100 }) { 77 }) {
101 Stack() { 78 Stack() {
102 - Image(this.contentDTO.coverUrl) 79 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  80 + .backgroundColor(0xf5f5f5)
103 .width(CommonConstants.FULL_WIDTH) 81 .width(CommonConstants.FULL_WIDTH)
104 .aspectRatio(16 / 9) 82 .aspectRatio(16 / 9)
105 .borderRadius($r('app.float.image_border_radius')) 83 .borderRadius($r('app.float.image_border_radius'))
@@ -116,7 +94,8 @@ struct createImg { @@ -116,7 +94,8 @@ struct createImg {
116 span: { xs: 6 } 94 span: { xs: 6 }
117 }) { 95 }) {
118 Stack() { 96 Stack() {
119 - Image(this.contentDTO.coverUrl) 97 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  98 + .backgroundColor(0xf5f5f5)
120 .width(CommonConstants.FULL_WIDTH) 99 .width(CommonConstants.FULL_WIDTH)
121 .borderRadius($r('app.float.image_border_radius')) 100 .borderRadius($r('app.float.image_border_radius'))
122 CardMediaInfo({ contentDTO: this.contentDTO }) 101 CardMediaInfo({ contentDTO: this.contentDTO })
@@ -4,6 +4,8 @@ import { ProcessUtils } from 'wdRouter'; @@ -4,6 +4,8 @@ import { ProcessUtils } from 'wdRouter';
4 import { RmhTitle } from '../cardCommon/RmhTitle' 4 import { RmhTitle } from '../cardCommon/RmhTitle'
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import {CarderInteraction} from '../CarderInteraction' 6 import {CarderInteraction} from '../CarderInteraction'
  7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  8 +
7 const TAG: string = 'Card6Component-Card13Component'; 9 const TAG: string = 'Card6Component-Card13Component';
8 10
9 /** 11 /**
@@ -12,6 +14,11 @@ const TAG: string = 'Card6Component-Card13Component'; @@ -12,6 +14,11 @@ const TAG: string = 'Card6Component-Card13Component';
12 @Component 14 @Component
13 export struct Card21Component { 15 export struct Card21Component {
14 @State contentDTO: ContentDTO = {} as ContentDTO; 16 @State contentDTO: ContentDTO = {} as ContentDTO;
  17 + @State loadImg: boolean = false;
  18 +
  19 + async aboutToAppear(): Promise<void> {
  20 + this.loadImg = await onlyWifiLoadImg();
  21 + }
15 22
16 build() { 23 build() {
17 Column() { 24 Column() {
@@ -32,7 +39,8 @@ export struct Card21Component { @@ -32,7 +39,8 @@ export struct Card21Component {
32 39
33 GridItem() { 40 GridItem() {
34 Stack() { 41 Stack() {
35 - Image(this.contentDTO.coverUrl) 42 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  43 + .backgroundColor(0xf5f5f5)
36 .width(CommonConstants.FULL_WIDTH) 44 .width(CommonConstants.FULL_WIDTH)
37 .borderRadius($r('app.float.image_border_radius')) 45 .borderRadius($r('app.float.image_border_radius'))
38 CardMediaInfo({ contentDTO: this.contentDTO }) 46 CardMediaInfo({ contentDTO: this.contentDTO })
@@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter'; @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; 6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
7 import { Notes } from './notes'; 7 import { Notes } from './notes';
  8 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 9
9 const TAG: string = 'Card2Component'; 10 const TAG: string = 'Card2Component';
10 11
@@ -17,21 +18,12 @@ const TAG: string = 'Card2Component'; @@ -17,21 +18,12 @@ const TAG: string = 'Card2Component';
17 */ 18 */
18 @Component 19 @Component
19 export struct Card2Component { 20 export struct Card2Component {
20 - @State contentDTO: ContentDTO = {  
21 - // appStyle: '2',  
22 - // objectType: '1',  
23 - // coverUrl:  
24 - // 'https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404141115457926.png?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',  
25 - // newsTitle: '又见花开!新疆伊犁花海延绵清新怡人',  
26 - // publishTime: '1713067227000',  
27 - // source: '荔枝新闻',  
28 - // videoInfo: {  
29 - // videoDuration: 25,  
30 - // videoLandscape: 1,  
31 - // videoUrl:  
32 - // 'https://rmrbcmsonline.peopleapp.com/upload/video/mp4/202404/1713064515901314d148763996.mp4'  
33 - // }  
34 - } as ContentDTO; 21 + @State contentDTO: ContentDTO = {} as ContentDTO;
  22 + @State loadImg: boolean = false;
  23 +
  24 + async aboutToAppear(): Promise<void> {
  25 + this.loadImg = await onlyWifiLoadImg();
  26 + }
35 27
36 build() { 28 build() {
37 Column() { 29 Column() {
@@ -53,10 +45,11 @@ export struct Card2Component { @@ -53,10 +45,11 @@ export struct Card2Component {
53 45
54 //大图 46 //大图
55 Stack() { 47 Stack() {
56 - Image(this.contentDTO.coverUrl) 48 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
57 .width(CommonConstants.FULL_WIDTH) 49 .width(CommonConstants.FULL_WIDTH)
58 .aspectRatio(16 / 9) 50 .aspectRatio(16 / 9)
59 .borderRadius($r('app.float.image_border_radius')) 51 .borderRadius($r('app.float.image_border_radius'))
  52 + .backgroundColor(0xf5f5f5)
60 //播放状态+时长 53 //播放状态+时长
61 CardMediaInfo({ 54 CardMediaInfo({
62 contentDTO: this.contentDTO 55 contentDTO: this.contentDTO
@@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  6 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
6 const TAG: string = 'Card4Component'; 7 const TAG: string = 'Card4Component';
7 8
8 /** 9 /**
@@ -14,62 +15,12 @@ const TAG: string = 'Card4Component'; @@ -14,62 +15,12 @@ const TAG: string = 'Card4Component';
14 */ 15 */
15 @Component 16 @Component
16 export struct Card4Component { 17 export struct Card4Component {
17 - @State contentDTO: ContentDTO = {  
18 - // appStyle: '4',  
19 - // fullColumnImgUrls: [  
20 - // {  
21 - // format: null,  
22 - // fullUrl: '',  
23 - // height: 187,  
24 - // landscape: 1,  
25 - // size: 1,  
26 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',  
27 - // weight: 248  
28 - // },  
29 - // {  
30 - // format: null,  
31 - // fullUrl: '',  
32 - // height: 187,  
33 - // landscape: 1,  
34 - // size: 1,  
35 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',  
36 - // weight: 248  
37 - // },  
38 - // {  
39 - // format: null,  
40 - // fullUrl: '',  
41 - // height: 187,  
42 - // landscape: 1,  
43 - // size: 1,  
44 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118200_d10309bee894a67311e6c8f77df676d4.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',  
45 - // weight: 248  
46 - // },  
47 - // {  
48 - // format: null,  
49 - // fullUrl: '',  
50 - // height: 187,  
51 - // landscape: 1,  
52 - // size: 1,  
53 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118202_f33743e452fb69ee2c45c18a56eccdf6.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',  
54 - // weight: 248  
55 - // }  
56 - // ],  
57 - // newsTitle: '科普:如何发现家中是否有白蚁危害?丨又到白蚁分飞季②',  
58 - // rmhInfo: {  
59 - // authIcon:  
60 - // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png',  
61 - // authTitle: '封面新闻',  
62 - // rmhDesc: '封面新闻,亿万年轻人的生活方式。',  
63 - // rmhHeadUrl:  
64 - // 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221212/122faff796.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',  
65 - // rmhId: '2016608',  
66 - // rmhName: '封面新闻',  
67 - // userId: '522390888224390',  
68 - // userType: '2'  
69 - // },  
70 - // source: '头条号',  
71 - // publishTime: '1651204607000',  
72 - } as ContentDTO; 18 + @State contentDTO: ContentDTO = {} as ContentDTO;
  19 + @State loadImg: boolean = false;
  20 +
  21 + async aboutToAppear(): Promise<void> {
  22 + this.loadImg = await onlyWifiLoadImg();
  23 + }
73 24
74 build() { 25 build() {
75 Column() { 26 Column() {
@@ -88,7 +39,8 @@ export struct Card4Component { @@ -88,7 +39,8 @@ export struct Card4Component {
88 ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { 39 ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
89 if (index < 3) { 40 if (index < 3) {
90 GridCol({ span: { xs: 4 } }) { 41 GridCol({ span: { xs: 4 } }) {
91 - Image(item.url) 42 + Image(this.loadImg ? item.url : '')
  43 + .backgroundColor(0xf5f5f5)
92 .width('100%') 44 .width('100%')
93 .aspectRatio(113 / 75) 45 .aspectRatio(113 / 75)
94 .borderRadius({ 46 .borderRadius({
1 import { ContentDTO } from 'wdBean'; 1 import { ContentDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant'; 2 import { CommonConstants } from 'wdConstant';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
  4 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
4 import { Notes } from './notes'; 5 import { Notes } from './notes';
5 6
6 const TAG: string = 'Card5Component'; 7 const TAG: string = 'Card5Component';
@@ -11,33 +12,30 @@ const TAG: string = 'Card5Component'; @@ -11,33 +12,30 @@ const TAG: string = 'Card5Component';
11 // @Entry 12 // @Entry
12 @Component 13 @Component
13 export struct Card5Component { 14 export struct Card5Component {
14 - @State contentDTO: ContentDTO = {  
15 - // coverSize: '850*478',  
16 - // coverType: 1,  
17 - // coverUrl:  
18 - // 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240323/image/display/54ce2de0d20842839e96a644c78361b7.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
19 - // linkUrl:  
20 - // 'https://pd-people-uat.pdnews.cn/h/atv/collect/1000000472?hiddenNavigator=1',  
21 - // newsTitle: '今天是周日,天气阴天,明天是周一。',  
22 - // objectType: '6'  
23 - } as ContentDTO; 15 + @State contentDTO: ContentDTO = {} as ContentDTO;
24 @State titleShowPolicy: number | string = 1 16 @State titleShowPolicy: number | string = 1
  17 + @State loadImg: boolean = false;
  18 +
  19 + async aboutToAppear(): Promise<void> {
  20 + this.loadImg = await onlyWifiLoadImg();
  21 + }
25 22
26 build() { 23 build() {
27 Stack() { 24 Stack() {
28 - Image(this.contentDTO.coverUrl) 25 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  26 + .backgroundColor(0xf5f5f5)
29 .width(CommonConstants.FULL_WIDTH) 27 .width(CommonConstants.FULL_WIDTH)
30 .autoResize(true) 28 .autoResize(true)
31 .borderRadius($r('app.float.image_border_radius')) 29 .borderRadius($r('app.float.image_border_radius'))
32 if ((this.titleShowPolicy === 1 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) { 30 if ((this.titleShowPolicy === 1 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) {
33 - // Row()  
34 - // .width(CommonConstants.FULL_WIDTH)  
35 - // .height(59)  
36 - // .linearGradient({  
37 - // colors: [  
38 - // ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]  
39 - // ]  
40 - // }) 31 + Row()
  32 + .width(CommonConstants.FULL_WIDTH)
  33 + .height(59)
  34 + .linearGradient({
  35 + colors: [
  36 + ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
  37 + ]
  38 + })
41 Row() { 39 Row() {
42 Stack() { 40 Stack() {
43 if (this.contentDTO.objectType == '5') { 41 if (this.contentDTO.objectType == '5') {
@@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter'; @@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter';
4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; 4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
6 import { Notes } from './notes'; 6 import { Notes } from './notes';
  7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 8
8 const TAG: string = 'Card6Component-Card13Component'; 9 const TAG: string = 'Card6Component-Card13Component';
9 10
@@ -13,6 +14,11 @@ const TAG: string = 'Card6Component-Card13Component'; @@ -13,6 +14,11 @@ const TAG: string = 'Card6Component-Card13Component';
13 @Component 14 @Component
14 export struct Card6Component { 15 export struct Card6Component {
15 @State contentDTO: ContentDTO = {} as ContentDTO; 16 @State contentDTO: ContentDTO = {} as ContentDTO;
  17 + @State loadImg: boolean = false;
  18 +
  19 + async aboutToAppear(): Promise<void> {
  20 + this.loadImg = await onlyWifiLoadImg();
  21 + }
16 22
17 build() { 23 build() {
18 Row() { 24 Row() {
@@ -57,8 +63,8 @@ export struct Card6Component { @@ -57,8 +63,8 @@ export struct Card6Component {
57 .width('58%') 63 .width('58%')
58 64
59 Stack() { 65 Stack() {
60 - Image(this.contentDTO.coverUrl)  
61 - .backgroundColor($r('app.color.color_B0B0B0')) 66 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  67 + .backgroundColor( this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
62 .borderRadius(5) 68 .borderRadius(5)
63 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) 69 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
64 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) 70 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180)
@@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant'; @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant';
3 import { DateTimeUtils } from 'wdKit'; 3 import { DateTimeUtils } from 'wdKit';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { Notes } from './notes'; 5 import { Notes } from './notes';
  6 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
6 7
7 /** 8 /**
8 * 时间链卡--CompStyle: 09 9 * 时间链卡--CompStyle: 09
@@ -12,6 +13,11 @@ const TAG: string = 'Card9Component'; @@ -12,6 +13,11 @@ const TAG: string = 'Card9Component';
12 @Component 13 @Component
13 export struct Card9Component { 14 export struct Card9Component {
14 @State contentDTO: ContentDTO = {} as ContentDTO; 15 @State contentDTO: ContentDTO = {} as ContentDTO;
  16 + @State loadImg: boolean = false;
  17 +
  18 + async aboutToAppear(): Promise<void> {
  19 + this.loadImg = await onlyWifiLoadImg();
  20 + }
15 21
16 build() { 22 build() {
17 Column() { 23 Column() {
@@ -27,7 +33,8 @@ export struct Card9Component { @@ -27,7 +33,8 @@ export struct Card9Component {
27 } 33 }
28 // 大图 34 // 大图
29 Stack() { 35 Stack() {
30 - Image(this.contentDTO.coverUrl) 36 + Image(this.loadImg ? this.contentDTO.coverUrl : '')
  37 + .backgroundColor(0xf5f5f5)
31 .width('100%') 38 .width('100%')
32 .borderRadius({ 39 .borderRadius({
33 topLeft: $r('app.float.image_border_radius'), 40 topLeft: $r('app.float.image_border_radius'),
@@ -127,7 +134,8 @@ export struct Card9Component { @@ -127,7 +134,8 @@ export struct Card9Component {
127 .alignSelf(ItemAlign.Center) 134 .alignSelf(ItemAlign.Center)
128 .margin({ left: 12 }) 135 .margin({ left: 12 })
129 if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { 136 if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
130 - Image(item.fullColumnImgUrls[0].url) 137 + Image(this.loadImg? item.fullColumnImgUrls[0].url : '')
  138 + .backgroundColor(0xf5f5f5)
131 .width(90) 139 .width(90)
132 .height(60) 140 .height(60)
133 .borderRadius($r('app.float.image_border_radius')) 141 .borderRadius($r('app.float.image_border_radius'))
@@ -4,7 +4,8 @@ import { BreakPointType, Logger } from 'wdKit'; @@ -4,7 +4,8 @@ import { BreakPointType, Logger } from 'wdKit';
4 import { CompUtils } from '../../utils/CompUtils'; 4 import { CompUtils } from '../../utils/CompUtils';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
6 import { EmptyComponent } from '../view/EmptyComponent'; 6 import { EmptyComponent } from '../view/EmptyComponent';
7 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 7 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
  8 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 9
9 const TAG = 'Zh_Carousel_Layout-01'; 10 const TAG = 'Zh_Carousel_Layout-01';
10 11
@@ -163,13 +164,19 @@ export struct ZhCarouselLayout01 { @@ -163,13 +164,19 @@ export struct ZhCarouselLayout01 {
163 struct CarouselLayout01CardView { 164 struct CarouselLayout01CardView {
164 private item: ContentDTO = {} as ContentDTO; 165 private item: ContentDTO = {} as ContentDTO;
165 private length: number = 1; // 轮播图数量 166 private length: number = 1; // 轮播图数量
  167 + @State loadImg: boolean = false;
  168 +
  169 + async aboutToAppear(): Promise<void> {
  170 + this.loadImg = await onlyWifiLoadImg();
  171 + }
166 172
167 build() { 173 build() {
168 Stack() { 174 Stack() {
169 - Image(this.item.coverUrl) 175 + Image(this.loadImg ? this.item.coverUrl : '')
170 .width(CommonConstants.FULL_PARENT) 176 .width(CommonConstants.FULL_PARENT)
171 .height(CommonConstants.FULL_PARENT) 177 .height(CommonConstants.FULL_PARENT)
172 .objectFit(ImageFit.Cover) 178 .objectFit(ImageFit.Cover)
  179 + .backgroundColor(0xf5f5f5)
173 180
174 Row() 181 Row()
175 .width(CommonConstants.FULL_PARENT) 182 .width(CommonConstants.FULL_PARENT)
@@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index';
3 import { Logger } from 'wdKit/Index'; 3 import { Logger } from 'wdKit/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import PageViewModel from '../../viewmodel/PageViewModel'; 5 import PageViewModel from '../../viewmodel/PageViewModel';
  6 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
6 7
7 const TAG = 'Zh_Grid_Layout-02'; 8 const TAG = 'Zh_Grid_Layout-02';
8 const FULL_PARENT: string = '100%'; 9 const FULL_PARENT: string = '100%';
@@ -18,18 +19,22 @@ let listSize: number = 2; @@ -18,18 +19,22 @@ let listSize: number = 2;
18 export struct ZhGridLayout02 { 19 export struct ZhGridLayout02 {
19 @State compDTO: CompDTO = {} as CompDTO 20 @State compDTO: CompDTO = {} as CompDTO
20 @State operDataList: ContentDTO[] = [] 21 @State operDataList: ContentDTO[] = []
21 - currentPage = 1  
22 - pageSize = 12 22 + @State loadImg: boolean = false;
23 23
24 - aboutToAppear() { 24 + async aboutToAppear(): Promise<void> {
25 Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) 25 Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle)
26 this.currentPage = 1 26 this.currentPage = 1
27 PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { 27 PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
28 this.operDataList = [] 28 this.operDataList = []
29 this.operDataList.push(...liveReviewDTO.list) 29 this.operDataList.push(...liveReviewDTO.list)
30 }) 30 })
  31 +
  32 + this.loadImg = await onlyWifiLoadImg();
31 } 33 }
32 34
  35 + currentPage = 1
  36 + pageSize = 12
  37 +
33 build() { 38 build() {
34 Column() { 39 Column() {
35 Scroll() { 40 Scroll() {
@@ -96,7 +101,8 @@ export struct ZhGridLayout02 { @@ -96,7 +101,8 @@ export struct ZhGridLayout02 {
96 @Builder 101 @Builder
97 buildItemCard(item: ContentDTO) { 102 buildItemCard(item: ContentDTO) {
98 Column() { 103 Column() {
99 - Image(item.fullColumnImgUrls[0].url) 104 + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
  105 + .backgroundColor(0xf5f5f5)
100 .width('100%') 106 .width('100%')
101 .height(95) 107 .height(95)
102 .borderRadius(4) 108 .borderRadius(4)
@@ -3,6 +3,7 @@ import { CompStyle } from 'wdConstant'; @@ -3,6 +3,7 @@ import { CompStyle } from 'wdConstant';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { WDRouterRule } from 'wdRouter'; 4 import { WDRouterRule } from 'wdRouter';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
  6 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
6 7
7 const TAG = 'Zh_Grid_Layout-03'; 8 const TAG = 'Zh_Grid_Layout-03';
8 const FULL_PARENT: string = '100%'; 9 const FULL_PARENT: string = '100%';
@@ -18,11 +19,13 @@ let listSize: number = 4; @@ -18,11 +19,13 @@ let listSize: number = 4;
18 @Component 19 @Component
19 export struct ZhGridLayout03 { 20 export struct ZhGridLayout03 {
20 @State compDTO: CompDTO = {} as CompDTO 21 @State compDTO: CompDTO = {} as CompDTO
  22 + @State loadImg: boolean = false;
21 23
22 - aboutToAppear() { 24 + async aboutToAppear(): Promise<void> {
23 if (this.compDTO.operDataList) { 25 if (this.compDTO.operDataList) {
24 listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length; 26 listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length;
25 } 27 }
  28 + this.loadImg = await onlyWifiLoadImg();
26 } 29 }
27 30
28 build() { 31 build() {
@@ -52,7 +55,8 @@ export struct ZhGridLayout03 { @@ -52,7 +55,8 @@ export struct ZhGridLayout03 {
52 @Builder 55 @Builder
53 buildItemCard(item: ContentDTO) { 56 buildItemCard(item: ContentDTO) {
54 Column() { 57 Column() {
55 - Image(item.coverUrl) 58 + Image(this.loadImg ? item.coverUrl : '')
  59 + .backgroundColor(0xf5f5f5)
56 .width(44) 60 .width(44)
57 .aspectRatio(1 / 1) 61 .aspectRatio(1 / 1)
58 .margin({ 62 .margin({
@@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; @@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
4 import { postInteractAccentionOperateParams } from 'wdBean'; 4 import { postInteractAccentionOperateParams } from 'wdBean';
5 import { PageRepository } from '../../repository/PageRepository'; 5 import { PageRepository } from '../../repository/PageRepository';
6 import { CommonConstants } from 'wdConstant/Index'; 6 import { CommonConstants } from 'wdConstant/Index';
7 - 7 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 /** 8 /**
9 * 兴趣卡 9 * 兴趣卡
10 * Zh_Single_Column-09 10 * Zh_Single_Column-09
@@ -18,12 +18,13 @@ export struct ZhSingleColumn09 { @@ -18,12 +18,13 @@ export struct ZhSingleColumn09 {
18 @State activeIndexs: Array<number> = [] 18 @State activeIndexs: Array<number> = []
19 @State operDataList: ContentDTO[] = this.compDTO?.operDataList || [] 19 @State operDataList: ContentDTO[] = this.compDTO?.operDataList || []
20 @State selfClosed: Boolean = false; 20 @State selfClosed: Boolean = false;
  21 + @State loadImg: boolean = false;
21 22
22 - aboutToAppear(): void { 23 + async aboutToAppear(): Promise<void> {
  24 + this.loadImg = await onlyWifiLoadImg();
23 this.operDataList = this.shuffleArray(this.compDTO?.operDataList) 25 this.operDataList = this.shuffleArray(this.compDTO?.operDataList)
24 } 26 }
25 27
26 -  
27 getItemWidth(index: number) { 28 getItemWidth(index: number) {
28 if (index % 4 === 0 || index % 4 === 3) { 29 if (index % 4 === 0 || index % 4 === 3) {
29 return 80 30 return 80
@@ -84,7 +85,8 @@ export struct ZhSingleColumn09 { @@ -84,7 +85,8 @@ export struct ZhSingleColumn09 {
84 ForEach(this.operDataList, (item: ContentDTO, index: number) => { 85 ForEach(this.operDataList, (item: ContentDTO, index: number) => {
85 GridItem() { 86 GridItem() {
86 Stack({alignContent: Alignment.TopEnd}) { 87 Stack({alignContent: Alignment.TopEnd}) {
87 - Image(item.coverUrl) 88 + Image(this.loadImg ? item.coverUrl : '')
  89 + .backgroundColor(0xf5f5f5)
88 .width('100%') 90 .width('100%')
89 .height('100%') 91 .height('100%')
90 Text(item.newsTitle) 92 Text(item.newsTitle)
@@ -5,6 +5,7 @@ import { PageRepository } from '../../repository/PageRepository'; @@ -5,6 +5,7 @@ import { PageRepository } from '../../repository/PageRepository';
5 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
6 import { ProcessUtils } from 'wdRouter'; 6 import { ProcessUtils } from 'wdRouter';
7 import { HttpUtils } from 'wdNetwork/Index'; 7 import { HttpUtils } from 'wdNetwork/Index';
  8 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 9
9 /** 10 /**
10 * 小视频横划卡 11 * 小视频横划卡
@@ -104,13 +105,21 @@ function textOverflowStyle(maxLine: number) { @@ -104,13 +105,21 @@ function textOverflowStyle(maxLine: number) {
104 struct CreatorItem { 105 struct CreatorItem {
105 @Prop item: ContentDTO 106 @Prop item: ContentDTO
106 @State rmhIsAttention: number = 0 107 @State rmhIsAttention: number = 0
  108 + @State loadImg: boolean = false;
  109 +
  110 + async aboutToAppear(): Promise<void> {
  111 + this.loadImg = await onlyWifiLoadImg();
  112 + }
  113 +
107 build() { 114 build() {
108 ListItem() { 115 ListItem() {
109 Column() { 116 Column() {
110 Stack({ alignContent: Alignment.Bottom }) { 117 Stack({ alignContent: Alignment.Bottom }) {
111 - Image(this.item.coverUrl) 118 + Image(this.loadImg ? this.item.coverUrl : '')
112 .width(156) 119 .width(156)
113 .height(208) 120 .height(208)
  121 + .backgroundColor(0xf5f5f5)
  122 +
114 Row() 123 Row()
115 .width(156) 124 .width(156)
116 .height(80) 125 .height(80)
@@ -4,9 +4,11 @@ import { postInteractAccentionOperateParams } from 'wdBean'; @@ -4,9 +4,11 @@ import { postInteractAccentionOperateParams } from 'wdBean';
4 import { PageRepository } from '../../repository/PageRepository'; 4 import { PageRepository } from '../../repository/PageRepository';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
6 import { HttpUtils } from 'wdNetwork/Index'; 6 import { HttpUtils } from 'wdNetwork/Index';
7 -import { DateTimeUtils } from 'wdKit'; 7 +import { DateTimeUtils, SPHelper } from 'wdKit';
8 import { LiveModel } from '../../viewmodel/LiveModel' 8 import { LiveModel } from '../../viewmodel/LiveModel'
9 import { Logger, ToastUtils } from 'wdKit'; 9 import { Logger, ToastUtils } from 'wdKit';
  10 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  11 +import { SpConstants } from 'wdConstant/Index'
10 12
11 /** 13 /**
12 * 直播预约卡 14 * 直播预约卡
@@ -32,12 +34,15 @@ export struct ZhSingleRow03 { @@ -32,12 +34,15 @@ export struct ZhSingleRow03 {
32 @State isEndEdge: boolean = false; 34 @State isEndEdge: boolean = false;
33 // @State reserveStatus: reserveItem[] = [] 35 // @State reserveStatus: reserveItem[] = []
34 @State reservedIds: string[] = []; 36 @State reservedIds: string[] = [];
35 - scroller: Scroller = new Scroller() 37 + @State loadImg: boolean = false;
36 38
37 - aboutToAppear(): void { 39 + async aboutToAppear(): Promise<void> {
38 this.getReserveState(); 40 this.getReserveState();
  41 + this.loadImg = await onlyWifiLoadImg();
39 } 42 }
40 43
  44 + scroller: Scroller = new Scroller()
  45 +
41 // 请求所有预约状态 46 // 请求所有预约状态
42 async getReserveState() { 47 async getReserveState() {
43 const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { 48 const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
@@ -63,6 +68,13 @@ export struct ZhSingleRow03 { @@ -63,6 +68,13 @@ export struct ZhSingleRow03 {
63 68
64 // 预约/取消预约 69 // 预约/取消预约
65 async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) { 70 async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) {
  71 + // 未登录,跳转登录
  72 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  73 + if (!user_id) {
  74 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  75 + return
  76 + }
  77 +
66 const res = await LiveModel.liveAppointment(relationId.toString(), liveId.toString(), isSubscribe); 78 const res = await LiveModel.liveAppointment(relationId.toString(), liveId.toString(), isSubscribe);
67 if (res.code == 0) { 79 if (res.code == 0) {
68 ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功') 80 ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功')
@@ -128,10 +140,12 @@ export struct ZhSingleRow03 { @@ -128,10 +140,12 @@ export struct ZhSingleRow03 {
128 ItemCard(item: ContentDTO) { 140 ItemCard(item: ContentDTO) {
129 Column() { 141 Column() {
130 Row() { 142 Row() {
131 - Image(item.coverUrl) 143 + Image(this.loadImg ? item.coverUrl : '')
132 .width(106) 144 .width(106)
133 .height(60) 145 .height(60)
134 .margin({right: 12}) 146 .margin({right: 12})
  147 + .backgroundColor(0xf5f5f5)
  148 +
135 Text(item.newsTitle) 149 Text(item.newsTitle)
136 .width(154) 150 .width(154)
137 .height(60) 151 .height(60)
@@ -256,11 +270,17 @@ function textOverflowStyle(maxLine: number) { @@ -256,11 +270,17 @@ function textOverflowStyle(maxLine: number) {
256 struct CreatorItem { 270 struct CreatorItem {
257 @Prop item: ContentDTO 271 @Prop item: ContentDTO
258 @State rmhIsAttention: number = 0 272 @State rmhIsAttention: number = 0
  273 + @State loadImg: boolean = false;
  274 +
  275 + async aboutToAppear(): Promise<void> {
  276 + this.loadImg = await onlyWifiLoadImg();
  277 + }
259 build() { 278 build() {
260 ListItem() { 279 ListItem() {
261 Column() { 280 Column() {
262 Stack({ alignContent: Alignment.Bottom }) { 281 Stack({ alignContent: Alignment.Bottom }) {
263 - Image(this.item.coverUrl) 282 + Image(this.loadImg ? this.item.coverUrl : '')
  283 + .backgroundColor(0xf5f5f5)
264 .width(156) 284 .width(156)
265 .height(208) 285 .height(208)
266 Row() 286 Row()
@@ -35,7 +35,7 @@ export struct FollowThirdTabsComponent{ @@ -35,7 +35,7 @@ export struct FollowThirdTabsComponent{
35 35
36 Text(item.directoryName) 36 Text(item.directoryName)
37 .fontSize('27lpx') 37 .fontSize('27lpx')
38 - .fontWeight(this.currentIndex === index ? "600lpx" : "400lpx") 38 + .fontWeight(this.currentIndex === index ? 600 : 400)
39 .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) 39 .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
40 .lineHeight('35lpx') 40 .lineHeight('35lpx')
41 .backgroundImage($r('app.media.ic_collect_mid')) 41 .backgroundImage($r('app.media.ic_collect_mid'))
@@ -517,7 +517,7 @@ export struct PaperSingleColumn999CardView { @@ -517,7 +517,7 @@ export struct PaperSingleColumn999CardView {
517 } 517 }
518 } 518 }
519 .backgroundColor(Color.White) 519 .backgroundColor(Color.White)
520 - .margin({ bottom: 5, left: 12, right: 12 }) 520 + .margin({ bottom: 14, left: 12, right: 12 })
521 .borderRadius(4) 521 .borderRadius(4)
522 .onClick(() => { 522 .onClick(() => {
523 ProcessUtils.processPage(this.item) 523 ProcessUtils.processPage(this.item)
@@ -13,8 +13,20 @@ const LOCAL_CHANNEL: string = '地方频道' @@ -13,8 +13,20 @@ const LOCAL_CHANNEL: string = '地方频道'
13 13
14 const TAG: string = 'ChannelSubscriptionLayout' 14 const TAG: string = 'ChannelSubscriptionLayout'
15 15
16 -@CustomDialog  
17 -struct ChannelDialog { 16 +// @Entry
  17 +@Component
  18 +struct ChannelSubscriptionLayout {
  19 + @State indexSettingArray: string [] = ['推荐', '热点']
  20 + //当前选中的频道
  21 + @Link currentTopNavSelectedIndex: number;
  22 + @Prop homeChannelList: TopNavDTO []
  23 + @Prop indexSettingChannelId: number
  24 + @Link myChannelList: TopNavDTO []
  25 + @Link moreChannelList: TopNavDTO []
  26 + @Link localChannelList: TopNavDTO []
  27 + @Link channelIds: number []
  28 + @StorageLink('channelIds') storeChannelIds: string = ''
  29 + @State isShow: boolean = false
18 @State dragItem: number = -1 30 @State dragItem: number = -1
19 private dragRefOffsetX: number = 0 31 private dragRefOffsetX: number = 0
20 private dragRefOffsetY: number = 0 32 private dragRefOffsetY: number = 0
@@ -25,26 +37,40 @@ struct ChannelDialog { @@ -25,26 +37,40 @@ struct ChannelDialog {
25 @State indexSettingTabIndex: number = 0 37 @State indexSettingTabIndex: number = 0
26 @State isEditIng: boolean = false 38 @State isEditIng: boolean = false
27 @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO 39 @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
28 - @Link currentTopNavSelectedIndex: number  
29 - @Link myChannelList: TopNavDTO[]  
30 - @Link moreChannelList: TopNavDTO[]  
31 - @Link localChannelList: TopNavDTO[]  
32 - @Link homeChannelList: TopNavDTO[]  
33 - @Link indexSettingChannelId: number  
34 - controller?: CustomDialogController  
35 - confirm: (index: number) => void = () => {  
36 - }  
37 - changeChannelIndex: (index1: number, index2: number) => void = () => {  
38 - }  
39 - delChannelItem: (index: number) => void = () => {  
40 - }  
41 - addChannelItem: (item: TopNavDTO) => void = () => { 40 + changeTab: (index: number) => void = () => {
42 } 41 }
43 42
44 aboutToAppear() { 43 aboutToAppear() {
45 this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex] 44 this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
46 } 45 }
47 46
  47 + //交换我的频道数组中的位置
  48 + changeChannelIndex(index1: number, index2: number) {
  49 + let tmp = this.myChannelList.splice(index1, 1)
  50 + let channelIdTmp = this.channelIds.splice(index1, 1)
  51 + this.myChannelList.splice(index2, 0, tmp[0])
  52 + this.channelIds.splice(index2, 0, channelIdTmp[0])
  53 + this.storeChannelIds = this.channelIds.join(',')
  54 + }
  55 + //删除频道
  56 + delChannelItem(index: number){
  57 + let item = this.myChannelList.splice(index, 1)[0]
  58 + this.channelIds.splice(index, 1)
  59 + this.storeChannelIds = this.channelIds.join(',')
  60 + if (item.moreChannel === '1') {
  61 + this.moreChannelList.unshift(item)
  62 + }
  63 + if (item.localChannel === '1') {
  64 + this.localChannelList.unshift(item)
  65 + }
  66 + }
  67 + // 添加频道
  68 + addChannelItem(item: TopNavDTO){
  69 + this.channelIds.push(item.channelId)
  70 + this.myChannelList.push(item)
  71 + this.storeChannelIds = this.channelIds.join(',')
  72 + }
  73 +
48 itemMove(index: number, newIndex: number): void { 74 itemMove(index: number, newIndex: number): void {
49 let targetItem = this.myChannelList[newIndex] 75 let targetItem = this.myChannelList[newIndex]
50 if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) { 76 if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) {
@@ -176,7 +202,8 @@ struct ChannelDialog { @@ -176,7 +202,8 @@ struct ChannelDialog {
176 } 202 }
177 } 203 }
178 204
179 - build() { 205 + @Builder
  206 + sheetBuilder() {
180 Column() { 207 Column() {
181 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 208 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
182 Image($r('app.media.icon_ren_min_ri_bao')) 209 Image($r('app.media.icon_ren_min_ri_bao'))
@@ -185,7 +212,7 @@ struct ChannelDialog { @@ -185,7 +212,7 @@ struct ChannelDialog {
185 Image($r('app.media.close_button')) 212 Image($r('app.media.close_button'))
186 .width(24) 213 .width(24)
187 .onClick(() => { 214 .onClick(() => {
188 - this.controller?.close() 215 + this.isShow = false
189 }) 216 })
190 } 217 }
191 .width('100%') 218 .width('100%')
@@ -310,8 +337,8 @@ struct ChannelDialog { @@ -310,8 +337,8 @@ struct ChannelDialog {
310 this.delChannelItem(index) 337 this.delChannelItem(index)
311 } 338 }
312 } else { 339 } else {
313 - this.confirm(index)  
314 - this.controller?.close() 340 + this.changeTab(index)
  341 + this.isShow = false
315 } 342 }
316 }), 343 }),
317 LongPressGesture({ repeat: true }) 344 LongPressGesture({ repeat: true })
@@ -464,73 +491,6 @@ struct ChannelDialog { @@ -464,73 +491,6 @@ struct ChannelDialog {
464 }) 491 })
465 .backgroundColor('#ffffff') 492 .backgroundColor('#ffffff')
466 } 493 }
467 -}  
468 -  
469 -// @Entry  
470 -@Component  
471 -struct ChannelSubscriptionLayout {  
472 - @State indexSettingArray: string [] = ['推荐', '热点']  
473 - //当前选中的频道  
474 - @Link currentTopNavSelectedIndex: number;  
475 - @Prop homeChannelList: TopNavDTO []  
476 - @Prop indexSettingChannelId: number  
477 - @Link myChannelList: TopNavDTO []  
478 - @Link moreChannelList: TopNavDTO []  
479 - @Link localChannelList: TopNavDTO []  
480 - @Link channelIds: number []  
481 - @StorageLink('channelIds') storeChannelIds: string = ''  
482 - changeTab: (index: number) => void = () => {  
483 - }  
484 - //频道弹窗点击切换频道  
485 - onAccept = (index: number) => {  
486 - this.changeTab(index)  
487 - }  
488 - //交换我的频道数组中的位置  
489 - changeChannelIndex = (index1: number, index2: number) => {  
490 - let tmp = this.myChannelList.splice(index1, 1)  
491 - let channelIdTmp = this.channelIds.splice(index1, 1)  
492 - this.myChannelList.splice(index2, 0, tmp[0])  
493 - this.channelIds.splice(index2, 0, channelIdTmp[0])  
494 - this.storeChannelIds = this.channelIds.join(',')  
495 - }  
496 - //删除频道  
497 - delChannelItem = (index: number) => {  
498 - let item = this.myChannelList.splice(index, 1)[0]  
499 - this.channelIds.splice(index, 1)  
500 - this.storeChannelIds = this.channelIds.join(',')  
501 - if (item.moreChannel === '1') {  
502 - this.moreChannelList.unshift(item)  
503 - }  
504 - if (item.localChannel === '1') {  
505 - this.localChannelList.unshift(item)  
506 - }  
507 - }  
508 - // 添加频道  
509 - addChannelItem = (item: TopNavDTO) => {  
510 - this.channelIds.push(item.channelId)  
511 - this.myChannelList.push(item)  
512 - this.storeChannelIds = this.channelIds.join(',')  
513 - }  
514 - dialogController: CustomDialogController | null = new CustomDialogController({  
515 - builder: ChannelDialog({  
516 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
517 - indexSettingChannelId: $indexSettingChannelId,  
518 - homeChannelList: $homeChannelList,  
519 - myChannelList: $myChannelList,  
520 - moreChannelList: $moreChannelList,  
521 - localChannelList: $localChannelList,  
522 - confirm: this.onAccept,  
523 - changeChannelIndex: this.changeChannelIndex,  
524 - delChannelItem: this.delChannelItem,  
525 - addChannelItem: this.addChannelItem  
526 - }),  
527 - alignment: DialogAlignment.TopEnd,  
528 - customStyle: true,  
529 - })  
530 -  
531 - aboutToDisappear() {  
532 - this.dialogController = null // 将dialogController置空  
533 - }  
534 494
535 build() { 495 build() {
536 Row() { 496 Row() {
@@ -542,10 +502,9 @@ struct ChannelSubscriptionLayout { @@ -542,10 +502,9 @@ struct ChannelSubscriptionLayout {
542 .justifyContent(FlexAlign.Center) 502 .justifyContent(FlexAlign.Center)
543 .backgroundColor(Color.White) 503 .backgroundColor(Color.White)
544 .onClick(() => { 504 .onClick(() => {
545 - if (this.dialogController != null) {  
546 - this.dialogController.open()  
547 - } 505 + this.isShow = true
548 }) 506 })
  507 + .bindContentCover(this.isShow, this.sheetBuilder())
549 } 508 }
550 } 509 }
551 510
1 import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; 1 import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
2 -import { LazyDataSource, Logger, SPHelper } from 'wdKit';  
3 import { SpConstants } from 'wdConstant'; 2 import { SpConstants } from 'wdConstant';
4 -import { ProcessUtils } from 'wdRouter'; 3 +import { DisplayUtils, LazyDataSource, Logger, SPHelper } from 'wdKit';
  4 +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
5 import { PageComponent } from './PageComponent'; 5 import { PageComponent } from './PageComponent';
6 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; 6 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
7 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; 7 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
8 -import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';  
9 import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; 8 import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
10 import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; 9 import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
11 -import { WDRouterPage, WDRouterRule } from 'wdRouter'  
12 -import { channelSkeleton } from '../skeleton/channelSkeleton' 10 +import { channelSkeleton } from '../skeleton/channelSkeleton';
13 11
14 12
15 const TAG = 'TopNavigationComponent'; 13 const TAG = 'TopNavigationComponent';
@@ -253,6 +251,8 @@ export struct TopNavigationComponent { @@ -253,6 +251,8 @@ export struct TopNavigationComponent {
253 }, (navItem: TopNavDTO) => JSON.stringify(navItem)); 251 }, (navItem: TopNavDTO) => JSON.stringify(navItem));
254 } 252 }
255 .barHeight($r('app.float.top_tab_bar_height')) 253 .barHeight($r('app.float.top_tab_bar_height'))
  254 + .height(this._currentNavIndex == 0 ? DisplayUtils.getDeviceHeight() - vp2px(48.3) :
  255 + '100%')
256 .barMode(BarMode.Scrollable) 256 .barMode(BarMode.Scrollable)
257 .vertical(false) 257 .vertical(false)
258 .barBackgroundColor(this.barBackgroundColor) 258 .barBackgroundColor(this.barBackgroundColor)
@@ -8,10 +8,18 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' @@ -8,10 +8,18 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
8 import { LiveModel } from '../../viewmodel/LiveModel' 8 import { LiveModel } from '../../viewmodel/LiveModel'
9 import { ContentConstants } from '../../constants/ContentConstants' 9 import { ContentConstants } from '../../constants/ContentConstants'
10 import { ProcessUtils } from 'wdRouter'; 10 import { ProcessUtils } from 'wdRouter';
  11 +import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  12 +
11 13
12 @Component 14 @Component
13 export struct LiveHorizontalCardComponent { 15 export struct LiveHorizontalCardComponent {
14 @State compDTO: CompDTO = {} as CompDTO 16 @State compDTO: CompDTO = {} as CompDTO
  17 + @State loadImg: boolean = false;
  18 +
  19 + async aboutToAppear(): Promise<void> {
  20 + this.loadImg = await onlyWifiLoadImg();
  21 + }
  22 +
15 23
16 build() { 24 build() {
17 Column() { 25 Column() {
@@ -63,7 +71,8 @@ export struct LiveHorizontalCardComponent { @@ -63,7 +71,8 @@ export struct LiveHorizontalCardComponent {
63 ListItem() { 71 ListItem() {
64 Column() { 72 Column() {
65 Stack({ alignContent: Alignment.BottomEnd }) { 73 Stack({ alignContent: Alignment.BottomEnd }) {
66 - Image(item.coverUrl) 74 + Image(this.loadImg ? item.coverUrl : '')
  75 + .backgroundColor(0xf5f5f5)
67 .aspectRatio(16 / 9) 76 .aspectRatio(16 / 9)
68 .width(this.compDTO.operDataList.length == 2 ? 210 : 150) 77 .width(this.compDTO.operDataList.length == 2 ? 210 : 150)
69 .borderRadius(4) 78 .borderRadius(4)
  1 +import { NetworkUtil, SPHelper } from 'wdKit';
  2 +import { SpConstants } from 'wdConstant';
  3 +
  4 +async function onlyWifiLoadImg() : Promise<boolean> {
  5 + let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false;
  6 + let isNetConnected = NetworkUtil.isNetConnected();
  7 + let netWorkStatus = NetworkUtil.getNetworkType();
  8 +
  9 + if (isNetConnected) {
  10 + if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
  11 + return true;
  12 + } else {
  13 + if (loadImageOnlyWifiSwitch) {
  14 + return false
  15 + } else {
  16 + return true;
  17 + }
  18 + }
  19 + } else {
  20 + return false;
  21 + }
  22 +}
  23 +
  24 +export { onlyWifiLoadImg }
@@ -7,6 +7,9 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' @@ -7,6 +7,9 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
7 import { ViewType } from 'wdConstant/Index' 7 import { ViewType } from 'wdConstant/Index'
8 import { LiveViewModel } from '../../viewModel/LiveViewModel' 8 import { LiveViewModel } from '../../viewModel/LiveViewModel'
9 import { TabChatItemComponent } from './TabChatItemComponent' 9 import { TabChatItemComponent } from './TabChatItemComponent'
  10 +import { Logger } from 'wdKit';
  11 +
  12 +const TAG: string = 'TabChatComponent';
10 13
11 @Component 14 @Component
12 export struct TabChatComponent { 15 export struct TabChatComponent {
@@ -84,6 +87,7 @@ export struct TabChatComponent { @@ -84,6 +87,7 @@ export struct TabChatComponent {
84 20,) 87 20,)
85 .then( 88 .then(
86 (data) => { 89 (data) => {
  90 + Logger.debug(TAG, `${JSON.stringify(data)}`)
87 if (data.barrageResponses && data.barrageResponses.length > 0) { 91 if (data.barrageResponses && data.barrageResponses.length > 0) {
88 this.pageModel.viewType = ViewType.LOADED; 92 this.pageModel.viewType = ViewType.LOADED;
89 this.liveChatList.push(...data.barrageResponses) 93 this.liveChatList.push(...data.barrageResponses)
@@ -98,7 +102,8 @@ export struct TabChatComponent { @@ -98,7 +102,8 @@ export struct TabChatComponent {
98 } 102 }
99 }, 103 },
100 () => { 104 () => {
101 - 105 + Logger.debug(TAG, `error`)
  106 + this.pageModel.viewType = ViewType.ERROR;
102 }) 107 })
103 } 108 }
104 109
1 -import { LiveRoomItemBean } from 'wdBean/Index' 1 +import { LiveRoomItemBean, Action, PhotoListBean, Params } from 'wdBean/Index'
2 import { StringUtils } from 'wdKit/Index' 2 import { StringUtils } from 'wdKit/Index'
  3 +// import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
  4 +import { WDRouterRule } from 'wdRouter'
  5 +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
3 6
4 @Component 7 @Component
5 export struct TabChatItemComponent { 8 export struct TabChatItemComponent {
@@ -14,6 +17,8 @@ export struct TabChatItemComponent { @@ -14,6 +17,8 @@ export struct TabChatItemComponent {
14 .borderRadius(90) 17 .borderRadius(90)
15 .width(24) 18 .width(24)
16 .height(24) 19 .height(24)
  20 + Column() {
  21 + Row() {
17 Text() { 22 Text() {
18 Span(this.item.senderUserName + ': ') 23 Span(this.item.senderUserName + ': ')
19 .fontColor('#666666') 24 .fontColor('#666666')
@@ -27,11 +32,58 @@ export struct TabChatItemComponent { @@ -27,11 +32,58 @@ export struct TabChatItemComponent {
27 .fontWeight(400) 32 .fontWeight(400)
28 } 33 }
29 .alignItems(VerticalAlign.Top) 34 .alignItems(VerticalAlign.Top)
  35 + if (this.item.dataType == 'ZH_TEXT_AND_IMAGE_MSG' && this.item.pictureUrls && this.item.pictureUrls.length > 0) {
  36 + Image(this.item.pictureUrls[0])
  37 + .width(`100%`)
  38 + .objectFit(ImageFit.Contain)
  39 + .borderRadius(4)
  40 + .margin({
  41 + top: 10
  42 + })
  43 + .onClick(() => {
  44 + this.gotoMultipleListImagePage(this.item.pictureUrls[0])
  45 + })
  46 + }
  47 + }
  48 + .margin({
  49 + left: 8,
  50 + right: 8
  51 + })
  52 + .layoutWeight(1)
  53 + .alignItems(HorizontalAlign.Start)
  54 + }
  55 + .alignItems(VerticalAlign.Top)
30 .padding({ 56 .padding({
31 left: 15, 57 left: 15,
32 top: 15, 58 top: 15,
33 right: 15 59 right: 15
34 }) 60 })
  61 +
  62 + }
  63 +
  64 + /**
  65 + * 大图列表页
  66 + * @param content
  67 + * */
  68 + gotoMultipleListImagePage(imgUrl: string) {
  69 + const photoList: PhotoListBean[] = []
  70 + photoList.push({
  71 + width: 0,
  72 + height: 0,
  73 + picPath: imgUrl,
  74 + picDesc: ''
  75 + })
  76 + let taskAction: Action = {
  77 + type: 'JUMP_DETAIL_PAGE',
  78 + params: {
  79 + detailPageType: 18,
  80 + extra: {
  81 + photoList: photoList,
  82 + swiperIndex: 0,
  83 + } as ExtraDTO
  84 + } as Params,
  85 + };
  86 + WDRouterRule.jumpWithAction(taskAction)
35 } 87 }
36 88
37 aboutToDisappear(): void { 89 aboutToDisappear(): void {
@@ -9,6 +9,10 @@ import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLay @@ -9,6 +9,10 @@ import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLay
9 import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' 9 import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
10 import { StringUtils } from 'wdKit/Index' 10 import { StringUtils } from 'wdKit/Index'
11 import { LiveViewModel } from '../../viewModel/LiveViewModel' 11 import { LiveViewModel } from '../../viewModel/LiveViewModel'
  12 +import { Logger } from 'wdKit'
  13 +
  14 +const TAG: string = 'TabLiveComponent';
  15 +
12 16
13 @Component 17 @Component
14 export struct TabLiveComponent { 18 export struct TabLiveComponent {
@@ -86,6 +90,7 @@ export struct TabLiveComponent { @@ -86,6 +90,7 @@ export struct TabLiveComponent {
86 20) 90 20)
87 .then( 91 .then(
88 (data) => { 92 (data) => {
  93 + Logger.debug(TAG, `${JSON.stringify(data)}`)
89 if (data.barrageResponses && data.barrageResponses.length > 0) { 94 if (data.barrageResponses && data.barrageResponses.length > 0) {
90 /** 95 /**
91 * 在直播聊天添加一条新内容逻辑: 96 * 在直播聊天添加一条新内容逻辑:
@@ -119,6 +124,8 @@ export struct TabLiveComponent { @@ -119,6 +124,8 @@ export struct TabLiveComponent {
119 } 124 }
120 }, 125 },
121 () => { 126 () => {
  127 + Logger.debug(TAG, `Error`)
  128 + this.pageModel.viewType = ViewType.ERROR;
122 129
123 }) 130 })
124 } 131 }
@@ -88,15 +88,15 @@ export struct TabLiveItemComponent { @@ -88,15 +88,15 @@ export struct TabLiveItemComponent {
88 if (this.item.pictureUrls.length > 1) { 88 if (this.item.pictureUrls.length > 1) {
89 Image(itemSub) 89 Image(itemSub)
90 .width(`${100 / this.item.pictureUrls.length}%`) 90 .width(`${100 / this.item.pictureUrls.length}%`)
91 - .height(70)  
92 - .objectFit(ImageFit.Auto) 91 + // .height(70)
  92 + .objectFit(ImageFit.Contain)
93 .borderRadius(4) 93 .borderRadius(4)
94 } else { 94 } else {
95 Image(itemSub) 95 Image(itemSub)
96 .width(`100%`) 96 .width(`100%`)
97 // .aspectRatio(this.getAspectRation()) 97 // .aspectRatio(this.getAspectRation())
98 - .height(177)  
99 - .objectFit(ImageFit.Auto) 98 + // .height(177)
  99 + .objectFit(ImageFit.Contain)
100 .borderRadius(4) 100 .borderRadius(4)
101 } 101 }
102 }.onClick(() => { 102 }.onClick(() => {
@@ -10,6 +10,7 @@ export struct PlayerProgressView { @@ -10,6 +10,7 @@ export struct PlayerProgressView {
10 @Consume isOpenDetail: boolean 10 @Consume isOpenDetail: boolean
11 @Consume isDragging: boolean 11 @Consume isDragging: boolean
12 @State status: number = PlayerConstants.STATUS_START; 12 @State status: number = PlayerConstants.STATUS_START;
  13 + @State videoDuration: number = this.contentDetailData?.videoInfo?.[0]?.videoDuration || 1
13 14
14 aboutToAppear() { 15 aboutToAppear() {
15 if (this.playerController) { 16 if (this.playerController) {
@@ -25,9 +26,9 @@ export struct PlayerProgressView { @@ -25,9 +26,9 @@ export struct PlayerProgressView {
25 build() { 26 build() {
26 Column() { 27 Column() {
27 Text() { 28 Text() {
28 - Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.contentDetailData.videoInfo[0].videoDuration))) 29 + Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.videoDuration)))
29 Span(' / ') 30 Span(' / ')
30 - Span(DateTimeUtils.secondToTime(this.contentDetailData.videoInfo[0].videoDuration || 0)) 31 + Span(DateTimeUtils.secondToTime(this.videoDuration))
31 } 32 }
32 .fontSize(24) 33 .fontSize(24)
33 .fontColor(Color.White) 34 .fontColor(Color.White)
@@ -40,12 +41,16 @@ export struct PlayerProgressView { @@ -40,12 +41,16 @@ export struct PlayerProgressView {
40 step: 0.01, 41 step: 0.01,
41 // style: SliderStyle.OutSet 42 // style: SliderStyle.OutSet
42 }) 43 })
43 - .blockColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.play_block_color') : Color.Transparent)  
44 - .trackColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.pause_track_color') : $r('app.color.play_track_color'))  
45 - .selectedColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.pause_selected_color') : $r('app.color.play_selected_color')) 44 + .blockColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.play_block_color') :
  45 + Color.Transparent)
  46 + .trackColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
  47 + $r('app.color.pause_track_color') : $r('app.color.play_track_color'))
  48 + .selectedColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
  49 + $r('app.color.pause_selected_color') : $r('app.color.play_selected_color'))
46 .trackThickness(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? 4 : 1) 50 .trackThickness(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? 4 : 1)
47 .blockStyle({ 51 .blockStyle({
48 - type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE : SliderBlockType.DEFAULT, 52 + type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE :
  53 + SliderBlockType.DEFAULT,
49 image: $r('app.media.ic_player_block') 54 image: $r('app.media.ic_player_block')
50 }) 55 })
51 .blockSize({ width: 18, height: 12 }) 56 .blockSize({ width: 18, height: 12 })
@@ -56,6 +56,7 @@ struct ModifyPasswordPage { @@ -56,6 +56,7 @@ struct ModifyPasswordPage {
56 Row() { 56 Row() {
57 Row() { 57 Row() {
58 TextInput({ placeholder: "请输入原密码" }) 58 TextInput({ placeholder: "请输入原密码" })
  59 + .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
59 .placeholderColor("#CCCCCC") 60 .placeholderColor("#CCCCCC")
60 .type(InputType.Password) 61 .type(InputType.Password)
61 .showPasswordIcon(true) 62 .showPasswordIcon(true)
@@ -78,6 +79,7 @@ struct ModifyPasswordPage { @@ -78,6 +79,7 @@ struct ModifyPasswordPage {
78 Row() { 79 Row() {
79 Row() { 80 Row() {
80 TextInput({ placeholder: "请输入新密码" }) 81 TextInput({ placeholder: "请输入新密码" })
  82 + .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
81 .placeholderColor("#CCCCCC") 83 .placeholderColor("#CCCCCC")
82 .type(InputType.Password) 84 .type(InputType.Password)
83 .showPasswordIcon(true) 85 .showPasswordIcon(true)
@@ -102,6 +104,7 @@ struct ModifyPasswordPage { @@ -102,6 +104,7 @@ struct ModifyPasswordPage {
102 TextInput({ placeholder: "再次输入新密码" }) 104 TextInput({ placeholder: "再次输入新密码" })
103 .placeholderColor("#CCCCCC") 105 .placeholderColor("#CCCCCC")
104 .type(InputType.Password) 106 .type(InputType.Password)
  107 + .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
105 .showPasswordIcon(true) 108 .showPasswordIcon(true)
106 .backgroundColor('#00000000') 109 .backgroundColor('#00000000')
107 .onChange((value: string) => { 110 .onChange((value: string) => {
@@ -120,18 +123,23 @@ struct ModifyPasswordPage { @@ -120,18 +123,23 @@ struct ModifyPasswordPage {
120 .alignItems(VerticalAlign.Center) 123 .alignItems(VerticalAlign.Center)
121 124
122 Column() { 125 Column() {
123 - Text("提示:密码长度6-20位,需答谢字母、小写字母、数字、特殊字符中组合三种及三种以上组成").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) 126 + Text("提示:密码长度6~20,需大写字母、小写字母、数字、特殊符合中组合三种及三种以上").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
124 } 127 }
125 .width('100%') 128 .width('100%')
126 .height('85lpx') 129 .height('85lpx')
127 .alignItems(HorizontalAlign.Start) 130 .alignItems(HorizontalAlign.Start)
128 131
129 Row() { 132 Row() {
130 - Button("确认", { type: ButtonType.Normal, stateEffect: true }) 133 + Button( { type: ButtonType.Normal, stateEffect: true }){
  134 + Text("确认")
  135 + .fontColor("#fff")
  136 + .fontSize("35lpx")
  137 + .lineHeight("50lpx")
  138 + .opacity(this.btnStatus ?1:0.5)
  139 + }
131 .width('100%') 140 .width('100%')
132 .height('80lpx') 141 .height('80lpx')
133 - .backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d')  
134 - .fontColor('#fff') 142 + .backgroundColor(this.btnStatus ? '#ED2800' : '#99ED2800')
135 .borderRadius('4vp') 143 .borderRadius('4vp')
136 .onClick(() => { 144 .onClick(() => {
137 if(this.btnStatus){ 145 if(this.btnStatus){
@@ -157,6 +165,7 @@ struct ModifyPasswordPage { @@ -157,6 +165,7 @@ struct ModifyPasswordPage {
157 }.padding({top:"92lpx",left:"48lpx",right:"48lpx"}) 165 }.padding({top:"92lpx",left:"48lpx",right:"48lpx"})
158 166
159 }.titleMode(NavigationTitleMode.Mini) 167 }.titleMode(NavigationTitleMode.Mini)
  168 + .backButtonIcon($r("app.media.login_back_icon"))
160 .title('') 169 .title('')
161 } 170 }
162 171
@@ -193,3 +202,5 @@ struct ModifyPasswordPage { @@ -193,3 +202,5 @@ struct ModifyPasswordPage {
193 this.dialogToast.open() 202 this.dialogToast.open()
194 } 203 }
195 } 204 }
  205 +
  206 +
@@ -200,6 +200,7 @@ export struct SettingPasswordLayout { @@ -200,6 +200,7 @@ export struct SettingPasswordLayout {
200 Row() { 200 Row() {
201 TextInput({ placeholder: item.inputPlacholder }) 201 TextInput({ placeholder: item.inputPlacholder })
202 .placeholderColor("#CCCCCC") 202 .placeholderColor("#CCCCCC")
  203 + .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
203 .type(InputType.Password) 204 .type(InputType.Password)
204 .showPasswordIcon(true) 205 .showPasswordIcon(true)
205 .backgroundColor('#00000000') 206 .backgroundColor('#00000000')