feat: application ui overview (#3237)
This commit is contained in:
parent
25cc01d51f
commit
6f61c18ff6
@ -138,7 +138,7 @@ const getStatistics: (
|
|||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||||
return get(`${prefix}/${application_id}/application-stats`, data, loading)
|
return get(`${prefix}/${application_id}/application_stats`, data, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@ -1,23 +1,23 @@
|
|||||||
import {defineStore} from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import {type Ref} from 'vue'
|
import { type Ref } from 'vue'
|
||||||
import type {User} from '@/api/type/user'
|
import type { User } from '@/api/type/user'
|
||||||
import UserApi from '@/api/user/user'
|
import UserApi from '@/api/user/user'
|
||||||
import LoginApi from '@/api/user/login'
|
import LoginApi from '@/api/user/login'
|
||||||
import {cloneDeep} from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import ThemeApi from '@/api/systemSettings/theme'
|
import ThemeApi from '@/api/systemSettings/theme'
|
||||||
// import { defaultPlatformSetting } from '@/utils/theme'
|
// import { defaultPlatformSetting } from '@/utils/theme'
|
||||||
import {useLocalStorage} from '@vueuse/core'
|
import { useLocalStorage } from '@vueuse/core'
|
||||||
import {localeConfigKey, getBrowserLang} from '@/locales/index'
|
import { localeConfigKey, getBrowserLang } from '@/locales/index'
|
||||||
import useThemeStore from './theme'
|
import useThemeStore from './theme'
|
||||||
import {useElementPlusTheme} from "use-element-plus-theme";
|
import { useElementPlusTheme } from 'use-element-plus-theme'
|
||||||
import {defaultPlatformSetting} from "@/utils/theme.ts";
|
import { defaultPlatformSetting } from '@/utils/theme.ts'
|
||||||
|
|
||||||
export interface userStateTypes {
|
export interface userStateTypes {
|
||||||
userType: number // 1 系统操作者 2 对话用户
|
userType: number // 1 系统操作者 2 对话用户
|
||||||
userInfo: User | null
|
userInfo: User | null
|
||||||
version?: string
|
version?: string
|
||||||
XPACK_LICENSE_IS_VALID: true
|
license_is_valid: boolean
|
||||||
isXPack: true
|
edition: 'CE' | 'PE' | 'EE'
|
||||||
themeInfo: any
|
themeInfo: any
|
||||||
token: any
|
token: any
|
||||||
}
|
}
|
||||||
@ -27,10 +27,10 @@ const useLoginStore = defineStore('user', {
|
|||||||
userType: 1, // 1 系统操作者 2 对话用户
|
userType: 1, // 1 系统操作者 2 对话用户
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
version: '',
|
version: '',
|
||||||
XPACK_LICENSE_IS_VALID: false,
|
license_is_valid: false,
|
||||||
isXPack: false,
|
edition: 'CE',
|
||||||
themeInfo: null,
|
themeInfo: null,
|
||||||
token: ''
|
token: '',
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
getLanguage() {
|
getLanguage() {
|
||||||
@ -42,7 +42,7 @@ const useLoginStore = defineStore('user', {
|
|||||||
return !this.themeInfo?.theme || this.themeInfo?.theme === '#3370FF'
|
return !this.themeInfo?.theme || this.themeInfo?.theme === '#3370FF'
|
||||||
},
|
},
|
||||||
setTheme(data: any) {
|
setTheme(data: any) {
|
||||||
const {changeTheme} = useElementPlusTheme(this.themeInfo?.theme)
|
const { changeTheme } = useElementPlusTheme(this.themeInfo?.theme)
|
||||||
changeTheme(data?.['theme'])
|
changeTheme(data?.['theme'])
|
||||||
this.themeInfo = cloneDeep(data)
|
this.themeInfo = cloneDeep(data)
|
||||||
},
|
},
|
||||||
@ -61,14 +61,15 @@ const useLoginStore = defineStore('user', {
|
|||||||
UserApi.getProfile()
|
UserApi.getProfile()
|
||||||
.then(async (ok) => {
|
.then(async (ok) => {
|
||||||
// this.version = ok.data?.version || '-'
|
// this.version = ok.data?.version || '-'
|
||||||
this.isXPack = true
|
console.log(ok)
|
||||||
this.XPACK_LICENSE_IS_VALID = true
|
this.license_is_valid = ok.data.license_is_valid
|
||||||
|
this.edition = ok.data.edition
|
||||||
|
|
||||||
if (this.isEnterprise()) {
|
if (this.isEE() || this.isPE()) {
|
||||||
// await this.theme()
|
// await this.theme()
|
||||||
} else {
|
} else {
|
||||||
this.themeInfo = {
|
this.themeInfo = {
|
||||||
...defaultPlatformSetting
|
...defaultPlatformSetting,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve(ok)
|
resolve(ok)
|
||||||
@ -106,22 +107,28 @@ const useLoginStore = defineStore('user', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
showXpack() {
|
showXpack() {
|
||||||
return this.isXPack
|
return this.edition != 'CE'
|
||||||
},
|
|
||||||
|
|
||||||
isExpire() {
|
|
||||||
return this.isXPack && !this.XPACK_LICENSE_IS_VALID
|
|
||||||
},
|
},
|
||||||
isEnterprise() {
|
isEnterprise() {
|
||||||
return this.isXPack && this.XPACK_LICENSE_IS_VALID
|
return this.edition != 'CE' && !this.license_is_valid
|
||||||
|
},
|
||||||
|
isExpire() {
|
||||||
|
return this.edition != 'CE' && !this.license_is_valid
|
||||||
|
},
|
||||||
|
isCE() {
|
||||||
|
return this.edition == 'CE' && this.license_is_valid
|
||||||
|
},
|
||||||
|
isPE() {
|
||||||
|
return this.edition == 'PE' && this.license_is_valid
|
||||||
|
},
|
||||||
|
isEE() {
|
||||||
|
return this.edition == 'EE' && this.license_is_valid
|
||||||
},
|
},
|
||||||
|
|
||||||
// changeUserType(num: number, token?: string) {
|
// changeUserType(num: number, token?: string) {
|
||||||
// this.userType = num
|
// this.userType = num
|
||||||
// this.userAccessToken = token
|
// this.userAccessToken = token
|
||||||
// },
|
// },
|
||||||
|
|
||||||
|
|
||||||
async dingCallback(code: string) {
|
async dingCallback(code: string) {
|
||||||
return LoginApi.getDingCallback(code).then((ok) => {
|
return LoginApi.getDingCallback(code).then((ok) => {
|
||||||
this.token = ok.data
|
this.token = ok.data
|
||||||
@ -184,7 +191,7 @@ const useLoginStore = defineStore('user', {
|
|||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -424,9 +424,9 @@ function mapToUrlParams(map: any[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// getDetail()
|
getDetail()
|
||||||
// getAccessToken()
|
getAccessToken()
|
||||||
// changeDayHandle(history_day.value)
|
changeDayHandle(history_day.value)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user