增加 swagger、druid、skywalking、admin 的自定义路径

This commit is contained in:
shizhong 2023-06-13 11:49:19 +08:00
parent 1ba37bfca4
commit 789ac414e9
5 changed files with 90 additions and 39 deletions

View File

@ -1,45 +1,37 @@
<template>
<ContentWrap title="数据库文档">
<!-- 操作工具栏 -->
<div class="mb-10px">
<XButton
type="primary"
preIcon="ep:download"
:title="t('action.export') + ' HTML'"
@click="handleExport('HTML')"
/>
<XButton
type="primary"
preIcon="ep:download"
:title="t('action.export') + ' Word'"
@click="handleExport('Word')"
/>
<XButton
type="primary"
preIcon="ep:download"
:title="t('action.export') + ' Markdown'"
@click="handleExport('Markdown')"
/>
<el-button type="primary" plain @click="handleExport('HTML')">
<Icon icon="ep:download" /> 导出 HTML
</el-button>
<el-button type="primary" plain @click="handleExport('Word')">
<Icon icon="ep:download" /> 导出 Word
</el-button>
<el-button type="primary" plain @click="handleExport('Markdown')">
<Icon icon="ep:download" /> 导出 Markdown
</el-button>
</div>
<IFrame v-if="!loding" v-loading="loding" :src="src" />
<IFrame v-if="!loading" v-loading="loading" :src="src" />
</ContentWrap>
</template>
<script setup lang="ts" name="DbDoc">
import download from '@/utils/download'
import * as DbDocApi from '@/api/infra/dbDoc'
const { t } = useI18n() //
const src = ref('')
const loding = ref(true)
const loading = ref(true) //
const src = ref('') // HTML
/** 页面加载 */
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
loding.value = false
try {
const data = await DbDocApi.exportHtmlApi()
const blob = new Blob([data], { type: 'text/html' })
src.value = window.URL.createObjectURL(blob)
} finally {
loading.value = false
}
}
/** 处理导出 */
const handleExport = async (type: string) => {
if (type === 'HTML') {
@ -55,6 +47,8 @@ const handleExport = async (type: string) => {
download.markdown(res, '数据库文档.md')
}
}
/** 初始化 */
onMounted(async () => {
await init()
})

View File

@ -1,9 +1,23 @@
<template>
<ContentWrap>
<IFrame :src="src" />
<IFrame v-if="!loading" :src="url" />
</ContentWrap>
</template>
<script setup lang="ts" name="Druid">
const BASE_URL = import.meta.env.VITE_BASE_URL
const src = ref(BASE_URL + '/druid/index.html')
import * as ConfigApi from '@/api/infra/config'
const loading = ref(true) //
const url = ref(import.meta.env.VITE_BASE_URL + '/druid/index.html')
/** 初始化 */
onMounted(async () => {
try {
const data = await ConfigApi.getConfigKey('url.druid')
if (data && data.length > 0) {
url.value = data
}
} finally {
loading.value = false
}
})
</script>

View File

@ -1,9 +1,23 @@
<template>
<ContentWrap>
<IFrame :src="src" />
<IFrame v-if="!loading" v-loading="loading" :src="src" />
</ContentWrap>
</template>
<script setup lang="ts" name="AdminServer">
const BASE_URL = import.meta.env.VITE_BASE_URL
const src = ref(BASE_URL + '/admin/applications')
import * as ConfigApi from '@/api/infra/config'
const loading = ref(true) //
const src = ref(import.meta.env.VITE_BASE_URL + '/admin/applications')
/** 初始化 */
onMounted(async () => {
try {
const data = await ConfigApi.getConfigKey('url.spring-boot-admin')
if (data && data.length > 0) {
src.value = data
}
} finally {
loading.value = false
}
})
</script>

View File

@ -1,8 +1,23 @@
<template>
<ContentWrap>
<IFrame :src="src" />
<IFrame v-if="!loading" v-loading="loading" :src="src" />
</ContentWrap>
</template>
<script setup lang="ts" name="Skywalking">
import * as ConfigApi from '@/api/infra/config'
const loading = ref(true) //
const src = ref('http://skywalking.shop.iocoder.cn')
/** 初始化 */
onMounted(async () => {
try {
const data = await ConfigApi.getConfigKey('url.skywalking')
if (data && data.length > 0) {
src.value = data
}
} finally {
loading.value = false
}
})
</script>

View File

@ -4,7 +4,21 @@
</ContentWrap>
</template>
<script setup lang="ts" name="Swagger">
const BASE_URL = import.meta.env.VITE_BASE_URL
// const src = ref(BASE_URL + '/doc.html')
const src = ref(BASE_URL + '/swagger-ui')
import * as ConfigApi from '@/api/infra/config'
const loading = ref(true) //
const src = ref(import.meta.env.VITE_BASE_URL + '/doc.html') // Knife4j UI
// const src = ref(import.meta.env.VITE_BASE_URL + '/swagger-ui') // Swagger UI
/** 初始化 */
onMounted(async () => {
try {
const data = await ConfigApi.getConfigKey('url.swagger')
if (data && data.length > 0) {
src.value = data
}
} finally {
loading.value = false
}
})
</script>