SpacialTopicPageComponent.ets 2.21 KB
import { Action, ContentDetailDTO, } from 'wdBean';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { WdWebComponent } from 'wdWebComponent';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge/Index';

const TAG = 'SpacialTopicPageComponent'

@Component
export struct SpacialTopicPageComponent {
  webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
  scroller: Scroller = new Scroller();
  action: Action = {} as Action
  @State webUrl: string = '';
  build() {
    Column() {
      Stack({ alignContent: Alignment.Bottom }) {
        Column() {
          WdWebComponent({
            webviewControl: this.webviewControl,
            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)
  }

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

  aboutToDisappear() {
  }
}