guochunsong

优化UI

@@ -41,7 +41,7 @@ export struct CompParser { @@ -41,7 +41,7 @@ export struct CompParser {
41 } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) { 41 } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
42 BannerComponent({ compDTO: compDTO }) 42 BannerComponent({ compDTO: compDTO })
43 } else if (compDTO.compStyle === CompStyle.Single_ImageCard_03 43 } else if (compDTO.compStyle === CompStyle.Single_ImageCard_03
44 - || compDTO.compStyle === CompStyle.Single_ImageCard_01 ) { 44 + || compDTO.compStyle === CompStyle.Single_ImageCard_01) {
45 SingleImageCardComponent({ compDTO: compDTO }) 45 SingleImageCardComponent({ compDTO: compDTO })
46 } else if (compDTO.compStyle === "2") { 46 } else if (compDTO.compStyle === "2") {
47 BigPicCardComponent({ compDTO: compDTO }) 47 BigPicCardComponent({ compDTO: compDTO })
@@ -55,12 +55,15 @@ export struct CompParser { @@ -55,12 +55,15 @@ export struct CompParser {
55 } else { 55 } else {
56 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) 56 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
57 } 57 }
58 - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { 58 + } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02
  59 + || compDTO.compStyle === '5') {
59 HeadPictureCardComponent({ compDTO: compDTO }) 60 HeadPictureCardComponent({ compDTO: compDTO })
60 } else if (compDTO.compStyle === CompStyle.ZhGrid_Layout_03) { 61 } else if (compDTO.compStyle === CompStyle.ZhGrid_Layout_03) {
61 ZhGridLayoutComponent({ compDTO: compDTO }) 62 ZhGridLayoutComponent({ compDTO: compDTO })
62 } else if (compDTO.compStyle === CompStyle.Album_Card_01) { 63 } else if (compDTO.compStyle === CompStyle.Album_Card_01) {
63 AlbumCardComponent({ compDTO: compDTO }) 64 AlbumCardComponent({ compDTO: compDTO })
  65 + } else if (compDTO.compStyle === CompStyle.Single_Row_02) {
  66 +
64 } 67 }
65 else { 68 else {
66 // todo:组件未实现 / Component Not Implemented 69 // todo:组件未实现 / Component Not Implemented
@@ -33,35 +33,32 @@ export struct SingleImageCardComponent { @@ -33,35 +33,32 @@ export struct SingleImageCardComponent {
33 .fontWeight(FontWeight.Normal) 33 .fontWeight(FontWeight.Normal)
34 .maxLines(3)// 34 .maxLines(3)//
35 .alignSelf(ItemAlign.Start) 35 .alignSelf(ItemAlign.Start)
36 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 36 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
37 }.height("80%") 37 }.height("80%")
38 .justifyContent(FlexAlign.Start) 38 .justifyContent(FlexAlign.Start)
39 39
40 Row() { 40 Row() {
41 if (this.compDTO.operDataList[0].source) { 41 if (this.compDTO.operDataList[0].source) {
42 Text(this.compDTO.operDataList[0].source) 42 Text(this.compDTO.operDataList[0].source)
43 -  
44 .fontSize($r('app.float.font_size_12')) 43 .fontSize($r('app.float.font_size_12'))
45 .fontColor(Color.Gray) 44 .fontColor(Color.Gray)
46 .maxLines(1) 45 .maxLines(1)
47 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 46 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
48 - .width('50%') 47 + .width(this.compDTO.operDataList[0].source.length > 8 ? '50%' : '')
49 Image($r('app.media.point')) 48 Image($r('app.media.point'))
50 .width(16) 49 .width(16)
51 .height(16) 50 .height(16)
52 } 51 }
53 if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) { 52 if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {
54 Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime))) 53 Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
55 -  
56 .fontSize($r('app.float.font_size_12')) 54 .fontSize($r('app.float.font_size_12'))
57 .fontColor(Color.Gray) 55 .fontColor(Color.Gray)
58 } 56 }
59 Text(this.compDTO.operDataList[0].visitorComment + '评') 57 Text(this.compDTO.operDataList[0].visitorComment + '评')
60 -  
61 .fontSize($r('app.float.font_size_12')) 58 .fontSize($r('app.float.font_size_12'))
62 .fontColor(Color.Gray) 59 .fontColor(Color.Gray)
63 .padding({ 60 .padding({
64 - left: 10 61 + left: 5
65 }) 62 })
66 }.alignSelf(ItemAlign.Start) 63 }.alignSelf(ItemAlign.Start)
67 .height("20%") 64 .height("20%")
@@ -76,7 +73,7 @@ export struct SingleImageCardComponent { @@ -76,7 +73,7 @@ export struct SingleImageCardComponent {
76 Stack() { 73 Stack() {
77 Image(this.compDTO.operDataList[0].coverUrl) 74 Image(this.compDTO.operDataList[0].coverUrl)
78 .borderRadius(5) 75 .borderRadius(5)
79 - .aspectRatio(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4 ) 76 + .aspectRatio(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4)
80 .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 90 : 180) 77 .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 90 : 180)
81 if (this.compDTO.operDataList[0].videoInfo) { 78 if (this.compDTO.operDataList[0].videoInfo) {
82 Row() { 79 Row() {
@@ -106,7 +103,7 @@ export struct SingleImageCardComponent { @@ -106,7 +103,7 @@ export struct SingleImageCardComponent {
106 .padding( 103 .padding(
107 { top: 16, bottom: 16, left: 14, right: 14 }) 104 { top: 16, bottom: 16, left: 14, right: 14 })
108 .width(FULL_PARENT) 105 .width(FULL_PARENT)
109 - .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 127: 217) 106 + .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 127 : 217)
110 .justifyContent(FlexAlign.SpaceBetween) 107 .justifyContent(FlexAlign.SpaceBetween)
111 } 108 }
112 } 109 }
@@ -14,54 +14,10 @@ let listSize: number = 4; @@ -14,54 +14,10 @@ let listSize: number = 4;
14 * Zh_Grid_Layout-03 14 * Zh_Grid_Layout-03
15 * 15 *
16 */ 16 */
17 - 17 +@Preview
18 @Component 18 @Component
19 export struct ZhGridLayoutComponent { 19 export struct ZhGridLayoutComponent {
20 @State compDTO: CompDTO = {} as CompDTO 20 @State compDTO: CompDTO = {} as CompDTO
21 - // @State compDTO: CompDTO = {  
22 - // operDataList: [  
23 - // {  
24 - // newsTitle: '健康专栏',  
25 - // description: "description0",  
26 - // coverUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'  
27 - // } as ContentDTO,  
28 - // {  
29 - // newsTitle: '金刚栏位22233',  
30 - // description: "description1",  
31 - // coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
32 - // } as ContentDTO,  
33 - // {  
34 - // newsTitle: '体育专栏2',  
35 - // description: "description2",  
36 - // coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231206/image/live/bbe6d821e92b48919d90c7dadfd1f05a.jpg?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg",  
37 - // } as ContentDTO,  
38 - // {  
39 - // newsTitle: '农业',  
40 - // description: "description3",  
41 - // coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231109/image/live/102e6eb9356b4ef19405b04c1f6ff875.png?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg'  
42 - // } as ContentDTO,  
43 - // {  
44 - // newsTitle: '民生铭记',  
45 - // description: "description4",  
46 - // coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/62bdbbb35dbd45689e00790c81f04c4b.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
47 - // } as ContentDTO,  
48 - // {  
49 - // newsTitle: '春节大欢乐',  
50 - // description: "description5",  
51 - // coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/f79bbaa5a33b4bd88176071c4f797ff6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
52 - // } as ContentDTO,  
53 - // {  
54 - // newsTitle: '春节大欢乐',  
55 - // description: "description6",  
56 - // coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/2c1d917009584ce2bb4a35cbb3a860a0.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
57 - // } as ContentDTO,  
58 - // {  
59 - // newsTitle: '旅游',  
60 - // description: "description7",  
61 - // coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231222/image/display/117dc516ca5c42d5843c0d32050c9fc6.jpeg?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",  
62 - // } as ContentDTO  
63 - // ]  
64 - // } as CompDTO  
65 21
66 aboutToAppear() { 22 aboutToAppear() {
67 if (this.compDTO.operDataList) { 23 if (this.compDTO.operDataList) {
@@ -23,7 +23,8 @@ export const enum CompStyle { @@ -23,7 +23,8 @@ export const enum CompStyle {
23 Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 23 Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动
24 Title_Abbr_01 = '11', // 标题缩略 24 Title_Abbr_01 = '11', // 标题缩略
25 Title_All_01 = '3', // 全标题 25 Title_All_01 = '3', // 全标题
26 - Single_Imagecard_03 = '13',//单图卡:3行标题 26 + Single_ImageCard_03 = '13',//单图卡:3行标题
  27 + Single_ImageCard_01 = '6',//单图卡,竖图
27 ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡 28 ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡
28 Album_Card_01 = '17' //图卡集 29 Album_Card_01 = '17' //图卡集
29 } 30 }