CommentComponentPage.ets 2.47 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 CommentComponentPage {
  scroller: Scroller = new Scroller()
  @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 || '')
  }

  build() {
    Column() {
      Scroll(this.scroller) {
        Stack() {
          CommentComponent({
            publishCommentModel: this.publishCommentModel
          })
          Image($r("app.media.ic_close_black"))
            .width(20)
            .height(20)
            .onClick(() => {
              this.showCommentList = false
            })
            .margin({ top: 10, right: 30 })
            .position({ x: '100%' })
            .markAnchor({ x: '100%' })

        }
      }
      .layoutWeight(1)

      OperRowListView({
        componentType: 1,
        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%')

  }
}