feat: 外观设置
This commit is contained in:
parent
57aade8d62
commit
4aafda3446
34
ui/src/api/theme.ts
Normal file
34
ui/src/api/theme.ts
Normal 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
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import type { User } from '@/api/type/user'
|
import type { User } from '@/api/type/user'
|
||||||
import UserApi from '@/api/user'
|
import UserApi from '@/api/user'
|
||||||
|
import ThemeApi from '@/api/theme'
|
||||||
|
|
||||||
export interface userStateTypes {
|
export interface userStateTypes {
|
||||||
userType: number // 1 系统操作者 2 对话用户
|
userType: number // 1 系统操作者 2 对话用户
|
||||||
@ -10,6 +11,7 @@ export interface userStateTypes {
|
|||||||
accessToken?: string
|
accessToken?: string
|
||||||
XPACK_LICENSE_IS_VALID: false
|
XPACK_LICENSE_IS_VALID: false
|
||||||
isXPack: false
|
isXPack: false
|
||||||
|
themeInfo: any
|
||||||
}
|
}
|
||||||
|
|
||||||
const useUserStore = defineStore({
|
const useUserStore = defineStore({
|
||||||
@ -20,7 +22,8 @@ const useUserStore = defineStore({
|
|||||||
token: '',
|
token: '',
|
||||||
version: '',
|
version: '',
|
||||||
XPACK_LICENSE_IS_VALID: false,
|
XPACK_LICENSE_IS_VALID: false,
|
||||||
isXPack: false
|
isXPack: false,
|
||||||
|
themeInfo: null
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
isExpire() {
|
isExpire() {
|
||||||
@ -78,6 +81,12 @@ const useUserStore = defineStore({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async theme() {
|
||||||
|
return ThemeApi.getThemeInfo().then((ok) => {
|
||||||
|
this.themeInfo = ok.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
async profile() {
|
async profile() {
|
||||||
return UserApi.profile().then((ok) => {
|
return UserApi.profile().then((ok) => {
|
||||||
this.userInfo = ok.data
|
this.userInfo = ok.data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user