CommentComponentPage.ets 1.65 KB
import { ContentDetailDTO } from 'wdBean/Index'
import {
  publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'

@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)
  }

  build() {
    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: 20 })
          .position({ x: '100%' })
          .markAnchor({ x: '100%' })

      }
    }
    .zIndex(1000)
    .backgroundColor(Color.White)
 
  }
}