xugenyuan

ref |> 解决内容稿件无法评论问题

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -70,6 +70,7 @@ export struct DynamicDetailComponent { @@ -70,6 +70,7 @@ export struct DynamicDetailComponent {
70 @State isPageEnd: boolean = false 70 @State isPageEnd: boolean = false
71 @State publishCommentModel: publishCommentModel = new publishCommentModel() 71 @State publishCommentModel: publishCommentModel = new publishCommentModel()
72 @State reachEndIncreament: number = 0 72 @State reachEndIncreament: number = 0
  73 + @State operationButtonList: string[] = []
73 74
74 async aboutToAppear() { 75 async aboutToAppear() {
75 await this.getContentDetailData() 76 await this.getContentDetailData()
@@ -532,15 +533,7 @@ export struct DynamicDetailComponent { @@ -532,15 +533,7 @@ export struct DynamicDetailComponent {
532 if (this.contentDetailData?.openComment) { 533 if (this.contentDetailData?.openComment) {
533 Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') }) 534 Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
534 CommentComponent({ 535 CommentComponent({
535 - publishCommentModel: {  
536 - targetId: String(this.contentDetailData?.newsId || ''),  
537 - targetRelId: this.contentDetailData?.reLInfo?.relId,  
538 - targetTitle: this.contentDetailData?.newsTitle,  
539 - targetRelType: this.contentDetailData?.reLInfo?.relType,  
540 - targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),  
541 - keyArticle: String(this.contentDetailData?.keyArticle),  
542 - targetType: String(this.contentDetailData?.newsType),  
543 - } as publishCommentModel 536 + publishCommentModel: this.publishCommentModel
544 }) 537 })
545 } 538 }
546 Blank().layoutWeight(1) 539 Blank().layoutWeight(1)
@@ -557,7 +550,7 @@ export struct DynamicDetailComponent { @@ -557,7 +550,7 @@ export struct DynamicDetailComponent {
557 OperRowListView({ 550 OperRowListView({
558 contentDetailData: this.contentDetailData, 551 contentDetailData: this.contentDetailData,
559 publishCommentModel: this.publishCommentModel, 552 publishCommentModel: this.publishCommentModel,
560 - operationButtonList: ['comment', 'collect', 'share'], 553 + operationButtonList: this.operationButtonList,
561 styleType: 1, 554 styleType: 1,
562 }) 555 })
563 556
@@ -574,13 +567,6 @@ export struct DynamicDetailComponent { @@ -574,13 +567,6 @@ export struct DynamicDetailComponent {
574 * */ 567 * */
575 private async getContentDetailData() { 568 private async getContentDetailData() {
576 this.isNetConnected = NetworkUtil.isNetConnected() 569 this.isNetConnected = NetworkUtil.isNetConnected()
577 - this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')  
578 - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)  
579 - this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle  
580 - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)  
581 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)  
582 - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)  
583 - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)  
584 try { 570 try {
585 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) 571 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
586 this.isPageEnd = true; 572 this.isPageEnd = true;
@@ -590,6 +576,20 @@ export struct DynamicDetailComponent { @@ -590,6 +576,20 @@ export struct DynamicDetailComponent {
590 let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) 576 let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
591 this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) 577 this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
592 console.log('动态详情', JSON.stringify(this.contentDetailData)) 578 console.log('动态详情', JSON.stringify(this.contentDetailData))
  579 +
  580 + if (this.contentDetailData?.openComment) {
  581 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  582 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
  583 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  584 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  585 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  586 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  587 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  588 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
  589 + }
  590 +
  591 + this.operationButtonList = ['comment', 'collect', 'share']
  592 +
593 } catch (exception) { 593 } catch (exception) {
594 console.log('请求失败', JSON.stringify(exception)) 594 console.log('请求失败', JSON.stringify(exception))
595 this.isPageEnd = true; 595 this.isPageEnd = true;
@@ -234,13 +234,13 @@ export struct ImageAndTextPageComponent { @@ -234,13 +234,13 @@ export struct ImageAndTextPageComponent {
234 } 234 }
235 if (this.contentDetailData?.openComment) { 235 if (this.contentDetailData?.openComment) {
236 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') 236 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
237 - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) 237 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
238 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle 238 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
239 - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)  
240 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)  
241 - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)  
242 - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)  
243 - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) 239 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  240 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  241 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  242 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  243 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
244 } 244 }
245 if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && 245 if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
246 this.contentDetailData?.audioList[0].audioUrl) { 246 this.contentDetailData?.audioList[0].audioUrl) {
@@ -445,13 +445,13 @@ export struct MultiPictureDetailPageComponent { @@ -445,13 +445,13 @@ export struct MultiPictureDetailPageComponent {
445 // } 445 // }
446 if (this.contentDetailData?.openComment) { 446 if (this.contentDetailData?.openComment) {
447 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') 447 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
448 - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) 448 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
449 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle 449 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
450 - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)  
451 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)  
452 - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)  
453 - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)  
454 - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) 450 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  451 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  452 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  453 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  454 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
455 } 455 }
456 // this.contentDetailData.photoList = [] 456 // this.contentDetailData.photoList = []
457 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { 457 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
@@ -72,13 +72,13 @@ export struct SpacialTopicPageComponent { @@ -72,13 +72,13 @@ export struct SpacialTopicPageComponent {
72 this.contentDetailData = detailBeans[0]; 72 this.contentDetailData = detailBeans[0];
73 // if (this.contentDetailData[0]?.openComment) { 73 // if (this.contentDetailData[0]?.openComment) {
74 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') 74 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
75 - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) 75 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
76 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle 76 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
77 - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)  
78 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)  
79 - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)  
80 - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)  
81 - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) 77 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  78 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  79 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  80 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  81 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
82 // } 82 // }
83 this.trySendData2H5() 83 this.trySendData2H5()
84 } 84 }
@@ -64,13 +64,13 @@ export struct DetailPlayLiveCommon { @@ -64,13 +64,13 @@ export struct DetailPlayLiveCommon {
64 // if (this.contentDetailData.openComment === 1) { 64 // if (this.contentDetailData.openComment === 1) {
65 console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment) 65 console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment)
66 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') 66 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
67 - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) 67 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
68 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle 68 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
69 - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)  
70 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)  
71 - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)  
72 - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)  
73 - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) 69 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  70 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  71 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  72 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  73 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
74 this.publishCommentModel.commentContent = '' 74 this.publishCommentModel.commentContent = ''
75 // } 75 // }
76 } 76 }
@@ -166,12 +166,13 @@ export struct DetailPlayShortVideoPage { @@ -166,12 +166,13 @@ export struct DetailPlayShortVideoPage {
166 this.queryNewsInfoOfUser() 166 this.queryNewsInfoOfUser()
167 167
168 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') 168 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
169 - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) 169 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
170 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle 170 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
171 - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)  
172 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)  
173 - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)  
174 - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) 171 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  172 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  173 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  174 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  175 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
175 this.publishCommentModel.commentContent = '' 176 this.publishCommentModel.commentContent = ''
176 177
177 } 178 }
@@ -17,13 +17,13 @@ export struct CommentComponentPage { @@ -17,13 +17,13 @@ export struct CommentComponentPage {
17 aboutToAppear(): void { 17 aboutToAppear(): void {
18 18
19 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') 19 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
20 - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) 20 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
21 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle 21 this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
22 - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)  
23 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)  
24 - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)  
25 - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)  
26 - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) 22 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  23 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  24 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  25 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  26 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
27 } 27 }
28 28
29 build() { 29 build() {