wangyong_wd

人民号主题卡样式新增

... ... @@ -64,5 +64,6 @@ export interface ContentDTO {
hasMore: number,
slideShows: slideShows[],
voiceInfo: VoiceInfoDTO
voiceInfo: VoiceInfoDTO,
tagWord: number,
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,6 @@ import { CommonConstants, CompStyle } from 'wdConstant';
import { BannerComponent } from './view/BannerComponent';
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import { ZhGridLayoutComponent } from './view/ZhGridLayoutComponent';
import {
HorizontalStrokeCardThreeTwoRadioForMoreComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
... ... @@ -11,6 +10,7 @@ import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow04 } from './compview/ZhSingleRow04'
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'
import { ZhGridLayout03 } from './compview/ZhGridLayout03'
import { CardParser } from './CardParser';
/**
... ... @@ -45,7 +45,9 @@ export struct CompParser {
ZhGridLayout03({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: compDTO})
} else if (!isNaN(Number(compDTO.compStyle))) {
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO})
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0]});
}
else {
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG = 'Zh_Single_Column-04';
/**
* 人民号主题卡
* 枚举值 Zh_Single_Column-04
*/
@Entry
@Component
export struct ZhSingleColumn04 {
@State compDTO: CompDTO = {} as CompDTO
operDataList: ContentDTO[] = [
// {newsTitle: "民检普法课堂:正当防卫是什么正当防卫是什么正当防卫是什么正当防卫是什么?", tagWord: 1} as ContentDTO,
// {newsTitle: "审批站”进菜市场 学才艺有云课堂", tagWord: 2} as ContentDTO,
]
aboutToAppear() {
this.operDataList = this.compDTO.operDataList;
}
build() {
Column() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text(this.compDTO.objectTitle)
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
.width(CommonConstants.FULL_WIDTH)
.margin({ bottom: 10 })
Column() {
ForEach(this.operDataList, (item: ContentDTO) => {
this.rmhThemeItem(item)
})
}
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
}
@Builder
rmhThemeItem(item: ContentDTO) {
Row() {
Image($r('app.media.rmh_theme_book_icon'))
.width(12)
.margin({ left: 12, right: 8 })
Text(item.newsTitle)
.fontSizeColorWeight($r('app.float.font_size_12'), $r('app.color.color_222222'), 400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)
if (item.tagWord === 1) {
Text('热')
.padding(3)
.borderRadius(4)
.fontSizeColorWeight($r('app.float.vp_12'), '#F07E46', 500)
.backgroundColor('rgba(240, 126, 70, 0.2)')
.margin({ right: 18 })
} else if (item.tagWord === 2) {
Text('新')
.padding(3)
.borderRadius(4)
.fontSizeColorWeight($r('app.float.vp_12'), '#468DF0', 500)
.backgroundColor('rgba(70, 141, 240, 0.2)')
.margin({ right: 18 })
}
}
.width(CommonConstants.FULL_WIDTH)
.height(32)
.margin({ bottom: 4 })
.backgroundImage($r('app.media.rmh_theme_bg'))
.backgroundImageSize({ width: CommonConstants.FULL_WIDTH, height: CommonConstants.FULL_WIDTH })
.onClick(() => {
ProcessUtils.processPage(item)
})
}
}
@Extend(Text)
function fontSizeColorWeight(fontSize: Resource, fontColor: Resource | string,
fontWeight:
number) {
.fontSize(fontSize)
.fontColor(fontColor)
.fontWeight(fontWeight)
}
... ...
... ... @@ -159,6 +159,14 @@
{
"name": "vp_16",
"value": "16vp"
},
{
"name": "card_comp_pagePadding_lf",
"value": "16fp"
},
{
"name": "card_comp_pagePadding_tb",
"value": "14fp"
}
]
}
\ No newline at end of file
... ...