陈剑华

Merge remote-tracking branch 'origin/main'

@@ -6,9 +6,12 @@ import router from '@ohos.router' @@ -6,9 +6,12 @@ import router from '@ohos.router'
6 @Reusable 6 @Reusable
7 @Component 7 @Component
8 export struct CardSourceInfo { 8 export struct CardSourceInfo {
9 - @State contentDTO: ContentDTO = new ContentDTO(); 9 + @State @Watch('checkData') contentDTO: ContentDTO = new ContentDTO();
10 @ObjectLink compDTO: CompDTO 10 @ObjectLink compDTO: CompDTO
  11 + // 特殊稿件内部item展示的来源信息
11 isCompInnerSource: boolean = false 12 isCompInnerSource: boolean = false
  13 + // 是否有展示的信息,如来源,标签、时间、评论
  14 + @State viewShowData: boolean = true
12 15
13 aboutToAppear(): void { 16 aboutToAppear(): void {
14 } 17 }
@@ -89,18 +92,20 @@ export struct CardSourceInfo { @@ -89,18 +92,20 @@ export struct CardSourceInfo {
89 92
90 build() { 93 build() {
91 Flex({ alignItems: ItemAlign.Center }) { 94 Flex({ alignItems: ItemAlign.Center }) {
  95 + // 标签
92 if (this.contentDTO.corner) { 96 if (this.contentDTO.corner) {
93 Text(this.contentDTO.corner) 97 Text(this.contentDTO.corner)
94 .fontSize($r("app.float.font_size_11")) 98 .fontSize($r("app.float.font_size_11"))
95 .fontColor($r("app.color.color_ED2800")) 99 .fontColor($r("app.color.color_ED2800"))
96 - .margin({ right: 2 }) 100 + .margin({ right: 6 })
97 } 101 }
98 if (this.contentDTO.cornerMark) { 102 if (this.contentDTO.cornerMark) {
99 Text(this.contentDTO.cornerMark) 103 Text(this.contentDTO.cornerMark)
100 .fontSize($r("app.float.font_size_11")) 104 .fontSize($r("app.float.font_size_11"))
101 .fontColor($r("app.color.color_ED2800")) 105 .fontColor($r("app.color.color_ED2800"))
102 - .margin({ right: 2 }) 106 + .margin({ right: 6 })
103 } 107 }
  108 + // 来源信息
104 if (this.contentDTO.rmhPlatform === 1) { 109 if (this.contentDTO.rmhPlatform === 1) {
105 Text(this.contentDTO.rmhInfo?.rmhName) 110 Text(this.contentDTO.rmhInfo?.rmhName)
106 .fontSize($r("app.float.font_size_11")) 111 .fontSize($r("app.float.font_size_11"))
@@ -115,6 +120,7 @@ export struct CardSourceInfo { @@ -115,6 +120,7 @@ export struct CardSourceInfo {
115 .textOverflow({ overflow: TextOverflow.Ellipsis }) 120 .textOverflow({ overflow: TextOverflow.Ellipsis })
116 } 121 }
117 122
  123 + // 点
118 if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && 124 if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName &&
119 this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && 125 this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) &&
120 (this.getContentDtoBean()?.interactData?.commentNum 126 (this.getContentDtoBean()?.interactData?.commentNum
@@ -143,6 +149,7 @@ export struct CardSourceInfo { @@ -143,6 +149,7 @@ export struct CardSourceInfo {
143 .margin({ right: 4 }) 149 .margin({ right: 4 })
144 } 150 }
145 151
  152 + // 评论数
146 if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && 153 if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
147 this.showCommentNum()) { 154 this.showCommentNum()) {
148 Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`) 155 Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)
@@ -162,7 +169,7 @@ export struct CardSourceInfo { @@ -162,7 +169,7 @@ export struct CardSourceInfo {
162 169
163 } 170 }
164 .width(CommonConstants.FULL_WIDTH) 171 .width(CommonConstants.FULL_WIDTH)
165 - .margin({ top: 8 }) 172 + .margin({ top: this.viewShowData ? 8 : 0 })
166 } 173 }
167 174
168 /** 175 /**
@@ -178,4 +185,45 @@ export struct CardSourceInfo { @@ -178,4 +185,45 @@ export struct CardSourceInfo {
178 } 185 }
179 return this.compDTO.operDataList[0] 186 return this.compDTO.operDataList[0]
180 } 187 }
  188 +
  189 + /**
  190 + * 检测是否有展示的数据
  191 + */
  192 + checkData() {
  193 +
  194 + let have = false
  195 +
  196 + if (this.contentDTO.corner) {
  197 + have = true
  198 + }
  199 + if (this.contentDTO.cornerMark) {
  200 + have = true
  201 + }
  202 + if (this.contentDTO.rmhPlatform === 1) {
  203 + have = true
  204 + } else if (this.contentDTO.source) {
  205 + have = true
  206 + }
  207 +
  208 + // 发布日期
  209 + if (this.showTime()) {
  210 + have = true
  211 + }
  212 +
  213 + // 评论数
  214 + if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
  215 + this.showCommentNum()) {
  216 + have = true
  217 + } else {
  218 + if (this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
  219 + have = true
  220 + }
  221 + }
  222 +
  223 + if (have) {
  224 +
  225 + } else {
  226 + this.viewShowData = false
  227 + }
  228 + }
181 } 229 }
@@ -28,9 +28,8 @@ export struct Card10Component { @@ -28,9 +28,8 @@ export struct Card10Component {
28 @State textArr: textItem[] = [] 28 @State textArr: textItem[] = []
29 @State hideDetail: boolean = false; 29 @State hideDetail: boolean = false;
30 basePageHelp: BasePageHelp = new BasePageHelp 30 basePageHelp: BasePageHelp = new BasePageHelp
31 -  
32 // 稿件参与批查,需要对列表信息单独重绘 31 // 稿件参与批查,需要对列表信息单独重绘
33 - @State isBatchData : boolean= false 32 + @State isBatchData: boolean = false
34 33
35 async aboutToAppear(): Promise<void> { 34 async aboutToAppear(): Promise<void> {
36 this.titleInit(); 35 this.titleInit();
@@ -126,11 +125,10 @@ export struct Card10Component { @@ -126,11 +125,10 @@ export struct Card10Component {
126 // 专题列表--后端返回三个, 125 // 专题列表--后端返回三个,
127 if (!this.hideDetail) { 126 if (!this.hideDetail) {
128 127
129 -  
130 - if(this.isBatchData){ 128 + if (this.isBatchData) {
  129 + this.drawCompList()
  130 + } else {
131 this.drawCompList() 131 this.drawCompList()
132 - }else {  
133 - this.drawCompList()  
134 } 132 }
135 133
136 } 134 }
@@ -170,7 +168,7 @@ export struct Card10Component { @@ -170,7 +168,7 @@ export struct Card10Component {
170 } 168 }
171 169
172 @Builder 170 @Builder
173 - drawCompList(){ 171 + drawCompList() {
174 172
175 Column() { 173 Column() {
176 ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => { 174 ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {
@@ -187,36 +185,37 @@ export struct Card10Component { @@ -187,36 +185,37 @@ export struct Card10Component {
187 @Builder 185 @Builder
188 timelineItem(item: slideShows, index: number) { 186 timelineItem(item: slideShows, index: number) {
189 Row() { 187 Row() {
190 - Column() {  
191 - Stack() {  
192 - if (item.objectType == '5') {  
193 - Notes({ objectType: 5 })  
194 - }  
195 - Text(item.newsTitle)  
196 - .fontSize($r('app.float.font_size_17'))  
197 - .fontWeight(400)  
198 - .fontColor($r('app.color.color_222222'))  
199 - .maxLines(2)  
200 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
201 - .textIndent(item.objectType == '5' ? 38 : 0)  
202 - }.alignContent(Alignment.TopStart) 188 + // 有图片资源的
  189 + if (item.fullColumnImgUrls && item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
203 190
204 - Blank()  
205 - //bottom 评论等信息  
206 - CardSourceInfo(  
207 - {  
208 - isCompInnerSource:true,  
209 - compDTO: this.compDTO,  
210 - contentDTO: this.createContent(item)  
211 - }  
212 - )  
213 - }  
214 - .layoutWeight(1)  
215 - .height(78)  
216 - .alignItems(HorizontalAlign.Start) 191 + Column() {
  192 + Stack() {
  193 + if (item.objectType == '5') {
  194 + Notes({ objectType: 5 })
  195 + }
  196 + Text(item.newsTitle)
  197 + .fontSize($r('app.float.font_size_17'))
  198 + .fontWeight(400)
  199 + .fontColor($r('app.color.color_222222'))
  200 + .maxLines(2)
  201 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  202 + .textIndent(item.objectType == '5' ? 38 : 0)
  203 + }.alignContent(Alignment.TopStart)
  204 +
  205 + Blank()
  206 + //bottom 评论等信息
  207 + CardSourceInfo(
  208 + {
  209 + isCompInnerSource: true,
  210 + compDTO: this.compDTO,
  211 + contentDTO: this.createContent(item)
  212 + }
  213 + )
  214 + }
  215 + .layoutWeight(1)
  216 + .height(78)
  217 + .alignItems(HorizontalAlign.Start)
217 218
218 - // 右侧图片  
219 - if (item.fullColumnImgUrls && item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {  
220 Stack() { 219 Stack() {
221 Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') 220 Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
222 .backgroundColor(0xf5f5f5) 221 .backgroundColor(0xf5f5f5)
@@ -231,6 +230,33 @@ export struct Card10Component { @@ -231,6 +230,33 @@ export struct Card10Component {
231 } 230 }
232 .alignContent(Alignment.BottomEnd) 231 .alignContent(Alignment.BottomEnd)
233 .height(78) 232 .height(78)
  233 + }else{
  234 + Column() {
  235 + Stack() {
  236 + if (item.objectType == '5') {
  237 + Notes({ objectType: 5 })
  238 + }
  239 + Text(item.newsTitle)
  240 + .fontSize($r('app.float.font_size_17'))
  241 + .fontWeight(400)
  242 + .fontColor($r('app.color.color_222222'))
  243 + .maxLines(2)
  244 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  245 + .textIndent(item.objectType == '5' ? 38 : 0)
  246 + }.alignContent(Alignment.TopStart)
  247 +
  248 + //bottom 评论等信息
  249 + CardSourceInfo(
  250 + {
  251 + isCompInnerSource: true,
  252 + compDTO: this.compDTO,
  253 + contentDTO: this.createContent(item)
  254 + }
  255 + )
  256 + }
  257 + .layoutWeight(1)
  258 + .alignItems(HorizontalAlign.Start)
  259 +
234 } 260 }
235 } 261 }
236 .padding({ top: 10, bottom: 10 }) 262 .padding({ top: 10, bottom: 10 })
@@ -260,6 +286,4 @@ export struct Card10Component { @@ -260,6 +286,4 @@ export struct Card10Component {
260 contentDTO.voiceInfo = { voiceDuration: Number(item.voiceDuration) as number }; 286 contentDTO.voiceInfo = { voiceDuration: Number(item.voiceDuration) as number };
261 return contentDTO; 287 return contentDTO;
262 } 288 }
263 -  
264 -  
265 } 289 }