Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
iClear-Connect-Pre-Clearance
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
jinhui.wang
2024-11-19 17:37:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
836ad5721f3506f75aac21e8c00adc5c3f1e892d
836ad572
1 parent
efe3cf43
菜单,用户信息接口增加,基础信息逻辑修改
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
110 deletions
web/src/api/login.js
web/src/api/menu.js
web/src/components/HeaderSetting/index.vue
web/src/permission.js
web/src/store/modules/permission.js
web/src/store/modules/user.js
web/src/utils/auth.js
web/src/views/redjrectLogin.vue
web/src/api/login.js
View file @
836ad57
import
request
from
"@/utils/request"
;
// 获取fcl登录地址
export
function
fclInit
()
{
return
request
({
url
:
"/manager-server/auth/init"
,
method
:
"post"
,
});
}
// 获取用户详细信息
export
function
getInfo
(
uid
)
{
export
function
getInfo
()
{
return
request
({
url
:
"/
icleartw/sysUser/getUserDetail/"
+
uid
,
url
:
"/
manager-server/user/getUser"
,
method
:
"get"
,
});
}
...
...
@@ -71,11 +79,4 @@ export function verifyResetPwd(data) {
url
:
"/icleartw/auth/verifyResetPwd/"
+
data
,
method
:
"get"
,
});
}
// 获取fcl登录地址
export
function
fclInit
()
{
return
request
({
url
:
"/icleartw/auth/init/"
,
method
:
"post"
,
});
}
\ No newline at end of file
...
...
web/src/api/menu.js
View file @
836ad57
...
...
@@ -3,7 +3,7 @@ import request from "@/utils/request";
// 获取路由
export
const
getRouters
=
()
=>
{
return
request
({
url
:
"/
icleartw/sysUser/userMenu
"
,
url
:
"/
manager-server/privilege/getPrivilege
"
,
method
:
"get"
,
});
};
...
...
web/src/components/HeaderSetting/index.vue
View file @
836ad57
...
...
@@ -90,7 +90,6 @@ export default {
saveTableHeader({ tableName: this.tableName, idList: this.transferValue }).then(res => {
if (res.code === 200) {
obj[this.tableName] = res.data
this.$store.dispatch('SavetableHeader', obj)
this.msgSuccess('操作成功')
this.close(1)
} else {
...
...
web/src/permission.js
View file @
836ad57
...
...
@@ -3,7 +3,7 @@ import store from "./store";
import
{
Message
,
MessageBox
}
from
"element-ui"
;
import
{
getToken
}
from
"@/utils/auth"
;
const
whiteList
=
[
"/login"
,
"/auth-redirect"
,
"/bind"
,
"/register"
,
"/redjrectLogin"
];
const
whiteList
=
[
"/login"
,
"/auth-redirect"
,
"/bind"
,
"/register"
,
"/redjrectLogin"
];
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
if
(
getToken
())
{
let
path
=
''
...
...
@@ -15,7 +15,7 @@ router.beforeEach((to, from, next) => {
store
.
dispatch
(
"GetInfo"
)
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
res
.
code
===
200
)
{
store
.
dispatch
(
"GenerateRoutes"
).
then
((
accessRoutes
)
=>
{
router
.
addRoutes
(
accessRoutes
);
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
});
// hack方法 确保addRoutes已完成
...
...
@@ -33,7 +33,6 @@ router.beforeEach((to, from, next) => {
}
}
}
else
{
store
.
dispatch
(
"RemoveInfo"
);
// 没有token
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
// 在免登录白名单,直接进入
...
...
@@ -44,4 +43,4 @@ router.beforeEach((to, from, next) => {
}
});
router
.
afterEach
(()
=>
{});
router
.
afterEach
(()
=>
{
});
...
...
web/src/store/modules/permission.js
View file @
836ad57
import
{
constantRoutes
}
from
"@/router"
;
import
{
getRouters
}
from
"@/api/menu"
;
import
Layout
from
"@/layout/index"
;
import
ParentView
from
"@/components/ParentView"
;
import
{
getInfo
}
from
"@/api/login"
;
import
{
getUid
}
from
"@/utils/auth"
;
import
{
getRouters
}
from
"@/api/menu.js"
const
permission
=
{
state
:
{
routes
:
[],
...
...
@@ -26,7 +24,7 @@ const permission = {
const
index
=
[
{
path
:
"index"
,
meta
:
{
title
:
"
首页
"
,
icon
:
"home"
},
meta
:
{
title
:
"
Index
"
,
icon
:
"home"
},
},
];
state
.
topbarRouters
=
routes
.
concat
(
index
);
...
...
@@ -46,11 +44,11 @@ const permission = {
// 生成路由
GenerateRoutes
({
commit
})
{
return
new
Promise
((
resolve
)
=>
{
// console.log(constantRoutes, "constantRoutes");
// 向后端请求路由数据
getInfo
(
getUid
()).
then
((
res
)
=>
{
const
sdata
=
JSON
.
parse
(
JSON
.
stringify
(
routeItemInfo
(
res
.
data
.
meunInfoList
)));
const
rdata
=
JSON
.
parse
(
JSON
.
stringify
(
routeItemInfo
(
res
.
data
.
meunInfoList
)));
getRouters
().
then
((
res
)
=>
{
console
.
log
(
res
);
const
sdata
=
JSON
.
parse
(
JSON
.
stringify
(
routeItemInfo
(
res
.
data
)));
const
rdata
=
JSON
.
parse
(
JSON
.
stringify
(
routeItemInfo
(
res
.
data
)));
const
sidebarRoutes
=
filterAsyncRouter
(
sdata
);
const
rewriteRoutes
=
filterAsyncRouter
(
rdata
,
false
,
true
);
rewriteRoutes
.
push
({
path
:
"*"
,
redirect
:
"/404"
,
hidden
:
true
});
...
...
@@ -122,19 +120,18 @@ function routeItemInfo(val) {
let
childrens
=
[];
arr
.
forEach
((
item
)
=>
{
let
obj
=
{};
let
obj1
=
{};
obj
=
{
children
:
[],
component
:
item
.
parentId
==
0
?
"Layout"
:
`/
${
item
.
name
}
`
,
component
:
item
.
parentId
==
0
?
"Layout"
:
`/
${
item
.
path
}
`
,
hidden
:
false
,
id
:
item
.
id
,
meta
:
{
title
:
item
.
titl
e
,
title
:
item
.
nam
e
,
icon
:
item
.
icon
,
},
parentId
:
item
.
parentId
,
name
:
item
.
nam
e
,
path
:
item
.
parentId
==
0
?
item
.
path
:
item
.
nam
e
,
name
:
item
.
cod
e
,
path
:
item
.
parentId
==
0
?
item
.
path
==
null
?
''
:
item
.
path
:
item
.
cod
e
,
};
item
.
parentId
!=
0
?
childrens
.
push
(
obj
)
:
router
.
push
(
obj
);
});
...
...
@@ -142,8 +139,6 @@ function routeItemInfo(val) {
}
//对ext框架route数据结构进行初始化
function
setRoute
(
route
,
childrens
)
{
let
rootRoute
=
{};
let
arr
=
[];
childrens
.
forEach
((
item
)
=>
{
route
.
forEach
((
val
)
=>
{
if
(
item
.
parentId
==
val
.
id
)
{
...
...
web/src/store/modules/user.js
View file @
836ad57
import
{
userLogin
,
logout
,
getInfo
}
from
"@/api/login"
;
import
{
getTableHeader
}
from
"@/api/menu"
;
import
{
changeCurrentPort
}
from
"@/api/system/user.js"
;
import
{
getToken
,
setToken
,
removeToken
,
getUid
}
from
"@/utils/auth"
;
import
{
MessageBox
,
Message
}
from
"element-ui"
;
import
{
getToken
,
setToken
,
removeToken
}
from
"@/utils/auth"
;
import
{
MessageBox
}
from
"element-ui"
;
const
user
=
{
state
:
{
...
...
@@ -12,10 +10,6 @@ const user = {
id
:
""
,
avatar
:
""
,
activePortName
:
""
,
portNames
:
[],
roles
:
[],
permissions
:
[],
tableHeader
:
null
,
appLoading
:
false
,
},
...
...
@@ -39,18 +33,6 @@ const user = {
state
.
activePortName
=
activePortName
;
sessionStorage
.
setItem
(
"portName"
,
activePortName
);
},
SET_PORTNAMES
:
(
state
,
portNames
)
=>
{
state
.
portNames
=
portNames
;
},
SET_ROLES
:
(
state
,
roles
)
=>
{
state
.
roles
=
roles
;
},
SET_PERMISSIONS
:
(
state
,
permissions
)
=>
{
state
.
permissions
=
permissions
;
},
SAVE_TABLEHEADER
:
(
state
,
table
)
=>
{
state
.
tableHeader
=
table
;
},
SET_APP_LOADING
(
state
,
newValue
)
{
state
.
appLoading
=
newValue
;
}
...
...
@@ -70,7 +52,7 @@ const user = {
commit
(
"SET_TOKEN"
,
res
.
data
);
resolve
();
}
else
{
MessageBox
.
alert
(
res
.
msg
,
"
註意
"
,
{
MessageBox
.
alert
(
res
.
msg
,
"
Tip
"
,
{
dangerouslyUseHTMLString
:
true
,
});
return
Promise
.
reject
(
new
Error
(
msg
));
...
...
@@ -82,44 +64,14 @@ const user = {
});
},
//获取表头
GetTableHeaders
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getTableHeader
()
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
commit
(
"SAVE_TABLEHEADER"
,
res
.
data
);
}
resolve
(
res
);
})
.
catch
((
err
)
=>
{
reject
(
err
);
});
});
},
//保存表头
SavetableHeader
({
commit
,
state
},
data
)
{
commit
(
"SAVE_TABLEHEADER"
,
data
);
},
// 获取用户信息
GetInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getInfo
(
getUid
()
)
getInfo
()
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
const
user
=
res
.
data
;
// const avatar =
// user.avatar == ""
// ? ""
// : process.env.VUE_APP_BASE_API + user.avatar;
// let ports = [];
// commit("SET_ID", user.id);
// commit("SET_NAME", user.userName);
commit
(
"SET_USERDATA"
,
res
.
data
.
userInfo
);
// commit("SET_AVATAR", avatar);
commit
(
"SET_USERDATA"
,
res
.
data
);
resolve
(
res
);
}
})
...
...
@@ -129,28 +81,11 @@ const user = {
});
},
//切换口岸
changePort
({
commit
},
portName
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
changeCurrentPort
({
portName
:
portName
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
commit
(
"SET_ACTIVEPORTNAME"
,
portName
);
}
resolve
(
res
);
})
.
catch
((
err
)
=>
{
reject
(
err
);
});
});
},
// 退出系统
LogOut
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
logout
(
state
.
token
)
.
then
(()
=>
{
// window.location.href = "https://test-myapps.secure.fedex.com/purpleid/signout";//wsso系统跳转
commit
(
"SET_TOKEN"
,
""
);
commit
(
"SET_USERDATA"
,
{});
removeToken
();
...
...
@@ -165,8 +100,6 @@ const user = {
RemoveInfo
({
commit
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
commit
(
"SET_USERDATA"
,
{
user
:
{}
});
commit
(
"SET_ROLES"
,
[]);
commit
(
"SET_PERMISSIONS"
,
[]);
commit
(
"SET_NAME"
,
""
);
commit
(
"SET_AVATAR"
,
""
);
resolve
();
...
...
web/src/utils/auth.js
View file @
836ad57
//import Cookies from 'js-cookie'
const
TokenKey
=
"
IClear
-Token"
;
const
TokenKey
=
"
preCliearnce
-Token"
;
const
Uid
=
"
IClear
-Uid"
;
const
Uid
=
"
preCliearnce
-Uid"
;
export
function
getToken
()
{
//return Cookies.get(TokenKey)
...
...
@@ -11,7 +11,7 @@ export function getToken() {
}
export
function
setToken
(
token
)
{
return
localStorage
.
setItem
(
TokenKey
,
token
)
}
...
...
@@ -21,7 +21,7 @@ export function removeToken() {
localStorage
.
removeItem
(
"portName"
);
localStorage
.
removeItem
(
Uid
);
return
localStorage
.
removeItem
(
TokenKey
);
// return localStorage.removeItem(TokenKey)
}
...
...
@@ -31,13 +31,13 @@ export function removeToken() {
export
function
getUid
()
{
let
locUid
=
localStorage
.
getItem
(
Uid
);
let
locUid
=
localStorage
.
getItem
(
Uid
);
return
locUid
?
locUid
:
0
;
}
export
function
removeUid
()
{
return
localStorage
.
removeItem
(
Uid
);
}
...
...
web/src/views/redjrectLogin.vue
View file @
836ad57
...
...
@@ -13,9 +13,8 @@ export default {
mounted() {
this.loading = true;
removeToken();
if (this.$route.query.token
&& this.$route.query.uid
) {
if (this.$route.query.token) {
setToken(decodeURI(this.$route.query.token));
setUid(decodeURI(this.$route.query.uid));
this.$router.push({ name: "WaybillInquiry" });
this.loading = false;
// this.$router.push({ path: '/login',query:{changePasswordType:this.$route.query.changePasswordType,loginname:this.$route.query.loginname} })
...
...
Please
register
or
login
to post a comment