yumaochao

fix:somebug

@@ -111,8 +111,7 @@ export struct CardSourceInfo { @@ -111,8 +111,7 @@ export struct CardSourceInfo {
111 .flexShrink(0) 111 .flexShrink(0)
112 .margin({right: 4}) 112 .margin({right: 4})
113 } 113 }
114 -  
115 - if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) { 114 + if (this.getContentDtoBean()?.interactData?.commentNum) {
116 Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) 115 Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
117 .fontSize($r("app.float.font_size_11")) 116 .fontSize($r("app.float.font_size_11"))
118 .fontColor($r("app.color.color_B0B0B0")) 117 .fontColor($r("app.color.color_B0B0B0"))
@@ -120,6 +119,15 @@ export struct CardSourceInfo { @@ -120,6 +119,15 @@ export struct CardSourceInfo {
120 .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : 119 .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None :
121 Visibility.Visible) 120 Visibility.Visible)
122 } 121 }
  122 +
  123 + // if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) {
  124 + // Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
  125 + // .fontSize($r("app.float.font_size_11"))
  126 + // .fontColor($r("app.color.color_B0B0B0"))
  127 + // .flexShrink(0)
  128 + // .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None :
  129 + // Visibility.Visible)
  130 + // }
123 } 131 }
124 .width(CommonConstants.FULL_WIDTH) 132 .width(CommonConstants.FULL_WIDTH)
125 .margin({ top: 8 }) 133 .margin({ top: 8 })
@@ -36,7 +36,18 @@ export struct Card2Component { @@ -36,7 +36,18 @@ export struct Card2Component {
36 this.titleInit(); 36 this.titleInit();
37 this.loadImg = await onlyWifiLoadImg(); 37 this.loadImg = await onlyWifiLoadImg();
38 } 38 }
39 - 39 + calculateTextIndent() {
  40 + if (this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2) {
  41 + return 58;
  42 + } else if ((this.contentDTO.newTags?.length !== 0) || (this.contentDTO.seoTags?.length !== 0)) {
  43 + // 当newTags或seoTags存在时,应用相同的缩进
  44 + return 35;
  45 + } else if (this.contentDTO.objectType == '5') {
  46 + return 35;
  47 + } else {
  48 + return 0;
  49 + }
  50 + }
40 titleInit() { 51 titleInit() {
41 if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { 52 if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
42 this.titleMarked = true; 53 this.titleMarked = true;
@@ -52,15 +63,10 @@ export struct Card2Component { @@ -52,15 +63,10 @@ export struct Card2Component {
52 Stack() { 63 Stack() {
53 if(this.contentDTO.objectType == '5'){ 64 if(this.contentDTO.objectType == '5'){
54 Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center) 65 Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
55 - }else if(this.contentDTO.objectType == '2'){  
56 - if(this.contentDTO.seoTags){  
57 - Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)  
58 - }else if(this.contentDTO.newTags){  
59 - Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)  
60 -  
61 - }  
62 - }else {  
63 - if(this.contentDTO.newTags){ 66 + } else {
  67 + if (this.contentDTO.seoTags) {
  68 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  69 + } else if (this.contentDTO.newTags) {
64 Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) 70 Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
65 } 71 }
66 } 72 }
@@ -80,11 +86,7 @@ export struct Card2Component { @@ -80,11 +86,7 @@ export struct Card2Component {
80 .lineHeight(27) 86 .lineHeight(27)
81 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 87 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
82 .align(Alignment.Start) 88 .align(Alignment.Start)
83 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
84 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
85 - this.contentDTO.objectType == '5' ? 35 : 0 || (this.contentDTO.objectType === '2' && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5) ? 58 :  
86 - (this.contentDTO.objectType === '2' && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 0 || this.contentDTO.objectType === '5') ? 35 :  
87 - 0 ) 89 + .textIndent(this.calculateTextIndent())
88 }.alignContent(Alignment.TopStart) 90 }.alignContent(Alignment.TopStart)
89 91
90 //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) 92 //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
@@ -32,6 +32,18 @@ export struct Card6Component { @@ -32,6 +32,18 @@ export struct Card6Component {
32 this.loadImg = await onlyWifiLoadImg(); 32 this.loadImg = await onlyWifiLoadImg();
33 this.clicked = hasClicked(this.contentDTO.objectId) 33 this.clicked = hasClicked(this.contentDTO.objectId)
34 } 34 }
  35 + calculateTextIndent() {
  36 + if (this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2) {
  37 + return 58;
  38 + } else if ((this.contentDTO.newTags?.length !== 0) || (this.contentDTO.seoTags?.length !== 0)) {
  39 + // 当newTags或seoTags存在时,应用相同的缩进
  40 + return 35;
  41 + } else if (this.contentDTO.objectType == '5') {
  42 + return 35;
  43 + } else {
  44 + return 0;
  45 + }
  46 + }
35 47
36 titleInit() { 48 titleInit() {
37 if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { 49 if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
@@ -57,12 +69,17 @@ export struct Card6Component { @@ -57,12 +69,17 @@ export struct Card6Component {
57 // .margin({ right: 2 }) 69 // .margin({ right: 2 })
58 // } 70 // }
59 Stack() { 71 Stack() {
60 - if (this.contentDTO.newTags) {  
61 - Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)  
62 - } else if (this.contentDTO.objectType == '5') {  
63 - Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) 72 + if(this.contentDTO.objectType == '5'){
  73 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
  74 + } else {
  75 + if (this.contentDTO.seoTags) {
  76 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  77 + } else if (this.contentDTO.newTags) {
  78 + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
  79 + }
64 } 80 }
65 81
  82 +
66 Text() { 83 Text() {
67 if (this.titleMarked) { 84 if (this.titleMarked) {
68 Span(this.str01) 85 Span(this.str01)
@@ -80,9 +97,7 @@ export struct Card6Component { @@ -80,9 +97,7 @@ export struct Card6Component {
80 .maxLines(3) 97 .maxLines(3)
81 .alignSelf(ItemAlign.Start) 98 .alignSelf(ItemAlign.Start)
82 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 99 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
83 - .textIndent(this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2 ? 58 :  
84 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
85 - this.contentDTO.objectType == '5' ? 35 : 0) 100 + .textIndent(this.calculateTextIndent())
86 }.alignContent(Alignment.TopStart) 101 }.alignContent(Alignment.TopStart)
87 102
88 } 103 }
@@ -123,4 +138,4 @@ export struct Card6Component { @@ -123,4 +138,4 @@ export struct Card6Component {
123 .justifyContent(FlexAlign.SpaceBetween) 138 .justifyContent(FlexAlign.SpaceBetween)
124 .alignItems(VerticalAlign.Top) 139 .alignItems(VerticalAlign.Top)
125 } 140 }
126 -}  
  141 +}