wangyujian_wd

fix:修改小视频卡组件的样式逻辑(小视频卡/小视频卡横划卡)

@@ -4,14 +4,22 @@ import { BannerComponent } from './view/BannerComponent'; @@ -4,14 +4,22 @@ import { BannerComponent } from './view/BannerComponent';
4 import { LabelComponent } from './view/LabelComponent'; 4 import { LabelComponent } from './view/LabelComponent';
5 import { TitleAbbrComponent } from './view/TitleAbbrComponent'; 5 import { TitleAbbrComponent } from './view/TitleAbbrComponent';
6 import { TitleAllComponent } from './view/TitleAllComponent'; 6 import { TitleAllComponent } from './view/TitleAllComponent';
7 -import { HorizontalStrokeCardThreeTwoRadioForOneComponent } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';  
8 -import { HorizontalStrokeCardThreeTwoRadioForMoreComponent } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; 7 +import {
  8 + HorizontalStrokeCardThreeTwoRadioForOneComponent
  9 +} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
  10 +import {
  11 + HorizontalStrokeCardThreeTwoRadioForMoreComponent
  12 +} from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
9 import { BigPicCardComponent } from './view/BigPicCardComponent'; 13 import { BigPicCardComponent } from './view/BigPicCardComponent';
10 import { TriPicCardComponent } from './view/TriPicCardComponent'; 14 import { TriPicCardComponent } from './view/TriPicCardComponent';
11 import { HeadPictureCardComponent } from './view/HeadPictureCardComponent'; 15 import { HeadPictureCardComponent } from './view/HeadPictureCardComponent';
12 16
13 import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; 17 import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
14 18
  19 +import { SmallVideoCardComponent } from './view/SmallVideoCardComponent';
  20 +
  21 +import { SmallVideoCardHorComponent } from './view/SmallVideoCardHorComponent';
  22 +
15 /** 23 /**
16 * comp适配器. 24 * comp适配器.
17 */ 25 */
@@ -48,7 +56,14 @@ export struct CompParser { @@ -48,7 +56,14 @@ export struct CompParser {
48 } 56 }
49 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { 57 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
50 HeadPictureCardComponent({ compDTO: compDTO }) 58 HeadPictureCardComponent({ compDTO: compDTO })
  59 + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
  60 + if (compDTO.operDataList.length > 1) {
  61 + SmallVideoCardHorComponent({ compDTO: compDTO })
51 } else { 62 } else {
  63 + SmallVideoCardComponent({ compDTO: compDTO })
  64 + }
  65 + }
  66 + else {
52 // todo:组件未实现 / Component Not Implemented 67 // todo:组件未实现 / Component Not Implemented
53 Text(compDTO.compStyle) 68 Text(compDTO.compStyle)
54 .width(CommonConstants.FULL_PARENT) 69 .width(CommonConstants.FULL_PARENT)
1 -// import { CommonConstants } from 'wdConstant/src/main/ets/constants/CommonConstants'  
2 -  
3 -@Entry 1 +import { CompDTO } from '../../repository/bean/CompDTO';
  2 +/**
  3 + * 小视频卡
  4 + */
4 @Component 5 @Component
5 export struct SmallVideoCardComponent { 6 export struct SmallVideoCardComponent {
  7 + @State compDTO: CompDTO = {} as CompDTO
  8 +
6 build() { 9 build() {
7 Row() { 10 Row() {
8 Column() { 11 Column() {
  1 +import { CompDTO } from '../../repository/bean/CompDTO'
  2 +import { ContentDTO } from '../../repository/bean/ContentDTO'
  3 +/**
  4 + * 通用 小视频卡3张以下
  5 + */
  6 +@Component
  7 +export struct SmallVideoCardHorComponent {
  8 + @State compDTO: CompDTO = {} as CompDTO
  9 +
  10 + build() {
  11 + Column() {
  12 + this.labelTabStyle()
  13 + List({ space: 8 }) {
  14 + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
  15 + ListItem() {
  16 + this.itemStyle(item)
  17 + }
  18 + }, (item: string, index: number) => {
  19 + return index.toString()
  20 + })
  21 + }
  22 + .listDirection(Axis.Horizontal)
  23 + .margin({
  24 + left: 16
  25 + })
  26 + }
  27 + }
  28 +
  29 + @Builder
  30 + itemStyle(item: ContentDTO) {
  31 + Stack({ alignContent: Alignment.Bottom }) {
  32 + Image(item.coverUrl)
  33 + .width(156)
  34 + .aspectRatio(156 / 208)
  35 + Row() {
  36 + Text(item.title)
  37 + .fontColor('#FFFFFF')
  38 + .fontSize('14fp')
  39 + .fontWeight(600)
  40 + }
  41 + .height(80)
  42 + .aspectRatio(156 / 80)
  43 + .linearGradient({ angle: 0, colors: [['#0000000', 0], ['#4d000000', 0.7], [Color.Transparent, 1]] })
  44 + .alignItems(VerticalAlign.Bottom)
  45 + .padding({ left: 8,
  46 + right: 8,
  47 + bottom: 8 })
  48 + }.border({ radius: 2 })
  49 + }
  50 +
  51 + @Builder
  52 + labelTabStyle() {
  53 + Row() {
  54 + Image($r('app.media.iv_line_vertical_label'))
  55 + .width(3)
  56 + .height(16)
  57 + Text(this.compDTO.name)
  58 + .fontSize('17sp')
  59 + .fontColor('#222222')
  60 + .fontWeight(600)
  61 + .maxLines(1)
  62 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  63 + .layoutWeight(1)
  64 + .margin({
  65 + left: 5
  66 + })
  67 + if (this.compDTO.operDataList.length >= 3) {
  68 + Text('更多')
  69 + .fontSize('14sp')
  70 + .fontColor('#999999')
  71 + .fontWeight(400)
  72 + Image($r('app.media.iv_arrow_right_gray'))
  73 + .width(14)
  74 + .height(14)
  75 + }
  76 + }
  77 + .width('100%')
  78 + .height('44vp')
  79 + .padding({
  80 + left: 16,
  81 + right: 16
  82 + })
  83 + }
  84 +}
@@ -23,4 +23,5 @@ export const enum CompStyle { @@ -23,4 +23,5 @@ export const enum CompStyle {
23 Title_All_01 = 'Title_All_01', // 全标题 23 Title_All_01 = 'Title_All_01', // 全标题
24 Zh_Single_Row_01 = 'Zh_Single_Row-01', // 横划卡 24 Zh_Single_Row_01 = 'Zh_Single_Row-01', // 横划卡
25 Zh_Single_Column_02 = 'Zh_Single_Column-02', // 头图卡 25 Zh_Single_Column_02 = 'Zh_Single_Column-02', // 头图卡
  26 + Zh_Single_Row_02 = 'Zh_Single_Row-02', // 小视频横划卡(通用(3图以下))/小视频卡
26 } 27 }