17 changed files with 137 additions and 18 deletions
			
			
		@ -1,16 +1,16 @@
					 | 
				
			||||
import { defHttp } from '@/utils/http/axios' | 
				
			||||
 | 
				
			||||
// 导出Html
 | 
				
			||||
export const exportHtmlApi = () => { | 
				
			||||
  return defHttp.get({ url: '/infra/db-doc/export-html' }) | 
				
			||||
export const exportHtmlApi = async () => { | 
				
			||||
  return defHttp.get({ url: '/infra/db-doc/export-html', responseType: 'blob' }) | 
				
			||||
} | 
				
			||||
 | 
				
			||||
// 导出Word
 | 
				
			||||
export const exportWordApi = () => { | 
				
			||||
  return defHttp.get({ url: '/infra/db-doc/export-word' }) | 
				
			||||
  return defHttp.get({ url: '/infra/db-doc/export-word', responseType: 'blob' }) | 
				
			||||
} | 
				
			||||
 | 
				
			||||
// 导出Markdown
 | 
				
			||||
export const exportMarkdownApi = () => { | 
				
			||||
  return defHttp.get({ url: '/infra/db-doc/export-markdown' }) | 
				
			||||
  return defHttp.get({ url: '/infra/db-doc/export-markdown', responseType: 'blob' }) | 
				
			||||
} | 
				
			||||
					 | 
				
			||||
@ -0,0 +1,5 @@
					 | 
				
			||||
import { withInstall } from '@/utils' | 
				
			||||
 | 
				
			||||
import iFrame from './src/IFrame.vue' | 
				
			||||
 | 
				
			||||
export const IFrame = withInstall(iFrame) | 
				
			||||
@ -0,0 +1,25 @@
					 | 
				
			||||
<template> | 
				
			||||
  <div v-loading="loading" :style="'height:' + height"> | 
				
			||||
    <iframe :src="props.src" style="width: 100%; height: 100%" frameborder="no" scrolling="auto" ref="frameRef"></iframe> | 
				
			||||
  </div> | 
				
			||||
</template> | 
				
			||||
<script setup lang="ts"> | 
				
			||||
import { propTypes } from '@/utils/propTypes' | 
				
			||||
import { onMounted, ref } from 'vue' | 
				
			||||
 | 
				
			||||
const props = defineProps({ | 
				
			||||
  src: propTypes.string.def('') | 
				
			||||
}) | 
				
			||||
const loading = ref(true) | 
				
			||||
const height = ref('') | 
				
			||||
const frameRef = ref<HTMLElement | null>(null) | 
				
			||||
const init = () => { | 
				
			||||
  height.value = document.documentElement.clientHeight - 94.5 + 'px' | 
				
			||||
  loading.value = false | 
				
			||||
} | 
				
			||||
onMounted(() => { | 
				
			||||
  setTimeout(() => { | 
				
			||||
    init() | 
				
			||||
  }, 300) | 
				
			||||
}) | 
				
			||||
</script> | 
				
			||||
@ -1,3 +1,47 @@
					 | 
				
			||||
<template> | 
				
			||||
  <div>开发中</div> | 
				
			||||
  <PageWrapper> | 
				
			||||
    <div class="mb-3"> | 
				
			||||
      <a-button type="primary" size="small" class="mr-1" @click="handleExport('HTML')">{{ t('action.export') + 'Html' }}</a-button> | 
				
			||||
      <a-button type="primary" size="small" class="mr-1" @click="handleExport('Word')">{{ t('action.export') + 'Word' }}</a-button> | 
				
			||||
      <a-button type="primary" size="small" @click="handleExport('Markdown')">{{ t('action.export') + 'Markdown' }}</a-button> | 
				
			||||
    </div> | 
				
			||||
    <IFrame :src="src" /> | 
				
			||||
  </PageWrapper> | 
				
			||||
</template> | 
				
			||||
<script setup lang="ts" name="Swagger"> | 
				
			||||
import { PageWrapper } from '@/components/Page' | 
				
			||||
import { onMounted, ref } from 'vue' | 
				
			||||
import { useI18n } from '@/hooks/web/useI18n' | 
				
			||||
import { IFrame } from '@/components/IFrame' | 
				
			||||
import * as DbDocApi from '@/api/infra/dbDoc' | 
				
			||||
import { downloadByData } from '@/utils/file/download' | 
				
			||||
 | 
				
			||||
const { t } = useI18n() | 
				
			||||
// const src = ref(BASE_URL + '/doc.html') | 
				
			||||
const src = ref('') | 
				
			||||
/** 页面加载 */ | 
				
			||||
const init = async () => { | 
				
			||||
  const res = await DbDocApi.exportHtmlApi() | 
				
			||||
  let blob = new Blob([res], { type: 'text/html' }) | 
				
			||||
  let blobUrl = window.URL.createObjectURL(blob) | 
				
			||||
  src.value = blobUrl | 
				
			||||
} | 
				
			||||
/** 处理导出  */ | 
				
			||||
const handleExport = async (type: string) => { | 
				
			||||
  if (type === 'HTML') { | 
				
			||||
    const res = await DbDocApi.exportHtmlApi() | 
				
			||||
    downloadByData(res, '数据库文档.html') | 
				
			||||
  } | 
				
			||||
  if (type === 'Word') { | 
				
			||||
    const res = await DbDocApi.exportWordApi() | 
				
			||||
    downloadByData(res, '数据库文档.doc') | 
				
			||||
  } | 
				
			||||
  if (type === 'Markdown') { | 
				
			||||
    const res = await DbDocApi.exportMarkdownApi() | 
				
			||||
    downloadByData(res, '数据库文档.md') | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
onMounted(async () => { | 
				
			||||
  await init() | 
				
			||||
}) | 
				
			||||
</script> | 
				
			||||
					 | 
				
			||||
@ -1,3 +1,13 @@
					 | 
				
			||||
<template> | 
				
			||||
  <div>开发中</div> | 
				
			||||
  <div> | 
				
			||||
    <IFrame :src="src" /> | 
				
			||||
  </div> | 
				
			||||
</template> | 
				
			||||
<script setup lang="ts" name="Swagger"> | 
				
			||||
import { ref } from 'vue' | 
				
			||||
import { IFrame } from '@/components/IFrame' | 
				
			||||
 | 
				
			||||
const BASE_URL = import.meta.env.VITE_GLOB_BASE_URL | 
				
			||||
// const src = ref(BASE_URL + '/doc.html') | 
				
			||||
const src = ref(BASE_URL + '/druid/index.html') | 
				
			||||
</script> | 
				
			||||
					 | 
				
			||||
@ -1,3 +1,13 @@
					 | 
				
			||||
<template> | 
				
			||||
  <div>开发中</div> | 
				
			||||
  <div> | 
				
			||||
    <IFrame :src="src" /> | 
				
			||||
  </div> | 
				
			||||
</template> | 
				
			||||
<script setup lang="ts" name="Swagger"> | 
				
			||||
import { ref } from 'vue' | 
				
			||||
import { IFrame } from '@/components/IFrame' | 
				
			||||
 | 
				
			||||
const BASE_URL = import.meta.env.VITE_GLOB_BASE_URL | 
				
			||||
// const src = ref(BASE_URL + '/doc.html') | 
				
			||||
const src = ref(BASE_URL + '/admin/applications') | 
				
			||||
</script> | 
				
			||||
					 | 
				
			||||
@ -1,3 +1,11 @@
					 | 
				
			||||
<template> | 
				
			||||
  <div>开发中</div> | 
				
			||||
  <div> | 
				
			||||
    <IFrame :src="src" /> | 
				
			||||
  </div> | 
				
			||||
</template> | 
				
			||||
<script setup lang="ts" name="Swagger"> | 
				
			||||
import { ref } from 'vue' | 
				
			||||
import { IFrame } from '@/components/IFrame' | 
				
			||||
 | 
				
			||||
const src = ref('http://skywalking.shop.iocoder.cn') | 
				
			||||
</script> | 
				
			||||
					 | 
				
			||||
@ -1,3 +1,13 @@
					 | 
				
			||||
<template> | 
				
			||||
  <div>开发中</div> | 
				
			||||
  <div> | 
				
			||||
    <IFrame :src="src" /> | 
				
			||||
  </div> | 
				
			||||
</template> | 
				
			||||
<script setup lang="ts" name="Swagger"> | 
				
			||||
import { ref } from 'vue' | 
				
			||||
import { IFrame } from '@/components/IFrame' | 
				
			||||
 | 
				
			||||
const BASE_URL = import.meta.env.VITE_GLOB_BASE_URL | 
				
			||||
// const src = ref(BASE_URL + '/doc.html') | 
				
			||||
const src = ref(BASE_URL + '/swagger-ui') | 
				
			||||
</script> | 
				
			||||
					 | 
				
			||||
		Reference in new issue