|
|
@@ -6,19 +6,19 @@ import Api from '@/api/api'
|
|
|
export const useAuthStore = defineStore('auth', {
|
|
|
state: () => {
|
|
|
return {
|
|
|
- isRefresh:true,
|
|
|
- accountList:[],
|
|
|
- nowAccount:{},
|
|
|
+ isRefresh: true,
|
|
|
+ accountList: [],
|
|
|
+ nowAccount: {},
|
|
|
system: [],
|
|
|
- actSystem:'',
|
|
|
- mods:[],
|
|
|
- app:{},
|
|
|
- actMod:{},
|
|
|
- current:[],
|
|
|
- tableConfigs:{},
|
|
|
- hiddenSensitiveFields:false,
|
|
|
- fieldsParam:{},
|
|
|
- qrCordBaseUrl:'',//二维码基本地址
|
|
|
+ actSystem: '',
|
|
|
+ mods: [],
|
|
|
+ app: {},
|
|
|
+ actMod: {},
|
|
|
+ current: [],
|
|
|
+ tableConfigs: {},
|
|
|
+ hiddenSensitiveFields: false,
|
|
|
+ fieldsParam: {},
|
|
|
+ qrCordBaseUrl: '',//二维码基本地址
|
|
|
}
|
|
|
},
|
|
|
// 开启数据缓存
|
|
|
@@ -27,14 +27,14 @@ export const useAuthStore = defineStore('auth', {
|
|
|
strategies: [
|
|
|
{
|
|
|
storage: localStorage,
|
|
|
- paths: ['system', 'mods','app','accountList','nowAccount','actSystem','current','tableConfigs','hiddenSensitiveFields','qrCordBaseUrl','fieldsParam']
|
|
|
+ paths: ['system', 'mods', 'app', 'accountList', 'nowAccount', 'actSystem', 'current', 'tableConfigs', 'hiddenSensitiveFields', 'qrCordBaseUrl', 'fieldsParam']
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- getters:{},
|
|
|
- actions:{
|
|
|
- systemAuthData () {
|
|
|
- return new Promise(async (reslove,reject)=>{
|
|
|
+ getters: {},
|
|
|
+ actions: {
|
|
|
+ systemAuthData() {
|
|
|
+ return new Promise(async (reslove, reject) => {
|
|
|
let data = {
|
|
|
"classname": "sysmanage.develop.userauthforweb.userauth",
|
|
|
"method": "query_userauth",
|
|
|
@@ -50,7 +50,7 @@ export const useAuthStore = defineStore('auth', {
|
|
|
reslove(this.mods)
|
|
|
})
|
|
|
},
|
|
|
- async hideKeyWords (data) {
|
|
|
+ async hideKeyWords(data) {
|
|
|
let account = data
|
|
|
const res = await Api.requested({
|
|
|
"classname": "sysmanage.develop.optiontype.optiontype",
|
|
|
@@ -72,7 +72,7 @@ export const useAuthStore = defineStore('auth', {
|
|
|
}
|
|
|
},
|
|
|
// 获取模块数据
|
|
|
- modulesData (system) {
|
|
|
+ modulesData(system) {
|
|
|
this.mods = system.modules
|
|
|
},
|
|
|
// 遍历应用
|
|
|
@@ -97,21 +97,21 @@ export const useAuthStore = defineStore('auth', {
|
|
|
return foundApp;
|
|
|
},
|
|
|
// 获取应用数据
|
|
|
- appData (appName) {
|
|
|
+ appData(appName) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- this.app = this.findAppByName(this.system,appName)
|
|
|
+ this.app = this.findAppByName(this.system, appName)
|
|
|
resolve()
|
|
|
})
|
|
|
},
|
|
|
// 查询应用是否存在
|
|
|
- hasAppData (appName) {
|
|
|
- if (this.findAppByName(this.system,appName)) {
|
|
|
+ hasAppData(appName) {
|
|
|
+ if (this.findAppByName(this.system, appName)) {
|
|
|
return true
|
|
|
} else {
|
|
|
return false
|
|
|
}
|
|
|
},
|
|
|
- async getConfig () {
|
|
|
+ async getConfig() {
|
|
|
const res = await Api.requested({
|
|
|
"classname": "sysmanage.develop.users.users",
|
|
|
"method": "queryClientConfig",
|
|
|
@@ -127,7 +127,7 @@ export const useAuthStore = defineStore('auth', {
|
|
|
/**
|
|
|
* 设置默认账号
|
|
|
*/
|
|
|
- async defaultAccount (account,fn) {
|
|
|
+ async defaultAccount(account, fn) {
|
|
|
switch (account.siteid) {
|
|
|
case 'cucu':
|
|
|
this.qrCordBaseUrl = 'https://lsa.cnyunl.com/'
|
|
|
@@ -142,19 +142,19 @@ export const useAuthStore = defineStore('auth', {
|
|
|
break;
|
|
|
}
|
|
|
account ? this.nowAccount = account : this.nowAccount
|
|
|
-
|
|
|
- sessionStorage.setItem('token',this.nowAccount.token)
|
|
|
+ sessionStorage.setItem('token', this.nowAccount.token)
|
|
|
+ sessionStorage.setItem('accountno', this.nowAccount.accountno)
|
|
|
|
|
|
this.getConfig()
|
|
|
this.hideKeyWords(account)
|
|
|
const res = await this.systemAuthData()
|
|
|
fn(res)
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
* 切换站点以后刷新数据
|
|
|
*/
|
|
|
- reloadPage (fn) {
|
|
|
+ reloadPage(fn) {
|
|
|
this.isRefresh = false
|
|
|
setTimeout(() => {
|
|
|
this.isRefresh = true
|
|
|
@@ -164,14 +164,14 @@ export const useAuthStore = defineStore('auth', {
|
|
|
* 手动缓存列表查询参数,防止丢失
|
|
|
*/
|
|
|
|
|
|
- setQueryParams (queryParams) {
|
|
|
+ setQueryParams(queryParams) {
|
|
|
this.fieldsParam[this.app.name] = queryParams
|
|
|
},
|
|
|
- getQueryParams () {
|
|
|
+ getQueryParams() {
|
|
|
console.log(this.fieldsParam)
|
|
|
return this.fieldsParam[this.app.name] || null
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
})
|