SpacialTopicPageComponent.ets 3.26 KB
import { Action, ContentDetailDTO, ContentDTO, batchLikeAndCollectResult, InteractDataDTO, } from 'wdBean';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { OperRowListView } from './view/OperRowListView';
import { WdWebComponent } from 'wdWebComponent';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'

const TAG = 'SpacialTopicPageComponent'

@Component
export struct SpacialTopicPageComponent {
  scroller: Scroller = new Scroller();
  action: Action = {} as Action
  private webUrl?: string;
  @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
  @State recommendList: ContentDTO[] = []
  @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
  @State interactData: InteractDataDTO = {} as InteractDataDTO

  build() {
    Column() {
      Stack({ alignContent: Alignment.Bottom }) {
        Column() {
          WdWebComponent({
            webUrl: this.webUrl,
            backVisibility: false
          })
        }
        .padding({bottom:56})
        .width(CommonConstants.FULL_WIDTH)
        .height(CommonConstants.FULL_HEIGHT)

        //底部交互区
        Row() {
          Image($r('app.media.icon_arrow_left'))
            .width(24)
            .height(24)
            .onClick((event: ClickEvent) => {
              router.back()
            })

          Row() {
            Image($r('app.media.icon_comment'))
              .width(24)
              .height(24)
              .margin({ right: 24 })
              .id('comment')

            Image($r('app.media.icon_star'))
              .width(24)
              .height(24)
              .margin({ right: 24 })

            Image($r('app.media.icon_listen'))
              .width(24)
              .height(24)
              .margin({ right: 24 })

            Image($r('app.media.icon_forward'))
              .width(24)
              .height(24)

          }
        }
        .width(CommonConstants.FULL_WIDTH)
        .height(56)
        .padding({ left: 15, right: 15, bottom: 20, top: 20 })
        .justifyContent(FlexAlign.SpaceBetween)
        .backgroundColor(Color.White)
      }
    }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
    .backgroundColor(Color.White)
  }

  // private async getDetail() {
  //   let contentId: string = ''
  //   let relId: string = ''
  //   let relType: string = ''
  //   if (this.action && this.action.params) {
  //     if (this.action.params.contentID) {
  //       contentId = this.action.params.contentID;
  //     }
  //     if (this.action && this.action.params && this.action.params.extra) {
  //       if (this.action.params.extra.relId) {
  //         relId = this.action.params.extra.relId;
  //       }
  //       if (this.action.params.extra.relType) {
  //         relType = this.action.params.extra.relType
  //       }
  //
  //     }
  //     let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
  //     if (detailBeans && detailBeans.length > 0) {
  //       this.contentDetailData = detailBeans;
  //     }
  //   }
  // }

  aboutToAppear() {
    let action: Action = router.getParams() as Action
    if (action) {
      this.webUrl = action.params?.url
    }
    // this.getDetail()
  }

  aboutToDisappear() {
  }
}