<script setup>
  import { onLoad } from '@dcloudio/uni-app'
  import { ref } from 'vue'
  import { useAuthUser } from '@/composables/useAuthUser'

  const { userInfo } = useAuthUser()

  const windowHeight = ref(0)
  const url = ref('')
  onLoad(() => {
    const info = uni.getSystemInfoSync()
    windowHeight.value = info.windowHeight - 4
    url.value = `https://www.axd01wf.cfd/chat/index?channelId=${
      import.meta.env.VITE_CHANNEL_ID
    }&userName=${userInfo.value.userName}&phone=${
      userInfo.value.mobile
    }&email=${userInfo.value.email}`
  })
</script>

<template>
  <view :style="{ height: windowHeight + 'px' }" class="webview-box">
    <web-view
      :fullscreen="false"
      :src="url"
      style="width: 100%; height: 100%"
    ></web-view>
  </view>
</template>

<style lang="scss" scoped>
  .webview-box {
    width: 100%;
  }
</style>
