xugenyuan

ref |> 新增评论列表对话框

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -4,6 +4,7 @@ import { commentItemModel } from '../model/CommentModel' @@ -4,6 +4,7 @@ import { commentItemModel } from '../model/CommentModel'
4 import { publishCommentModel } from '../model/PublishCommentModel' 4 import { publishCommentModel } from '../model/PublishCommentModel'
5 import commentViewModel from '../viewmodel/CommentViewModel' 5 import commentViewModel from '../viewmodel/CommentViewModel'
6 6
  7 +/// 评论输入框
7 @Preview 8 @Preview
8 @CustomDialog 9 @CustomDialog
9 export struct CommentCustomDialog { 10 export struct CommentCustomDialog {
1 import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' 1 import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
  2 +import { OperRowListView } from '../../view/OperRowListView'
2 import { publishCommentModel } from '../model/PublishCommentModel' 3 import { publishCommentModel } from '../model/PublishCommentModel'
  4 +import { CommentComponent } from './CommentComponent'
3 5
  6 +/// 评论列表弹框
4 @CustomDialog 7 @CustomDialog
5 export struct CommentListDialog { 8 export struct CommentListDialog {
6 9
7 /// 内部使用 10 /// 内部使用
8 - private publishCommentModel: publishCommentModel = new publishCommentModel() 11 + @State private publishCommentModel: publishCommentModel = new publishCommentModel()
  12 + @State private operationButtonList: string[] = []
9 controller?: CustomDialogController 13 controller?: CustomDialogController
  14 + @State windowWidth: number = AppStorage.get<number>('windowWidth') || 0
  15 + @State windowHeight: number = AppStorage.get<number>('windowHeight') || 0
10 16
11 /// 外部初始化 17 /// 外部初始化
12 - contentDetail?: ContentDetailDTO  
13 - pageInfo?: PageInfoDTO 18 + @Consume contentDetailData: ContentDetailDTO // 详情页传
  19 + @Consume pageInfo: PageInfoDTO // 专题页传
  20 + onClose?: () => void
14 21
15 - build() { 22 + aboutToAppear(): void {
  23 + if (this.contentDetailData) {
  24 + if (this.contentDetailData?.openComment) {
  25 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  26 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
  27 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  28 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
  29 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
  30 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
  31 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
  32 + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
  33 +
  34 + this.operationButtonList.push('comment')
  35 + }
  36 + this.operationButtonList.push('collect')
  37 + this.operationButtonList.push('share')
16 } 38 }
17 39
  40 + if (this.pageInfo) {
  41 + }
  42 + }
18 43
  44 + build() {
  45 + Column() {
  46 + CommentComponent({
  47 + publishCommentModel: this.publishCommentModel,
  48 + showCloseIcon: true,
  49 + fixedHeightMode: true,
  50 + onCloseClick: () => {
  51 + this.controller!.close()
  52 + if (this.onClose) {
  53 + this.onClose()
  54 + }
  55 + }
  56 + }).layoutWeight(1)
  57 +
  58 + OperRowListView({
  59 + componentType: 1,
  60 + pageComponentType: 8,
  61 + showBackIcon: false,
  62 + operationButtonList: this.operationButtonList,
  63 + contentDetailData: this.contentDetailData,
  64 + publishCommentModel: this.publishCommentModel,
  65 + showCommentIcon: true,
  66 + })
  67 + }
  68 + .height(this.windowHeight - this.windowWidth * 9 / 16 + 'px')
  69 + .zIndex(1000)
  70 + .backgroundColor(Color.White)
  71 + }
19 } 72 }