Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
sheng du
CountingDreams
Commits
e205bd5b
Commit
e205bd5b
authored
1 year ago
by
sheng du
Browse files
Options
Download
Email Patches
Plain Diff
缓存登陆账号
parent
e01e0a41
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
1 deletion
+30
-1
src/components/App/AppHeader/index.vue
src/components/App/AppHeader/index.vue
+3
-0
src/router/index.js
src/router/index.js
+6
-0
src/views/login.vue
src/views/login.vue
+20
-0
vue.config.js
vue.config.js
+1
-1
No files found.
src/components/App/AppHeader/index.vue
View file @
e205bd5b
...
...
@@ -63,6 +63,9 @@ export default {
})
.
then
(()
=>
{
this
.
$store
.
dispatch
(
"
user/setUserAuth
"
,
[]);
localStorage
.
removeItem
(
"
userInfo
"
);
localStorage
.
removeItem
(
"
userAuth
"
);
this
.
$router
.
replace
(
"
/login
"
);
})
.
catch
(()
=>
{});
...
...
This diff is collapsed.
Click to expand it.
src/router/index.js
View file @
e205bd5b
...
...
@@ -98,6 +98,12 @@ const router = new VueRouter({
});
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
let
storeAuth
=
localStorage
.
getItem
(
"
userAuth
"
);
let
storeUserInfo
=
localStorage
.
getItem
(
"
userInfo
"
);
store
.
dispatch
(
"
user/setUserAuth
"
,
JSON
.
parse
(
storeAuth
));
store
.
dispatch
(
"
user/setUserInfo
"
,
JSON
.
parse
(
storeUserInfo
));
let
userAuth
=
store
.
state
.
user
.
userAuth
;
// console.log(to, userAuth);
if
(
to
.
meta
.
keepAlive
)
{
...
...
This diff is collapsed.
Click to expand it.
src/views/login.vue
View file @
e205bd5b
...
...
@@ -127,6 +127,14 @@ export default {
name
:
"
刘云
"
,
type
:
1
,
});
localStorage
.
setItem
(
"
userAuth
"
,
JSON
.
stringify
(
this
.
testAuthUser
));
localStorage
.
setItem
(
"
userInfo
"
,
JSON
.
stringify
({
name
:
"
刘云
"
,
type
:
1
,
})
);
this
.
$message
.
success
(
"
登陆成功
"
);
this
.
$nextTick
(()
=>
{
this
.
$router
.
replace
({
...
...
@@ -141,6 +149,18 @@ export default {
name
:
"
重庆伟星新型建材有限公司
"
,
type
:
2
,
});
localStorage
.
setItem
(
"
userAuth
"
,
JSON
.
stringify
(
this
.
testAuthEnterprise
)
);
localStorage
.
setItem
(
"
userInfo
"
,
JSON
.
stringify
({
name
:
"
重庆伟星新型建材有限公司
"
,
type
:
2
,
})
);
this
.
$message
.
success
(
"
登陆成功
"
);
this
.
$nextTick
(()
=>
{
this
.
$router
.
replace
({
...
...
This diff is collapsed.
Click to expand it.
vue.config.js
View file @
e205bd5b
...
...
@@ -2,7 +2,7 @@ const path = require("path");
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
module
.
exports
=
{
publicPath
:
"
.
/
"
,
publicPath
:
"
/admin
/
"
,
lintOnSave
:
process
.
env
.
NODE_ENV
===
"
development
"
,
productionSourceMap
:
false
,
devServer
:
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment