<route lang="json5" type="page">
{
  style: {
    navigationBarTitleText: '六纬AI小助手',
  },
  needLogin: true,
}
</route>
<template>
  <web-view :src="url" :update-title="false" />
</template>

<script setup lang="ts">
import { useUserStore } from '@/store'
import { getAssistant } from '@/service/index/api'

const userStore = useUserStore()

//chat.ycymedu.com
//chatv2.ycymedu.com
const url = ref(``)

onLoad((options) => {
  getAssistant().then((res) => {
    if (res.code === 200) {
      const data = res.result as unknown as string
      url.value = `${data}?userId=${userStore.userInfo.estimatedAchievement.wxId}&subjectGroup=${userStore.userInfo.estimatedAchievement.subjectGroup}&expectedScore=${userStore.userInfo.estimatedAchievement.expectedScore}&provinceName=${userStore.userInfo.estimatedAchievement.provinceName}&locationCode=${userStore.userInfo.estimatedAchievement.provinceCode}&token=${userStore.userInfo.token}&timestamp=${new Date().getTime()}`
    }
    if (options?.id) {
      url.value += `&reportId=${options.id}`
    }
    if (options?.type) {
      url.value += `&reportType=${options.type}`
    }
    if (options?.fileId) {
      url.value += `&fileId=${options.fileId}`
    }
  })
})
</script>

<style lang="scss" scoped></style>
