Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖康
/
cloudSystem
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
619bc84b
authored
May 12, 2021
by
肖康
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
x
parent
cf6168af
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
13 deletions
src/ajax/index.js
src/components/menu.vue
src/main.js
src/views/User/login.vue
src/ajax/index.js
View file @
619bc84b
...
@@ -15,7 +15,7 @@ let NODE_ENVS = "/";
...
@@ -15,7 +15,7 @@ let NODE_ENVS = "/";
switch
(
envs
)
{
switch
(
envs
)
{
case
'development'
:
case
'development'
:
//开发环境
//开发环境
NODE_ENVS
=
'http://192.168.2.1
42
:8080'
;
NODE_ENVS
=
'http://192.168.2.1
64
:8080'
;
break
;
break
;
case
'test'
:
case
'test'
:
//测试环境
//测试环境
...
...
src/components/menu.vue
View file @
619bc84b
...
@@ -166,6 +166,7 @@
...
@@ -166,6 +166,7 @@
}
else
{
}
else
{
app_
.
setAttribute
(
'style'
,
'padding-left:226px'
);
app_
.
setAttribute
(
'style'
,
'padding-left:226px'
);
}
}
}
}
},
},
mounted
()
{
mounted
()
{
...
...
src/main.js
View file @
619bc84b
...
@@ -57,12 +57,15 @@ router.afterEach((to, from, next) => {
...
@@ -57,12 +57,15 @@ router.afterEach((to, from, next) => {
if
(
tabOldJson
)
{
if
(
tabOldJson
)
{
sessionStorage
.
setItem
(
'tabs'
,
JSON
.
stringify
(
tabOldJson
));
sessionStorage
.
setItem
(
'tabs'
,
JSON
.
stringify
(
tabOldJson
));
}
}
if
(
tabOldJson
)
{
sessionStorage
.
setItem
(
'tabs'
,
JSON
.
stringify
(
tabOldJson
));
}
});
});
axios
.
interceptors
.
response
.
use
(
res
=>
{
axios
.
interceptors
.
response
.
use
(
res
=>
{
return
res
;
return
res
;
},
error
=>
{
},
error
=>
{
Message
(
'网络出现问题,请检查网络'
);
//
Message('网络出现问题,请检查网络');
return
Promise
.
reject
(
new
Error
(
error
))
return
Promise
.
reject
(
new
Error
(
error
))
})
})
...
@@ -71,17 +74,28 @@ Vue.prototype.$http = http;
...
@@ -71,17 +74,28 @@ Vue.prototype.$http = http;
//路由页面回跳处理 mate里面参数 back:true 开启登录态回跳
//路由页面回跳处理 mate里面参数 back:true 开启登录态回跳
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
console
.
log
(
to
.
query
)
if
(
to
.
path
!=
"/login"
){
http
(
'get'
,
"/api/user/getuserinfo"
,
{
}).
then
(
data
=>
{
let
res
=
data
.
data
;
if
(
res
.
err_code
===
101
)
{
window
.
location
.
href
=
'/#/login?referer='
+
encodeURI
(
to
.
path
);
}
else
{
next
()
}
}).
catch
(
err
=>
{
console
.
log
(
err
.
message
);
next
()
})
}
else
{
next
()
}
http
(
'get'
,
"/api/user/getuserinfo"
,
{
}).
then
(
data
=>
{
let
res
=
data
.
data
;
if
(
res
.
err_code
===
101
)
{
window
.
location
.
href
=
'/#/login'
;
}
}).
catch
(
err
=>
{
console
.
log
(
err
.
message
);
})
next
();
});
});
...
...
src/views/User/login.vue
View file @
619bc84b
...
@@ -91,6 +91,7 @@
...
@@ -91,6 +91,7 @@
},
},
created
()
{
created
()
{
this
.
updateCp
();
this
.
updateCp
();
console
.
log
(
this
.
$route
.
query
.
referer
)
},
},
computed
:
{},
computed
:
{},
methods
:
{
methods
:
{
...
@@ -139,7 +140,12 @@
...
@@ -139,7 +140,12 @@
let
res
=
data
.
data
;
let
res
=
data
.
data
;
if
(
res
.
err_code
===
0
)
{
if
(
res
.
err_code
===
0
)
{
Util
.
setCookie
(
"token"
,
res
.
data
.
api_token
,
1
);
Util
.
setCookie
(
"token"
,
res
.
data
.
api_token
,
1
);
window
.
location
.
href
=
'/'
;
if
(
this
.
$route
.
query
.
referer
){
window
.
location
.
href
=
"/#"
+
this
.
$route
.
query
.
referer
}
else
{
window
.
location
.
href
=
'/'
;
}
}
else
{
}
else
{
Message
(
res
.
err_msg
);
Message
(
res
.
err_msg
);
this
.
updateCp
();
this
.
updateCp
();
...
...
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