Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f9230003
authored
Jun 21, 2023
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
解决获取不到module.导致调用reset找不到方法问题
1 parent
de5c2177
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
src/config/index.js
src/layout/components/NavMenu.vue
src/store/modules/init.js
src/config/index.js
View file @
f923000
...
@@ -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-0
5-31 16:06:51
* @LastEditTime: 2023-0
6-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
)
{
...
...
src/layout/components/NavMenu.vue
View file @
f923000
...
@@ -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
...
...
src/store/modules/init.js
View file @
f923000
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
})
})
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment