Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangyong_wd
2024-04-16 15:08:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1d7d690e69ab133cc8403fdf63980ce11bf21611
1d7d690e
1 parent
37ceb536
卡片样式优化
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
35 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/CardMediaInfo.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card9Component.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/card_audio.png
sight_harmony/features/wdComponent/src/main/resources/base/media/card_image.png
sight_harmony/features/wdComponent/src/main/resources/base/media/card_live.png
sight_harmony/features/wdComponent/src/main/resources/base/media/card_play.png
sight_harmony/features/wdComponent/src/main/resources/base/media/card_wait.png
sight_harmony/features/wdComponent/src/main/resources/base/media/point.png
sight_harmony/features/wdComponent/src/main/resources/base/media/timeline_rect.png
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/CardMediaInfo.ets
View file @
1d7d690
...
...
@@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index'
@Component
export struct CardMediaInfo {
@State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
// objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
// 14动态图文,15动态视频16问政;100人民号,101标签
build() {
Row() {
if
(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15'
) {
if
(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15'
) {
// 点播、动态视频
Row(){
Image($r('app.media.videoTypeIcon'))
Row() {
Image($r('app.media.card_play'))
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
} else if(this.contentDTO.objectType === '2') {
} 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'))
Row() {
if(this.contentDTO.liveInfo.liveState === 'wait') {
Image($r('app.media.card_wait'))
.mediaLogo()
Text('预约')
.mediaText()
} else if (this.contentDTO.liveInfo.liveState === 'running') {
Image($r('app.media.card_live'))
.mediaLogo()
Text('直播中')
.mediaText()
} else if(this.contentDTO.liveInfo.liveState === 'end'){
Image($r('app.media.videoTypeIcon'))
} else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) {
Image($r('app.media.card_play'))
.mediaLogo()
Text('回看')
.mediaText()
} else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo
.replayUri) {
// Image($r('app.media.card_live'))
// .mediaLogo()
Text('直播结束')
.mediaText()
}
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
} else if(this.contentDTO.objectType === '9') {
} else if (this.contentDTO.objectType === '9') {
// 显示组图;图片数量
Row(){
Image($r('app.media.album_card_shape'))
Row() {
Image($r('app.media.card_image'))
.mediaLogo()
Text(`${this.contentDTO.photoNum}`)
.mediaText()
.width(20)
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
} else if(this.contentDTO.objectType === '13') {
} else if (this.contentDTO.objectType === '13') {
// 显示音频信息
Row(){
Image($r('app.media.broadcast_listen'))
.height(14)
.borderRadius($r('app.float.button_border_radius'))
Row() {
Image($r('app.media.card_audio'))
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
.mediaText()
}
...
...
@@ -68,18 +72,27 @@ export struct CardMediaInfo {
.margin(6)
}
@Styles mediaLogo() {
.width(22)
.height(18)
.borderRadius($r('app.float.button_border_radius'))
@Styles
mediaLogo() {
.width(14)
.height(14)
.margin({ right: 3 })
.shadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetY: 2
})
}
}
@Extend(Text) function mediaText() {
@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 })
.fontSize($r('app.float.font_size_14'))
.lineHeight(18)
.textShadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetY: 2
})
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card9Component.ets
View file @
1d7d690
...
...
@@ -104,7 +104,7 @@ export struct Card9Component {
Column() {
Row() {
// 标题
Image($r("app.media.
point_icon
"))
Image($r("app.media.
timeline_rect
"))
.width(9)
.height(9)
.margin({ right: 5 })
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/card_audio.png
0 → 100644
View file @
1d7d690
1.38 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/card_image.png
0 → 100644
View file @
1d7d690
952 Bytes
sight_harmony/features/wdComponent/src/main/resources/base/media/card_live.png
0 → 100644
View file @
1d7d690
1.4 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/card_play.png
0 → 100644
View file @
1d7d690
1.12 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/card_wait.png
0 → 100644
View file @
1d7d690
2.09 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/point.png
View file @
1d7d690
495 Bytes
|
W:
|
H:
477 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
sight_harmony/features/wdComponent/src/main/resources/base/media/timeline_rect.png
0 → 100644
View file @
1d7d690
489 Bytes
Please
register
or
login
to post a comment