Showing
1 changed file
with
16 additions
and
10 deletions
| 1 | import { Action, ContentDTO, Params } from 'wdBean'; | 1 | import { Action, ContentDTO, Params } from 'wdBean'; |
| 2 | import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; | 2 | import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; |
| 3 | -import { Logger } from 'wdKit'; | 3 | +import { DateTimeUtils, Logger, StringUtils } from 'wdKit'; |
| 4 | import { CompUtils } from '../../utils/CompUtils'; | 4 | import { CompUtils } from '../../utils/CompUtils'; |
| 5 | import { WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterRule } from 'wdRouter'; |
| 6 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | 6 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; |
| 7 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 7 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 8 | +import { LiveVideoTypeComponent } from '../view/LiveVideoTypeComponent'; | ||
| 8 | 9 | ||
| 9 | const TAG: string = 'CardView'; | 10 | const TAG: string = 'CardView'; |
| 10 | 11 | ||
| @@ -392,6 +393,15 @@ export struct MasonryLayout01CardView { | @@ -392,6 +393,15 @@ export struct MasonryLayout01CardView { | ||
| 392 | export struct PaperSingleColumn999CardView { | 393 | export struct PaperSingleColumn999CardView { |
| 393 | private item: ContentDTO = {} as ContentDTO; | 394 | private item: ContentDTO = {} as ContentDTO; |
| 394 | private index: number = -1; | 395 | private index: number = -1; |
| 396 | + @State videoDuration?: string = '' | ||
| 397 | + | ||
| 398 | + aboutToAppear() { | ||
| 399 | + if(this.item?.videoInfo?.videoDuration) { | ||
| 400 | + let duration = StringUtils.parseNumber(this.item?.videoInfo?.videoDuration) | ||
| 401 | + this.videoDuration = DateTimeUtils.getFormattedDuration(duration * 1000) // 转换为毫秒 | ||
| 402 | + console.info(TAG, `aboutToAppear videoDuration:${this.videoDuration}`); | ||
| 403 | + } | ||
| 404 | + } | ||
| 395 | 405 | ||
| 396 | build() { | 406 | build() { |
| 397 | Column() { | 407 | Column() { |
| @@ -408,15 +418,11 @@ export struct PaperSingleColumn999CardView { | @@ -408,15 +418,11 @@ export struct PaperSingleColumn999CardView { | ||
| 408 | .aspectRatio(16 / 9) | 418 | .aspectRatio(16 / 9) |
| 409 | .padding({ top: 10 }) | 419 | .padding({ top: 10 }) |
| 410 | if (this.item?.videoInfo) { | 420 | if (this.item?.videoInfo) { |
| 411 | - Stack() { | ||
| 412 | - Text(this.item?.videoInfo.videoDuration) | ||
| 413 | - .backgroundColor(Color.Black) | ||
| 414 | - .opacity(0.6) | ||
| 415 | - .width(CommonConstants.FULL_PARENT) | ||
| 416 | - .padding({ left: 40 }) | ||
| 417 | - Image($r('app.media.iv_card_play_yellow_flag')) | ||
| 418 | - .fitOriginalSize(true) | ||
| 419 | - }.width(CommonConstants.FULL_PARENT) | 421 | + LiveVideoTypeComponent({ nType: 1, name: this.videoDuration }) |
| 422 | + .padding({ | ||
| 423 | + bottom: 4, | ||
| 424 | + right: 4 | ||
| 425 | + }) | ||
| 420 | } | 426 | } |
| 421 | } | 427 | } |
| 422 | } | 428 | } |
-
Please register or login to post a comment