liyubing

fix:1)【uat】进入新闻-热点,大专专题卡评论数和android不一致,看图

@@ -9,4 +9,6 @@ export class InteractDataDTO { @@ -9,4 +9,6 @@ export class InteractDataDTO {
9 likeNum: number | string = 0; 9 likeNum: number | string = 0;
10 readNum: number = 0; 10 readNum: number = 0;
11 shareNum: number = 0; 11 shareNum: number = 0;
  12 +
  13 +
12 } 14 }
  1 +import { InteractDataDTO } from '../content/InteractDataDTO';
1 import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO'; 2 import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO';
2 -export interface slideShows {  
3 - fullColumnImgUrls: FullColumnImgUrlDTO[];  
4 - linkUrl?: string;  
5 - newsId: string;  
6 - newsTitle?: string;  
7 - newsTitleColor?: string;  
8 - objectLevel?: string;  
9 - objectType: string;  
10 - pageId?: string;  
11 - photoNum?: string;  
12 - publishTime: number;  
13 - relId: string;  
14 - source?: string;  
15 - timeBlurred?: string;  
16 - videoDuration?: string;  
17 - videoLandscape?: string;  
18 - videoUrl?: string;  
19 - voiceDuration?: string; 3 +
  4 +@Observed
  5 +export class slideShows {
  6 + fullColumnImgUrls?: FullColumnImgUrlDTO[];
  7 + linkUrl: string='';
  8 + newsId: string = '';
  9 + newsTitle: string='';
  10 + newsTitleColor: string='';
  11 + objectLevel: string='';
  12 + objectType: string ='';
  13 + pageId: string='';
  14 + photoNum: string='';
  15 + publishTime: number=0;
  16 + relId: string='';
  17 + source: string='';
  18 + timeBlurred: string='';
  19 + videoDuration: string='';
  20 + videoLandscape: string='';
  21 + videoUrl: string='';
  22 + voiceDuration: string='';
  23 +
  24 + interactDataDto? :InteractDataDTO
20 } 25 }
@@ -8,6 +8,7 @@ import router from '@ohos.router' @@ -8,6 +8,7 @@ import router from '@ohos.router'
8 export struct CardSourceInfo { 8 export struct CardSourceInfo {
9 @State contentDTO: ContentDTO = new ContentDTO(); 9 @State contentDTO: ContentDTO = new ContentDTO();
10 @ObjectLink compDTO: CompDTO 10 @ObjectLink compDTO: CompDTO
  11 + isCompInnerSource: boolean = false
11 12
12 aboutToAppear(): void { 13 aboutToAppear(): void {
13 } 14 }
@@ -21,6 +22,7 @@ export struct CardSourceInfo { @@ -21,6 +22,7 @@ export struct CardSourceInfo {
21 22
22 aboutToDisappear(): void { 23 aboutToDisappear(): void {
23 } 24 }
  25 +
24 handleTimeStr() { 26 handleTimeStr() {
25 return DateTimeUtils.getCommentTime( 27 return DateTimeUtils.getCommentTime(
26 this.contentDTO.publishTime.includes(' ') 28 this.contentDTO.publishTime.includes(' ')
@@ -54,7 +56,6 @@ export struct CardSourceInfo { @@ -54,7 +56,6 @@ export struct CardSourceInfo {
54 return true 56 return true
55 } 57 }
56 58
57 -  
58 /** 59 /**
59 * 全域数字显示规则 60 * 全域数字显示规则
60 * 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585 61 * 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585
@@ -64,17 +65,17 @@ export struct CardSourceInfo { @@ -64,17 +65,17 @@ export struct CardSourceInfo {
64 * 5、0 和空 不显示 65 * 5、0 和空 不显示
65 */ 66 */
66 handlerNum(number: string) { 67 handlerNum(number: string) {
67 - const num = number??'0'; 68 + const num = number ?? '0';
68 if (Number.parseInt(num) <= 9999) { 69 if (Number.parseInt(num) <= 9999) {
69 return Number.parseInt(num).toString() 70 return Number.parseInt(num).toString()
70 } else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) { 71 } else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) {
71 const num1: string = num.slice(0, -4); // 万 72 const num1: string = num.slice(0, -4); // 万
72 const num2: string = num.slice(-4, -3); // 千 73 const num2: string = num.slice(-4, -3); // 千
73 - return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万' 74 + return num2 === '0' ? num1 + '万' : num1 + '.' + num2 + '万'
74 } else if (Number.parseInt(num) > 99999999) { 75 } else if (Number.parseInt(num) > 99999999) {
75 const num1: string = num.slice(0, -8); // 亿 76 const num1: string = num.slice(0, -8); // 亿
76 const num2: string = num.slice(-8, -7); 77 const num2: string = num.slice(-8, -7);
77 - return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿' 78 + return num2 === '0' ? num1 + '亿' : num1 + '.' + num2 + '亿'
78 } 79 }
79 return num 80 return num
80 } 81 }
@@ -94,7 +95,7 @@ export struct CardSourceInfo { @@ -94,7 +95,7 @@ export struct CardSourceInfo {
94 .fontColor($r("app.color.color_ED2800")) 95 .fontColor($r("app.color.color_ED2800"))
95 .margin({ right: 2 }) 96 .margin({ right: 2 })
96 } 97 }
97 - if(this.contentDTO.cornerMark){ 98 + if (this.contentDTO.cornerMark) {
98 Text(this.contentDTO.cornerMark) 99 Text(this.contentDTO.cornerMark)
99 .fontSize($r("app.float.font_size_11")) 100 .fontSize($r("app.float.font_size_11"))
100 .fontColor($r("app.color.color_ED2800")) 101 .fontColor($r("app.color.color_ED2800"))
@@ -113,59 +114,52 @@ export struct CardSourceInfo { @@ -113,59 +114,52 @@ export struct CardSourceInfo {
113 .maxLines(1) 114 .maxLines(1)
114 .textOverflow({ overflow: TextOverflow.Ellipsis }) 115 .textOverflow({ overflow: TextOverflow.Ellipsis })
115 } 116 }
116 - if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum  
117 - // || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != ''  
118 - || (this.contentDTO.isSearch || this.contentDTO.isCollection ||  
119 - !this.contentDTO.isSearch && DateTimeUtils.getCommentTime  
120 - (Number  
121 - .parseFloat(this  
122 - .contentDTO.publishTime))  
123 - .indexOf  
124 - ('-') === -1)  
125 - )) { 117 +
  118 + if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName &&
  119 + this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) &&
  120 + (this.getContentDtoBean()?.interactData?.commentNum
  121 + // || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != ''
  122 + || (this.contentDTO.isSearch || this.contentDTO.isCollection ||
  123 + !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
  124 + (Number
  125 + .parseFloat(this
  126 + .contentDTO.publishTime))
  127 + .indexOf
  128 + ('-') === -1)
  129 + )) {
  130 +
126 Image($r("app.media.point")) 131 Image($r("app.media.point"))
127 .width(11) 132 .width(11)
128 .height(11) 133 .height(11)
  134 +
129 } 135 }
130 - // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间  
131 - // if (this.contentDTO.isSearch || this.contentDTO.isCollection ||  
132 - // (!this.contentDTO.isSearch &&  
133 - // DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)).indexOf('-') === -1)) {  
134 - //  
135 - // Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
136 - // .fontSize($r("app.float.font_size_11"))  
137 - // .fontColor($r("app.color.color_B0B0B0"))  
138 - // .flexShrink(0);  
139 - // }  
140 - // if (this.contentDTO.source && this.showTime()) {  
141 - // Text(this.handleTimeStr())  
142 - // .fontSize($r("app.float.font_size_11"))  
143 - // .fontColor($r("app.color.color_B0B0B0"))  
144 - // .flexShrink(0)  
145 - // .margin({right: 4})  
146 - // } 136 +
  137 + // 发布日期
147 if (this.showTime()) { 138 if (this.showTime()) {
148 Text(this.handleTimeStr()) 139 Text(this.handleTimeStr())
149 .fontSize($r("app.float.font_size_11")) 140 .fontSize($r("app.float.font_size_11"))
150 .fontColor($r("app.color.color_B0B0B0")) 141 .fontColor($r("app.color.color_B0B0B0"))
151 .flexShrink(0) 142 .flexShrink(0)
152 - .margin({right: 4}) 143 + .margin({ right: 4 })
153 } 144 }
154 - if (Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && this.showCommentNum()) { 145 +
  146 + if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
  147 + this.showCommentNum()) {
155 Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`) 148 Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)
156 .fontSize($r("app.float.font_size_11")) 149 .fontSize($r("app.float.font_size_11"))
157 .fontColor($r("app.color.color_B0B0B0")) 150 .fontColor($r("app.color.color_B0B0B0"))
158 .flexShrink(0) 151 .flexShrink(0)
  152 + } else {
  153 +
  154 + if (this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
  155 + Text(`${this.handlerNum(this.contentDTO.interactData?.commentNum.toString())}评`)
  156 + .fontSize($r("app.float.font_size_11"))
  157 + .fontColor($r("app.color.color_B0B0B0"))
  158 + .flexShrink(0)
  159 + }
  160 +
159 } 161 }
160 162
161 - // if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) {  
162 - // Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)  
163 - // .fontSize($r("app.float.font_size_11"))  
164 - // .fontColor($r("app.color.color_B0B0B0"))  
165 - // .flexShrink(0)  
166 - // .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None :  
167 - // Visibility.Visible)  
168 - // }  
169 } 163 }
170 .width(CommonConstants.FULL_WIDTH) 164 .width(CommonConstants.FULL_WIDTH)
171 .margin({ top: 8 }) 165 .margin({ top: 8 })
1 -import { ContentDTO, slideShows, VideoInfoDTO, CompDTO } from 'wdBean'; 1 +import { ContentDTO, slideShows, VideoInfoDTO, CompDTO, InteractDataDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant'; 2 import { CommonConstants } from 'wdConstant';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; 4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
@@ -8,6 +8,8 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; @@ -8,6 +8,8 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { InfomationCardClick } from '../../utils/infomationCardClick' 8 import { InfomationCardClick } from '../../utils/infomationCardClick'
9 import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; 9 import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 import router from '@ohos.router' 10 import router from '@ohos.router'
  11 +import { BasePageHelp } from '../page/template/BasePageHelp';
  12 +import { Logger } from 'wdKit/Index';
11 13
12 /** 14 /**
13 * 大专题卡--CompStyle: 10 15 * 大专题卡--CompStyle: 10
@@ -25,11 +27,40 @@ export struct Card10Component { @@ -25,11 +27,40 @@ export struct Card10Component {
25 @State titleMarked: boolean = false; 27 @State titleMarked: boolean = false;
26 @State textArr: textItem[] = [] 28 @State textArr: textItem[] = []
27 @State hideDetail: boolean = false; 29 @State hideDetail: boolean = false;
  30 + basePageHelp: BasePageHelp = new BasePageHelp
  31 +
  32 + // 稿件参与批查,需要对列表信息单独重绘
  33 + @State isBatchData : boolean= false
28 34
29 async aboutToAppear(): Promise<void> { 35 async aboutToAppear(): Promise<void> {
30 this.titleInit(); 36 this.titleInit();
31 this.loadImg = await onlyWifiLoadImg(); 37 this.loadImg = await onlyWifiLoadImg();
32 this.initHideDetail(); 38 this.initHideDetail();
  39 +
  40 + if (!this.hideDetail) {
  41 + this.isBatchData = false
  42 + // 批查评论数据
  43 + let interactArray = this.basePageHelp.getCompInteractParams(this.contentDTO.slideShows)
  44 + if (interactArray.contentList != null && interactArray.contentList.length > 0) {
  45 + this.basePageHelp.requestCompInteractData(interactArray)
  46 + .then((result) => {
  47 + if (result != null && result.length > 0) {
  48 + this.isBatchData = true
  49 + this.contentDTO.slideShows.forEach((slideShowBean) => {
  50 + let newsId = slideShowBean.newsId
  51 + for (let interactBean of result) {
  52 + console.debug(TAG, JSON.stringify(interactBean))
  53 + if (newsId == interactBean.contentId) {
  54 + slideShowBean.interactDataDto = interactBean
  55 + break
  56 + }
  57 + }
  58 + })
  59 + }
  60 + })
  61 + }
  62 + }
  63 +
33 } 64 }
34 65
35 initHideDetail() { 66 initHideDetail() {
@@ -40,7 +71,7 @@ export struct Card10Component { @@ -40,7 +71,7 @@ export struct Card10Component {
40 } 71 }
41 72
42 titleInit() { 73 titleInit() {
43 - const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); 74 + const titleInitRes: titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
44 this.titleMarked = titleInitRes.titleMarked; 75 this.titleMarked = titleInitRes.titleMarked;
45 this.textArr = titleInitRes.textArr; 76 this.textArr = titleInitRes.textArr;
46 } 77 }
@@ -63,16 +94,16 @@ export struct Card10Component { @@ -63,16 +94,16 @@ export struct Card10Component {
63 Span(this.contentDTO.newsTitle) 94 Span(this.contentDTO.newsTitle)
64 } 95 }
65 } 96 }
66 - .width(CommonConstants.FULL_WIDTH)  
67 - .fontSize($r('app.float.font_size_18'))  
68 - .fontWeight(600)  
69 - .maxLines(1)  
70 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
71 - .margin({ bottom: 19 })  
72 - .onClick((event: ClickEvent) => {  
73 - InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)  
74 - ProcessUtils.processPage(this.contentDTO)  
75 - }) 97 + .width(CommonConstants.FULL_WIDTH)
  98 + .fontSize($r('app.float.font_size_18'))
  99 + .fontWeight(600)
  100 + .maxLines(1)
  101 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  102 + .margin({ bottom: 19 })
  103 + .onClick((event: ClickEvent) => {
  104 + InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
  105 + ProcessUtils.processPage(this.contentDTO)
  106 + })
76 } 107 }
77 // 大图 108 // 大图
78 Stack() { 109 Stack() {
@@ -94,17 +125,15 @@ export struct Card10Component { @@ -94,17 +125,15 @@ export struct Card10Component {
94 125
95 // 专题列表--后端返回三个, 126 // 专题列表--后端返回三个,
96 if (!this.hideDetail) { 127 if (!this.hideDetail) {
97 - Column() {  
98 - ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {  
99 - this.timelineItem(item, index)  
100 - if (index < this.contentDTO.slideShows.length - 1) {  
101 - // 在不是最后一个元素的情况下添加分隔符  
102 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 });  
103 - }  
104 - }) 128 +
  129 +
  130 + if(this.isBatchData){
  131 + this.drawCompList()
  132 + }else {
  133 + this.drawCompList()
105 } 134 }
106 - }  
107 135
  136 + }
108 137
109 // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 138 // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多
110 if (this.contentDTO.hasMore == 1 && !this.hideDetail) { 139 if (this.contentDTO.hasMore == 1 && !this.hideDetail) {
@@ -141,6 +170,21 @@ export struct Card10Component { @@ -141,6 +170,21 @@ export struct Card10Component {
141 } 170 }
142 171
143 @Builder 172 @Builder
  173 + drawCompList(){
  174 +
  175 + Column() {
  176 + ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {
  177 + this.timelineItem(item, index)
  178 + if (index < this.contentDTO.slideShows.length - 1) {
  179 + // 在不是最后一个元素的情况下添加分隔符
  180 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 });
  181 + }
  182 + })
  183 + }
  184 +
  185 + }
  186 +
  187 + @Builder
144 timelineItem(item: slideShows, index: number) { 188 timelineItem(item: slideShows, index: number) {
145 Row() { 189 Row() {
146 Column() { 190 Column() {
@@ -161,6 +205,7 @@ export struct Card10Component { @@ -161,6 +205,7 @@ export struct Card10Component {
161 //bottom 评论等信息 205 //bottom 评论等信息
162 CardSourceInfo( 206 CardSourceInfo(
163 { 207 {
  208 + isCompInnerSource:true,
164 compDTO: this.compDTO, 209 compDTO: this.compDTO,
165 contentDTO: this.createContent(item) 210 contentDTO: this.createContent(item)
166 } 211 }
@@ -171,7 +216,7 @@ export struct Card10Component { @@ -171,7 +216,7 @@ export struct Card10Component {
171 .alignItems(HorizontalAlign.Start) 216 .alignItems(HorizontalAlign.Start)
172 217
173 // 右侧图片 218 // 右侧图片
174 - if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { 219 + if (item.fullColumnImgUrls && item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
175 Stack() { 220 Stack() {
176 Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') 221 Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
177 .backgroundColor(0xf5f5f5) 222 .backgroundColor(0xf5f5f5)
@@ -201,8 +246,9 @@ export struct Card10Component { @@ -201,8 +246,9 @@ export struct Card10Component {
201 246
202 private createContent(item: slideShows): ContentDTO { 247 private createContent(item: slideShows): ContentDTO {
203 let contentDTO = new ContentDTO() 248 let contentDTO = new ContentDTO()
204 - contentDTO.publishTime = item.publishTime.toString() || ''; 249 + contentDTO.publishTime = item.publishTime?.toString() || '';
205 contentDTO.source = item.source || ''; 250 contentDTO.source = item.source || '';
  251 + contentDTO.interactData = item.interactDataDto
206 return contentDTO; 252 return contentDTO;
207 } 253 }
208 254
@@ -214,4 +260,6 @@ export struct Card10Component { @@ -214,4 +260,6 @@ export struct Card10Component {
214 contentDTO.voiceInfo = { voiceDuration: Number(item.voiceDuration) as number }; 260 contentDTO.voiceInfo = { voiceDuration: Number(item.voiceDuration) as number };
215 return contentDTO; 261 return contentDTO;
216 } 262 }
  263 +
  264 +
217 } 265 }
@@ -395,7 +395,7 @@ export struct PaperSingleColumn999CardView { @@ -395,7 +395,7 @@ export struct PaperSingleColumn999CardView {
395 private item: ContentDTO = new ContentDTO(); 395 private item: ContentDTO = new ContentDTO();
396 private index: number = -1; 396 private index: number = -1;
397 @State isRead: boolean = false;//已读状态 397 @State isRead: boolean = false;//已读状态
398 - @State interactData: InteractDataDTO = {} as InteractDataDTO; 398 + @State interactData: InteractDataDTO = new InteractDataDTO
399 @Consume @Watch('onChangeCommentList') commentList: InteractDataDTO[] 399 @Consume @Watch('onChangeCommentList') commentList: InteractDataDTO[]
400 400
401 getPublishTime(): string { 401 getPublishTime(): string {
1 -import { CompDTO, 1 +import {
  2 + CompDTO,
2 ContentBean, 3 ContentBean,
3 ContentDTO, 4 ContentDTO,
4 InteractDataDTO, 5 InteractDataDTO,
5 - InteractParam, LiveRoomDataBean, ReserveBean, ReserveItemBean } from 'wdBean/Index' 6 + InteractParam,
  7 + LiveRoomDataBean,
  8 + ReserveBean,
  9 + ReserveItemBean,
  10 + slideShows
  11 +} from 'wdBean/Index'
6 import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO' 12 import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'
7 import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, StringUtils } from 'wdKit/Index' 13 import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, StringUtils } from 'wdKit/Index'
8 import { HttpUtils, ResponseDTO } from 'wdNetwork/Index' 14 import { HttpUtils, ResponseDTO } from 'wdNetwork/Index'
@@ -22,7 +28,7 @@ export class BasePageHelp { @@ -22,7 +28,7 @@ export class BasePageHelp {
22 if (HttpUtils.getUserId()) { 28 if (HttpUtils.getUserId()) {
23 29
24 let time = DateTimeUtils.getTimeStamp().toString() 30 let time = DateTimeUtils.getTimeStamp().toString()
25 - Logger.debug(TAG, 'getAppointmentInfo-->'+time) 31 + Logger.debug(TAG, 'getAppointmentInfo-->' + time)
26 const reserveBean = this.transformToLiveDetailsBeans(compList) 32 const reserveBean = this.transformToLiveDetailsBeans(compList)
27 LiveModel.getAppointmentStatus(reserveBean).then((result) => { 33 LiveModel.getAppointmentStatus(reserveBean).then((result) => {
28 Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`) 34 Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`)
@@ -116,11 +122,11 @@ export class BasePageHelp { @@ -116,11 +122,11 @@ export class BasePageHelp {
116 return idList.join(',') 122 return idList.join(',')
117 } 123 }
118 124
119 -/**  
120 - * 批查稿件的互动数据,如 评论人数等  
121 - * @param compList  
122 - * @returns  
123 - */ 125 + /**
  126 + * 批查稿件的互动数据,如 评论人数等
  127 + * @param compList
  128 + * @returns
  129 + */
124 async getInteractData(compList: CompDTO[]) { 130 async getInteractData(compList: CompDTO[]) {
125 let param: InteractParam = this.getInteractParams(compList); 131 let param: InteractParam = this.getInteractParams(compList);
126 const SIZE = 20; 132 const SIZE = 20;
@@ -165,13 +171,17 @@ export class BasePageHelp { @@ -165,13 +171,17 @@ export class BasePageHelp {
165 allInteractDataList.push(...value); 171 allInteractDataList.push(...value);
166 } 172 }
167 }) 173 })
168 - // 批查全部完成,统一设置到comp里  
169 - // this.resetInteract(allInteractDataList, compList);  
170 success(allInteractDataList); 174 success(allInteractDataList);
171 }) 175 })
172 }) 176 })
173 } 177 }
174 178
  179 +
  180 + /**
  181 + * 收集信息流页面,可参与批查稿件的业务信息
  182 + * @param compList
  183 + * @returns
  184 + */
175 private getInteractParams(compList: CompDTO[]): InteractParam { 185 private getInteractParams(compList: CompDTO[]): InteractParam {
176 if (compList == null || compList.length == 0) { 186 if (compList == null || compList.length == 0) {
177 return {} as InteractParam; 187 return {} as InteractParam;
@@ -204,6 +214,34 @@ export class BasePageHelp { @@ -204,6 +214,34 @@ export class BasePageHelp {
204 return param; 214 return param;
205 } 215 }
206 216
  217 + /**
  218 + * 获取组件中需要参与批查业务信息
  219 + * @param slideShowArray
  220 + * @returns
  221 + */
  222 + public getCompInteractParams(slideShowArray: slideShows[]): InteractParam {
  223 +
  224 + if (slideShowArray == null || slideShowArray.length == 0) {
  225 + return {} as InteractParam;
  226 + }
  227 + let param: InteractParam = {} as InteractParam;
  228 + param.contentList = new Array<ContentBean>();
  229 + slideShowArray.forEach((value) => {
  230 + let bean = {} as ContentBean;
  231 + bean.contentId = value.newsId;
  232 + bean.contentType = value.objectType;
  233 + param.contentList.push(bean);
  234 + })
  235 +
  236 + return param
  237 + }
  238 +
  239 +
  240 + /**
  241 + * 查询互动相关数据,如收藏数、评论数等
  242 + * @param param
  243 + * @returns
  244 + */
207 private createInteractDataPromise(param: InteractParam) { 245 private createInteractDataPromise(param: InteractParam) {
208 return new Promise<InteractDataDTO[]>((success, error) => { 246 return new Promise<InteractDataDTO[]>((success, error) => {
209 PageRepository.fetchInteractData(param).then((resDTO: ResponseDTO<InteractDataDTO[]>) => { 247 PageRepository.fetchInteractData(param).then((resDTO: ResponseDTO<InteractDataDTO[]>) => {
@@ -221,12 +259,24 @@ export class BasePageHelp { @@ -221,12 +259,24 @@ export class BasePageHelp {
221 }); 259 });
222 } 260 }
223 261
  262 + async requestCompInteractData(param: InteractParam): Promise<InteractDataDTO[]> {
  263 + return new Promise<InteractDataDTO[]>((success, error) => {
  264 + this.createInteractDataPromise(param).then((result) => {
  265 + if (!CollectionUtils.isArray(result)) {
  266 + success(new Array<InteractDataDTO>());
  267 + return;
  268 + }
  269 + success(result);
  270 + })
  271 + })
  272 + }
  273 +
224 /** 274 /**
225 * 刷新互动数据到compList 275 * 刷新互动数据到compList
226 * @param interact 批查互动数据结果 276 * @param interact 批查互动数据结果
227 * @param compList comp list 277 * @param compList comp list
228 */ 278 */
229 - resetInteract(interact: InteractDataDTO[], compList: BaseDTO[]) { 279 + resetInteract(interact: InteractDataDTO[], compList: BaseDTO[]) {
230 if (interact == null || interact.length == 0) { 280 if (interact == null || interact.length == 0) {
231 return 281 return
232 } 282 }
@@ -252,6 +302,4 @@ export class BasePageHelp { @@ -252,6 +302,4 @@ export class BasePageHelp {
252 } 302 }
253 }) 303 })
254 } 304 }
255 -  
256 -  
257 } 305 }
@@ -59,7 +59,7 @@ export struct LiveOperRowListView { @@ -59,7 +59,7 @@ export struct LiveOperRowListView {
59 @State needLike: boolean = true 59 @State needLike: boolean = true
60 @State styleType: number = -1 60 @State styleType: number = -1
61 @State bgColor: ResourceColor = Color.White 61 @State bgColor: ResourceColor = Color.White
62 - @State interactData: InteractDataDTO = {} as InteractDataDTO 62 + @State interactData: InteractDataDTO = new InteractDataDTO
63 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 63 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
64 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 64 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
65 @State dialogController: CustomDialogController | null = null; 65 @State dialogController: CustomDialogController | null = null;