import { AppUtil } from '@pura/harmony-utils'
import { Constants } from '../../../../../common/Constants'
import { RouterUrls } from '../../../../../common/RouterUrls'
import { TextItemChildView } from '../../../../../view/TextItemChildView'
import { TitleBar } from '../../../../../view/TitleBar'

@Entry
@ComponentV2
struct AboutPage {
  build() {
    Column() {
      TitleBar({ title: '关于' }).width('100%')
      Image($r('app.media.ic_login_logo')).width(100).height(100).margin({ top: 100 })
      Text($r('app.string.app_name'))
        .fontColor($r('app.color.color_1a1a1a'))
        .fontSize(16)
        .fontWeight(FontWeight.Medium)
        .margin({ top: 16 })
        .width('auto')
      Text('版本号：v' + AppUtil.getVersionName())
        .fontColor($r('app.color.color_999999'))
        .fontSize(14)
        .margin({ top: 6 })
        .width('auto')
      TextItemChildView({ text: '用户协议' }).height(60).margin({ left: 16, top: 52, right: 16 })
        .onClick(() => {
          this.getUIContext()
            .getRouter()
            .pushUrl({ url: RouterUrls.WEB_PAGE, params: { title: '用户协议', url: Constants.USER_AGREEMENT } })
        })
      TextItemChildView({ text: '隐私政策', divider: false }).height(60).margin({ left: 16, right: 16 })
        .onClick(() => {
          this.getUIContext()
            .getRouter()
            .pushUrl({ url: RouterUrls.WEB_PAGE, params: { title: '隐私政策', url: Constants.PRIVACY_POLICY } })
        })
    }
    .justifyContent(FlexAlign.Start)
    .backgroundColor($r('app.color.window_background'))
    .width('100%')
    .height('100%')
  }
}