<template>
  <iframe :src="openUrl"
    frameborder="0"></iframe>
</template>

<script setup>
import { getToken } from '@/utils/auth'
const reportBaseDomain = import.meta.env.VITE_APP_REPORT_URL // 基础域名
const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL // 预览
const reportEditURL = import.meta.env.VITE_APP_REPORT_EDIT_URL // 新增/编辑
const route = useRoute()
const targetUrl = route.fullPath.split('?')[0]
const queryStr = route.fullPath.split('?')[1] || ''
let openUrl = targetUrl
// 判断路由上是否包含新建/编辑/预览积木的地址，需要携带 token
if (route.fullPath.includes(reportViewURL.substring(1)) || route.fullPath.includes(reportEditURL.substring(1))) {
  openUrl += `?token=${getToken()}&${queryStr}`
} else {
  openUrl += `?${queryStr}`
}
console.log(openUrl)
</script>

<style scoped
  lang="scss">
  iframe {
    width: 100%;
    height: 100%;
  }
</style>