wangyong_wd

卡片样式优化

@@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index' @@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index'
10 @Component 10 @Component
11 export struct CardMediaInfo { 11 export struct CardMediaInfo {
12 @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 12 @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
  13 +
13 // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, 14 // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
14 // 14动态图文,15动态视频16问政;100人民号,101标签 15 // 14动态图文,15动态视频16问政;100人民号,101标签
15 16
16 build() { 17 build() {
17 Row() { 18 Row() {
18 - if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) { 19 + if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') {
19 // 点播、动态视频 20 // 点播、动态视频
20 - Row(){  
21 - Image($r('app.media.videoTypeIcon')) 21 + Row() {
  22 + Image($r('app.media.card_play'))
22 .mediaLogo() 23 .mediaLogo()
23 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) 24 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
24 .mediaText() 25 .mediaText()
25 } 26 }
26 - .backgroundColor('#4d000000')  
27 - .borderRadius($r('app.float.button_border_radius'))  
28 - } else if(this.contentDTO.objectType === '2') { 27 + } else if (this.contentDTO.objectType === '2') {
29 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 28 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
30 // 显示直播信息 29 // 显示直播信息
31 - Row(){  
32 - if(this.contentDTO.liveInfo.liveState === 'running') {  
33 - Image($r('app.media.icon_live')) 30 + Row() {
  31 + if(this.contentDTO.liveInfo.liveState === 'wait') {
  32 + Image($r('app.media.card_wait'))
  33 + .mediaLogo()
  34 + Text('预约')
  35 + .mediaText()
  36 + } else if (this.contentDTO.liveInfo.liveState === 'running') {
  37 + Image($r('app.media.card_live'))
34 .mediaLogo() 38 .mediaLogo()
35 Text('直播中') 39 Text('直播中')
36 .mediaText() 40 .mediaText()
37 - } else if(this.contentDTO.liveInfo.liveState === 'end'){  
38 - Image($r('app.media.videoTypeIcon')) 41 + } else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) {
  42 + Image($r('app.media.card_play'))
39 .mediaLogo() 43 .mediaLogo()
40 Text('回看') 44 Text('回看')
41 .mediaText() 45 .mediaText()
  46 + } else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo
  47 + .replayUri) {
  48 + // Image($r('app.media.card_live'))
  49 + // .mediaLogo()
  50 + Text('直播结束')
  51 + .mediaText()
42 } 52 }
43 } 53 }
44 - .backgroundColor('#4d000000')  
45 - .borderRadius($r('app.float.button_border_radius'))  
46 - } else if(this.contentDTO.objectType === '9') { 54 + } else if (this.contentDTO.objectType === '9') {
47 // 显示组图;图片数量 55 // 显示组图;图片数量
48 - Row(){  
49 - Image($r('app.media.album_card_shape')) 56 + Row() {
  57 + Image($r('app.media.card_image'))
50 .mediaLogo() 58 .mediaLogo()
51 Text(`${this.contentDTO.photoNum}`) 59 Text(`${this.contentDTO.photoNum}`)
52 .mediaText() 60 .mediaText()
53 - .width(20)  
54 } 61 }
55 - .backgroundColor('#4d000000')  
56 - .borderRadius($r('app.float.button_border_radius'))  
57 - } else if(this.contentDTO.objectType === '13') { 62 + } else if (this.contentDTO.objectType === '13') {
58 // 显示音频信息 63 // 显示音频信息
59 - Row(){  
60 - Image($r('app.media.broadcast_listen'))  
61 - .height(14)  
62 - .borderRadius($r('app.float.button_border_radius')) 64 + Row() {
  65 + Image($r('app.media.card_audio'))
  66 + .mediaLogo()
63 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) 67 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
64 .mediaText() 68 .mediaText()
65 } 69 }
@@ -68,18 +72,27 @@ export struct CardMediaInfo { @@ -68,18 +72,27 @@ export struct CardMediaInfo {
68 .margin(6) 72 .margin(6)
69 } 73 }
70 74
71 - @Styles mediaLogo() {  
72 - .width(22)  
73 - .height(18)  
74 - .borderRadius($r('app.float.button_border_radius')) 75 + @Styles
  76 + mediaLogo() {
  77 + .width(14)
  78 + .height(14)
  79 + .margin({ right: 3 })
  80 + .shadow({
  81 + radius: 2,
  82 + color: 'rgba(0,0,0,0.3)',
  83 + offsetY: 2
  84 + })
75 } 85 }
76 } 86 }
77 87
78 -@Extend(Text) function mediaText() { 88 +@Extend(Text)
  89 +function mediaText() {
79 .fontColor($r('app.color.color_fff')) 90 .fontColor($r('app.color.color_fff'))
80 - .fontSize($r('app.float.font_size_12'))  
81 - .width(40)  
82 - .height(18)  
83 - .textAlign(TextAlign.Center)  
84 - .margin({ left: -3 }) 91 + .fontSize($r('app.float.font_size_14'))
  92 + .lineHeight(18)
  93 + .textShadow({
  94 + radius: 2,
  95 + color: 'rgba(0,0,0,0.3)',
  96 + offsetY: 2
  97 + })
85 } 98 }
@@ -104,7 +104,7 @@ export struct Card9Component { @@ -104,7 +104,7 @@ export struct Card9Component {
104 Column() { 104 Column() {
105 Row() { 105 Row() {
106 // 标题 106 // 标题
107 - Image($r("app.media.point_icon")) 107 + Image($r("app.media.timeline_rect"))
108 .width(9) 108 .width(9)
109 .height(9) 109 .height(9)
110 .margin({ right: 5 }) 110 .margin({ right: 5 })