shishuangxi

优化无图卡样式展示逻辑

@@ -6,6 +6,14 @@ import { DateTimeUtils } from 'wdKit' @@ -6,6 +6,14 @@ import { DateTimeUtils } from 'wdKit'
6 @Component 6 @Component
7 export struct TitleAbbrComponent { 7 export struct TitleAbbrComponent {
8 @State compDTO: CompDTO = {} as CompDTO 8 @State compDTO: CompDTO = {} as CompDTO
  9 + @State @Watch('isPoint') source:boolean=false;//来源是否为空 publishTime 字段是否为空
  10 + @State isPo:number=Visibility.Visible;
  11 +
  12 + isPoint(){
  13 + if(this.source){
  14 + this.isPo=Visibility.None
  15 + }
  16 + }
9 17
10 build() { 18 build() {
11 Column() { 19 Column() {
@@ -15,21 +23,26 @@ export struct TitleAbbrComponent { @@ -15,21 +23,26 @@ export struct TitleAbbrComponent {
15 .maxLines(3) 23 .maxLines(3)
16 .textOverflow({ overflow: TextOverflow.Ellipsis }) 24 .textOverflow({ overflow: TextOverflow.Ellipsis })
17 .width(CommonConstants.FULL_WIDTH) 25 .width(CommonConstants.FULL_WIDTH)
  26 + .fontWeight(400)
18 Row() { 27 Row() {
19 Text(this.compDTO.operDataList[0].corner) 28 Text(this.compDTO.operDataList[0].corner)
20 .fontSize($r("app.float.font_size_12")) 29 .fontSize($r("app.float.font_size_12"))
21 .fontColor($r("app.color.color_ED2800")) 30 .fontColor($r("app.color.color_ED2800"))
  31 + .fontWeight(400)
22 Text(this.compDTO.operDataList[0].source) 32 Text(this.compDTO.operDataList[0].source)
23 .fontSize($r("app.float.font_size_12")) 33 .fontSize($r("app.float.font_size_12"))
24 .fontColor($r("app.color.color_B0B0B0")) 34 .fontColor($r("app.color.color_B0B0B0"))
25 .margin({ left: 6 }) 35 .margin({ left: 6 })
  36 + .fontWeight(400)
26 Image($r("app.media.point")) 37 Image($r("app.media.point"))
27 .width(16) 38 .width(16)
28 .height(16) 39 .height(16)
  40 + .visibility(this.isPo)
29 41
30 Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime))) 42 Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
31 .fontSize($r("app.float.font_size_12")) 43 .fontSize($r("app.float.font_size_12"))
32 .fontColor($r("app.color.color_B0B0B0")) 44 .fontColor($r("app.color.color_B0B0B0"))
  45 + .fontWeight(400)
33 46
34 }.width(CommonConstants.FULL_WIDTH) 47 }.width(CommonConstants.FULL_WIDTH)
35 .justifyContent(FlexAlign.Start) 48 .justifyContent(FlexAlign.Start)
@@ -45,4 +58,13 @@ export struct TitleAbbrComponent { @@ -45,4 +58,13 @@ export struct TitleAbbrComponent {
45 .backgroundColor($r("app.color.white")) 58 .backgroundColor($r("app.color.white"))
46 .margin({ bottom: 8 }) 59 .margin({ bottom: 8 })
47 } 60 }
  61 +
  62 + aboutToAppear(){
  63 + if(this.compDTO.operDataList[0].source==""){
  64 + this.source=true;
  65 + }
  66 + if(this.compDTO.operDataList[0].publishTime==""){
  67 + this.source=true;
  68 + }
  69 + }
48 } 70 }
@@ -7,6 +7,14 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger' @@ -7,6 +7,14 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger'
7 @Component 7 @Component
8 export struct TitleAllComponent { 8 export struct TitleAllComponent {
9 @State compDTO: CompDTO = {} as CompDTO 9 @State compDTO: CompDTO = {} as CompDTO
  10 + @State @Watch('isPoint') source:boolean=false;//来源是否为空 publishTime 字段是否为空
  11 + @State isPo:number=Visibility.Visible;
  12 +
  13 + isPoint(){
  14 + if(this.source){
  15 + this.isPo=Visibility.None
  16 + }
  17 + }
10 18
11 build() { 19 build() {
12 Column() { 20 Column() {
@@ -14,21 +22,26 @@ export struct TitleAllComponent { @@ -14,21 +22,26 @@ export struct TitleAllComponent {
14 .fontSize($r("app.float.font_size_17")) 22 .fontSize($r("app.float.font_size_17"))
15 .fontColor($r("app.color.color_222222")) 23 .fontColor($r("app.color.color_222222"))
16 .width(CommonConstants.FULL_WIDTH) 24 .width(CommonConstants.FULL_WIDTH)
  25 + .fontWeight(400)
17 Row() { 26 Row() {
18 Text(this.compDTO.operDataList[0].corner) 27 Text(this.compDTO.operDataList[0].corner)
19 .fontSize($r("app.float.font_size_12")) 28 .fontSize($r("app.float.font_size_12"))
20 .fontColor($r("app.color.color_ED2800")) 29 .fontColor($r("app.color.color_ED2800"))
  30 + .fontWeight(400)
21 Text(this.compDTO.operDataList[0].source) 31 Text(this.compDTO.operDataList[0].source)
22 .fontSize($r("app.float.font_size_12")) 32 .fontSize($r("app.float.font_size_12"))
23 .fontColor($r("app.color.color_B0B0B0")) 33 .fontColor($r("app.color.color_B0B0B0"))
24 .margin({ left: 6 }) 34 .margin({ left: 6 })
  35 + .fontWeight(400)
25 Image($r("app.media.point")) 36 Image($r("app.media.point"))
26 .width(16) 37 .width(16)
27 .height(16) 38 .height(16)
  39 + .visibility(this.isPo)
28 40
29 Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime))) 41 Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
30 .fontSize($r("app.float.font_size_12")) 42 .fontSize($r("app.float.font_size_12"))
31 .fontColor($r("app.color.color_B0B0B0")) 43 .fontColor($r("app.color.color_B0B0B0"))
  44 + .fontWeight(400)
32 45
33 }.width(CommonConstants.FULL_WIDTH) 46 }.width(CommonConstants.FULL_WIDTH)
34 .justifyContent(FlexAlign.Start) 47 .justifyContent(FlexAlign.Start)
@@ -44,7 +57,15 @@ export struct TitleAllComponent { @@ -44,7 +57,15 @@ export struct TitleAllComponent {
44 .backgroundColor($r("app.color.white")) 57 .backgroundColor($r("app.color.white"))
45 .margin({ bottom: 8 }) 58 .margin({ bottom: 8 })
46 } 59 }
47 - aboutToAppear(){ 60 +
  61 + aboutToAppear() {
48 // Logger.info("ssx",JSON.stringify(this.compDTO.operDataList[0])) 62 // Logger.info("ssx",JSON.stringify(this.compDTO.operDataList[0]))
  63 + if (this.compDTO.operDataList[0].source == "") {
  64 + this.source = true;
  65 + }
  66 + if (this.compDTO.operDataList[0].publishTime == "") {
  67 + this.source = true;
  68 + }
  69 +
49 } 70 }
50 } 71 }