张善主

feat(动态):评论对接

... ... @@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base';
import { CommonConstants, SpConstants } from 'wdConstant/Index';
import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
import router from '@ohos.router';
import { publishCommentModel } from './comment/model/PublishCommentModel';
import { CommentComponent } from './comment/view/CommentComponent';
const TAG = 'DynamicDetailComponent'
@Preview
@Component
... ... @@ -50,6 +53,8 @@ export struct DynamicDetailComponent {
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
@State publishCommentModel: publishCommentModel = new publishCommentModel()
async aboutToAppear() {
await this.getContentDetailData()
}
... ... @@ -355,8 +360,14 @@ export struct DynamicDetailComponent {
//点赞操作
this.toggleLikeStatus()
})
// 评论
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
})
}
Blank().layoutWeight(1)
//fixme 评论组件
}
}
.width(CommonConstants.FULL_WIDTH)
... ... @@ -365,7 +376,10 @@ export struct DynamicDetailComponent {
.scrollBar(BarState.Off)
.alignSelf(ItemAlign.Start)
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData,interactData:this.interactDataDTO,newsStatusOfUser:this.newsStatusOfUser })
OperRowListView({ contentDetailData: this.contentDetailData
,interactData:this.interactDataDTO
,newsStatusOfUser:this.newsStatusOfUser
,publishCommentModel: this.publishCommentModel})
}
}
.alignSelf(ItemAlign.Start)
... ... @@ -384,6 +398,17 @@ export struct DynamicDetailComponent {
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
if (this.contentDetailData.openComment) {
this.publishCommentModel = {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
}
this.getBatchAttentionStatus()
this.getInteractDataStatus()
this.makeJumpInfo()
... ...