<script setup>
const webviewStyles = ref({
  top: `${uni.getSystemInfoSync().statusBarHeight + 44}px`, // 距离顶部的距离
  height: `${uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 44}px`, // 高度
  position: 'absolute', // 绝对定位
  dock: 'bottom', // 停靠在底部
  bounce: 'vertical', // 垂直方向的回弹效果
})
const orderId = ref(null)
const token = ref(null)
const webviewSrc = ref('')

onLoad((option) => {
  if (option.id) {
    orderId.value = option.id
  }

  token.value = uni.getStorageSync('token') || ''

  const baseUrl = 'https://app.quannengcha.com/report'
  webviewSrc.value = `${baseUrl}?order_id=${encodeURIComponent(orderId.value)}&token=${encodeURIComponent(token.value)}`
})
</script>

<template>
  <view>
    <web-view :webview-styles="webviewStyles" :src="webviewSrc" />
  </view>
</template>

<style lang="scss" scoped>

</style>

<route lang="json">
  {
    "layout": "page",
    "title": "报告结果"
  }
</route>
