From 671f3831e5a1e5b47a17b68f709e9c32c8149597 Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Wed, 23 Oct 2024 16:58:37 +0800 Subject: [PATCH] =?UTF-8?q?page:=20=F0=9F=93=84=20=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=90=8E=E7=AB=AFweb=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/platform-config.json | 28 --- src/api/v1/system.ts | 5 + src/config/index.ts | 6 +- src/types/global.d.ts | 2 +- src/views/configuration/webConifg/index.vue | 204 ++++++++++++++++++ .../configuration/webConifg/utils/columns.ts | 0 .../configuration/webConifg/utils/hooks.ts | 38 ++++ src/views/monitor/server/index.vue | 33 +-- src/views/monitor/server/info.vue | 11 - src/views/monitor/server/utils/hooks.ts | 27 +++ 10 files changed, 282 insertions(+), 72 deletions(-) delete mode 100644 public/platform-config.json create mode 100644 src/views/configuration/webConifg/index.vue create mode 100644 src/views/configuration/webConifg/utils/columns.ts create mode 100644 src/views/configuration/webConifg/utils/hooks.ts create mode 100644 src/views/monitor/server/utils/hooks.ts diff --git a/public/platform-config.json b/public/platform-config.json deleted file mode 100644 index d31a494..0000000 --- a/public/platform-config.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "Version": "5.8.0", - "Title": "BunnyAdmin", - "Copyright": "Copyright © 2020-present", - "FixedHeader": true, - "HiddenSideBar": false, - "MultiTagsCache": false, - "KeepAlive": true, - "Locale": "zh", - "Layout": "vertical", - "Theme": "light", - "DarkMode": false, - "OverallStyle": "light", - "Grey": false, - "Weak": false, - "HideTabs": false, - "HideFooter": false, - "Stretch": false, - "SidebarStatus": true, - "EpThemeColor": "#409EFF", - "ShowLogo": true, - "ShowModel": "smart", - "MenuArrowIconNoTransition": false, - "CachingAsyncRoutes": false, - "TooltipEffect": "light", - "ResponsiveStorageNameSpace": "responsive-", - "MenuSearchHistory": 6 -} diff --git a/src/api/v1/system.ts b/src/api/v1/system.ts index 58465a3..f1696d6 100644 --- a/src/api/v1/system.ts +++ b/src/api/v1/system.ts @@ -10,3 +10,8 @@ export const getRouterAsync = () => { export const fetchUploadFile = (data: any) => { return http.request>('post', '/files/upload', { data }, { headers: { 'Content-Type': 'multipart/form-data' } }); }; + +/** 获取前端配置文件 */ +export const fetchPlatformConfig = () => { + return http.request('get', '/files/noManage/resourceFiles/platform-config.json'); +}; diff --git a/src/config/index.ts b/src/config/index.ts index 47d201c..3132b8c 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import type { App } from 'vue'; let config: object = {}; -const { VITE_PUBLIC_PATH } = import.meta.env; +const { VITE_PUBLIC_PATH, VITE_BASE_API } = import.meta.env; const setConfig = (cfg?: unknown) => { config = Object.assign(config, cfg); @@ -31,7 +31,7 @@ export const getPlatformConfig = async (app: App): Promise => { app.config.globalProperties.$config = getConfig(); return axios({ method: 'get', - url: `${VITE_PUBLIC_PATH}platform-config.json`, + url: `${VITE_BASE_API}/files/noManage/resourceFiles/platform-config.json`, }) .then(({ data: config }) => { let $config = app.config.globalProperties.$config; @@ -45,7 +45,7 @@ export const getPlatformConfig = async (app: App): Promise => { return $config; }) .catch(() => { - throw '请在public文件夹下添加platform-config.json配置文件'; + throw '请在后端文件夹下添加platform-config.json配置文件'; }); }; diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 41b2773..729b783 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -72,7 +72,7 @@ declare global { interface TableColumnList extends Array {} /** - * 对应 `public/platform-config.json` 文件的类型声明 + * 对应 `server/platform-config` 文件的类型声明 * @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#platform-config-json} */ interface PlatformConfigs { diff --git a/src/views/configuration/webConifg/index.vue b/src/views/configuration/webConifg/index.vue new file mode 100644 index 0000000..8a80235 --- /dev/null +++ b/src/views/configuration/webConifg/index.vue @@ -0,0 +1,204 @@ + + + + + diff --git a/src/views/configuration/webConifg/utils/columns.ts b/src/views/configuration/webConifg/utils/columns.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/views/configuration/webConifg/utils/hooks.ts b/src/views/configuration/webConifg/utils/hooks.ts new file mode 100644 index 0000000..2c4be56 --- /dev/null +++ b/src/views/configuration/webConifg/utils/hooks.ts @@ -0,0 +1,38 @@ +import { fetchPlatformConfig } from '@/api/v1/system'; +import { ref } from 'vue'; + +export const form = ref({ + version: '', // 应用程序的版本 + title: '', // 应用程序的标题 + copyright: '', // 版权信息 + fixedHeader: false, // 头部是否固定 + hiddenSideBar: false, // 侧边栏是否隐藏 + multiTagsCache: false, // 是否缓存多个标签 + keepAlive: false, // 是否持久化 + locale: '', // 语言类型 + layout: '', // 应用程序的布局 + theme: '', // 应用程序的主题 + darkMode: false, // 是否启用深色模式 + overallStyle: '', // 应用程序的整体样式 + grey: false, // 是否启用灰色模式 + weak: false, // 色弱模式 + hideTabs: false, // 是否隐藏选项卡 + hideFooter: false, // 是否隐藏页脚 + stretch: false, // 是否拉伸显示 + sidebarStatus: false, // 侧边栏的状态 + epThemeColor: '', // 主题颜色 + showLogo: false, // 是否显示logo + showModel: '', // 要显示的模型 + menuArrowIconNoTransition: false, // 菜单箭头图标是否没有过渡效果 + cachingAsyncRoutes: false, // 是否缓存异步路由 + tooltipEffect: '', // 工具提示的效果 + responsiveStorageNameSpace: '', // 响应式存储的命名空间 + menuSearchHistory: 0, // 菜单搜索历史 +}); + +/** 获取前端配置文件 */ +export const onSearch = async () => { + const result = await fetchPlatformConfig(); + console.log(result); + form.value = result; +}; diff --git a/src/views/monitor/server/index.vue b/src/views/monitor/server/index.vue index a3492a6..9538739 100644 --- a/src/views/monitor/server/index.vue +++ b/src/views/monitor/server/index.vue @@ -1,35 +1,10 @@