陈剑华

feat: 18020 大图卡组件样式,搜索结果中标题展示不全、标签元素缺失

@@ -32,6 +32,12 @@ export struct CardParser { @@ -32,6 +32,12 @@ export struct CardParser {
32 pageShowTime:number = 0; 32 pageShowTime:number = 0;
33 pageHideTime:number = 0; 33 pageHideTime:number = 0;
34 34
  35 + aboutToAppear(): void {
  36 +
  37 + console.log('CardParser-contentDTO', JSON.stringify(this.contentDTO))
  38 + console.log('CardParser-compDTO', JSON.stringify(this.compDTO))
  39 + }
  40 +
35 onPageShow() { 41 onPageShow() {
36 this.pageShowTime = DateTimeUtils.getTimeStamp() 42 this.pageShowTime = DateTimeUtils.getTimeStamp()
37 } 43 }
@@ -77,8 +77,15 @@ export struct Card10Component { @@ -77,8 +77,15 @@ export struct Card10Component {
77 InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName) 77 InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
78 ProcessUtils.processPage(this.contentDTO) 78 ProcessUtils.processPage(this.contentDTO)
79 }) 79 })
80 - if (this.contentDTO.objectType == '5') {  
81 - Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 }) 80 + if(this.contentDTO.objectType == '5'){
  81 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center).margin({ left: 5, bottom: 5 })
  82 + } else {
  83 + if (this.contentDTO.seoTags) {
  84 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  85 + }
  86 + if (this.contentDTO.newTags) {
  87 + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
  88 + }
82 } 89 }
83 }.alignContent(Alignment.BottomStart) 90 }.alignContent(Alignment.BottomStart)
84 91
@@ -128,8 +135,15 @@ export struct Card10Component { @@ -128,8 +135,15 @@ export struct Card10Component {
128 Row() { 135 Row() {
129 Column() { 136 Column() {
130 Stack() { 137 Stack() {
131 - if (item.objectType == '5') {  
132 - Notes({ objectType: 5 }) 138 + if(this.contentDTO.objectType == '5'){
  139 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
  140 + } else {
  141 + if (this.contentDTO.seoTags) {
  142 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  143 + }
  144 + if (this.contentDTO.newTags) {
  145 + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
  146 + }
133 } 147 }
134 Text(item.newsTitle) 148 Text(item.newsTitle)
135 .fontSize($r('app.float.font_size_17')) 149 .fontSize($r('app.float.font_size_17'))
@@ -137,7 +151,10 @@ export struct Card10Component { @@ -137,7 +151,10 @@ export struct Card10Component {
137 .fontColor($r('app.color.color_222222')) 151 .fontColor($r('app.color.color_222222'))
138 .maxLines(2) 152 .maxLines(2)
139 .textOverflow({ overflow: TextOverflow.Ellipsis }) 153 .textOverflow({ overflow: TextOverflow.Ellipsis })
140 - .textIndent(item.objectType == '5' ? 38 : 0) 154 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  155 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  156 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  157 + 0 )
141 }.alignContent(Alignment.TopStart) 158 }.alignContent(Alignment.TopStart)
142 159
143 //bottom 评论等信息 160 //bottom 评论等信息
@@ -38,10 +38,15 @@ export struct Card11Component { @@ -38,10 +38,15 @@ export struct Card11Component {
38 build() { 38 build() {
39 Column() { 39 Column() {
40 Stack() { 40 Stack() {
  41 + if(this.contentDTO.objectType == '5'){
  42 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
  43 + } else {
  44 + if (this.contentDTO.seoTags) {
  45 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  46 + }
41 if (this.contentDTO.newTags) { 47 if (this.contentDTO.newTags) {
42 Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) 48 Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
43 - } else if (this.contentDTO.objectType == '5') {  
44 - Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center) 49 + }
45 } 50 }
46 Text() { 51 Text() {
47 if (this.titleMarked) { 52 if (this.titleMarked) {
@@ -63,9 +68,10 @@ export struct Card11Component { @@ -63,9 +68,10 @@ export struct Card11Component {
63 .maxLines(3) 68 .maxLines(3)
64 .textOverflow({ overflow: TextOverflow.Ellipsis }) 69 .textOverflow({ overflow: TextOverflow.Ellipsis })
65 .width(CommonConstants.FULL_WIDTH) 70 .width(CommonConstants.FULL_WIDTH)
66 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
67 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
68 - this.contentDTO.objectType == '5' ? 35 : 0) 71 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  72 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  73 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  74 + 0 )
69 75
70 }.alignContent(Alignment.TopStart) 76 }.alignContent(Alignment.TopStart)
71 77
@@ -36,10 +36,20 @@ export struct Card3Component { @@ -36,10 +36,20 @@ export struct Card3Component {
36 build() { 36 build() {
37 Column() { 37 Column() {
38 Stack() { 38 Stack() {
  39 + // if (this.contentDTO.newTags) {
  40 + // Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)
  41 + // } else if (this.contentDTO.objectType == '5') {
  42 + // Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center)
  43 + // }
  44 + if(this.contentDTO.objectType == '5'){
  45 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
  46 + } else {
  47 + if (this.contentDTO.seoTags) {
  48 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  49 + }
39 if (this.contentDTO.newTags) { 50 if (this.contentDTO.newTags) {
40 - Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)  
41 - } else if (this.contentDTO.objectType == '5') {  
42 - Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) 51 + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
  52 + }
43 } 53 }
44 Text() { 54 Text() {
45 if (this.titleMarked) { 55 if (this.titleMarked) {
@@ -59,9 +69,10 @@ export struct Card3Component { @@ -59,9 +69,10 @@ export struct Card3Component {
59 .fontSize($r("app.float.font_size_18")) 69 .fontSize($r("app.float.font_size_18"))
60 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) 70 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
61 .width(CommonConstants.FULL_WIDTH) 71 .width(CommonConstants.FULL_WIDTH)
62 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
63 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
64 - this.contentDTO.objectType == '5' ? 35 : 0) 72 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  73 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  74 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  75 + 0 )
65 }.alignContent(Alignment.TopStart) 76 }.alignContent(Alignment.TopStart)
66 77
67 // 评论等信息 78 // 评论等信息
@@ -46,10 +46,15 @@ export struct Card4Component { @@ -46,10 +46,15 @@ export struct Card4Component {
46 //body 46 //body
47 Column() { 47 Column() {
48 Stack() { 48 Stack() {
  49 + if(this.contentDTO.objectType == '5'){
  50 + Notes({ objectType: this.contentDTO.objectType }).height(19).align(Alignment.Center)
  51 + } else {
  52 + if (this.contentDTO.seoTags) {
  53 + Notes({ newTags: this.contentDTO.seoTags }).height(19).align(Alignment.Center)
  54 + }
49 if (this.contentDTO.newTags) { 55 if (this.contentDTO.newTags) {
50 Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center) 56 Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center)
51 - } else if (this.contentDTO.objectType == '5') {  
52 - Notes({ objectType: this.contentDTO.objectType }).height(19).align(Alignment.Center) 57 + }
53 } 58 }
54 Text() { 59 Text() {
55 if (this.titleMarked) { 60 if (this.titleMarked) {
@@ -69,9 +74,10 @@ export struct Card4Component { @@ -69,9 +74,10 @@ export struct Card4Component {
69 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 74 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
70 .maxLines(3) 75 .maxLines(3)
71 .textOverflow({ overflow: TextOverflow.Ellipsis }) 76 .textOverflow({ overflow: TextOverflow.Ellipsis })
72 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
73 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
74 - this.contentDTO.objectType == '5' ? 30 : 0) 77 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  78 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  79 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  80 + 0 )
75 }.alignContent(Alignment.TopStart) 81 }.alignContent(Alignment.TopStart)
76 //新闻标题 82 //新闻标题
77 83
@@ -57,10 +57,15 @@ export struct Card5Component { @@ -57,10 +57,15 @@ export struct Card5Component {
57 }) 57 })
58 Row() { 58 Row() {
59 Stack() { 59 Stack() {
  60 + if(this.contentDTO.objectType == '5'){
  61 + Notes({ objectType: this.contentDTO.objectType }).align(Alignment.Center)
  62 + } else {
  63 + if (this.contentDTO.seoTags) {
  64 + Notes({ newTags: this.contentDTO.seoTags }).align(Alignment.Center)
  65 + }
60 if (this.contentDTO.newTags) { 66 if (this.contentDTO.newTags) {
61 - Notes({ newTags: this.contentDTO.newTags })  
62 - } else if (this.contentDTO.objectType == '5') {  
63 - Notes({ objectType: this.contentDTO.objectType }) 67 + Notes({ newTags: this.contentDTO.newTags }).align(Alignment.Center)
  68 + }
64 } 69 }
65 70
66 Text() { 71 Text() {
@@ -83,9 +88,10 @@ export struct Card5Component { @@ -83,9 +88,10 @@ export struct Card5Component {
83 .maxLines(2) 88 .maxLines(2)
84 .align(Alignment.TopStart) 89 .align(Alignment.TopStart)
85 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 90 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
86 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
87 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
88 - this.contentDTO.objectType == '5' ? 35 : 0) 91 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  92 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  93 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  94 + 0 )
89 }.alignContent(Alignment.TopStart) 95 }.alignContent(Alignment.TopStart)
90 } 96 }
91 .justifyContent(FlexAlign.Start) 97 .justifyContent(FlexAlign.Start)
@@ -88,10 +88,16 @@ export struct Card9Component { @@ -88,10 +88,16 @@ export struct Card9Component {
88 topLeft: $r('app.float.image_border_radius'), 88 topLeft: $r('app.float.image_border_radius'),
89 topRight: $r('app.float.image_border_radius') 89 topRight: $r('app.float.image_border_radius')
90 }) 90 })
91 -  
92 - if (this.contentDTO.objectType == '5') {  
93 - Notes({ objectType: 5 }) 91 + if(this.contentDTO.objectType == '5'){
  92 + Notes({ objectType: this.contentDTO.objectType }).align(Alignment.Center)
94 .margin({ left: 5, bottom: 5 }) 93 .margin({ left: 5, bottom: 5 })
  94 + } else {
  95 + if (this.contentDTO.seoTags) {
  96 + Notes({ newTags: this.contentDTO.seoTags }).align(Alignment.Center)
  97 + }
  98 + if (this.contentDTO.newTags) {
  99 + Notes({ newTags: this.contentDTO.newTags }).align(Alignment.Center)
  100 + }
95 } 101 }
96 102
97 }.alignContent(Alignment.BottomStart) 103 }.alignContent(Alignment.BottomStart)