Showing
6 changed files
with
210 additions
and
0 deletions
| @@ -155,6 +155,130 @@ | @@ -155,6 +155,130 @@ | ||
| 155 | "subType": "" | 155 | "subType": "" |
| 156 | }, | 156 | }, |
| 157 | { | 157 | { |
| 158 | + "audioDataList": [], | ||
| 159 | + "backgroundImgUrl": "", | ||
| 160 | + "bottomNavId": null, | ||
| 161 | + "cardItemId": "", | ||
| 162 | + "cardUpdateStrategy": null, | ||
| 163 | + "compStyle": "Single_Imagecard_03", | ||
| 164 | + "compType": "appStyle", | ||
| 165 | + "dataSourceType": "", | ||
| 166 | + "extraData": "", | ||
| 167 | + "fullColumnImgUrls": [], | ||
| 168 | + "hasMore": 1, | ||
| 169 | + "id": null, | ||
| 170 | + "imageScale": null, | ||
| 171 | + "imgSize": "", | ||
| 172 | + "itemId": "", | ||
| 173 | + "itemType": "", | ||
| 174 | + "itemTypeCode": "", | ||
| 175 | + "linkUrl": "", | ||
| 176 | + "name": "", | ||
| 177 | + "objectId": "", | ||
| 178 | + "objectLevel": "", | ||
| 179 | + "objectSummary": "", | ||
| 180 | + "objectTitle": "", | ||
| 181 | + "objectType": "", | ||
| 182 | + "openComment": null, | ||
| 183 | + "openLikes": null, | ||
| 184 | + "operDataList": [ | ||
| 185 | + { | ||
| 186 | + "activityExt": null, | ||
| 187 | + "appStyle": "13", | ||
| 188 | + "askInfo": null, | ||
| 189 | + "axisColor": "", | ||
| 190 | + "bestNoticer": null, | ||
| 191 | + "bottomNavId": null, | ||
| 192 | + "cardItemId": "", | ||
| 193 | + "channelId": 2001, | ||
| 194 | + "commentInfo": null, | ||
| 195 | + "corner": "", | ||
| 196 | + "coverSize": "660*440", | ||
| 197 | + "coverType": 1, | ||
| 198 | + "coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231215/image/display/846c62e2411e4eb39d2ac37bf72910df.png?x-oss-process=image/resize,w_240/quality,q_90/format,jpg", | ||
| 199 | + "extra": "", | ||
| 200 | + "fullColumnImgUrls": [ | ||
| 201 | + { | ||
| 202 | + "format": null, | ||
| 203 | + "height": 440, | ||
| 204 | + "landscape": 1, | ||
| 205 | + "size": 445035, | ||
| 206 | + "url": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231215/image/display/846c62e2411e4eb39d2ac37bf72910df.png?x-oss-process=image/resize,w_240/quality,q_90/format,jpg", | ||
| 207 | + "weight": 660 | ||
| 208 | + } | ||
| 209 | + ], | ||
| 210 | + "hasMore": null, | ||
| 211 | + "itemId": "", | ||
| 212 | + "itemType": "", | ||
| 213 | + "itemTypeCode": "", | ||
| 214 | + "keyArticle": null, | ||
| 215 | + "landscape": null, | ||
| 216 | + "likeStyle": null, | ||
| 217 | + "linkUrl": "", | ||
| 218 | + "liveInfo": null, | ||
| 219 | + "menuShow": 1, | ||
| 220 | + "newTags": "", | ||
| 221 | + "newsAuthor": "", | ||
| 222 | + "newsSubTitle": "", | ||
| 223 | + "newsSummary": "", | ||
| 224 | + "newsTitle": "特稿:《巴黎协定》首次全球“大考” 中国“答卷”尽显大国担当", | ||
| 225 | + "newsTitleColor": "", | ||
| 226 | + "objectId": "30001374647", | ||
| 227 | + "objectLevel": "", | ||
| 228 | + "objectType": "8", | ||
| 229 | + "openComment": null, | ||
| 230 | + "openLikes": null, | ||
| 231 | + "pageId": "", | ||
| 232 | + "photoNum": null, | ||
| 233 | + "position": null, | ||
| 234 | + "publishTime": "1702627948000", | ||
| 235 | + "pushTime": null, | ||
| 236 | + "pushUnqueId": null, | ||
| 237 | + "readFlag": 0, | ||
| 238 | + "recommend": null, | ||
| 239 | + "relId": 500000008765, | ||
| 240 | + "relObjectId": "2001", | ||
| 241 | + "relType": 1, | ||
| 242 | + "rmhInfo": null, | ||
| 243 | + "rmhPlatform": 0, | ||
| 244 | + "sceneId": "", | ||
| 245 | + "shareInfo": null, | ||
| 246 | + "slideShows": [], | ||
| 247 | + "sortValue": null, | ||
| 248 | + "source": "", | ||
| 249 | + "subSceneId": "", | ||
| 250 | + "tagIds": [], | ||
| 251 | + "tagWord": null, | ||
| 252 | + "titleShow": null, | ||
| 253 | + "titleShowPolicy": null, | ||
| 254 | + "topicTemplate": null, | ||
| 255 | + "traceId": "", | ||
| 256 | + "traceInfo": "", | ||
| 257 | + "userInfo": null, | ||
| 258 | + "videoInfo": null, | ||
| 259 | + "visitorComment": 1, | ||
| 260 | + "voiceInfo": null | ||
| 261 | + } | ||
| 262 | + ], | ||
| 263 | + "pageId": "", | ||
| 264 | + "position": null, | ||
| 265 | + "posterSize": "", | ||
| 266 | + "posterUrl": "", | ||
| 267 | + "recommend": 0, | ||
| 268 | + "relId": null, | ||
| 269 | + "sceneId": "", | ||
| 270 | + "sortValue": null, | ||
| 271 | + "subSceneId": "", | ||
| 272 | + "summaryName": "", | ||
| 273 | + "tabOperDataList": [], | ||
| 274 | + "titleShowPolicy": null, | ||
| 275 | + "topicTemplate": null, | ||
| 276 | + "traceId": "", | ||
| 277 | + "traceInfo": "", | ||
| 278 | + "viewTime": "", | ||
| 279 | + "viewTimeBlurred": null | ||
| 280 | + }, | ||
| 281 | + { | ||
| 158 | "backgroundColor": "", | 282 | "backgroundColor": "", |
| 159 | "backgroundImgUrl": "", | 283 | "backgroundImgUrl": "", |
| 160 | "cityCode": "", | 284 | "cityCode": "", |
| @@ -40,4 +40,9 @@ export interface ContentDTO { | @@ -40,4 +40,9 @@ export interface ContentDTO { | ||
| 40 | channelId: string; | 40 | channelId: string; |
| 41 | relId: string; | 41 | relId: string; |
| 42 | relType: string; | 42 | relType: string; |
| 43 | + | ||
| 44 | + //单图卡/2行标题/3行标题 | ||
| 45 | + newsTitle:string; | ||
| 46 | + publishTime:string; | ||
| 47 | + visitorComment:number; | ||
| 43 | } | 48 | } |
| @@ -33,3 +33,5 @@ export { ENewspaperPageComponent } from "./src/main/ets/components/ENewspaperPag | @@ -33,3 +33,5 @@ export { ENewspaperPageComponent } from "./src/main/ets/components/ENewspaperPag | ||
| 33 | export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperItemComponent" | 33 | export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperItemComponent" |
| 34 | 34 | ||
| 35 | export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog" | 35 | export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog" |
| 36 | + | ||
| 37 | +export { SingleImageCardComponent } from "./src/main/ets/components/view/SingleImageCardComponent" |
| @@ -7,6 +7,7 @@ import { HorizontalStrokeCardThreeTwoRadioForOneComponent } from './view/Horizon | @@ -7,6 +7,7 @@ import { HorizontalStrokeCardThreeTwoRadioForOneComponent } from './view/Horizon | ||
| 7 | import { HorizontalStrokeCardThreeTwoRadioForTwoComponent } from './view/HorizontalStrokeCardThreeTwoRadioForTwoComponent'; | 7 | import { HorizontalStrokeCardThreeTwoRadioForTwoComponent } from './view/HorizontalStrokeCardThreeTwoRadioForTwoComponent'; |
| 8 | import { HorizontalStrokeCardThreeTwoRadioForMoreComponent } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; | 8 | import { HorizontalStrokeCardThreeTwoRadioForMoreComponent } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; |
| 9 | import { CompDTO } from 'wdBean'; | 9 | import { CompDTO } from 'wdBean'; |
| 10 | +import { SingleImageCardComponent } from './view/SingleImageCardComponent'; | ||
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| 12 | * comp适配器. | 13 | * comp适配器. |
| @@ -30,6 +31,8 @@ export struct CompParser { | @@ -30,6 +31,8 @@ export struct CompParser { | ||
| 30 | TitleAllComponent({ compDTO: compDTO }) | 31 | TitleAllComponent({ compDTO: compDTO }) |
| 31 | } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) { | 32 | } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) { |
| 32 | BannerComponent({ compDTO: compDTO }) | 33 | BannerComponent({ compDTO: compDTO }) |
| 34 | + } else if (compDTO.compStyle === CompStyle.Single_Imagecard_02 || compDTO.compStyle === CompStyle.Single_Imagecard_03) { | ||
| 35 | + SingleImageCardComponent({ compDTO: compDTO }) | ||
| 33 | } else { | 36 | } else { |
| 34 | // todo:组件未实现 / Component Not Implemented | 37 | // todo:组件未实现 / Component Not Implemented |
| 35 | Text(compDTO.compStyle) | 38 | Text(compDTO.compStyle) |
| 1 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { Logger } from 'wdKit'; | ||
| 3 | +import { WDRouterRule } from 'wdRouter'; | ||
| 4 | + | ||
| 5 | +const TAG = 'SingleImageCardComponent'; | ||
| 6 | +const FULL_PARENT: string = '100%'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 单图卡-3行标题/2行标题 | ||
| 10 | + * 枚举值13 | ||
| 11 | + * ImageCard-03 | ||
| 12 | + * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/ | ||
| 13 | + */ | ||
| 14 | +@Entry | ||
| 15 | +@Component | ||
| 16 | +export struct SingleImageCardComponent { | ||
| 17 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 18 | + @State titleNumber: number = 3 //标题行数 | ||
| 19 | + | ||
| 20 | + aboutToAppear() { | ||
| 21 | + if (this.compDTO.compStyle === 'Single_Imagecard_03') { | ||
| 22 | + this.titleNumber = 3; | ||
| 23 | + } else { | ||
| 24 | + this.titleNumber = 2; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + build() { | ||
| 30 | + Row() { | ||
| 31 | + Column() { | ||
| 32 | + Text(this.compDTO.operDataList[0].newsTitle) | ||
| 33 | + .fontSize(16) | ||
| 34 | + .fontWeight(FontWeight.Bold) | ||
| 35 | + .maxLines(this.titleNumber)// | ||
| 36 | + .alignSelf(ItemAlign.Start) | ||
| 37 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 38 | + .height("70%") | ||
| 39 | + Row() { | ||
| 40 | + Text('人民日报') | ||
| 41 | + .height(40) | ||
| 42 | + .fontSize(14) | ||
| 43 | + .fontColor(Color.Gray) | ||
| 44 | + Image($r('app.media.point')) | ||
| 45 | + .width(16) | ||
| 46 | + .height(16) | ||
| 47 | + Text('45分钟前') | ||
| 48 | + .height(40) | ||
| 49 | + .fontSize(14) | ||
| 50 | + .fontColor(Color.Gray) | ||
| 51 | + Text(this.compDTO.operDataList[0].visitorComment + '评') | ||
| 52 | + .height(40) | ||
| 53 | + .fontSize(14) | ||
| 54 | + .fontColor(Color.Gray) | ||
| 55 | + .padding({ | ||
| 56 | + left: 10 | ||
| 57 | + }) | ||
| 58 | + }.alignSelf(ItemAlign.Start) | ||
| 59 | + .height("30%") | ||
| 60 | + } | ||
| 61 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 62 | + .width('58%') | ||
| 63 | + Blank(16) | ||
| 64 | + Image(this.compDTO.operDataList[0].coverUrl) | ||
| 65 | + .width('38%') | ||
| 66 | + .aspectRatio(3 / 2) | ||
| 67 | + } | ||
| 68 | + .padding( | ||
| 69 | + { top: 16, bottom: 16, left: 14, right: 14 }) | ||
| 70 | + .width(FULL_PARENT) | ||
| 71 | + .height(this.titleNumber === 3 ? '152vp' : '106vp') | ||
| 72 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 73 | + } | ||
| 74 | +} |
| @@ -21,4 +21,6 @@ export const enum CompStyle { | @@ -21,4 +21,6 @@ export const enum CompStyle { | ||
| 21 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 | 21 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 |
| 22 | Title_Abbr_01 = 'Title_Abbr_01', // 标题缩略 | 22 | Title_Abbr_01 = 'Title_Abbr_01', // 标题缩略 |
| 23 | Title_All_01 = 'Title_All_01', // 全标题 | 23 | Title_All_01 = 'Title_All_01', // 全标题 |
| 24 | + Single_Imagecard_02 = 'Single_Imagecard_02',//单图卡:2行标题 | ||
| 25 | + Single_Imagecard_03 = 'Single_Imagecard_03'//单图卡:3行标题 | ||
| 24 | } | 26 | } |
-
Please register or login to post a comment