wangyong_wd

人民号主题卡样式新增

@@ -64,5 +64,6 @@ export interface ContentDTO { @@ -64,5 +64,6 @@ export interface ContentDTO {
64 64
65 hasMore: number, 65 hasMore: number,
66 slideShows: slideShows[], 66 slideShows: slideShows[],
67 - voiceInfo: VoiceInfoDTO 67 + voiceInfo: VoiceInfoDTO,
  68 + tagWord: number,
68 } 69 }
@@ -3,7 +3,6 @@ import { CommonConstants, CompStyle } from 'wdConstant'; @@ -3,7 +3,6 @@ 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 { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; 5 import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
6 -import { ZhGridLayoutComponent } from './view/ZhGridLayoutComponent';  
7 import { 6 import {
8 HorizontalStrokeCardThreeTwoRadioForMoreComponent 7 HorizontalStrokeCardThreeTwoRadioForMoreComponent
9 } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; 8 } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
@@ -11,6 +10,7 @@ import { @@ -11,6 +10,7 @@ import {
11 HorizontalStrokeCardThreeTwoRadioForOneComponent 10 HorizontalStrokeCardThreeTwoRadioForOneComponent
12 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; 11 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
13 import { ZhSingleRow04 } from './compview/ZhSingleRow04' 12 import { ZhSingleRow04 } from './compview/ZhSingleRow04'
  13 +import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'
14 import { ZhGridLayout03 } from './compview/ZhGridLayout03' 14 import { ZhGridLayout03 } from './compview/ZhGridLayout03'
15 import { CardParser } from './CardParser'; 15 import { CardParser } from './CardParser';
16 /** 16 /**
@@ -45,7 +45,9 @@ export struct CompParser { @@ -45,7 +45,9 @@ export struct CompParser {
45 ZhGridLayout03({ compDTO: compDTO }) 45 ZhGridLayout03({ compDTO: compDTO })
46 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { 46 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
47 ZhSingleRow04({ compDTO: compDTO}) 47 ZhSingleRow04({ compDTO: compDTO})
48 - } else if (!isNaN(Number(compDTO.compStyle))) { 48 + } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
  49 + ZhSingleColumn04({ compDTO: compDTO})
  50 + } else if (!Number.isNaN(Number(compDTO.compStyle))) {
49 CardParser({ contentDTO: compDTO.operDataList[0]}); 51 CardParser({ contentDTO: compDTO.operDataList[0]});
50 } 52 }
51 else { 53 else {
  1 +import { CompDTO, ContentDTO } from 'wdBean';
  2 +import { CommonConstants } from 'wdConstant';
  3 +import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +
  5 +const TAG = 'Zh_Single_Column-04';
  6 +
  7 +/**
  8 + * 人民号主题卡
  9 + * 枚举值 Zh_Single_Column-04
  10 + */
  11 +@Entry
  12 +@Component
  13 +export struct ZhSingleColumn04 {
  14 + @State compDTO: CompDTO = {} as CompDTO
  15 + operDataList: ContentDTO[] = [
  16 + // {newsTitle: "民检普法课堂:正当防卫是什么正当防卫是什么正当防卫是什么正当防卫是什么?", tagWord: 1} as ContentDTO,
  17 + // {newsTitle: "审批站”进菜市场 学才艺有云课堂", tagWord: 2} as ContentDTO,
  18 + ]
  19 +
  20 + aboutToAppear() {
  21 + this.operDataList = this.compDTO.operDataList;
  22 + }
  23 +
  24 + build() {
  25 + Column() {
  26 + Row() {
  27 + Image($r("app.media.redLine"))
  28 + .width(3)
  29 + .height(16)
  30 + .margin({ right: 4 })
  31 + Text(this.compDTO.objectTitle)
  32 + .fontSize($r("app.float.font_size_17"))
  33 + .fontColor($r("app.color.color_222222"))
  34 + .fontWeight(600)
  35 + }
  36 + .width(CommonConstants.FULL_WIDTH)
  37 + .margin({ bottom: 10 })
  38 +
  39 + Column() {
  40 + ForEach(this.operDataList, (item: ContentDTO) => {
  41 + this.rmhThemeItem(item)
  42 + })
  43 + }
  44 + }
  45 + .width(CommonConstants.FULL_WIDTH)
  46 + .padding({
  47 + left: $r('app.float.card_comp_pagePadding_lf'),
  48 + right: $r('app.float.card_comp_pagePadding_lf'),
  49 + top: $r('app.float.card_comp_pagePadding_tb'),
  50 + bottom: $r('app.float.card_comp_pagePadding_tb')
  51 + })
  52 + }
  53 +
  54 + @Builder
  55 + rmhThemeItem(item: ContentDTO) {
  56 + Row() {
  57 + Image($r('app.media.rmh_theme_book_icon'))
  58 + .width(12)
  59 + .margin({ left: 12, right: 8 })
  60 + Text(item.newsTitle)
  61 + .fontSizeColorWeight($r('app.float.font_size_12'), $r('app.color.color_222222'), 400)
  62 + .maxLines(1)
  63 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  64 + .layoutWeight(1)
  65 + if (item.tagWord === 1) {
  66 + Text('热')
  67 + .padding(3)
  68 + .borderRadius(4)
  69 + .fontSizeColorWeight($r('app.float.vp_12'), '#F07E46', 500)
  70 + .backgroundColor('rgba(240, 126, 70, 0.2)')
  71 + .margin({ right: 18 })
  72 + } else if (item.tagWord === 2) {
  73 + Text('新')
  74 + .padding(3)
  75 + .borderRadius(4)
  76 + .fontSizeColorWeight($r('app.float.vp_12'), '#468DF0', 500)
  77 + .backgroundColor('rgba(70, 141, 240, 0.2)')
  78 + .margin({ right: 18 })
  79 + }
  80 + }
  81 + .width(CommonConstants.FULL_WIDTH)
  82 + .height(32)
  83 + .margin({ bottom: 4 })
  84 + .backgroundImage($r('app.media.rmh_theme_bg'))
  85 + .backgroundImageSize({ width: CommonConstants.FULL_WIDTH, height: CommonConstants.FULL_WIDTH })
  86 + .onClick(() => {
  87 + ProcessUtils.processPage(item)
  88 + })
  89 + }
  90 +}
  91 +
  92 +@Extend(Text)
  93 +function fontSizeColorWeight(fontSize: Resource, fontColor: Resource | string,
  94 + fontWeight:
  95 + number) {
  96 + .fontSize(fontSize)
  97 + .fontColor(fontColor)
  98 + .fontWeight(fontWeight)
  99 +}
  100 +
@@ -159,6 +159,14 @@ @@ -159,6 +159,14 @@
159 { 159 {
160 "name": "vp_16", 160 "name": "vp_16",
161 "value": "16vp" 161 "value": "16vp"
  162 + },
  163 + {
  164 + "name": "card_comp_pagePadding_lf",
  165 + "value": "16fp"
  166 + },
  167 + {
  168 + "name": "card_comp_pagePadding_tb",
  169 + "value": "14fp"
162 } 170 }
163 ] 171 ]
164 } 172 }