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
陈剑华
2024-05-21 14:09:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
205ab67a950118d7441e9008853209ae139737d6
205ab67a
1 parent
b3f5160b
feat: 16910 功能缺陷--回看类型的稿件鸿蒙版缺少**人参与与安卓不一致
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
2 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/CardMediaInfo.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/CardMediaInfo.ets
View file @
205ab67
import { ContentDTO } from 'wdBean/Index'
import { ContentDTO
, joinPeopleNum
} from 'wdBean/Index'
import { DateTimeUtils } from 'wdKit/Index'
import { LiveModel } from '../../viewmodel/LiveModel'
/**
* 这里是样式卡中,右下角显示的音视频信息
...
...
@@ -10,10 +11,50 @@ import { DateTimeUtils } from 'wdKit/Index'
@Component
export struct CardMediaInfo {
@State contentDTO: ContentDTO = new ContentDTO() // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
@State joinPeopleNum: number = 0;
// objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
// 14动态图文,15动态视频16问政;100人民号,101标签
aboutToAppear(): void {
this.getJoinPeopleNum();
}
/**
* 全域数字显示规则
* 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585
* 2、当数量为万位~1亿时,显示xx 万,保留小数点后一位,比如1517.9w、2.9w
* 3、当数量为1亿~千亿时,显示XX 亿,保留小数点后一位,比如1517.9亿、2.9亿
* 4、不进行四舍五入
* 5、0 和空 不显示
*/
handlerNum(number: string) {
const num = number??'0';
if (Number.parseInt(num) <= 9999) {
return Number.parseInt(num).toString()
} else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) {
const num1: string = num.slice(0, -4); // 万
const num2: string = num.slice(-4, -3); // 千
return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万'
} else if (Number.parseInt(num) > 99999999) {
const num1: string = num.slice(0, -8); // 亿
const num2: string = num.slice(-8, -7);
return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿'
}
return num
}
//
/**
* 获取直播节目参与人数
*/
async getJoinPeopleNum() {
if (this.contentDTO.objectType !== '2') return;
console.log('getJoinPeopleNum-ContentDTO', JSON.stringify(this.contentDTO.objectId))
let liveIdList: string = this.contentDTO.objectId
let data: joinPeopleNum[] = await LiveModel.getJoinPeopleNum(liveIdList)
this.joinPeopleNum = data[0].pv;
}
build() {
Row() {
if (this.contentDTO?.objectType === '1' || this.contentDTO?.objectType === '15') {
...
...
@@ -24,6 +65,7 @@ export struct CardMediaInfo {
if (this.contentDTO.videoInfo != null) {
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
.fontFamily('BebasNeueBold')
}
}
} else if (this.contentDTO.objectType === '2') {
...
...
@@ -50,6 +92,10 @@ export struct CardMediaInfo {
Text('已结束')
.mediaText()
}
Text(' | ')
.mediaText()
Text(`${this.handlerNum(this.joinPeopleNum.toString())}人参加`)
.mediaText()
// } else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo
// ?.replayUri) {
// // Image($r('app.media.card_live'))
...
...
@@ -73,6 +119,7 @@ export struct CardMediaInfo {
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
.mediaText()
.fontFamily('BebasNeueBold')
}
} else if (this.contentDTO.objectType === '4') {//广告标签
Text($r('app.string.comp_advertisement'))
...
...
Please
register
or
login
to post a comment