<template>
  <iframe :src="url" class="iframe-full" frameborder="0" />
</template>

<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'

const route = useRoute()

// 旧页面映射表
const oldPages = {
  '/gzfa':     '/src/pages/gwHzzIndex.html#/gzfa',
  '/shjsxm':   '/src/pages/gwHzzIndex.html#/shjsxm',
  '/syaxgl':   '/src/pages/gwHzzIndex.html#/syaxgl',
  '/khpg':     '/src/pages/gwHzzIndex.html#/khpg',
  '/khwj':     '/src/pages/gwHzzIndex.html#/khwj',
  '/ddlb':     '/src/pages/gwHzzIndex.html#/ddlb',
  '/ddsh':     '/src/pages/gwHzzIndex.html#/ddsh',
  '/sjml':     '/src/pages/gwHzzIndex.html#/sjml',
}

const isDev = import.meta.env.MODE === 'development'

const url = computed(() => {
  const path = route.path
  const oldPath = oldPages[path] || ''
  if (isDev) {
    return 'http://localhost:8081' + oldPath
  }
  return oldPath
})
</script>

<style scoped>
.iframe-full { width: 100%; height: calc(100vh - 84px); border: none; }
</style>
