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
fanmingyou3_wd
2024-02-04 14:27:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
08ba02877dd9ce9bd90258c31a508db07d1c3c37
08ba0287
1 parent
0a33bce3
早晚报,格式化视频时长
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
sight_harmony/wdComponent/src/main/ets/components/page/CardView.ets
sight_harmony/wdComponent/src/main/ets/components/page/CardView.ets
View file @
08ba028
import { Action, ContentDTO, Params } from 'wdBean';
import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
import {
Logger
} from 'wdKit';
import {
DateTimeUtils, Logger, StringUtils
} from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { WDRouterRule } from 'wdRouter';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { LiveVideoTypeComponent } from '../view/LiveVideoTypeComponent';
const TAG: string = 'CardView';
...
...
@@ -392,6 +393,15 @@ export struct MasonryLayout01CardView {
export struct PaperSingleColumn999CardView {
private item: ContentDTO = {} as ContentDTO;
private index: number = -1;
@State videoDuration?: string = ''
aboutToAppear() {
if(this.item?.videoInfo?.videoDuration) {
let duration = StringUtils.parseNumber(this.item?.videoInfo?.videoDuration)
this.videoDuration = DateTimeUtils.getFormattedDuration(duration * 1000) // 转换为毫秒
console.info(TAG, `aboutToAppear videoDuration:${this.videoDuration}`);
}
}
build() {
Column() {
...
...
@@ -408,15 +418,11 @@ export struct PaperSingleColumn999CardView {
.aspectRatio(16 / 9)
.padding({ top: 10 })
if (this.item?.videoInfo) {
Stack() {
Text(this.item?.videoInfo.videoDuration)
.backgroundColor(Color.Black)
.opacity(0.6)
.width(CommonConstants.FULL_PARENT)
.padding({ left: 40 })
Image($r('app.media.iv_card_play_yellow_flag'))
.fitOriginalSize(true)
}.width(CommonConstants.FULL_PARENT)
LiveVideoTypeComponent({ nType: 1, name: this.videoDuration })
.padding({
bottom: 4,
right: 4
})
}
}
}
...
...
Please
register
or
login
to post a comment