guochunsong

单图卡,2行/3行 comp提交

... ... @@ -155,6 +155,130 @@
"subType": ""
},
{
"audioDataList": [],
"backgroundImgUrl": "",
"bottomNavId": null,
"cardItemId": "",
"cardUpdateStrategy": null,
"compStyle": "Single_Imagecard_03",
"compType": "appStyle",
"dataSourceType": "",
"extraData": "",
"fullColumnImgUrls": [],
"hasMore": 1,
"id": null,
"imageScale": null,
"imgSize": "",
"itemId": "",
"itemType": "",
"itemTypeCode": "",
"linkUrl": "",
"name": "",
"objectId": "",
"objectLevel": "",
"objectSummary": "",
"objectTitle": "",
"objectType": "",
"openComment": null,
"openLikes": null,
"operDataList": [
{
"activityExt": null,
"appStyle": "13",
"askInfo": null,
"axisColor": "",
"bestNoticer": null,
"bottomNavId": null,
"cardItemId": "",
"channelId": 2001,
"commentInfo": null,
"corner": "",
"coverSize": "660*440",
"coverType": 1,
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231215/image/display/846c62e2411e4eb39d2ac37bf72910df.png?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",
"extra": "",
"fullColumnImgUrls": [
{
"format": null,
"height": 440,
"landscape": 1,
"size": 445035,
"url": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231215/image/display/846c62e2411e4eb39d2ac37bf72910df.png?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",
"weight": 660
}
],
"hasMore": null,
"itemId": "",
"itemType": "",
"itemTypeCode": "",
"keyArticle": null,
"landscape": null,
"likeStyle": null,
"linkUrl": "",
"liveInfo": null,
"menuShow": 1,
"newTags": "",
"newsAuthor": "",
"newsSubTitle": "",
"newsSummary": "",
"newsTitle": "特稿:《巴黎协定》首次全球“大考” 中国“答卷”尽显大国担当",
"newsTitleColor": "",
"objectId": "30001374647",
"objectLevel": "",
"objectType": "8",
"openComment": null,
"openLikes": null,
"pageId": "",
"photoNum": null,
"position": null,
"publishTime": "1702627948000",
"pushTime": null,
"pushUnqueId": null,
"readFlag": 0,
"recommend": null,
"relId": 500000008765,
"relObjectId": "2001",
"relType": 1,
"rmhInfo": null,
"rmhPlatform": 0,
"sceneId": "",
"shareInfo": null,
"slideShows": [],
"sortValue": null,
"source": "",
"subSceneId": "",
"tagIds": [],
"tagWord": null,
"titleShow": null,
"titleShowPolicy": null,
"topicTemplate": null,
"traceId": "",
"traceInfo": "",
"userInfo": null,
"videoInfo": null,
"visitorComment": 1,
"voiceInfo": null
}
],
"pageId": "",
"position": null,
"posterSize": "",
"posterUrl": "",
"recommend": 0,
"relId": null,
"sceneId": "",
"sortValue": null,
"subSceneId": "",
"summaryName": "",
"tabOperDataList": [],
"titleShowPolicy": null,
"topicTemplate": null,
"traceId": "",
"traceInfo": "",
"viewTime": "",
"viewTimeBlurred": null
},
{
"backgroundColor": "",
"backgroundImgUrl": "",
"cityCode": "",
... ...
... ... @@ -40,4 +40,9 @@ export interface ContentDTO {
channelId: string;
relId: string;
relType: string;
//单图卡/2行标题/3行标题
newsTitle:string;
publishTime:string;
visitorComment:number;
}
\ No newline at end of file
... ...
... ... @@ -33,3 +33,5 @@ export { ENewspaperPageComponent } from "./src/main/ets/components/ENewspaperPag
export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperItemComponent"
export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog"
export { SingleImageCardComponent } from "./src/main/ets/components/view/SingleImageCardComponent"
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@ import { HorizontalStrokeCardThreeTwoRadioForOneComponent } from './view/Horizon
import { HorizontalStrokeCardThreeTwoRadioForTwoComponent } from './view/HorizontalStrokeCardThreeTwoRadioForTwoComponent';
import { HorizontalStrokeCardThreeTwoRadioForMoreComponent } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
import { CompDTO } from 'wdBean';
import { SingleImageCardComponent } from './view/SingleImageCardComponent';
/**
* comp适配器.
... ... @@ -30,6 +31,8 @@ export struct CompParser {
TitleAllComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Single_Imagecard_02 || compDTO.compStyle === CompStyle.Single_Imagecard_03) {
SingleImageCardComponent({ compDTO: compDTO })
} else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
... ...
import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
const TAG = 'SingleImageCardComponent';
const FULL_PARENT: string = '100%';
/**
* 单图卡-3行标题/2行标题
* 枚举值13
* ImageCard-03
* 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/
*/
@Entry
@Component
export struct SingleImageCardComponent {
@State compDTO: CompDTO = {} as CompDTO
@State titleNumber: number = 3 //标题行数
aboutToAppear() {
if (this.compDTO.compStyle === 'Single_Imagecard_03') {
this.titleNumber = 3;
} else {
this.titleNumber = 2;
}
}
build() {
Row() {
Column() {
Text(this.compDTO.operDataList[0].newsTitle)
.fontSize(16)
.fontWeight(FontWeight.Bold)
.maxLines(this.titleNumber)//
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.height("70%")
Row() {
Text('人民日报')
.height(40)
.fontSize(14)
.fontColor(Color.Gray)
Image($r('app.media.point'))
.width(16)
.height(16)
Text('45分钟前')
.height(40)
.fontSize(14)
.fontColor(Color.Gray)
Text(this.compDTO.operDataList[0].visitorComment + '评')
.height(40)
.fontSize(14)
.fontColor(Color.Gray)
.padding({
left: 10
})
}.alignSelf(ItemAlign.Start)
.height("30%")
}
.justifyContent(FlexAlign.SpaceBetween)
.width('58%')
Blank(16)
Image(this.compDTO.operDataList[0].coverUrl)
.width('38%')
.aspectRatio(3 / 2)
}
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.width(FULL_PARENT)
.height(this.titleNumber === 3 ? '152vp' : '106vp')
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
... ...
... ... @@ -21,4 +21,6 @@ export const enum CompStyle {
Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动
Title_Abbr_01 = 'Title_Abbr_01', // 标题缩略
Title_All_01 = 'Title_All_01', // 全标题
Single_Imagecard_02 = 'Single_Imagecard_02',//单图卡:2行标题
Single_Imagecard_03 = 'Single_Imagecard_03'//单图卡:3行标题
}
... ...