Commit fcaa134f by liimin

修改配置获取逻辑,刷新不再掉接口获取

1 parent 97927b56
......@@ -10,6 +10,7 @@
export default {
SCRM_BASE_SESSION: 'SCRM_BASE_SESSION',
SCRM_BASE_MENULIST: 'SCRM_BASE_MENULIST',
SCRM_BASE_CONFIG: 'SCRM_BASE_CONFIG',
SCRM_BASE_FUNCTIONAL_FLAG: 'function',
SCRM_BASE_USERTYPE: {
MERCHANT: '1',
......
......@@ -4,17 +4,22 @@
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2023-04-10 11:47:48
* @LastEditTime: 2023-04-10 17:37:40
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
let cfg = require('./conf.js')
import { Http } from 'glsx-common'
import { utils } from 'glsx-common'
import { constants } from '@/common'
const sw = !!+process.env.VUE_APP_CONFIG_SWITCH_LOCAL
export const fetchConfig = (isEnv = sw) => {
if (isEnv) {
return Promise.resolve(cfg)
}
const _config = utils.storage.getSession(constants.SCRM_BASE_CONFIG)
if (_config && location.pathname !== '/') {
return Promise.resolve(_config)
}
return new Http({ headers: { refererurl: location.pathname }, request: { timeout: 30000 } }).get('https://oss-config.dev.glsx.com.cn/mock/6136bea6ceeb5a5c2bec6950/base/config')
}
export const config = {
......
......@@ -217,6 +217,7 @@ export default {
sessionData.track = track
this.setSession(sessionData)
this.setTracker(sessionData)
this.storeConfig()
const path = helper.locationPath()
const redirect = path?.get('redirect')
const to = redirect ? `/${decodeURIComponent(redirect)}` : defaultPath
......@@ -294,6 +295,9 @@ export default {
this.error(error.message, ERROR_TYPE.MESSAGE)
}
},
storeConfig() {
utils.storage.setSession(constants.SCRM_BASE_CONFIG, this.$config)
},
...mapActions('app', ['login']),
...mapActions('auth', ['permission', 'setSession']),
...mapActions('track', ['setTracker'])
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!