wangyujian_wd

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

... ... @@ -4,14 +4,22 @@ import { BannerComponent } from './view/BannerComponent';
import { LabelComponent } from './view/LabelComponent';
import { TitleAbbrComponent } from './view/TitleAbbrComponent';
import { TitleAllComponent } from './view/TitleAllComponent';
import { HorizontalStrokeCardThreeTwoRadioForOneComponent } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { HorizontalStrokeCardThreeTwoRadioForMoreComponent } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import {
HorizontalStrokeCardThreeTwoRadioForMoreComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
import { BigPicCardComponent } from './view/BigPicCardComponent';
import { TriPicCardComponent } from './view/TriPicCardComponent';
import { HeadPictureCardComponent } from './view/HeadPictureCardComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import { SmallVideoCardComponent } from './view/SmallVideoCardComponent';
import { SmallVideoCardHorComponent } from './view/SmallVideoCardHorComponent';
/**
* comp适配器.
*/
... ... @@ -48,7 +56,14 @@ export struct CompParser {
}
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
HeadPictureCardComponent({ compDTO: compDTO })
} else {
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
if (compDTO.operDataList.length > 1) {
SmallVideoCardHorComponent({ compDTO: compDTO })
} else {
SmallVideoCardComponent({ compDTO: compDTO })
}
}
else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
... ...
// import { CommonConstants } from 'wdConstant/src/main/ets/constants/CommonConstants'
@Entry
import { CompDTO } from '../../repository/bean/CompDTO';
/**
* 小视频卡
*/
@Component
export struct SmallVideoCardComponent {
@State compDTO: CompDTO = {} as CompDTO
build() {
Row() {
Column() {
... ...
import { CompDTO } from '../../repository/bean/CompDTO'
import { ContentDTO } from '../../repository/bean/ContentDTO'
/**
* 通用 小视频卡3张以下
*/
@Component
export struct SmallVideoCardHorComponent {
@State compDTO: CompDTO = {} as CompDTO
build() {
Column() {
this.labelTabStyle()
List({ space: 8 }) {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
ListItem() {
this.itemStyle(item)
}
}, (item: string, index: number) => {
return index.toString()
})
}
.listDirection(Axis.Horizontal)
.margin({
left: 16
})
}
}
@Builder
itemStyle(item: ContentDTO) {
Stack({ alignContent: Alignment.Bottom }) {
Image(item.coverUrl)
.width(156)
.aspectRatio(156 / 208)
Row() {
Text(item.title)
.fontColor('#FFFFFF')
.fontSize('14fp')
.fontWeight(600)
}
.height(80)
.aspectRatio(156 / 80)
.linearGradient({ angle: 0, colors: [['#0000000', 0], ['#4d000000', 0.7], [Color.Transparent, 1]] })
.alignItems(VerticalAlign.Bottom)
.padding({ left: 8,
right: 8,
bottom: 8 })
}.border({ radius: 2 })
}
@Builder
labelTabStyle() {
Row() {
Image($r('app.media.iv_line_vertical_label'))
.width(3)
.height(16)
Text(this.compDTO.name)
.fontSize('17sp')
.fontColor('#222222')
.fontWeight(600)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)
.margin({
left: 5
})
if (this.compDTO.operDataList.length >= 3) {
Text('更多')
.fontSize('14sp')
.fontColor('#999999')
.fontWeight(400)
Image($r('app.media.iv_arrow_right_gray'))
.width(14)
.height(14)
}
}
.width('100%')
.height('44vp')
.padding({
left: 16,
right: 16
})
}
}
\ No newline at end of file
... ...
... ... @@ -23,4 +23,5 @@ export const enum CompStyle {
Title_All_01 = 'Title_All_01', // 全标题
Zh_Single_Row_01 = 'Zh_Single_Row-01', // 横划卡
Zh_Single_Column_02 = 'Zh_Single_Column-02', // 头图卡
Zh_Single_Row_02 = 'Zh_Single_Row-02', // 小视频横划卡(通用(3图以下))/小视频卡
}
... ...