Showing
11 changed files
with
732 additions
and
123 deletions
| 1 | /** | 1 | /** |
| 2 | * 组件Style/展示样式 | 2 | * 组件Style/展示样式 |
| 3 | */ | 3 | */ |
| 4 | + | ||
| 4 | export const enum CompStyle { | 5 | export const enum CompStyle { |
| 5 | Label_03 = 'Label-03', // 标题卡:icon+文字 | 6 | Label_03 = 'Label-03', // 标题卡:icon+文字 |
| 6 | - Carousel_Layout_01 = 'Zh_Carousel_Layout-01', // 通用轮播卡:视频、直播、活动、专题、榜单、外链 | ||
| 7 | Carousel_Layout_02 = 'Carousel_Layout-02', // 直播轮播卡:直播 | 7 | Carousel_Layout_02 = 'Carousel_Layout-02', // 直播轮播卡:直播 |
| 8 | - Single_Row_01 = 'Zh_Single_Row-01', // 三格方形小卡(排名):专题、活动 | ||
| 9 | - Zh_Single_Row_01 = 'Zh_Single_Row-01', // 横划卡 imageScale-封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 10 | Single_Row_02 = 'Zh_Single_Row-02', // 通用横划卡:视频、直播、专题 | 8 | Single_Row_02 = 'Zh_Single_Row-02', // 通用横划卡:视频、直播、专题 |
| 11 | Single_Row_03 = 'Single_Row-03', // 直播横划卡:直播 | 9 | Single_Row_03 = 'Single_Row-03', // 直播横划卡:直播 |
| 12 | Single_Row_04 = 'Single_Row-04', // 三格方形小卡:专题、活动 | 10 | Single_Row_04 = 'Single_Row-04', // 三格方形小卡:专题、活动 |
| @@ -17,17 +15,52 @@ export const enum CompStyle { | @@ -17,17 +15,52 @@ export const enum CompStyle { | ||
| 17 | Single_Column_04 = 'Single_Column-04', // 大卡横屏(带背景):视频、直播 | 15 | Single_Column_04 = 'Single_Column-04', // 大卡横屏(带背景):视频、直播 |
| 18 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ | 16 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ |
| 19 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ | 17 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ |
| 20 | - Zh_Single_Column_02 = 'Zh_Single_Column-02', // 头图卡 | ||
| 21 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 | 18 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 |
| 22 | Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡:视频、直播、榜单 | 19 | Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡:视频、直播、榜单 |
| 23 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 | 20 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 |
| 24 | - Title_Abbr_01 = '11', // 标题缩略 | ||
| 25 | - Title_All_01 = '3', // 全标题 | ||
| 26 | - Single_ImageCard_03 = '13',//单图卡:3行标题 | ||
| 27 | - Single_ImageCard_01 = '6',//单图卡,竖图 | ||
| 28 | - ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡 | ||
| 29 | - Album_Card_01 = '17', //图卡集 | ||
| 30 | - Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡 | ||
| 31 | - CompStyle_09 = '9', // 时间链卡 | ||
| 32 | - CompStyle_10 = '10', // 大专题卡 | 21 | + |
| 22 | + | ||
| 23 | + Zh_Carousel_Layout_01 = 'Zh_Carousel_Layout-01', //1 轮播图卡---1 | ||
| 24 | + Zh_Single_Row_01 = 'Zh_Single_Row-01', //2 横划卡 imageScale-封面图比例 1-4:3, 2-16:9, 3-3:2---1 | ||
| 25 | + Zh_Single_Row_02 = 'Zh_Single_Row-02', //3 小视频横划卡---1 | ||
| 26 | + Zh_Single_Row_03 = 'Zh_Single_Row-03', //6 直播预约卡 | ||
| 27 | + Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡---2 | ||
| 28 | + Zh_Single_Row_05 = 'Zh_Single_Row-05', //15 人民号横划卡---1 | ||
| 29 | + Zh_Single_Row_06 = 'Zh_Single_Row-06', //20 热门评论卡--精选评论卡-1 | ||
| 30 | + Zh_Single_Column_01 = 'Zh_Single_Column-01', //5 专题时间链卡 | ||
| 31 | + Zh_Single_Column_02 = 'Zh_Single_Column-02', //10 头图卡---2 | ||
| 32 | + Zh_Single_Column_03 = 'Zh_Single_Column-03', //9 直播大图卡 | ||
| 33 | + Zh_Single_Column_04 = 'Zh_Single_Column-04', //17 人民号主题卡---1 | ||
| 34 | + Zh_Single_Column_05 = 'Zh_Single_Column-05', //16 人民号入驻卡---1 | ||
| 35 | + Zh_Single_Column_06 = 'Zh_Single_Column-06', //12 本地问政卡 | ||
| 36 | + Zh_Single_Column_07 = 'Zh_Single_Column-07', //14 热门留言卡 | ||
| 37 | + Zh_Single_Column_08 = 'Zh_Single_Column-08', //12 问政提问卡 | ||
| 38 | + Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡 | ||
| 39 | + Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡 | ||
| 40 | + Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡 | ||
| 41 | + Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡---1 | ||
| 42 | + Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡---2 | ||
| 43 | + Card_01 = '1', // 小图卡 | ||
| 44 | + Card_02 = '2', // 大图卡---2 | ||
| 45 | + Card_03 = '3', // 无图卡(全标题)---2 | ||
| 46 | + Card_04 = '4', // 三图卡---2 | ||
| 47 | + Card_05 = '5', // 头图卡---2 | ||
| 48 | + Card_06 = '6', // 小视频卡---2 | ||
| 49 | + Card_07 = '7', // 作者卡 | ||
| 50 | + Card_08 = '8', // 财经快讯卡 | ||
| 51 | + Card_09 = '9', // 时间轴卡---2 | ||
| 52 | + Card_10 = '10', // 大专题卡---2 | ||
| 53 | + Card_11 = '11', // 无图卡(标题省略)---2 | ||
| 54 | + Card_12 = '12', // 无图卡人民号---1 | ||
| 55 | + Card_13 = '13', // 单图卡---2--同6 | ||
| 56 | + Card_14 = '14', // 单图卡人民号---1 | ||
| 57 | + Card_15 = '15', // 大图卡人民号---1 | ||
| 58 | + Card_16 = '16', // 三图卡人民号---1 | ||
| 59 | + Card_17 = '17', // 图卡集---2 | ||
| 60 | + Card_18 = '18', // 图卡集人民号 | ||
| 61 | + Card_19 = '19', // 动态图文卡人民号---1 | ||
| 62 | + Card_20 = '20', // 动态视频卡人民号---1 | ||
| 63 | + Card_21 = '21', // 小视频卡人民号---1 | ||
| 64 | + Card_22 = '22', // 时间链 | ||
| 65 | + Card_23 = '23', // 问政卡 | ||
| 33 | } | 66 | } |
| 1 | -import { CommonConstants } from 'wdConstant'; | ||
| 2 | -import { Card3Component } from './cardview/Card3Component'; | 1 | +import { CommonConstants, CompStyle } from 'wdConstant'; |
| 2 | +import { ContentDTO } from 'wdBean'; | ||
| 3 | import { Card2Component } from './cardview/Card2Component'; | 3 | import { Card2Component } from './cardview/Card2Component'; |
| 4 | +import { Card3Component } from './cardview/Card3Component'; | ||
| 4 | import { Card4Component } from './cardview/Card4Component'; | 5 | import { Card4Component } from './cardview/Card4Component'; |
| 5 | -import { ContentDTO } from 'wdBean'; | ||
| 6 | import { Card5Component } from './cardview/Card5Component'; | 6 | import { Card5Component } from './cardview/Card5Component'; |
| 7 | import { Card6Component } from './cardview/Card6Component'; | 7 | import { Card6Component } from './cardview/Card6Component'; |
| 8 | +import { Card9Component } from './cardview/Card9Component'; | ||
| 9 | +import { Card10Component } from './cardview/Card10Component'; | ||
| 10 | +import { Card11Component } from './cardview/Card11Component'; | ||
| 11 | +import { Card17Component } from './cardview/Card17Component'; | ||
| 8 | 12 | ||
| 9 | /** | 13 | /** |
| 10 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 14 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| @@ -20,16 +24,25 @@ export struct CardParser { | @@ -20,16 +24,25 @@ export struct CardParser { | ||
| 20 | 24 | ||
| 21 | @Builder | 25 | @Builder |
| 22 | contentBuilder(contentDTO: ContentDTO) { | 26 | contentBuilder(contentDTO: ContentDTO) { |
| 23 | - if (contentDTO.appStyle === '2') { | 27 | + if (contentDTO.appStyle === CompStyle.Card_02) { |
| 24 | Card2Component({ contentDTO }) | 28 | Card2Component({ contentDTO }) |
| 25 | - } else if (contentDTO.appStyle === '3') { | 29 | + } else if (contentDTO.appStyle === CompStyle.Card_03) { |
| 26 | Card3Component({ contentDTO }) | 30 | Card3Component({ contentDTO }) |
| 27 | - } else if (contentDTO.appStyle === "4") { | 31 | + } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 28 | Card4Component({ contentDTO }) | 32 | Card4Component({ contentDTO }) |
| 29 | - } else if (contentDTO.appStyle === "5") { | 33 | + } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 30 | Card5Component({ contentDTO }) | 34 | Card5Component({ contentDTO }) |
| 31 | - } else if (contentDTO.appStyle === "6") { | 35 | + } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 36 | + .Card_13) { | ||
| 32 | Card6Component({ contentDTO }) | 37 | Card6Component({ contentDTO }) |
| 38 | + } else if (contentDTO.appStyle === CompStyle.Card_09) { | ||
| 39 | + Card9Component({ contentDTO }) | ||
| 40 | + } else if (contentDTO.appStyle === CompStyle.Card_10) { | ||
| 41 | + Card10Component({ contentDTO }) | ||
| 42 | + } else if (contentDTO.appStyle === CompStyle.Card_11) { | ||
| 43 | + Card11Component({ contentDTO }) | ||
| 44 | + } else if (contentDTO.appStyle === CompStyle.Card_17) { | ||
| 45 | + Card17Component({ contentDTO }) | ||
| 33 | } | 46 | } |
| 34 | else { | 47 | else { |
| 35 | // todo:组件未实现 / Component Not Implemented | 48 | // todo:组件未实现 / Component Not Implemented |
| 1 | -import { CompDTO, ContentDTO , slideShows} from 'wdBean'; | 1 | +import { CompDTO} from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | import { BannerComponent } from './view/BannerComponent'; | 3 | import { BannerComponent } from './view/BannerComponent'; |
| 4 | import { LabelComponent } from './view/LabelComponent'; | 4 | import { LabelComponent } from './view/LabelComponent'; |
| 5 | -import { TitleAbbrComponent } from './view/TitleAbbrComponent'; | ||
| 6 | -import { TitleAllComponent } from './view/TitleAllComponent'; | ||
| 7 | -import { SingleImageCardComponent } from './view/SingleImageCardComponent'; | ||
| 8 | -import { BigPicCardComponent } from './view/BigPicCardComponent'; | ||
| 9 | -import { TriPicCardComponent } from './view/TriPicCardComponent'; | ||
| 10 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; | 5 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; |
| 11 | -import { HeadPictureCardComponent } from './view/HeadPictureCardComponent'; | ||
| 12 | import { ZhGridLayoutComponent } from './view/ZhGridLayoutComponent'; | 6 | import { ZhGridLayoutComponent } from './view/ZhGridLayoutComponent'; |
| 13 | import { | 7 | import { |
| 14 | HorizontalStrokeCardThreeTwoRadioForMoreComponent | 8 | HorizontalStrokeCardThreeTwoRadioForMoreComponent |
| @@ -16,11 +10,9 @@ import { | @@ -16,11 +10,9 @@ import { | ||
| 16 | import { | 10 | import { |
| 17 | HorizontalStrokeCardThreeTwoRadioForOneComponent | 11 | HorizontalStrokeCardThreeTwoRadioForOneComponent |
| 18 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; | 12 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; |
| 19 | -import { AlbumCardComponent } from './view/AlbumCardComponent'; | ||
| 20 | -import { ZhSingleRow04 } from './view/ZhSingleRow04' | ||
| 21 | -import { CompStyle_09 } from './view/CompStyle_09' | ||
| 22 | -import { CompStyle_10 } from './view/CompStyle_10' | ||
| 23 | - | 13 | +import { ZhSingleRow04 } from './compview/ZhSingleRow04' |
| 14 | +import { ZhGridLayout03 } from './compview/ZhGridLayout03' | ||
| 15 | +import { CardParser } from './CardParser'; | ||
| 24 | /** | 16 | /** |
| 25 | * comp适配器. | 17 | * comp适配器. |
| 26 | * 首页楼层comp解析器. | 18 | * 首页楼层comp解析器. |
| @@ -28,67 +20,7 @@ import { CompStyle_10 } from './view/CompStyle_10' | @@ -28,67 +20,7 @@ import { CompStyle_10 } from './view/CompStyle_10' | ||
| 28 | @Preview | 20 | @Preview |
| 29 | @Component | 21 | @Component |
| 30 | export struct CompParser { | 22 | export struct CompParser { |
| 31 | - @State compDTO: CompDTO = { | ||
| 32 | - compStyle: '17', | ||
| 33 | - imageScale: 3, | ||
| 34 | - operDataList: [ | ||
| 35 | - { | ||
| 36 | - title: 'title0', | ||
| 37 | - description: "description0", | ||
| 38 | - coverUrl: 'https://uatjdcdnphoto.aikan.pdnews' + | ||
| 39 | - '.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 40 | - fullColumnImgUrls: [{ | ||
| 41 | - url: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 42 | - },{ | ||
| 43 | - url:'https://uatjdcdnphoto.aikan.pdnews' + | ||
| 44 | - '.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 45 | - },{ | ||
| 46 | - url: 'https://uatjdcdnphoto.aikan.pdnews' + | ||
| 47 | - '.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 48 | - }] | ||
| 49 | - } as ContentDTO, | ||
| 50 | - { | ||
| 51 | - title: 'title1 title1 title1 title1 title1 title1 title1 title1 title1', | ||
| 52 | - description: "description1", | ||
| 53 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 54 | - } as ContentDTO, | ||
| 55 | - { | ||
| 56 | - title: 'title2', | ||
| 57 | - description: "description2", | ||
| 58 | - 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", | ||
| 59 | - } as ContentDTO, | ||
| 60 | - { | ||
| 61 | - title: 'title3', | ||
| 62 | - description: "description3", | ||
| 63 | - 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' | ||
| 64 | - } as ContentDTO, | ||
| 65 | - { | ||
| 66 | - title: 'title4', | ||
| 67 | - description: "description4", | ||
| 68 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/62bdbbb35dbd45689e00790c81f04c4b.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 69 | - } as ContentDTO, | ||
| 70 | - { | ||
| 71 | - title: 'title5', | ||
| 72 | - description: "description5", | ||
| 73 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/f79bbaa5a33b4bd88176071c4f797ff6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 74 | - } as ContentDTO, | ||
| 75 | - { | ||
| 76 | - title: 'title6', | ||
| 77 | - description: "description6", | ||
| 78 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/2c1d917009584ce2bb4a35cbb3a860a0.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 79 | - } as ContentDTO, | ||
| 80 | - { | ||
| 81 | - title: 'title7', | ||
| 82 | - description: "description7", | ||
| 83 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231222/image/display/117dc516ca5c42d5843c0d32050c9fc6.jpeg?x-oss-process=image/resize,w_240/quality,q_90/format,jpg", | ||
| 84 | - } as ContentDTO, | ||
| 85 | - { | ||
| 86 | - title: 'title8', | ||
| 87 | - description: "description8", | ||
| 88 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231228/image/display/90a2db4077d44a1f887f068fc659d977.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 89 | - } as ContentDTO | ||
| 90 | - ] | ||
| 91 | - } as CompDTO | 23 | + @State compDTO: CompDTO = {} as CompDTO |
| 92 | compIndex: number = 0; | 24 | compIndex: number = 0; |
| 93 | 25 | ||
| 94 | build() { | 26 | build() { |
| @@ -99,19 +31,8 @@ export struct CompParser { | @@ -99,19 +31,8 @@ export struct CompParser { | ||
| 99 | componentBuilder(compDTO: CompDTO, compIndex: number) { | 31 | componentBuilder(compDTO: CompDTO, compIndex: number) { |
| 100 | if (compDTO.compStyle === CompStyle.Label_03) { | 32 | if (compDTO.compStyle === CompStyle.Label_03) { |
| 101 | LabelComponent({ compDTO: compDTO }) | 33 | LabelComponent({ compDTO: compDTO }) |
| 102 | - } else if (compDTO.compStyle === CompStyle.Title_Abbr_01) { | ||
| 103 | - TitleAbbrComponent({ compDTO: compDTO }) | ||
| 104 | - } else if (compDTO.compStyle === CompStyle.Title_All_01) { | ||
| 105 | - TitleAllComponent({ compDTO: compDTO }) | ||
| 106 | - } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) { | 34 | + } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 107 | BannerComponent({ compDTO: compDTO }) | 35 | BannerComponent({ compDTO: compDTO }) |
| 108 | - } else if (compDTO.compStyle === CompStyle.Single_ImageCard_03 | ||
| 109 | - || compDTO.compStyle === CompStyle.Single_ImageCard_01) { | ||
| 110 | - SingleImageCardComponent({ compDTO: compDTO }) | ||
| 111 | - } else if (compDTO.compStyle === "2") { | ||
| 112 | - BigPicCardComponent({ compDTO: compDTO }) | ||
| 113 | - } else if (compDTO.compStyle === "4") { | ||
| 114 | - TriPicCardComponent({ compDTO: compDTO }) | ||
| 115 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) { | 36 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) { |
| 116 | LiveHorizontalCardComponent({ compDTO: compDTO }) | 37 | LiveHorizontalCardComponent({ compDTO: compDTO }) |
| 117 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { | 38 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { |
| @@ -120,19 +41,12 @@ export struct CompParser { | @@ -120,19 +41,12 @@ export struct CompParser { | ||
| 120 | } else { | 41 | } else { |
| 121 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) | 42 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) |
| 122 | } | 43 | } |
| 123 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02 | ||
| 124 | - || compDTO.compStyle === '5') { | ||
| 125 | - HeadPictureCardComponent({ compDTO: compDTO }) | ||
| 126 | - } else if (compDTO.compStyle === CompStyle.ZhGrid_Layout_03) { | ||
| 127 | - ZhGridLayoutComponent({ compDTO: compDTO }) | ||
| 128 | - } else if (compDTO.compStyle === CompStyle.Album_Card_01) { | ||
| 129 | - AlbumCardComponent({ compDTO: compDTO }) | 44 | + } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { |
| 45 | + ZhGridLayout03({ compDTO: compDTO }) | ||
| 130 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { | 46 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { |
| 131 | ZhSingleRow04({ compDTO: compDTO}) | 47 | ZhSingleRow04({ compDTO: compDTO}) |
| 132 | - } else if (compDTO.compStyle === CompStyle.CompStyle_09) { | ||
| 133 | - CompStyle_09({ compDTO: compDTO}) | ||
| 134 | - } else if (compDTO.compStyle === CompStyle.CompStyle_10) { | ||
| 135 | - CompStyle_10({ compDTO: compDTO}) | 48 | + } else if (!isNaN(Number(compDTO.compStyle))) { |
| 49 | + CardParser({ contentDTO: compDTO.operDataList[0]}); | ||
| 136 | } | 50 | } |
| 137 | else { | 51 | else { |
| 138 | // todo:组件未实现 / Component Not Implemented | 52 | // todo:组件未实现 / Component Not Implemented |
| 1 | +import { ContentDTO, slideShows } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | +import { DateTimeUtils } from 'wdKit'; | ||
| 4 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 大专题卡--CompStyle: 10 | ||
| 9 | + */ | ||
| 10 | +const TAG: string = 'Card10Component'; | ||
| 11 | + | ||
| 12 | +@Component | ||
| 13 | +export struct Card10Component { | ||
| 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column() { | ||
| 18 | + // 顶部标题,最多两行 | ||
| 19 | + if (this.contentDTO.newsTitle) { | ||
| 20 | + Text(this.contentDTO.newsTitle) | ||
| 21 | + .width(CommonConstants.FULL_WIDTH) | ||
| 22 | + .fontSize($r('app.float.font_size_17')) | ||
| 23 | + .fontWeight(600) | ||
| 24 | + .maxLines(2) | ||
| 25 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 26 | + .margin({ bottom: 19 }) | ||
| 27 | + } | ||
| 28 | + // 大图 | ||
| 29 | + Stack() { | ||
| 30 | + Image(this.contentDTO && this.contentDTO.coverUrl) | ||
| 31 | + .width('100%') | ||
| 32 | + .borderRadius({ | ||
| 33 | + topLeft: $r('app.float.image_border_radius'), | ||
| 34 | + topRight: $r('app.float.image_border_radius') | ||
| 35 | + }) | ||
| 36 | + .onClick((event: ClickEvent) => { | ||
| 37 | + ProcessUtils.processPage(this.contentDTO) | ||
| 38 | + }) | ||
| 39 | + Text('专题') | ||
| 40 | + .fontSize($r('app.float.font_size_12')) | ||
| 41 | + .padding({ left: 8, right: 8, top: 3, bottom: 3 }) | ||
| 42 | + .backgroundColor(Color.Red) | ||
| 43 | + .fontColor(Color.White) | ||
| 44 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 45 | + .margin({ left: 5, bottom: 5 }) | ||
| 46 | + }.alignContent(Alignment.BottomStart) | ||
| 47 | + | ||
| 48 | + // 专题列表--后端返回三个, | ||
| 49 | + Column() { | ||
| 50 | + ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => { | ||
| 51 | + this.timelineItem(item, index) | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 | ||
| 56 | + if (this.contentDTO.hasMore == 1) { | ||
| 57 | + Row() { | ||
| 58 | + Text("查看更多") | ||
| 59 | + .fontSize($r("app.float.font_size_14")) | ||
| 60 | + .fontColor($r("app.color.color_222222")) | ||
| 61 | + .margin({ right: 1 }) | ||
| 62 | + Image($r("app.media.more")) | ||
| 63 | + .width(14) | ||
| 64 | + .height(14) | ||
| 65 | + } | ||
| 66 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 67 | + .width(CommonConstants.FULL_WIDTH) | ||
| 68 | + .height(40) | ||
| 69 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 70 | + .justifyContent(FlexAlign.Center) | ||
| 71 | + .margin({ top: 5 }) | ||
| 72 | + .onClick((event: ClickEvent) => { | ||
| 73 | + ProcessUtils.processPage(this.contentDTO) | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + .width(CommonConstants.FULL_WIDTH) | ||
| 78 | + .padding({ | ||
| 79 | + top: 14, | ||
| 80 | + left: 16, | ||
| 81 | + right: 16, | ||
| 82 | + bottom: 14 | ||
| 83 | + }) | ||
| 84 | + .backgroundColor($r("app.color.white")) | ||
| 85 | + .margin({ bottom: 8 }) | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @Builder | ||
| 89 | + timelineItem(item: slideShows, index: number) { | ||
| 90 | + Row() { | ||
| 91 | + Column() { | ||
| 92 | + Text(item.newsTitle) | ||
| 93 | + .fontSize($r('app.float.font_size_17')) | ||
| 94 | + .fontWeight(400) | ||
| 95 | + .fontColor($r('app.color.color_222222')) | ||
| 96 | + .maxLines(2) | ||
| 97 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 98 | + Row() { | ||
| 99 | + // 展示发稿人 | ||
| 100 | + if (item.source) { | ||
| 101 | + Text(item.source) | ||
| 102 | + .fontSize($r('app.float.font_size_12')) | ||
| 103 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 104 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 105 | + .maxLines(1) | ||
| 106 | + .width(item.source.length > 10 ? '60%' : '') | ||
| 107 | + | ||
| 108 | + Image($r('app.media.point')) | ||
| 109 | + .width(16) | ||
| 110 | + .height(16) | ||
| 111 | + } | ||
| 112 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime)))) | ||
| 113 | + .fontSize($r("app.float.font_size_12")) | ||
| 114 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 115 | + } | ||
| 116 | + .margin({ top: 12 }) | ||
| 117 | + } | ||
| 118 | + .layoutWeight(1) | ||
| 119 | + .alignItems(HorizontalAlign.Start) | ||
| 120 | + | ||
| 121 | + // 右侧图片 | ||
| 122 | + if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | ||
| 123 | + Image(item.fullColumnImgUrls[0].url) | ||
| 124 | + .width(117) | ||
| 125 | + .height(78) | ||
| 126 | + .objectFit(ImageFit.Cover) | ||
| 127 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 128 | + .margin({ left: 12 }) | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + .padding({ top: 10, bottom: 10 }) | ||
| 132 | + .onClick((event: ClickEvent) => { | ||
| 133 | + const str: string = JSON.stringify(this.contentDTO); | ||
| 134 | + const data: ContentDTO = JSON.parse(str) | ||
| 135 | + data.objectId = item.newsId | ||
| 136 | + data.relId = item.relId | ||
| 137 | + data.objectType = String(item.objectType) | ||
| 138 | + ProcessUtils.processPage(data) | ||
| 139 | + }) | ||
| 140 | + } | ||
| 141 | +} |
| 1 | +//缩略标题 | ||
| 2 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | +import { ContentDTO } from 'wdBean' | ||
| 4 | +import { DateTimeUtils } from 'wdKit' | ||
| 5 | + | ||
| 6 | +const TAG = 'Card11Component'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 无图卡(标题省略) | ||
| 10 | + */ | ||
| 11 | +@Component | ||
| 12 | +export struct Card11Component { | ||
| 13 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + Column() { | ||
| 17 | + Text(this.contentDTO.newsTitle) | ||
| 18 | + .fontSize($r("app.float.font_size_16")) | ||
| 19 | + .fontColor($r("app.color.color_222222")) | ||
| 20 | + .maxLines(3) | ||
| 21 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 22 | + .width(CommonConstants.FULL_WIDTH) | ||
| 23 | + Row() { | ||
| 24 | + Text("锐评") | ||
| 25 | + .fontSize($r("app.float.font_size_12")) | ||
| 26 | + .fontColor($r("app.color.color_ED2800")) | ||
| 27 | + Text(this.contentDTO.source) | ||
| 28 | + .fontSize($r("app.float.font_size_12")) | ||
| 29 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 30 | + .margin({ left: 6 }) | ||
| 31 | + Image($r("app.media.point")) | ||
| 32 | + .width(16) | ||
| 33 | + .height(16) | ||
| 34 | + | ||
| 35 | + Text(DateTimeUtils.formatDate(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 36 | + .fontSize($r("app.float.font_size_12")) | ||
| 37 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 38 | + | ||
| 39 | + }.width(CommonConstants.FULL_WIDTH) | ||
| 40 | + .justifyContent(FlexAlign.Start) | ||
| 41 | + .margin({ top: 8 }) | ||
| 42 | + | ||
| 43 | + }.width(CommonConstants.FULL_WIDTH) | ||
| 44 | + .padding({ | ||
| 45 | + top: 14, | ||
| 46 | + left: 16, | ||
| 47 | + right: 16, | ||
| 48 | + bottom: 14 | ||
| 49 | + }) | ||
| 50 | + .backgroundColor($r("app.color.white")) | ||
| 51 | + .margin({ bottom: 8 }) | ||
| 52 | + } | ||
| 53 | +} |
| 1 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | ||
| 3 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 4 | +import { DateTimeUtils } from 'wdKit'; | ||
| 5 | +import { WDRouterRule } from 'wdRouter'; | ||
| 6 | + | ||
| 7 | +const TAG = 'Card17Component'; | ||
| 8 | +/** | ||
| 9 | +* 图卡集---2 | ||
| 10 | +*/ | ||
| 11 | + | ||
| 12 | +@Component | ||
| 13 | +export struct Card17Component { | ||
| 14 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 15 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 16 | + | ||
| 17 | + build() { | ||
| 18 | + Column({ space: 8 }) { | ||
| 19 | + Text(this.contentDTO.newsTitle) | ||
| 20 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 21 | + .fontSize(17) | ||
| 22 | + .fontColor(0x222222) | ||
| 23 | + .lineHeight(25) | ||
| 24 | + .maxLines(3) | ||
| 25 | + .width(CommonConstants.FULL_WIDTH) | ||
| 26 | + | ||
| 27 | + RelativeContainer() { | ||
| 28 | + Image(this.contentDTO.fullColumnImgUrls[0].url) | ||
| 29 | + .width('66.6%') | ||
| 30 | + .aspectRatio(16 / 9) | ||
| 31 | + .alignRules({ | ||
| 32 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 33 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 34 | + }) | ||
| 35 | + .id('mainImage') | ||
| 36 | + | ||
| 37 | + Image(this.contentDTO.fullColumnImgUrls[1].url) | ||
| 38 | + .width('33%') | ||
| 39 | + .aspectRatio(16 / 9) | ||
| 40 | + .alignRules({ | ||
| 41 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 42 | + right: { anchor: "__container__", align: HorizontalAlign.End } | ||
| 43 | + }) | ||
| 44 | + .id('subTopImage') | ||
| 45 | + | ||
| 46 | + Image(this.contentDTO.fullColumnImgUrls[2].url) | ||
| 47 | + .width('33%') | ||
| 48 | + .aspectRatio(16 / 9) | ||
| 49 | + .alignRules({ | ||
| 50 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 51 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom } | ||
| 52 | + }) | ||
| 53 | + .id('subBottomImage') | ||
| 54 | + // 下面是渲染右下角图标 | ||
| 55 | + Shape() { | ||
| 56 | + Rect().width(33).height(18) | ||
| 57 | + } | ||
| 58 | + .fill(0x000000) | ||
| 59 | + .fillOpacity(0.3) | ||
| 60 | + .strokeLineCap(LineCapStyle.Round) | ||
| 61 | + .strokeLineJoin(LineJoinStyle.Round) | ||
| 62 | + .antiAlias(true) | ||
| 63 | + .id('shape') | ||
| 64 | + .alignRules({ | ||
| 65 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 66 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom } | ||
| 67 | + }) | ||
| 68 | + .margin({ | ||
| 69 | + right: 4, | ||
| 70 | + bottom: 4 | ||
| 71 | + }) | ||
| 72 | + | ||
| 73 | + Image($r('app.media.album_card_shape')) | ||
| 74 | + .width(22) | ||
| 75 | + .height(18) | ||
| 76 | + .alignRules({ | ||
| 77 | + left: { anchor: "shape", align: HorizontalAlign.Start }, | ||
| 78 | + top: { anchor: "shape", align: VerticalAlign.Top } | ||
| 79 | + }) | ||
| 80 | + .id('shapeSubImage') | ||
| 81 | + | ||
| 82 | + Text(this.contentDTO.fullColumnImgUrls.length + '') | ||
| 83 | + .fontSize(13) | ||
| 84 | + .fontColor(0xFFFFFF) | ||
| 85 | + .id('pageIndex') | ||
| 86 | + .alignRules({ | ||
| 87 | + right: { anchor: "shape", align: HorizontalAlign.End }, | ||
| 88 | + top: { anchor: "shape", align: VerticalAlign.Top } | ||
| 89 | + }) | ||
| 90 | + .margin({ right: 2 }) | ||
| 91 | + .textAlign(TextAlign.Center) | ||
| 92 | + .width(17) | ||
| 93 | + .height(17) | ||
| 94 | + } | ||
| 95 | + .width(CommonConstants.FULL_WIDTH) | ||
| 96 | + .aspectRatio(24 / 9) | ||
| 97 | + .onClick((event: ClickEvent) => { | ||
| 98 | + let taskAction: Action = { | ||
| 99 | + type: 'JUMP_DETAIL_PAGE', | ||
| 100 | + params: { | ||
| 101 | + detailPageType: 17, | ||
| 102 | + contentID: this.contentDTO.objectId, | ||
| 103 | + extra: { | ||
| 104 | + relType: this.contentDTO.relType, | ||
| 105 | + relId: `${this.contentDTO.relId}`, | ||
| 106 | + } as ExtraDTO | ||
| 107 | + } as Params, | ||
| 108 | + }; | ||
| 109 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 110 | + }) | ||
| 111 | + | ||
| 112 | + Row() { | ||
| 113 | + if (this.contentDTO.source) { | ||
| 114 | + Text(this.contentDTO.source) | ||
| 115 | + .fontSize(13) | ||
| 116 | + .fontColor(0xB0B0B0) | ||
| 117 | + Image($r('app.media.point')) | ||
| 118 | + .width(16) | ||
| 119 | + .height(16) | ||
| 120 | + } | ||
| 121 | + if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { | ||
| 122 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 123 | + .fontSize(13) | ||
| 124 | + .fontColor(0xB0B0B0) | ||
| 125 | + } | ||
| 126 | + Text('328评') | ||
| 127 | + .fontSize(13) | ||
| 128 | + .fontColor(0xB0B0B0) | ||
| 129 | + .margin({ | ||
| 130 | + left: 6 | ||
| 131 | + }) | ||
| 132 | + } | ||
| 133 | + .width(CommonConstants.FULL_WIDTH) | ||
| 134 | + .height(16) | ||
| 135 | + .id('label') | ||
| 136 | + } | ||
| 137 | + .width(CommonConstants.FULL_WIDTH) | ||
| 138 | + .padding({ | ||
| 139 | + top: 14, | ||
| 140 | + left: 16, | ||
| 141 | + right: 16, | ||
| 142 | + bottom: 14 | ||
| 143 | + }) | ||
| 144 | + } | ||
| 145 | +} |
| @@ -62,8 +62,8 @@ export struct Card6Component { | @@ -62,8 +62,8 @@ export struct Card6Component { | ||
| 62 | Stack() { | 62 | Stack() { |
| 63 | Image(this.contentDTO.coverUrl) | 63 | Image(this.contentDTO.coverUrl) |
| 64 | .borderRadius(5) | 64 | .borderRadius(5) |
| 65 | - .aspectRatio(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4) | ||
| 66 | - .height(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 90 : 180) | 65 | + .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 66 | + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) | ||
| 67 | if (this.contentDTO.videoInfo) { | 67 | if (this.contentDTO.videoInfo) { |
| 68 | Row() { | 68 | Row() { |
| 69 | Image($r('app.media.iv_card_play_yellow_flag')) | 69 | Image($r('app.media.iv_card_play_yellow_flag')) |
| @@ -111,7 +111,7 @@ export struct Card6Component { | @@ -111,7 +111,7 @@ export struct Card6Component { | ||
| 111 | .padding( | 111 | .padding( |
| 112 | { top: 16, bottom: 16, left: 14, right: 14 }) | 112 | { top: 16, bottom: 16, left: 14, right: 14 }) |
| 113 | .width(FULL_PARENT) | 113 | .width(FULL_PARENT) |
| 114 | - .height(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 127 : 217) | 114 | + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 127 : 217) |
| 115 | .justifyContent(FlexAlign.SpaceBetween) | 115 | .justifyContent(FlexAlign.SpaceBetween) |
| 116 | 116 | ||
| 117 | } | 117 | } |
| 1 | +import { ContentDTO, slideShows } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | +import { DateTimeUtils } from 'wdKit'; | ||
| 4 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 时间链卡--CompStyle: 09 | ||
| 8 | + */ | ||
| 9 | +const TAG: string = 'Card9Component'; | ||
| 10 | + | ||
| 11 | +@Component | ||
| 12 | +export struct Card9Component { | ||
| 13 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + Column() { | ||
| 17 | + // 顶部标题,最多两行 | ||
| 18 | + if (this.contentDTO.newsTitle) { | ||
| 19 | + Text(this.contentDTO.newsTitle) | ||
| 20 | + .width(CommonConstants.FULL_WIDTH) | ||
| 21 | + .fontSize($r('app.float.font_size_17')) | ||
| 22 | + .fontWeight(600) | ||
| 23 | + .maxLines(2) | ||
| 24 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 25 | + .margin({ bottom: 19 }) | ||
| 26 | + } | ||
| 27 | + // 大图 | ||
| 28 | + Stack() { | ||
| 29 | + Image(this.contentDTO.coverUrl) | ||
| 30 | + .width('100%') | ||
| 31 | + .borderRadius({ | ||
| 32 | + topLeft: $r('app.float.image_border_radius'), | ||
| 33 | + topRight: $r('app.float.image_border_radius') | ||
| 34 | + }) | ||
| 35 | + Text('专题') | ||
| 36 | + .fontSize($r('app.float.font_size_12')) | ||
| 37 | + .padding({ left: 8, right: 8, top: 3, bottom: 3 }) | ||
| 38 | + .backgroundColor(Color.Red) | ||
| 39 | + .fontColor(Color.White) | ||
| 40 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 41 | + .margin({ left: 5, bottom: 5 }) | ||
| 42 | + }.alignContent(Alignment.BottomStart) | ||
| 43 | + | ||
| 44 | + // 时间线--后端返回三个, | ||
| 45 | + Column() { | ||
| 46 | + ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => { | ||
| 47 | + this.timelineItem(item, index) | ||
| 48 | + }) | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 | ||
| 52 | + if (this.contentDTO.hasMore == 1) { | ||
| 53 | + Row() { | ||
| 54 | + Text("查看更多") | ||
| 55 | + .fontSize($r("app.float.font_size_14")) | ||
| 56 | + .fontColor($r("app.color.color_222222")) | ||
| 57 | + .margin({ right: 1 }) | ||
| 58 | + Image($r("app.media.more")) | ||
| 59 | + .width(14) | ||
| 60 | + .height(14) | ||
| 61 | + } | ||
| 62 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 63 | + .width(CommonConstants.FULL_WIDTH) | ||
| 64 | + .height(40) | ||
| 65 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 66 | + .justifyContent(FlexAlign.Center) | ||
| 67 | + .margin({ top: 5 }) | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + .width(CommonConstants.FULL_WIDTH) | ||
| 71 | + .padding({ | ||
| 72 | + top: 14, | ||
| 73 | + left: 16, | ||
| 74 | + right: 16, | ||
| 75 | + bottom: 14 | ||
| 76 | + }) | ||
| 77 | + .backgroundColor($r("app.color.white")) | ||
| 78 | + .margin({ bottom: 8 }) | ||
| 79 | + .onClick((event: ClickEvent) => { | ||
| 80 | + ProcessUtils.processPage(this.contentDTO) | ||
| 81 | + }) | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @Builder | ||
| 85 | + timelineItem(item: slideShows, index: number) { | ||
| 86 | + Column() { | ||
| 87 | + Stack() { | ||
| 88 | + if (index < this.contentDTO.slideShows.length - 1) { | ||
| 89 | + Divider() | ||
| 90 | + .vertical(true) | ||
| 91 | + .color($r('app.color.color_EDEDED')) | ||
| 92 | + .strokeWidth(1) | ||
| 93 | + .margin({ top: index > 0 ? 0 : 16, left: 4 }) | ||
| 94 | + } | ||
| 95 | + if (index > 0 && index == this.contentDTO.slideShows.length - 1) { | ||
| 96 | + Divider() | ||
| 97 | + .vertical(true) | ||
| 98 | + .color($r('app.color.color_EDEDED')) | ||
| 99 | + .strokeWidth(1) | ||
| 100 | + .height(16) | ||
| 101 | + .margin({ left: 4 }) | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + Column() { | ||
| 105 | + Row() { | ||
| 106 | + // 标题 | ||
| 107 | + Image($r("app.media.point_icon")) | ||
| 108 | + .width(9) | ||
| 109 | + .height(9) | ||
| 110 | + .margin({ right: 5 }) | ||
| 111 | + Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm")) | ||
| 112 | + .fontSize($r('app.float.font_size_12')) | ||
| 113 | + .fontColor($r('app.color.color_222222')) | ||
| 114 | + .fontWeight(600) | ||
| 115 | + } | ||
| 116 | + .width(CommonConstants.FULL_WIDTH) | ||
| 117 | + .height(32) | ||
| 118 | + .alignItems(VerticalAlign.Center) | ||
| 119 | + | ||
| 120 | + Row() { | ||
| 121 | + Text(item.newsTitle) | ||
| 122 | + .fontSize($r('app.float.font_size_17')) | ||
| 123 | + .fontWeight(400) | ||
| 124 | + .fontColor($r('app.color.color_222222')) | ||
| 125 | + .layoutWeight(1) | ||
| 126 | + .maxLines(2) | ||
| 127 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 128 | + .alignSelf(ItemAlign.Center) | ||
| 129 | + .margin({ left: 12 }) | ||
| 130 | + if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | ||
| 131 | + Image(item.fullColumnImgUrls[0].url) | ||
| 132 | + .width(90) | ||
| 133 | + .height(60) | ||
| 134 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + .alignContent(Alignment.TopStart) | ||
| 140 | + } | ||
| 141 | + .height(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url ? 100 : 78) | ||
| 142 | + .alignItems(HorizontalAlign.Start) | ||
| 143 | + } | ||
| 144 | +} |
| 1 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { CompStyle } from 'wdConstant'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import { WDRouterRule } from 'wdRouter'; | ||
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 6 | + | ||
| 7 | +const TAG = 'Zh_Grid_Layout-03'; | ||
| 8 | +const FULL_PARENT: string = '100%'; | ||
| 9 | +let listSize: number = 4; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 金刚卡位 | ||
| 13 | + * 枚举值Zh_Grid_Layout-03 | ||
| 14 | + * Zh_Grid_Layout-03 | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | +@Preview | ||
| 18 | +@Component | ||
| 19 | +export struct ZhGridLayout03 { | ||
| 20 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 21 | + | ||
| 22 | + aboutToAppear() { | ||
| 23 | + if (this.compDTO.operDataList) { | ||
| 24 | + listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length; | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + build() { | ||
| 29 | + GridRow({ | ||
| 30 | + columns: { sm: listSize, md: 8 }, | ||
| 31 | + breakpoints: { value: ['320vp', '520vp', '840vp'] } | ||
| 32 | + }) { | ||
| 33 | + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 34 | + GridCol() { | ||
| 35 | + this.buildItemCard(this.compDTO.operDataList[index]); | ||
| 36 | + } | ||
| 37 | + }) | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 组件项 | ||
| 43 | + * | ||
| 44 | + * @param programmeBean item 组件项, 上面icon,下面标题 | ||
| 45 | + */ | ||
| 46 | + @Builder | ||
| 47 | + buildItemCard(item: ContentDTO) { | ||
| 48 | + Column() { | ||
| 49 | + Image(item.coverUrl) | ||
| 50 | + .width(44) | ||
| 51 | + .aspectRatio(1 / 1) | ||
| 52 | + .margin(16) | ||
| 53 | + Text(item.newsTitle) | ||
| 54 | + .fontSize(13) | ||
| 55 | + .maxLines(1) | ||
| 56 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 57 | + } | ||
| 58 | + .width('100%') | ||
| 59 | + } | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | + |
| 1 | +import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant'; | ||
| 3 | +import { DateTimeUtils } from 'wdKit'; | ||
| 4 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 本地精选卡 | ||
| 8 | + * ZhSingleRow04 | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +@Component | ||
| 12 | +export struct ZhSingleRow04 { | ||
| 13 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 14 | + | ||
| 15 | + aboutToAppear() {} | ||
| 16 | + | ||
| 17 | + build() { | ||
| 18 | + Column(){ | ||
| 19 | + //顶部 | ||
| 20 | + Row(){ | ||
| 21 | + Row() { | ||
| 22 | + Image($r("app.media.local_selection")) | ||
| 23 | + .width(24) | ||
| 24 | + .height(24) | ||
| 25 | + .margin({ right: 4 }) | ||
| 26 | + Text(this.compDTO.objectTitle) | ||
| 27 | + .fontSize($r("app.float.font_size_17")) | ||
| 28 | + .fontColor($r("app.color.color_222222")) | ||
| 29 | + .fontWeight(600) | ||
| 30 | + } | ||
| 31 | + Row() { | ||
| 32 | + Text("更多") | ||
| 33 | + .fontSize($r("app.float.font_size_14")) | ||
| 34 | + .fontColor($r("app.color.color_999999")) | ||
| 35 | + .margin({ right: 1 }) | ||
| 36 | + Image($r("app.media.more")) | ||
| 37 | + .width(14) | ||
| 38 | + .height(14) | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 42 | + .margin({ top: 8, bottom: 8 }) | ||
| 43 | + .width('100%') | ||
| 44 | + // 列表内容 | ||
| 45 | + List({ space: 12 }) { | ||
| 46 | + ForEach(this.compDTO.operDataList, (item: ContentDTO) => { | ||
| 47 | + ListItem() { | ||
| 48 | + Row(){ | ||
| 49 | + if(item.coverUrl) { | ||
| 50 | + Image(item.coverUrl) | ||
| 51 | + .width(84) | ||
| 52 | + .height(56) | ||
| 53 | + .borderRadius(3) | ||
| 54 | + .objectFit(ImageFit.Cover) | ||
| 55 | + .padding({right: 6}) | ||
| 56 | + } | ||
| 57 | + Column(){ | ||
| 58 | + Text(item.newsTitle) | ||
| 59 | + .fontSize($r("app.float.font_size_16")) | ||
| 60 | + .fontColor($r("app.color.color_212228")) | ||
| 61 | + .fontWeight(400) | ||
| 62 | + .maxLines(2) | ||
| 63 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 64 | + .margin({ top: 8 }) | ||
| 65 | + | ||
| 66 | + Row(){ | ||
| 67 | + Text(item.source) | ||
| 68 | + .fontSize($r('app.float.font_size_12')) | ||
| 69 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 70 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 71 | + .maxLines(1) | ||
| 72 | + .width(item.source.length > 10 ? '60%' : '') | ||
| 73 | + Image($r("app.media.point")) | ||
| 74 | + .width(16) | ||
| 75 | + .height(16) | ||
| 76 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime))) | ||
| 77 | + .fontSize($r("app.float.font_size_12")) | ||
| 78 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 79 | + } | ||
| 80 | + .width('100%') | ||
| 81 | + } | ||
| 82 | + .width(200) | ||
| 83 | + } | ||
| 84 | + // .margin({right: 18}) | ||
| 85 | + .onClick(() =>{ | ||
| 86 | + ProcessUtils.processPage(item) | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + }) | ||
| 90 | + } | ||
| 91 | + .listDirection(Axis.Horizontal) | ||
| 92 | + .width('100%') | ||
| 93 | + } | ||
| 94 | + .width(CommonConstants.FULL_WIDTH) | ||
| 95 | + .padding({ | ||
| 96 | + top: 14, | ||
| 97 | + left: 16, | ||
| 98 | + right: 16, | ||
| 99 | + bottom: 14 | ||
| 100 | + }) | ||
| 101 | + .backgroundColor($r("app.color.white")) | ||
| 102 | + .margin({ bottom: 8 }) | ||
| 103 | + } | ||
| 104 | +} |
| @@ -73,8 +73,8 @@ export struct SingleImageCardComponent { | @@ -73,8 +73,8 @@ export struct SingleImageCardComponent { | ||
| 73 | Stack() { | 73 | Stack() { |
| 74 | Image(this.compDTO.operDataList[0].coverUrl) | 74 | Image(this.compDTO.operDataList[0].coverUrl) |
| 75 | .borderRadius(5) | 75 | .borderRadius(5) |
| 76 | - .aspectRatio(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4) | ||
| 77 | - .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 90 : 180) | 76 | + .aspectRatio(this.compDTO.compStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 77 | + .height(this.compDTO.compStyle === CompStyle.Card_13 ? 90 : 180) | ||
| 78 | if (this.compDTO.operDataList[0].videoInfo) { | 78 | if (this.compDTO.operDataList[0].videoInfo) { |
| 79 | Row() { | 79 | Row() { |
| 80 | Image($r('app.media.iv_card_play_yellow_flag')) | 80 | Image($r('app.media.iv_card_play_yellow_flag')) |
| @@ -122,7 +122,7 @@ export struct SingleImageCardComponent { | @@ -122,7 +122,7 @@ export struct SingleImageCardComponent { | ||
| 122 | .padding( | 122 | .padding( |
| 123 | { top: 16, bottom: 16, left: 14, right: 14 }) | 123 | { top: 16, bottom: 16, left: 14, right: 14 }) |
| 124 | .width(FULL_PARENT) | 124 | .width(FULL_PARENT) |
| 125 | - .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 127 : 217) | 125 | + .height(this.compDTO.compStyle === CompStyle.Card_13 ? 127 : 217) |
| 126 | .justifyContent(FlexAlign.SpaceBetween) | 126 | .justifyContent(FlexAlign.SpaceBetween) |
| 127 | } | 127 | } |
| 128 | } | 128 | } |
-
Please register or login to post a comment