wangyong_wd

卡片右下角样式组件优化

... ... @@ -67,6 +67,6 @@ export interface ContentDTO {
voiceInfo: VoiceInfoDTO;
tagWord: number;
rmhInfo: RmhInfoDTO; // 人民号信息
photoNum: string;
photoNum: number;
}
\ No newline at end of file
... ...
... ... @@ -15,37 +15,31 @@ export struct CardMediaInfo {
build() {
Row() {
if(this.contentDTO.objectType === '1') {
// 显示点播
if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) {
// 点播、动态视频
Row(){
Image($r('app.media.videoTypeIcon'))
.width(22)
.height(18)
.borderRadius($r('app.float.button_border_radius'))
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.fontColor($r('app.color.color_fff'))
.fontSize($r('app.float.font_size_12'))
.width(40)
.height(18)
.textAlign(TextAlign.Center)
.margin({ left: -3 })
.mediaText()
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
} else if(this.contentDTO.objectType === '2') {
// liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
// 显示直播信息
Row(){
if(this.contentDTO.liveInfo.liveState === 'running') {
Image($r('app.media.icon_live'))
.width(22)
.height(18)
.borderRadius($r('app.float.button_border_radius'))
.mediaLogo()
Text('直播中')
.fontColor($r('app.color.color_fff'))
.fontSize($r('app.float.font_size_12'))
.width(40)
.height(18)
.textAlign(TextAlign.Center)
.margin({ left: -3 })
.mediaText()
} else if(this.contentDTO.liveInfo.liveState === 'end'){
Image($r('app.media.videoTypeIcon'))
.mediaLogo()
Text('回看')
.mediaText()
}
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
... ... @@ -53,16 +47,10 @@ export struct CardMediaInfo {
// 显示组图;图片数量
Row(){
Image($r('app.media.album_card_shape'))
.width(22)
.height(18)
.borderRadius($r('app.float.button_border_radius'))
Text(this.contentDTO.photoNum)
.fontColor($r('app.color.color_fff'))
.fontSize($r('app.float.font_size_12'))
.mediaLogo()
Text(`${this.contentDTO.photoNum}`)
.mediaText()
.width(20)
.height(18)
.textAlign(TextAlign.Center)
.margin({ left: -3 })
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
... ... @@ -73,15 +61,25 @@ export struct CardMediaInfo {
.height(14)
.borderRadius($r('app.float.button_border_radius'))
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
.mediaText()
}
}
}
.margin(6)
}
@Styles mediaLogo() {
.width(22)
.height(18)
.borderRadius($r('app.float.button_border_radius'))
}
}
@Extend(Text) function mediaText() {
.fontColor($r('app.color.color_fff'))
.fontSize($r('app.float.font_size_12'))
.width(40)
.height(18)
.textAlign(TextAlign.Center)
.margin({ left: -3 })
}
}
}
.margin(6)
}
}
\ No newline at end of file
... ...