|
@@ -1,6 +1,6 @@
|
|
|
import { defineStore } from 'pinia'
|
|
|
import pinia from '~src/store/init'
|
|
|
-import appConfig from '~src/config/index'
|
|
|
+import website from '~src/config/index'
|
|
|
import logoIcon from '~src/assets/logo/icon.png'
|
|
|
import { clearStoreAll } from 'hc-vue3-ui'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
@@ -9,12 +9,12 @@ import { removeRefreshToken, removeToken, setRefreshToken, setToken } from '~src
|
|
|
export const useAppStore = defineStore('main', {
|
|
|
state: () => ({
|
|
|
//系统信息
|
|
|
- title: getStoreValue('title') || appConfig.title,
|
|
|
+ title: getStoreValue('title') || website.title,
|
|
|
logoIcon: getStoreValue('logoIcon') || logoIcon,
|
|
|
- logoName: getStoreValue('logoName') || appConfig.name,
|
|
|
+ logoName: getStoreValue('logoName') || website.name,
|
|
|
//主题信息
|
|
|
- theme: getStoreValue('theme') || '',
|
|
|
- color: getStoreValue('color') || '',
|
|
|
+ theme: getStoreValue('theme') || website.theme,
|
|
|
+ color: getStoreValue('color') || website.color,
|
|
|
//用户信息
|
|
|
token: getStoreValue('token') || '',
|
|
|
refreshToken: getStoreValue('refreshToken') || '',
|
|
@@ -31,6 +31,9 @@ export const useAppStore = defineStore('main', {
|
|
|
getTitle: state => state.title,
|
|
|
getLogoIcon: state => state.logoIcon,
|
|
|
getLogoName: state => state.logoName,
|
|
|
+ //主题信息
|
|
|
+ getTheme: state => state.theme,
|
|
|
+ getColor: state => state.color,
|
|
|
//用户信息
|
|
|
getToken: state => state.token,
|
|
|
getRefreshToken: state => state.refreshToken,
|
|
@@ -56,6 +59,15 @@ export const useAppStore = defineStore('main', {
|
|
|
this.logoName = value
|
|
|
setStoreValue('logoName', value)
|
|
|
},
|
|
|
+ //主题信息
|
|
|
+ setTheme(value) {
|
|
|
+ this.theme = value
|
|
|
+ setStoreValue('theme', value)
|
|
|
+ },
|
|
|
+ setColor(value) {
|
|
|
+ this.color = value
|
|
|
+ setStoreValue('color', value)
|
|
|
+ },
|
|
|
//用户信息
|
|
|
setTokenVal(value) {
|
|
|
this.token = value
|
|
@@ -97,6 +109,8 @@ export const useAppStore = defineStore('main', {
|
|
|
this.title = null
|
|
|
this.logoIcon = null
|
|
|
this.logoName = null
|
|
|
+ this.theme = website.theme
|
|
|
+ this.color = website.color
|
|
|
this.token = null
|
|
|
this.refreshToken = null
|
|
|
this.tenantId = null
|