Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-4
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
office
haoban-4
Commits
a1426b66
Commit
a1426b66
authored
Sep 21, 2020
by
无尘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改接口 header 参数
parent
4ccab745
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
index.html
dist/index.html
+0
-0
app.f345110c.js
dist/js/app.f345110c.js
+0
-0
permission.js
src/utils/permission.js
+9
-3
No files found.
dist/index.html
View file @
a1426b66
This diff is collapsed.
Click to expand it.
dist/js/app.
7a3c53cf
.js
→
dist/js/app.
f345110c
.js
View file @
a1426b66
This diff is collapsed.
Click to expand it.
src/utils/permission.js
View file @
a1426b66
...
...
@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-07-31 11:41:34
* @LastEditors: 无尘
* @LastEditTime: 2020-09-21 11:4
0:56
* @LastEditTime: 2020-09-21 11:4
5:37
*/
import
{
request
}
from
'./request.js'
;
import
axios
from
'axios'
;
...
...
@@ -69,12 +69,18 @@ function intercept(to, from, next) {
});
// 有权限访问
if
(
hasPerm
)
{
Object
.
assign
(
axios
.
defaults
.
headers
.
common
,
{
route
:
to
.
path
.
replace
(
/^
\/
/
,
''
)
});
return
next
();
};
// 无权限访问
if
(
projectRoutes
.
some
(
el
=>
el
==
to
.
path
)
||
accessPath
.
length
==
0
)
{
next
(
'/gic-error'
);
}
else
{
Object
.
assign
(
axios
.
defaults
.
headers
.
common
,
{
route
:
accessPath
[
0
].
replace
(
/^
\/
/
,
''
)
});
next
(
accessPath
[
0
]);
}
}
...
...
@@ -87,7 +93,7 @@ function itemPerm(itemPermCode) {
let
permission
=
function
(
config
)
{
const
{
projectPath
,
whiteRoute
,
router
,
routes
,
createApp
}
=
config
;
window
.
addEventListener
(
'load'
,
async
function
()
{
window
.
onload
=
async
function
()
{
// 获取菜单数据
// 获取权限数据
const
path
=
window
.
location
.
href
;
...
...
@@ -109,7 +115,7 @@ let permission = function(config) {
router
.
beforeEach
(
intercept
);
// 创建vue实例,渲染页面
if
(
typeof
createApp
==
'function'
)
createApp
();
}
)
;
};
};
export
{
permission
,
itemPerm
};
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