Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcjg-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
8521a4e9
authored
2023-03-14 16:14:49 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' into dev
2 parents
fad6506d
e3eaf360
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
57 deletions
src/layout/components/Navbar.vue
src/permission.js
src/utils/request.js
src/views/loginjg/index.vue
src/views/loginsb/index.vue
src/layout/components/Navbar.vue
View file @
8521a4e
...
...
@@ -19,11 +19,11 @@
</div>
</
template
>
<
script
>
import
sidebarLeft
from
"./Sidebar/sidebarLeft"
;
import
sidebarRight
from
"./Sidebar/sidebarRight"
;
import
{
logout
}
from
"@/api/login.js"
;
import
{
mapGetters
}
from
"vuex"
;
export
default
{
import
sidebarLeft
from
"./Sidebar/sidebarLeft"
;
import
sidebarRight
from
"./Sidebar/sidebarRight"
;
import
{
logout
}
from
"@/api/login.js"
;
import
{
mapGetters
}
from
"vuex"
;
export
default
{
components
:
{
sidebarLeft
,
sidebarRight
,
...
...
@@ -57,89 +57,89 @@
});
},
},
};
};
</
script
>
<
style
lang=
"scss"
scoped
>
/
deep
/
.el-menu--horizontal
{
/
deep
/
.el-menu--horizontal
{
display
:
flex
;
align-items
:
center
;
}
}
.menubg
{
.menubg
{
height
:
34px
;
width
:
130px
;
width
:
130px
!important
;
text-align
:
center
;
color
:
#ffffff
;
margin-right
:
20px
;
background
:
url("~@/image/navbar.png")
no-repeat
;
background-size
:
100%
100%
;
}
}
/
deep
/
.el-menu-item
{
/
deep
/
.el-menu-item
{
@extend
.menubg;
}
}
/
deep
/
.el-submenu
{
/
deep
/
.el-submenu
{
@extend
.menubg;
}
}
/
deep
/
.el-submenu__title
{
/
deep
/
.el-submenu__title
{
height
:
34px
;
color
:
#ffffff
;
}
}
/
deep
/
.el-submenu__title
span
{
/
deep
/
.el-submenu__title
span
{
font-size
:
14px
;
}
}
.sidebarLeft
{
.sidebarLeft
{
position
:
relative
;
top
:
13px
;
width
:
30%
;
}
}
/
deep
/
.el-menu
{
/
deep
/
.el-menu
{
display
:
flex
;
justify-content
:
space-between
;
}
width
:
100%
;
}
/
deep
/
.el-menu-item
{
/
deep
/
.el-menu-item
{
flex
:
1
;
width
:
100%
;
}
}
.sidebarRight
{
.sidebarRight
{
position
:
relative
;
top
:
13px
;
width
:
30%
;
padding-left
:
20px
;
}
}
//
导航选中背景色
.xuanzhong
{
//
导航选中背景色
.xuanzhong
{
background
:
url("~@/image/selNavbar.png")
no-repeat
;
background-size
:
100%
100%
;
color
:
#ffffff
!important
;
font-weight
:
700
;
}
}
/
deep
/
.el-menu-item
:hover
{
/
deep
/
.el-menu-item
:hover
{
@extend
.xuanzhong;
}
}
/
deep
/
.el-submenu__title
:hover
{
/
deep
/
.el-submenu__title
:hover
{
@extend
.xuanzhong;
}
}
/
deep
/
.el-menu--horizontal
.el-menu-item
:not
(
.is-disabled
)
:focus
{
/
deep
/
.el-menu--horizontal
.el-menu-item
:not
(
.is-disabled
)
:focus
{
@extend
.xuanzhong;
}
}
/
deep
/
.el-menu-item.is-active
{
/
deep
/
.el-menu-item.is-active
{
@extend
.xuanzhong;
}
.navbar
{
}
.navbar
{
height
:
$
headerHeight
;
overflow
:
hidden
;
position
:
relative
;
...
...
@@ -258,5 +258,5 @@
}
}
}
}
}
</
style
>
...
...
src/permission.js
View file @
8521a4e
...
...
@@ -18,13 +18,13 @@ router.beforeEach(async (to, from, next) => {
let
hasUser
=
store
.
state
.
user
.
hasUser
;
let
hasAddRoute
=
store
.
state
.
permission
.
addRoutes
;
if
(
to
.
path
==
"/sb"
||
to
.
path
==
"/jg"
)
{
session
Storage
.
removeItem
(
"token"
);
local
Storage
.
removeItem
(
"token"
);
sessionStorage
.
setItem
(
"psth"
,
to
.
path
)
next
();
}
else
{
let
code
=
sessionStorage
.
getItem
(
"psth"
)
==
"/sb"
?
"BDCSBPT"
:
"BDCJGPT"
//判断token是否存在
const
hasToken
=
session
Storage
.
getItem
(
"token"
);
const
hasToken
=
local
Storage
.
getItem
(
"token"
);
if
(
hasToken
)
{
//请求用户信息
if
(
!
hasUser
)
{
...
...
src/utils/request.js
View file @
8521a4e
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-1
3 14:11:50
* @LastEditTime: 2023-03-1
4 14:39:24
*/
/**
* 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
...
...
@@ -25,7 +25,7 @@ const service = axios.create({
service
.
interceptors
.
request
.
use
(
(
config
)
=>
{
//调用登录接口时无token,也不需要传token,其他接口都传入token
config
.
headers
.
Authorization
=
session
Storage
.
getItem
(
"token"
)
||
""
;
config
.
headers
.
Authorization
=
local
Storage
.
getItem
(
"token"
)
||
""
;
config
.
headers
.
Accept
=
"application/json"
;
return
config
;
},
...
...
@@ -35,6 +35,7 @@ service.interceptors.request.use(
}
);
window
.
tokenValid
=
true
// response interceptor
service
.
interceptors
.
response
.
use
(
(
response
)
=>
{
...
...
@@ -64,15 +65,20 @@ service.interceptors.response.use(
//对错误信息的处理函数
function
handleErrorData
(
status
)
{
switch
(
status
)
{
// case 401:
// Message.error("由于长时间未操作,请重新登录!");
// router.replace({
// path: "/login/jg",
// query: {
// redirect: router.history.current.fullPath,
// },
// });
// break;
case
401
:
// 多个请求不重复提示错误信息
if
(
window
.
tokenValid
)
{
window
.
tokenValid
=
false
;
Message
.
error
(
"由于长时间未操作,请重新登录!"
);
localStorage
.
removeItem
(
"token"
);
router
.
replace
({
path
:
"/jg"
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
,
},
});
}
break
;
case
403
:
Message
.
error
(
"拒绝访问"
);
break
;
...
...
src/views/loginjg/index.vue
View file @
8521a4e
...
...
@@ -96,7 +96,7 @@
.
then
((
res
)
=>
{
if
(
res
.
status
===
1
)
{
//存储token
session
Storage
.
setItem
(
"token"
,
`Bearer
${
res
.
content
}
`
);
local
Storage
.
setItem
(
"token"
,
`Bearer
${
res
.
content
}
`
);
//登录成功后需判断有无重定向,没有重定向则跳转首页
this
.
$router
.
replace
(
this
.
$route
.
query
.
redirect
||
"/"
);
}
else
{
...
...
src/views/loginsb/index.vue
View file @
8521a4e
...
...
@@ -103,7 +103,7 @@
if
(
res
.
status
===
1
)
{
this
.
$store
.
dispatch
(
'business/setInitRules'
,
"layout1"
)
//存储token
session
Storage
.
setItem
(
"token"
,
`Bearer
${
res
.
content
}
`
);
local
Storage
.
setItem
(
"token"
,
`Bearer
${
res
.
content
}
`
);
//登录成功后需判断有无重定向,没有重定向则跳转首页
this
.
$router
.
replace
(
this
.
$route
.
query
.
redirect
||
"/"
);
}
else
{
...
...
Please
register
or
sign in
to post a comment