CommentDialogView.ets 2.73 KB
import { ContentDetailDTO } from 'wdBean/Index'
import { WindowModel } from 'wdKit/Index'
import {
  publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'

@Component
export struct CommentDialogView {
  private dialogController: CustomDialogController = new CustomDialogController({
    builder: this.commentBuilder(),
    autoCancel: true,
    customStyle: true,
    alignment: DialogAlignment.Bottom,
    height: (this.windowHeight - this.windowWidth / 16 / 9) + 'px' as Dimension
  })
  @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
  @Provide windowHeight: number = AppStorage.get<number>('windowHeight') || 0
  @Consume contentDetailData: ContentDetailDTO
  @Consume showCommentList: boolean
  @State publishCommentModel: publishCommentModel = new publishCommentModel()

  aboutToAppear(): void {

    this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
    this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
    this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
    this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
    this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
    this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
    this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
    this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')

    this.dialogController.open()
  }

  @Builder
  commentBuilder() {
    Column() {
      CommentComponent({
        publishCommentModel: this.publishCommentModel,
        showCloseIcon: true,
        onCloseClick: () => {
          this.dialogController.close()
          this.showCommentList = false
        }
      })
        .layoutWeight(1)
      OperRowListView({
        componentType: 1,
        showBackIcon: false,
        operationButtonList: ['comment', 'like', 'collect', 'share'],
        contentDetailData: this.contentDetailData,
        publishCommentModel: this.publishCommentModel,
        showCommentIcon: true,
        onBack: () => {
          WindowModel.shared.setWindowLayoutFullScreen(false)
          WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
        }
      })
    }
    .zIndex(1000)
    .backgroundColor(Color.White)
    .height('60%')
  }

  build() {


  }
}