diff --git a/src/api/info.js b/src/api/info.js new file mode 100644 index 0000000..5d73d5d --- /dev/null +++ b/src/api/info.js @@ -0,0 +1,16 @@ +import axiosInstance from './axiosConfig' + +/** + * 获取后端版本信息 + * GET /info + * 基于 axiosInstance 的 baseURL:`http://zybdatasupport.online:8000` + * 返回后端提供的原始 JSON 数据 + */ +export const getBackendInfo = async () => { + try { + const { data } = await axiosInstance.get('/info') + return data + } catch (error) { + throw error + } +} \ No newline at end of file diff --git a/src/assets/version.md b/src/assets/version.md index 054a9b0..774afee 100644 --- a/src/assets/version.md +++ b/src/assets/version.md @@ -1,5 +1,11 @@ +### 后端 +## V.2025.07.30.1 + +1、修改服务器地址 + +### 前端 ## v.1.0.0 1、添加版本信息页面 -2、更换api +2、修改服务器地址 diff --git a/src/views/index/VersionInfo.vue b/src/views/index/VersionInfo.vue index 5d0cc99..2e0d517 100644 --- a/src/views/index/VersionInfo.vue +++ b/src/views/index/VersionInfo.vue @@ -3,9 +3,19 @@ +

更新日志

@@ -14,19 +24,70 @@ import pkg from '../../../package.json' import { marked } from 'marked' import versionMd from '@/assets/version.md?raw' +import { getBackendInfo } from '@/api/info' +import { ref, onMounted } from 'vue' + +const backendVersion = ref('') +const contactEmails = ref({}) + +onMounted(async () => { + try { + const info = await getBackendInfo() + backendVersion.value = info.version || '未知' + if (info.contact && info.contact.email) { + try { + const emailString = info.contact.email.replace(/'/g, '"') + contactEmails.value = JSON.parse(emailString) + } catch (e) { + contactEmails.value = {} + } + } + } catch (_) { + backendVersion.value = '获取失败' + } +}) const appVersion = pkg.version || '未知' const mdHtml = marked.parse(versionMd || '') -