Skip to content

Commit 7cc8d90

Browse files
committed
增加 swagger、druid、skywalking、admin 的自定义路径
1 parent 5fb61f8 commit 7cc8d90

File tree

6 files changed

+96
-39
lines changed

6 files changed

+96
-39
lines changed

src/types/auto-components.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ declare module '@vue/runtime-core' {
5656
ElIcon: typeof import('element-plus/es')['ElIcon']
5757
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
5858
ElInput: typeof import('element-plus/es')['ElInput']
59+
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
5960
ElLink: typeof import('element-plus/es')['ElLink']
6061
ElOption: typeof import('element-plus/es')['ElOption']
6162
ElPagination: typeof import('element-plus/es')['ElPagination']
6263
ElPopover: typeof import('element-plus/es')['ElPopover']
64+
ElRadio: typeof import('element-plus/es')['ElRadio']
65+
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
66+
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
6367
ElRow: typeof import('element-plus/es')['ElRow']
6468
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
6569
ElSelect: typeof import('element-plus/es')['ElSelect']

src/views/infra/dbDoc/index.vue

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,38 @@
22
<doc-alert title="数据库文档" url="https://doc.iocoder.cn/db-doc/" />
33

44
<ContentWrap title="数据库文档">
5-
<!-- 操作工具栏 -->
65
<div class="mb-10px">
7-
<XButton
8-
type="primary"
9-
preIcon="ep:download"
10-
:title="t('action.export') + ' HTML'"
11-
@click="handleExport('HTML')"
12-
/>
13-
<XButton
14-
type="primary"
15-
preIcon="ep:download"
16-
:title="t('action.export') + ' Word'"
17-
@click="handleExport('Word')"
18-
/>
19-
<XButton
20-
type="primary"
21-
preIcon="ep:download"
22-
:title="t('action.export') + ' Markdown'"
23-
@click="handleExport('Markdown')"
24-
/>
6+
<el-button type="primary" plain @click="handleExport('HTML')">
7+
<Icon icon="ep:download" /> 导出 HTML
8+
</el-button>
9+
<el-button type="primary" plain @click="handleExport('Word')">
10+
<Icon icon="ep:download" /> 导出 Word
11+
</el-button>
12+
<el-button type="primary" plain @click="handleExport('Markdown')">
13+
<Icon icon="ep:download" /> 导出 Markdown
14+
</el-button>
2515
</div>
26-
<IFrame v-if="!loding" v-loading="loding" :src="src" />
16+
<IFrame v-if="!loading" v-loading="loading" :src="src" />
2717
</ContentWrap>
2818
</template>
2919
<script setup lang="ts" name="DbDoc">
3020
import download from '@/utils/download'
31-
3221
import * as DbDocApi from '@/api/infra/dbDoc'
3322
34-
const { t } = useI18n() // 国际化
35-
const src = ref('')
36-
const loding = ref(true)
23+
const loading = ref(true) // 是否加载中
24+
const src = ref('') // HTML 的地址
25+
3726
/** 页面加载 */
3827
const init = async () => {
39-
const res = await DbDocApi.exportHtml()
40-
let blob = new Blob([res], { type: 'text/html' })
41-
let blobUrl = window.URL.createObjectURL(blob)
42-
src.value = blobUrl
43-
loding.value = false
28+
try {
29+
const data = await DbDocApi.exportHtml()
30+
const blob = new Blob([data], { type: 'text/html' })
31+
src.value = window.URL.createObjectURL(blob)
32+
} finally {
33+
loading.value = false
34+
}
4435
}
36+
4537
/** 处理导出 */
4638
const handleExport = async (type: string) => {
4739
if (type === 'HTML') {
@@ -57,6 +49,8 @@ const handleExport = async (type: string) => {
5749
download.markdown(res, '数据库文档.md')
5850
}
5951
}
52+
53+
/** 初始化 */
6054
onMounted(async () => {
6155
await init()
6256
})

src/views/infra/druid/index.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@
33
<doc-alert title="多数据源(读写分离)" url="https://doc.iocoder.cn/dynamic-datasource/" />
44

55
<ContentWrap>
6-
<IFrame :src="src" />
6+
<IFrame v-if="!loading" :src="url" />
77
</ContentWrap>
88
</template>
99
<script setup lang="ts" name="Druid">
10-
const BASE_URL = import.meta.env.VITE_BASE_URL
11-
const src = ref(BASE_URL + '/druid/index.html')
10+
import * as ConfigApi from '@/api/infra/config'
11+
12+
const loading = ref(true) // 是否加载中
13+
const url = ref(import.meta.env.VITE_BASE_URL + '/druid/index.html')
14+
15+
/** 初始化 */
16+
onMounted(async () => {
17+
try {
18+
const data = await ConfigApi.getConfigKey('url.druid')
19+
if (data && data.length > 0) {
20+
url.value = data
21+
}
22+
} finally {
23+
loading.value = false
24+
}
25+
})
1226
</script>

src/views/infra/server/index.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
<template>
22
<doc-alert title="服务监控" url="https://doc.iocoder.cn/server-monitor/" />
3+
34
<ContentWrap>
4-
<IFrame :src="src" />
5+
<IFrame v-if="!loading" v-loading="loading" :src="src" />
56
</ContentWrap>
67
</template>
78
<script setup lang="ts" name="AdminServer">
8-
const BASE_URL = import.meta.env.VITE_BASE_URL
9-
const src = ref(BASE_URL + '/admin/applications')
9+
import * as ConfigApi from '@/api/infra/config'
10+
11+
const loading = ref(true) // 是否加载中
12+
const src = ref(import.meta.env.VITE_BASE_URL + '/admin/applications')
13+
14+
/** 初始化 */
15+
onMounted(async () => {
16+
try {
17+
const data = await ConfigApi.getConfigKey('url.spring-boot-admin')
18+
if (data && data.length > 0) {
19+
src.value = data
20+
}
21+
} finally {
22+
loading.value = false
23+
}
24+
})
1025
</script>

src/views/infra/skywalking/index.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
<template>
22
<doc-alert title="服务监控" url="https://doc.iocoder.cn/server-monitor/" />
3+
34
<ContentWrap>
4-
<IFrame :src="src" />
5+
<IFrame v-if="!loading" v-loading="loading" :src="src" />
56
</ContentWrap>
67
</template>
78
<script setup lang="ts" name="Skywalking">
9+
import * as ConfigApi from '@/api/infra/config'
10+
11+
const loading = ref(true) // 是否加载中
812
const src = ref('http://skywalking.shop.iocoder.cn')
13+
14+
/** 初始化 */
15+
onMounted(async () => {
16+
try {
17+
const data = await ConfigApi.getConfigKey('url.skywalking')
18+
if (data && data.length > 0) {
19+
src.value = data
20+
}
21+
} finally {
22+
loading.value = false
23+
}
24+
})
925
</script>

src/views/infra/swagger/index.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@
66
</ContentWrap>
77
</template>
88
<script setup lang="ts" name="Swagger">
9-
const BASE_URL = import.meta.env.VITE_BASE_URL
10-
// const src = ref(BASE_URL + '/doc.html')
11-
const src = ref(BASE_URL + '/swagger-ui')
9+
import * as ConfigApi from '@/api/infra/config'
10+
11+
const loading = ref(true) // 是否加载中
12+
const src = ref(import.meta.env.VITE_BASE_URL + '/doc.html') // Knife4j UI
13+
// const src = ref(import.meta.env.VITE_BASE_URL + '/swagger-ui') // Swagger UI
14+
15+
/** 初始化 */
16+
onMounted(async () => {
17+
try {
18+
const data = await ConfigApi.getConfigKey('url.swagger')
19+
if (data && data.length > 0) {
20+
src.value = data
21+
}
22+
} finally {
23+
loading.value = false
24+
}
25+
})
1226
</script>

0 commit comments

Comments
 (0)