feat: 外观设置

This commit is contained in:
wangdan-fit2cloud 2024-07-15 18:53:10 +08:00
parent 6292b0189a
commit 80a54401b0
2 changed files with 44 additions and 1 deletions

34
ui/src/api/theme.ts Normal file
View File

@ -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<Result<any>> = () => {
return get(`${prefix}/info`)
}
/**
*
* @param
* * formData {
* theme
* icon
* loginLogo
* loginImage
* title
* slogan
* }
*/
const postThemeInfo: (data: any) => Promise<Result<boolean>> = (data) => {
return post(`${prefix}/update`, data)
}
export default {
getThemeInfo,
postThemeInfo
}

View File

@ -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