From 255e6f4bd2c8728d32d64d148ef4ab9535bcb4b3 Mon Sep 17 00:00:00 2001 From: Bull-BCLS Date: Sun, 14 Apr 2024 20:12:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 +- src/apis/common/common.ts | 6 + src/apis/system/config.ts | 19 + src/apis/system/index.ts | 1 + src/apis/system/type.ts | 25 ++ src/components/GiFooter/index.vue | 5 +- src/layout/components/Logo.vue | 8 +- src/router/permission.ts | 4 +- src/stores/modules/app.ts | 58 ++- src/views/login/index.vue | 35 +- .../system/config/components/BasicSetting.vue | 364 ++++++++++++++++++ src/views/system/config/index.vue | 28 ++ 12 files changed, 547 insertions(+), 10 deletions(-) create mode 100644 src/apis/system/config.ts create mode 100644 src/views/system/config/components/BasicSetting.vue create mode 100644 src/views/system/config/index.vue diff --git a/index.html b/index.html index 63025d8..09ce353 100644 --- a/index.html +++ b/index.html @@ -2,10 +2,10 @@ - + - ContiNew Admin + diff --git a/src/apis/common/common.ts b/src/apis/common/common.ts index 4760e85..fc5110d 100644 --- a/src/apis/common/common.ts +++ b/src/apis/common/common.ts @@ -1,6 +1,7 @@ import http from '@/utils/http' import type { LabelValueState } from '@/types/global' import type { TreeNodeData } from '@arco-design/web-vue' +import type {OptionQuery} from '@/apis' const BASE_URL = '/common' @@ -24,6 +25,11 @@ export function listCommonDict(code: string) { return http.get(`${BASE_URL}/dict/${code}`) } +/** @desc 获取系统参数 */ +export function listOption(params: OptionQuery) { + return http.get(`${BASE_URL}/option`, params) +} + /** @desc 上传文件 */ export function uploadFile(data: FormData) { return http.post(`${BASE_URL}/file`, data) diff --git a/src/apis/system/config.ts b/src/apis/system/config.ts new file mode 100644 index 0000000..1ba3e00 --- /dev/null +++ b/src/apis/system/config.ts @@ -0,0 +1,19 @@ +import http from '@/utils/http' +import type * as System from './type' + +const BASE_URL = '/system/option' + +/** @desc 获取系统配置参数 */ +export function list(params: System.OptionQuery) { + return http.get(`${BASE_URL}`, params) +} + +/** @desc 保存系统参数 */ +export function save(req: System.OptionReq[]) { + return http.patch(`${BASE_URL}`, req) +} + +/** @desc 重置系统参数 */ +export function resetValue(params: System.OptionQuery) { + return http.patch(`${BASE_URL}/value`, params) +} diff --git a/src/apis/system/index.ts b/src/apis/system/index.ts index 73b2ac9..753dfaa 100644 --- a/src/apis/system/index.ts +++ b/src/apis/system/index.ts @@ -6,3 +6,4 @@ export * from './log' export * from './dict' export * from './file' export * from './storage' +export * from './config' diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index a12c54f..30f0d96 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -233,4 +233,29 @@ export type StorageResp = { export interface StorageQuery extends PageQuery { description?: string status?: number +} + +/** 系统参数*/ +export interface OptionQuery { + code?: Array +} + +export interface OptionReq { + code: string + value: string +} + +export interface OptionResp { + name?: string + code: string + value: string + description?: string +} + +/** 系统配置*/ +export interface BasicConfigRecordResp { + site_title?: string + site_copyright?: string + site_logo?: string + site_favicon?: string } \ No newline at end of file diff --git a/src/components/GiFooter/index.vue b/src/components/GiFooter/index.vue index c92f960..5b574c4 100644 --- a/src/components/GiFooter/index.vue +++ b/src/components/GiFooter/index.vue @@ -1,9 +1,12 @@ + + diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue new file mode 100644 index 0000000..077c92b --- /dev/null +++ b/src/views/system/config/index.vue @@ -0,0 +1,28 @@ + + + + + + + -- Gitee From 4e3e46d2d850931c33b26a1688754c46af82713c Mon Sep 17 00:00:00 2001 From: Bull-BCLS Date: Sun, 14 Apr 2024 23:14:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E7=BD=91=E7=AB=99=E9=85=8D=E7=BD=AE=E4=B9=8B=E5=90=8E=E7=BD=91?= =?UTF-8?q?=E7=AB=99=E6=A0=87=E9=A2=98=E3=80=81LOGO=20=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=9B=B4=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/Logo.vue | 2 +- src/stores/modules/app.ts | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/layout/components/Logo.vue b/src/layout/components/Logo.vue index ab741a6..787e9f2 100644 --- a/src/layout/components/Logo.vue +++ b/src/layout/components/Logo.vue @@ -1,7 +1,7 @@ diff --git a/src/stores/modules/app.ts b/src/stores/modules/app.ts index 1786f07..57d05d3 100644 --- a/src/stores/modules/app.ts +++ b/src/stores/modules/app.ts @@ -9,19 +9,19 @@ const storeSetup = () => { // App配置 const settingConfig = reactive({ ...defaultSettings }) as App.SettingConfig // 系统配置 - let webConfig = {} as BasicConfigRecordResp + const webConfig = reactive({}) as BasicConfigRecordResp const getLogo = () => { return webConfig.site_logo; } const getFavicon = () => { - return webConfig?.site_favicon + return webConfig.site_favicon } const getTitle = () => { - return webConfig?.site_title + return webConfig.site_title } const getCopyright = () => { - return webConfig?.site_copyright + return webConfig.site_copyright } // 初始化系统配置 @@ -33,12 +33,10 @@ const storeSetup = () => { res.data.forEach((item) => { resMap.set(item.label, item.value) }) - webConfig = { - site_title: resMap.get('site_title'), - site_copyright: resMap.get('site_copyright'), - site_logo: resMap.get('site_logo'), - site_favicon: resMap.get('site_logo') - } + webConfig.site_title=resMap.get('site_title'); + webConfig.site_copyright=resMap.get('site_copyright'); + webConfig.site_logo=resMap.get('site_logo'); + webConfig.site_favicon=resMap.get('site_favicon'); document.title = resMap.get('site_title') document .querySelector('link[rel="shortcut icon"]') @@ -48,7 +46,7 @@ const storeSetup = () => { // 保存系统配置 const saveWebConfig = (config: BasicConfigRecordResp) => { - webConfig = config + Object.assign(webConfig,config) document.title = config.site_title || '' document .querySelector('link[rel="shortcut icon"]') @@ -104,6 +102,7 @@ const storeSetup = () => { return { ...toRefs(settingConfig), + ...toRefs(webConfig), transitionName, themeCSSVar, toggleTheme, @@ -119,4 +118,4 @@ const storeSetup = () => { } } -export const useAppStore = defineStore('app', storeSetup, {}) +export const useAppStore = defineStore('app', storeSetup, {persist: true}) -- Gitee