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

This commit is contained in:
YunaiV 2023-04-07 23:26:09 +08:00
parent 5fb61f8cb8
commit 7cc8d9067c
6 changed files with 96 additions and 39 deletions

View File

@ -56,10 +56,14 @@ declare module '@vue/runtime-core' {
ElIcon: typeof import('element-plus/es')['ElIcon'] ElIcon: typeof import('element-plus/es')['ElIcon']
ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
ElInput: typeof import('element-plus/es')['ElInput'] ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink'] ElLink: typeof import('element-plus/es')['ElLink']
ElOption: typeof import('element-plus/es')['ElOption'] ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination'] ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover'] ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow'] ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect'] ElSelect: typeof import('element-plus/es')['ElSelect']

View File

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

View File

@ -3,10 +3,24 @@
<doc-alert title="多数据源(读写分离)" url="https://doc.iocoder.cn/dynamic-datasource/" /> <doc-alert title="多数据源(读写分离)" url="https://doc.iocoder.cn/dynamic-datasource/" />
<ContentWrap> <ContentWrap>
<IFrame :src="src" /> <IFrame v-if="!loading" :src="url" />
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="Druid"> <script setup lang="ts" name="Druid">
const BASE_URL = import.meta.env.VITE_BASE_URL import * as ConfigApi from '@/api/infra/config'
const src = ref(BASE_URL + '/druid/index.html')
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> </script>

View File

@ -1,10 +1,25 @@
<template> <template>
<doc-alert title="服务监控" url="https://doc.iocoder.cn/server-monitor/" /> <doc-alert title="服务监控" url="https://doc.iocoder.cn/server-monitor/" />
<ContentWrap> <ContentWrap>
<IFrame :src="src" /> <IFrame v-if="!loading" v-loading="loading" :src="src" />
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="AdminServer"> <script setup lang="ts" name="AdminServer">
const BASE_URL = import.meta.env.VITE_BASE_URL import * as ConfigApi from '@/api/infra/config'
const src = ref(BASE_URL + '/admin/applications')
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> </script>

View File

@ -1,9 +1,25 @@
<template> <template>
<doc-alert title="服务监控" url="https://doc.iocoder.cn/server-monitor/" /> <doc-alert title="服务监控" url="https://doc.iocoder.cn/server-monitor/" />
<ContentWrap> <ContentWrap>
<IFrame :src="src" /> <IFrame v-if="!loading" v-loading="loading" :src="src" />
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="Skywalking"> <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') 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> </script>

View File

@ -6,7 +6,21 @@
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="Swagger"> <script setup lang="ts" name="Swagger">
const BASE_URL = import.meta.env.VITE_BASE_URL import * as ConfigApi from '@/api/infra/config'
// const src = ref(BASE_URL + '/doc.html')
const src = ref(BASE_URL + '/swagger-ui') 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> </script>