mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: 外观设置
This commit is contained in:
parent
57aade8d62
commit
4aafda3446
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue