Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
Project
Project
Details
Activity
Releases
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
bp
op-web-service
Commits
fb59c181
Commit
fb59c181
authored
Aug 10, 2021
by
liwenhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:sub菜单校验
parent
b0d1fe80
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
60 additions
and
72 deletions
+60
-72
App.vue
src/App.vue
+19
-22
main.js
src/main.js
+6
-8
h5.vue
src/pages/Withdrawal/Examine/h5.vue
+0
-1
index.vue
src/pages/Withdrawal/Examine/index.vue
+1
-7
config.js
src/pages/Withdrawal/components/PageHeader/config.js
+6
-5
index.vue
src/pages/Withdrawal/components/PageHeader/index.vue
+8
-9
index.js
src/router/Withdrawal/index.js
+4
-4
index.js
src/router/index.js
+3
-3
user.js
src/service/user.js
+3
-1
login.js
src/store/modules/login.js
+1
-6
util.js
src/utils/util.js
+9
-6
No files found.
src/App.vue
View file @
fb59c181
...
@@ -10,33 +10,30 @@
...
@@ -10,33 +10,30 @@
</
template
>
</
template
>
<
script
>
<
script
>
//
import { fetchCurrentUser } from "./service/user";
import
{
fetchCurrentUser
}
from
"./service/user"
;
import
{
getCookie
,
redirectToLogin
}
from
"@/utils/util"
;
import
{
getCookie
,
redirectToLogin
}
from
"@/utils/util"
;
export
default
{
export
default
{
async
mounted
()
{
async
mounted
()
{
console
.
log
(
getCookie
(
'username'
));
if
(
this
.
$store
.
state
.
permissions
&&
this
.
$store
.
state
.
userInfo
)
return
;
if
(
!
getCookie
(
'username'
))
{
if
(
!
getCookie
(
'username'
))
{
this
.
$message
(
'请先登录'
);
this
.
$message
(
'请先登录'
);
redirectToLogin
();
redirectToLogin
();
}
}
// if (this.$store.state.permissions && this.$store.state.userInfo) return
;
const
{
status
,
user
}
=
await
fetchCurrentUser
()
;
// let isDefault = window.localStorage.getItem('isDefault');
// let isDefault = window.localStorage.getItem('isDefault');
// if(isDefault == 2) {
// if (isDefault == 2) return;
// user.email = getCookie('username');
if
(
status
===
"success"
)
{
// }
this
.
$store
.
commit
(
"updateUserInfo"
,
user
);
// const { status, user } = await fetchCurrentUser();
this
.
$store
.
dispatch
(
"updateUserPermission"
,
{
email
:
user
.
email
});
// if (status === "success") {
// 无奈之举,后期需要重构到提现管理中
// this.$store.commit("updateUserInfo", user);
this
.
$store
.
dispatch
(
"fetchPermission"
,
{
// console.log('user',user)
appId
:
"merchant-op-auditing"
,
// this.$store.dispatch("updateUserPermission", { email: user.email });
});
// // 无奈之举,后期需要重构到提现管理中
}
else
{
// this.$store.dispatch("fetchPermission", {
redirectToLogin
();
// appId: "merchant-op-auditing",
}
// });
// } else {
// redirectToLogin();
// }
},
},
computed
:
{
computed
:
{
...
...
src/main.js
View file @
fb59c181
...
@@ -10,7 +10,7 @@ import locale from "element-plus/lib/locale/lang/zh-cn";
...
@@ -10,7 +10,7 @@ import locale from "element-plus/lib/locale/lang/zh-cn";
import
{
fetchCurrentUser
}
from
"./service/user"
;
import
{
fetchCurrentUser
}
from
"./service/user"
;
import
{
checkPathAuth
}
from
"./utils/authUtil"
;
import
{
checkPathAuth
}
from
"./utils/authUtil"
;
import
{
redirectToLogin
,
getCookie
}
from
"./utils/util"
;
import
{
redirectToLogin
}
from
"./utils/util"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
ElMessage
}
from
"element-plus"
;
// 处理路由权限
// 处理路由权限
...
@@ -20,19 +20,17 @@ router.beforeResolve(async (to, from, next) => {
...
@@ -20,19 +20,17 @@ router.beforeResolve(async (to, from, next) => {
next
();
next
();
return
true
;
return
true
;
}
}
if
(
!
store
.
state
.
permissions
)
{
const
{
status
,
user
}
=
await
fetchCurrentUser
();
let
isDefault
=
window
.
localStorage
.
getItem
(
'isDefault'
);
let
isDefault
=
window
.
localStorage
.
getItem
(
'isDefault'
);
if
(
isDefault
==
2
)
{
if
(
!
store
.
state
.
permissions
&&
isDefault
==
1
)
{
user
.
email
=
getCookie
(
'username'
);
const
{
status
,
user
}
=
await
fetchCurrentUser
(
);
}
if
(
status
===
'success'
)
{
if
(
status
===
'success'
)
{
store
.
commit
(
'updateUserInfo'
,
user
);
store
.
commit
(
'updateUserInfo'
,
user
);
console
.
log
(
'updateUserInfo====='
,
user
)
await
store
.
dispatch
(
'updateUserPermission'
,
{
email
:
user
.
email
})
await
store
.
dispatch
(
'updateUserPermission'
,
{
email
:
user
.
email
})
}
else
{
}
else
{
redirectToLogin
();
redirectToLogin
();
return
false
;
return
ElMessage
(
"您没有权限"
)
;
}
}
}
}
...
...
src/pages/Withdrawal/Examine/h5.vue
View file @
fb59c181
...
@@ -131,7 +131,6 @@ export default {
...
@@ -131,7 +131,6 @@ export default {
this
.
$router
.
push
({
name
:
"Forbidden"
});
this
.
$router
.
push
({
name
:
"Forbidden"
});
return
;
return
;
}
}
console
.
log
(
"withdrawlPermission"
,
withdrawlPermission
);
withdrawlPermission
=
withdrawlPermission
[
0
];
withdrawlPermission
=
withdrawlPermission
[
0
];
// judge subpermission
// judge subpermission
let
subpermissions
=
withdrawlPermission
.
sub_permissions
.
filter
(
let
subpermissions
=
withdrawlPermission
.
sub_permissions
.
filter
(
...
...
src/pages/Withdrawal/Examine/index.vue
View file @
fb59c181
...
@@ -289,7 +289,7 @@ import {
...
@@ -289,7 +289,7 @@ import {
}
from
"@/service/Withdrawal/withdrawal"
;
}
from
"@/service/Withdrawal/withdrawal"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
fetchCurrentUser
}
from
"../../../service/user"
;
import
{
fetchCurrentUser
}
from
"../../../service/user"
;
import
{
getCookie
,
redirectToLogin
}
from
"@/utils/util"
;
import
{
redirectToLogin
}
from
"@/utils/util"
;
const
TABS
=
{
const
TABS
=
{
pending
:
"0"
,
pending
:
"0"
,
...
@@ -353,7 +353,6 @@ export default {
...
@@ -353,7 +353,6 @@ export default {
},
},
async
mounted
()
{
async
mounted
()
{
const
res
=
await
this
.
getPermissionsAll
();
const
res
=
await
this
.
getPermissionsAll
();
if
(
!
res
)
{
if
(
!
res
)
{
redirectToLogin
();
redirectToLogin
();
return
ElMessage
(
"您没有权限"
);
return
ElMessage
(
"您没有权限"
);
...
@@ -368,7 +367,6 @@ export default {
...
@@ -368,7 +367,6 @@ export default {
redirectToLogin
();
redirectToLogin
();
return
ElMessage
(
"您没有权限"
);
return
ElMessage
(
"您没有权限"
);
}
}
console
.
log
(
"withdrawlPermission"
,
withdrawlPermission
);
withdrawlPermission
=
withdrawlPermission
[
0
];
withdrawlPermission
=
withdrawlPermission
[
0
];
// judge subpermission
// judge subpermission
let
subpermissions
=
withdrawlPermission
.
sub_permissions
.
filter
(
let
subpermissions
=
withdrawlPermission
.
sub_permissions
.
filter
(
...
@@ -384,10 +382,6 @@ export default {
...
@@ -384,10 +382,6 @@ export default {
// 不能够信赖 store 中的 email,无法知道全局中的 fetchCurrentUser 处理完毕
// 不能够信赖 store 中的 email,无法知道全局中的 fetchCurrentUser 处理完毕
// 是一个重构的点
// 是一个重构的点
const
{
user
}
=
await
fetchCurrentUser
();
const
{
user
}
=
await
fetchCurrentUser
();
let
isDefault
=
window
.
localStorage
.
getItem
(
'isDefault'
);
if
(
isDefault
==
2
)
{
user
.
email
=
getCookie
(
'username'
);
}
const
res
=
await
getRolesForUser
(
user
.
email
);
const
res
=
await
getRolesForUser
(
user
.
email
);
this
.
permissions
=
res
;
this
.
permissions
=
res
;
...
...
src/pages/Withdrawal/components/PageHeader/config.js
View file @
fb59c181
const
headerConfig
=
[
const
headerConfig
=
[
{
{
name
:
"提现审核"
,
name
:
"提现审核"
,
path
:
"/op/withdrawal/examine"
path
:
"/op/withdrawal/examine"
,
requiredPermission
:
"withdrawal_audit"
},
},
{
{
path
:
"/op/withdrawal/roleManageRole"
,
path
:
"/op/withdrawal/roleManageRole"
,
name
:
"角色管理"
,
name
:
"角色管理"
,
//
requireAuthentication: true,
requireAuthentication
:
true
,
//
requiredPermission: "role_management"
requiredPermission
:
"role_management"
},
},
{
{
path
:
"/op/withdrawal/user"
,
path
:
"/op/withdrawal/user"
,
name
:
"用户管理"
,
name
:
"用户管理"
,
//
requireAuthentication: true,
requireAuthentication
:
true
,
//
requiredPermission: "user_management"
requiredPermission
:
"user_management"
}
}
];
];
...
...
src/pages/Withdrawal/components/PageHeader/index.vue
View file @
fb59c181
...
@@ -54,7 +54,7 @@ export default {
...
@@ -54,7 +54,7 @@ export default {
if
(
this
.
hasPermission
(
item
.
requiredPermission
))
{
if
(
this
.
hasPermission
(
item
.
requiredPermission
))
{
return
true
;
return
true
;
}
}
return
tru
e
;
return
fals
e
;
});
});
return
visibleMenuItems
;
return
visibleMenuItems
;
},
},
...
@@ -62,14 +62,13 @@ export default {
...
@@ -62,14 +62,13 @@ export default {
beforeMount
()
{},
beforeMount
()
{},
methods
:
{
methods
:
{
...
mapActions
([
'logout'
]),
...
mapActions
([
'logout'
]),
hasPermission
()
{
hasPermission
(
permissionId
)
{
// return (
return
(
// this.moduleSubPermissions(
this
.
$store
.
getters
.
moduleSubPermissions
(
// permissionId,
permissionId
,
// "merchant-op-auditing"
"merchant-op-auditing"
// ).length !== 0
).
length
!==
0
// );
);
return
true
},
},
handleLogout
()
{
handleLogout
()
{
this
.
logout
()
this
.
logout
()
...
...
src/router/Withdrawal/index.js
View file @
fb59c181
...
@@ -26,10 +26,10 @@ const withdrawalRoutes = [
...
@@ -26,10 +26,10 @@ const withdrawalRoutes = [
import
(
import
(
/* webpackChunkName: "Withdrawal" */
"@/pages/Withdrawal/Role/manage-role"
/* webpackChunkName: "Withdrawal" */
"@/pages/Withdrawal/Role/manage-role"
),
),
//
meta: {
meta
:
{
//
requireAuth: true,
requireAuth
:
true
,
//
keepAlive: true
keepAlive
:
true
//
}
}
},
},
//角色管理
//角色管理
{
{
...
...
src/router/index.js
View file @
fb59c181
...
@@ -94,9 +94,9 @@ const routes = [
...
@@ -94,9 +94,9 @@ const routes = [
path
:
"/op/roleManageRole"
,
path
:
"/op/roleManageRole"
,
name
:
"/op/ManageRole"
,
name
:
"/op/ManageRole"
,
component
:
ManageRole
,
component
:
ManageRole
,
//
meta: {
meta
:
{
//
requireAuth: true
requireAuth
:
true
//
}
}
},
},
{
{
path
:
"/op/roleRoleDetail"
,
path
:
"/op/roleRoleDetail"
,
...
...
src/service/user.js
View file @
fb59c181
import
axios
from
'../utils/request'
;
import
axios
from
'../utils/request'
;
import
{
getCookie
}
from
"@/utils/util"
;
export
async
function
yd_login
(
userInfo
)
{
export
async
function
yd_login
(
userInfo
)
{
const
res
=
await
axios
.
post
(
"/api/v1/YD_login"
,
userInfo
);
const
res
=
await
axios
.
post
(
"/api/v1/YD_login"
,
userInfo
);
...
@@ -12,7 +13,8 @@ export async function j_login (userInfo) {
...
@@ -12,7 +13,8 @@ export async function j_login (userInfo) {
export
async
function
fetchCurrentUser
()
{
export
async
function
fetchCurrentUser
()
{
let
isDefault
=
window
.
localStorage
.
getItem
(
'isDefault'
);
let
isDefault
=
window
.
localStorage
.
getItem
(
'isDefault'
);
if
(
isDefault
==
2
)
return
true
;
let
username
=
getCookie
(
'username'
)
if
(
isDefault
==
2
)
return
{
user
:
{
email
:
username
,
status
:
'success'
}};
return
await
axios
.
get
(
"/api/v1/fetch_user"
);
return
await
axios
.
get
(
"/api/v1/fetch_user"
);
}
}
...
...
src/store/modules/login.js
View file @
fb59c181
...
@@ -43,12 +43,7 @@ export default {
...
@@ -43,12 +43,7 @@ export default {
logout
()
{
logout
()
{
return
new
Promise
(
async
(
resolve
)
=>
{
return
new
Promise
(
async
(
resolve
)
=>
{
window
.
localStorage
.
clear
();
window
.
localStorage
.
clear
();
await
delCookie
(
'username'
)
delCookie
()
await
delCookie
(
'uid'
)
await
delCookie
(
'YD_PANDORA_JWT_TOKEN'
)
await
delCookie
(
'nickname'
)
await
delCookie
(
'userid'
)
await
delCookie
(
'YD_PANDORA_UID'
)
redirectToLogin
()
redirectToLogin
()
resolve
()
resolve
()
});
});
...
...
src/utils/util.js
View file @
fb59c181
...
@@ -30,7 +30,6 @@ export function redirectToLogin() {
...
@@ -30,7 +30,6 @@ export function redirectToLogin() {
export
function
redirectPage
()
{
export
function
redirectPage
()
{
let
url
=
window
.
location
.
search
.
split
(
'?callback='
)[
1
]
||
window
.
location
.
pathname
;
let
url
=
window
.
location
.
search
.
split
(
'?callback='
)[
1
]
||
window
.
location
.
pathname
;
router
.
push
(
window
.
decodeURIComponent
(
url
))
router
.
push
(
window
.
decodeURIComponent
(
url
))
console
.
log
(
'redirectUrl'
,
url
)
}
}
export
function
isYdUser
(
email
)
{
export
function
isYdUser
(
email
)
{
...
@@ -58,9 +57,13 @@ export function getCookie(NameOfCookie) {
...
@@ -58,9 +57,13 @@ export function getCookie(NameOfCookie) {
return
null
;
return
null
;
}
}
export
function
delCookie
(
name
)
{
export
function
delCookie
()
{
var
exp
=
new
Date
();
var
keys
=
document
.
cookie
.
match
(
/
[^
=;
]
+
(?=
=
)
/g
)
exp
.
setTime
(
exp
.
getTime
()
-
1
);
if
(
keys
)
{
var
cval
=
getCookie
(
name
);
for
(
var
i
=
keys
.
length
;
i
--
;)
{
if
(
cval
!=
null
)
document
.
cookie
=
name
+
"="
+
cval
+
";expires="
+
exp
.
toGMTString
()
+
";path=/"
;
document
.
cookie
=
keys
[
i
]
+
'=0;path=/;expires='
+
new
Date
(
0
).
toUTCString
()
document
.
cookie
=
keys
[
i
]
+
'=0;path=/;domain='
+
document
.
domain
+
';expires='
+
new
Date
(
0
).
toUTCString
()
document
.
cookie
=
keys
[
i
]
+
'=0;path=/;domain=yidian-inc.com;expires='
+
new
Date
(
0
).
toUTCString
()
}
}
}
}
\ No newline at end of file
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