张善主

feat(动态):评论对接

@@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base'; @@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base';
25 import { CommonConstants, SpConstants } from 'wdConstant/Index'; 25 import { CommonConstants, SpConstants } from 'wdConstant/Index';
26 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' 26 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
27 import router from '@ohos.router'; 27 import router from '@ohos.router';
  28 +import { publishCommentModel } from './comment/model/PublishCommentModel';
  29 +import { CommentComponent } from './comment/view/CommentComponent';
  30 +
28 const TAG = 'DynamicDetailComponent' 31 const TAG = 'DynamicDetailComponent'
29 @Preview 32 @Preview
30 @Component 33 @Component
@@ -50,6 +53,8 @@ export struct DynamicDetailComponent { @@ -50,6 +53,8 @@ export struct DynamicDetailComponent {
50 //跳转 53 //跳转
51 private mJumpInfo: ContentDTO = {} as ContentDTO; 54 private mJumpInfo: ContentDTO = {} as ContentDTO;
52 55
  56 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
  57 +
53 async aboutToAppear() { 58 async aboutToAppear() {
54 await this.getContentDetailData() 59 await this.getContentDetailData()
55 } 60 }
@@ -355,8 +360,14 @@ export struct DynamicDetailComponent { @@ -355,8 +360,14 @@ export struct DynamicDetailComponent {
355 //点赞操作 360 //点赞操作
356 this.toggleLikeStatus() 361 this.toggleLikeStatus()
357 }) 362 })
  363 + // 评论
  364 + if (this.contentDetailData?.openComment) {
  365 + Divider().strokeWidth(6).color('#f5f5f5')
  366 + CommentComponent({
  367 + publishCommentModel: this.publishCommentModel
  368 + })
  369 + }
358 Blank().layoutWeight(1) 370 Blank().layoutWeight(1)
359 - //fixme 评论组件  
360 } 371 }
361 } 372 }
362 .width(CommonConstants.FULL_WIDTH) 373 .width(CommonConstants.FULL_WIDTH)
@@ -365,7 +376,10 @@ export struct DynamicDetailComponent { @@ -365,7 +376,10 @@ export struct DynamicDetailComponent {
365 .scrollBar(BarState.Off) 376 .scrollBar(BarState.Off)
366 .alignSelf(ItemAlign.Start) 377 .alignSelf(ItemAlign.Start)
367 //底部交互区 378 //底部交互区
368 - OperRowListView({ contentDetailData: this.contentDetailData,interactData:this.interactDataDTO,newsStatusOfUser:this.newsStatusOfUser }) 379 + OperRowListView({ contentDetailData: this.contentDetailData
  380 + ,interactData:this.interactDataDTO
  381 + ,newsStatusOfUser:this.newsStatusOfUser
  382 + ,publishCommentModel: this.publishCommentModel})
369 } 383 }
370 } 384 }
371 .alignSelf(ItemAlign.Start) 385 .alignSelf(ItemAlign.Start)
@@ -384,6 +398,17 @@ export struct DynamicDetailComponent { @@ -384,6 +398,17 @@ export struct DynamicDetailComponent {
384 } catch (exception) { 398 } catch (exception) {
385 console.log('请求失败',JSON.stringify(exception)) 399 console.log('请求失败',JSON.stringify(exception))
386 } 400 }
  401 + if (this.contentDetailData.openComment) {
  402 + this.publishCommentModel = {
  403 + targetId: String(this.contentDetailData?.newsId || ''),
  404 + targetRelId: this.contentDetailData?.reLInfo?.relId,
  405 + targetTitle: this.contentDetailData?.newsTitle,
  406 + targetRelType: this.contentDetailData?.reLInfo?.relType,
  407 + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
  408 + keyArticle: String(this.contentDetailData?.keyArticle),
  409 + targetType: String(this.contentDetailData?.newsType),
  410 + } as publishCommentModel
  411 + }
387 this.getBatchAttentionStatus() 412 this.getBatchAttentionStatus()
388 this.getInteractDataStatus() 413 this.getInteractDataStatus()
389 this.makeJumpInfo() 414 this.makeJumpInfo()