From 4aafda344684b8808bb212506321ece02fc21a83 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Mon, 15 Jul 2024 18:53:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=96=E8=A7=82=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/theme.ts | 34 ++++++++++++++++++++++++++++++++++ ui/src/stores/modules/user.ts | 11 ++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 ui/src/api/theme.ts diff --git a/ui/src/api/theme.ts b/ui/src/api/theme.ts new file mode 100644 index 000000000..a397f3a90 --- /dev/null +++ b/ui/src/api/theme.ts @@ -0,0 +1,34 @@ +import { Result } from '@/request/Result' +import { get, post, del, put } from '@/request/index' +import type { TeamMember } from '@/api/type/team' + +const prefix = '/display' + +/** + * 查看外观设置 + */ +const getThemeInfo: () => Promise> = () => { + return get(`${prefix}/info`) +} + +/** + * 更新外观设置 + * @param 参数 + * * formData { + * theme + * icon + * loginLogo + * loginImage + * title + * slogan + * } + */ +const postThemeInfo: (data: any) => Promise> = (data) => { + return post(`${prefix}/update`, data) +} + +export default { + getThemeInfo, + postThemeInfo + } + \ No newline at end of file diff --git a/ui/src/stores/modules/user.ts b/ui/src/stores/modules/user.ts index 1f9bd14de..1673052e8 100644 --- a/ui/src/stores/modules/user.ts +++ b/ui/src/stores/modules/user.ts @@ -1,6 +1,7 @@ import { defineStore } from 'pinia' import type { User } from '@/api/type/user' import UserApi from '@/api/user' +import ThemeApi from '@/api/theme' export interface userStateTypes { userType: number // 1 系统操作者 2 对话用户 @@ -10,6 +11,7 @@ export interface userStateTypes { accessToken?: string XPACK_LICENSE_IS_VALID: false isXPack: false + themeInfo: any } const useUserStore = defineStore({ @@ -20,7 +22,8 @@ const useUserStore = defineStore({ token: '', version: '', XPACK_LICENSE_IS_VALID: false, - isXPack: false + isXPack: false, + themeInfo: null }), actions: { isExpire() { @@ -78,6 +81,12 @@ const useUserStore = defineStore({ }) }, + async theme() { + return ThemeApi.getThemeInfo().then((ok) => { + this.themeInfo = ok.data + }) + }, + async profile() { return UserApi.profile().then((ok) => { this.userInfo = ok.data