chenjun1_wd

19989 视频详情页:文本框弹出样式,缺少发布时间。

  1 +import { DateTimeUtils } from 'wdKit'
  2 +
1 @Preview 3 @Preview
2 @CustomDialog 4 @CustomDialog
3 export struct DetailDialog { 5 export struct DetailDialog {
@@ -5,6 +7,7 @@ export struct DetailDialog { @@ -5,6 +7,7 @@ export struct DetailDialog {
5 @Prop name: string 7 @Prop name: string
6 @Prop title: string 8 @Prop title: string
7 @Prop summary: string 9 @Prop summary: string
  10 + @Prop publishTime: string
8 @Link isOpenDetail: boolean 11 @Link isOpenDetail: boolean
9 12
10 build() { 13 build() {
@@ -36,6 +39,16 @@ export struct DetailDialog { @@ -36,6 +39,16 @@ export struct DetailDialog {
36 .fontWeight(400) 39 .fontWeight(400)
37 .margin({ top: 8 }) 40 .margin({ top: 8 })
38 .lineHeight(21) 41 .lineHeight(21)
  42 +
  43 + Text(DateTimeUtils.formatDate(new Date(this.publishTime).getTime(),
  44 + DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM))
  45 + .fontSize(12)
  46 + .fontColor(Color.White)
  47 + .opacity(0.7)
  48 + .lineHeight(16)
  49 + .fontWeight(400)
  50 + .fontFamily('PingFang SC-Regular')
  51 + .margin({ top: 8, bottom: 8 })
39 } 52 }
40 .alignItems(HorizontalAlign.Start) 53 .alignItems(HorizontalAlign.Start)
41 54
@@ -24,6 +24,7 @@ export struct PlayerTitleView { @@ -24,6 +24,7 @@ export struct PlayerTitleView {
24 name: this.getName(), 24 name: this.getName(),
25 title: this.getTitle(), 25 title: this.getTitle(),
26 summary: this.getSummary(), 26 summary: this.getSummary(),
  27 + publishTime: this.getPublishTime(),
27 isOpenDetail: this.isOpenDetail 28 isOpenDetail: this.isOpenDetail
28 29
29 }), 30 }),
@@ -55,6 +56,10 @@ export struct PlayerTitleView { @@ -55,6 +56,10 @@ export struct PlayerTitleView {
55 return this.contentDetailData?.newIntroduction || '' 56 return this.contentDetailData?.newIntroduction || ''
56 } 57 }
57 58
  59 + getPublishTime(): string {
  60 + return this.contentDetailData?.publishTime || ''
  61 + }
  62 +
58 /** 63 /**
59 * 截断文本 64 * 截断文本
60 * @param {string} str 要截断的文本 '啊啊啊啊啊' 65 * @param {string} str 要截断的文本 '啊啊啊啊啊'