Commit f9230003 by liimin

解决获取不到module.导致调用reset找不到方法问题

1 parent de5c2177
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: limin * @Author: limin
* @Date: 2021-06-07 14:12:32 * @Date: 2021-06-07 14:12:32
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2023-05-31 16:06:51 * @LastEditTime: 2023-06-21 10:42:25
*/ */
// 根据环境引入不同配置 process.env.VUE_APP_ENV // 根据环境引入不同配置 process.env.VUE_APP_ENV
let cfg = require('./conf.js') let cfg = require('./conf.js')
...@@ -25,7 +25,7 @@ export const fetchConfig = (isEnv = sw) => { ...@@ -25,7 +25,7 @@ export const fetchConfig = (isEnv = sw) => {
if ((_config && !_constRoutes.includes(_pathname)) || _pathname === _login_path || (_pathname === '/' && _login_path === '/login')) { if ((_config && !_constRoutes.includes(_pathname)) || _pathname === _login_path || (_pathname === '/' && _login_path === '/login')) {
return Promise.resolve(_config) return Promise.resolve(_config)
} }
return new Http({ headers: { refererurl: _pathname }, request: { timeout: 30000 } }).get('https://oss-config.test.glsx.com.cn/mock/6136bea6ceeb5a5c2bec6950/base/config') return new Http({ headers: { refererurl: _pathname }, request: { timeout: 30000 } }).get('https://oss-config.dev.glsx.com.cn/mock/6136bea6ceeb5a5c2bec6950/base/config')
} }
export const config = { export const config = {
install(vue, cfg) { install(vue, cfg) {
......
...@@ -152,8 +152,13 @@ export default { ...@@ -152,8 +152,13 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
async logoff() { async logoff() {
this.$router.replace('/login') try {
this.logout() await this.logout()
} catch (error) {
console.log({ error })
} finally {
this.$router.replace('/login')
}
}, },
dropdownVisibleChange(isShow) { dropdownVisibleChange(isShow) {
this.drOpen = isShow this.drOpen = isShow
......
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import { constants } from '@/common' import { constants } from '@/common'
const modulesFiles = require.context('.', true, /^(?!.*\/init\.js$).*\.js$/) // eslint-disable-next-line prettier/prettier
const modules = require.context('.', true, /^(?!.*\/init\.js$).*\.js$/).keys().map(fileName => fileName.replace(/^\.\/(.*)\.\w+$/, '$1'))
const init = { const init = {
namespaced: true, namespaced: true,
actions: { actions: {
...@@ -13,10 +14,7 @@ const init = { ...@@ -13,10 +14,7 @@ const init = {
await dispatch('track/setTracker', sessionInfo, { root: true }) await dispatch('track/setTracker', sessionInfo, { root: true })
}, },
reset({ dispatch }) { reset({ dispatch }) {
modulesFiles.forEach(modulePath => { modules.forEach(module => dispatch(`${module}/clear`, null, { root: true }))
const module = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
dispatch(`${module}/clear`, null, { root: true })
})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!