Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TOSTUMI
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
Maple
TOSTUMI
Commits
b2039d32
Commit
b2039d32
authored
Dec 03, 2020
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
8a96ea46
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
68 deletions
+83
-68
config.ts
config/config.ts
+14
-5
access.ts
src/access.ts
+4
-5
baseLayout.e2e.js
src/e2e/baseLayout.e2e.js
+1
-1
SecurityLayout.tsx
src/layouts/SecurityLayout.tsx
+45
-45
Account.tsx
src/pages/AccountManagement/account/Account.tsx
+3
-1
Template.tsx
src/pages/runTest/Template.tsx
+6
-10
authority.ts
src/utils/authority.ts
+9
-1
params.ts
src/utils/params.ts
+1
-0
No files found.
config/config.ts
View file @
b2039d32
...
...
@@ -246,7 +246,11 @@ export default defineConfig({
{
path
:
'./'
,
component
:
'./ContractManagement/Contract'
},
{
path
:
'./Detail'
,
component
:
'./ContractManagement/ContractDetail'
},
{
path
:
'./Edit'
,
component
:
'./ContractManagement/ContractContent'
},
{
path
:
'./Add'
,
component
:
'./ContractManagement/ContractContent'
},
{
path
:
'./Add'
,
component
:
'./ContractManagement/ContractContent'
,
access
:
'canRead'
,
},
{
path
:
'*'
,
component
:
'@/pages/404'
},
],
},
...
...
@@ -254,7 +258,7 @@ export default defineConfig({
path
:
'/CommunityManagement'
,
name
:
'communitymanagement'
,
icon
:
'HddOutlined'
,
access
:
'canRead'
,
access
:
'canRead
2
'
,
routes
:
[
{
path
:
'./CellList'
,
...
...
@@ -376,6 +380,10 @@ export default defineConfig({
},
],
},
{
path
:
'/403'
,
component
:
'@/pages/403'
,
},
{
path
:
'*'
,
component
:
'@/pages/404'
,
...
...
@@ -385,11 +393,12 @@ export default defineConfig({
],
},
{
path
:
'
*
'
,
component
:
'@/pages/40
4
'
,
path
:
'
/403
'
,
component
:
'@/pages/40
3
'
,
},
{
component
:
'./403'
,
path
:
'*'
,
component
:
'@/pages/404'
,
},
],
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
...
...
src/access.ts
View file @
b2039d32
/*
* @Author: your name
* @Date: 2020-12-03 11:27:07
* @LastEditTime: 2020-12-03 1
1:31:17
* @LastEditTime: 2020-12-03 1
4:04:53
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\access.ts
*/
export
default
function
(
initialState
:
any
)
{
const
userId
=
JSON
.
parse
(
localStorage
.
getItem
(
'userInfo'
)
as
any
);
// const userId = JSON.parse(localStorage.getItem('userInfo') as any);
return
{
canRead
:
(
foo
:
any
)
=>
{
console
.
log
(
foo
);
console
.
log
(
userId
);
//
console.log(foo);
//
console.log(userId);
// return foo.ownerId === userId;
return
true
;
},
...
...
src/e2e/baseLayout.e2e.js
View file @
b2039d32
...
...
@@ -22,7 +22,7 @@ function formatter(routes, parentPath = '') {
beforeEach
(
async
()
=>
{
await
page
.
goto
(
`
${
BASE_URL
}
`
);
await
page
.
evaluate
(()
=>
{
localStorage
.
setItem
(
'antd-pro-authority'
,
'["admin"]'
);
//
localStorage.setItem('antd-pro-authority', '["admin"]');
});
});
...
...
src/layouts/SecurityLayout.tsx
View file @
b2039d32
...
...
@@ -52,65 +52,65 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
// 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
const
perList
=
[
{
key
:
'1'
,
path
:
'/UserManagement/LIFEUserManagement'
},
{
key
:
'18'
,
path
:
'/UserManagement/ServiceProviderManagement'
},
{
key
:
'15'
,
path
:
'/PropertyManagement'
},
{
key
:
'17'
,
path
:
'/CommercialService/CommunityMaintenance'
},
{
key
:
'20'
,
path
:
'/CommercialService/OwnerComplaints'
},
{
key
:
'23'
,
path
:
'/CommercialService/ProblemFeedback'
},
{
key
:
'26'
,
path
:
'/CommercialService/RenovationApplication'
},
{
key
:
'29'
,
path
:
'/CommercialService/AccessCardApplication'
},
{
key
:
'33'
,
path
:
'/CommercialService/ReportOnline'
},
{
key
:
'36'
,
path
:
'/CommercialService/ShelfLifeService'
},
// cellee 负责部分
// 合同
{
key
:
'39'
,
path
:
'/ContractManagement'
},
{
key
:
'40'
,
path
:
'/ContractManagement/Detail'
},
{
key
:
'41'
,
path
:
'/ContractManagement/Add'
},
{
key
:
'42'
,
path
:
'/ContractManagement/Edit'
},
// 小区
{
path
:
'/CommunityManagement/CellList'
,
title
:
'小区列表'
,
key
:
'44'
},
{
path
:
'/CommunityManagement/CellList/Detail'
,
title
:
'查看小区'
,
key
:
'44'
},
{
path
:
'/CommunityManagement/CellList/Add'
,
title
:
'编辑小区'
,
key
:
'45'
},
{
path
:
'/CommunityManagement/CellList/Add'
,
title
:
'添加小区'
,
key
:
'46'
},
// 小区公告
{
path
:
'/CommunityManagement/CommunityAnnouncement'
,
title
:
'小区公告'
,
key
:
'48'
},
{
path
:
'/CommunityManagement/CommunityAnnouncement/Detail'
,
title
:
'查看公告'
,
key
:
'49'
},
{
path
:
'/CommunityManagement/CommunityAnnouncement/Edit'
,
title
:
'编辑公告'
,
key
:
'50'
},
{
path
:
'/CommunityManagement/CommunityAnnouncement/Add'
,
title
:
'添加公告'
,
key
:
'51'
},
// 小区设施
{
path
:
'/CommunityManagement/FacilityBookings'
,
title
:
'小区设施'
,
key
:
'52'
},
{
path
:
'/CommunityManagement/FacilityBookings/Detail'
,
title
:
'查看预约设施'
,
key
:
'53'
},
{
path
:
'/CommunityManagement/FacilityBookings/Booking'
,
title
:
'添加预约设施'
,
key
:
'54'
},
{
path
:
'/UserManagement/LIFEUserManagement'
,
key
:
'1'
,
path
:
'/CommunityManagement/FacilityBookings/FacilityApply'
,
title
:
'添加预约设施'
,
key
:
'54'
,
},
{
path
:
'/UserManagement/ServiceProviderManagement'
,
key
:
'8'
,
},
{
path
:
'/PropertyManagement'
,
key
:
'15'
,
},
{
path
:
'/CommercialService/CommunityMaintenance'
,
key
:
'17'
,
},
{
path
:
'/CommercialService/OwnerComplaints'
,
key
:
'20'
,
},
{
path
:
'/CommercialService/ProblemFeedback'
,
key
:
'23'
,
},
{
path
:
'/CommercialService/RenovationApplication'
,
key
:
'26'
,
},
{
path
:
'/CommercialService/AccessCardApplication'
,
key
:
'29'
,
},
{
path
:
'/CommercialService/ReportOnline'
,
key
:
'33'
,
},
{
path
:
'/CommercialService/ShelfLifeService'
,
key
:
'36'
,
path
:
'/CommunityManagement/FacilityBookings/FacilityDetail'
,
title
:
'查看设施'
,
key
:
'57'
,
},
{
path
:
'/CommunityManagement/FacilityBookings/FacilityEdit'
,
title
:
'编辑设施'
,
key
:
'58'
},
{
path
:
'/CommunityManagement/FacilityBookings/Adding'
,
title
:
'添加设施'
,
key
:
'59'
},
// 访客记录
{
path
:
'/CommunityManagement/VisitorRecord'
,
title
:
'访客记录'
,
key
:
'60'
},
// 账号管理
{
path
:
'AccountManagement/account'
,
title
:
'账号管理'
,
key
:
'62'
},
{
path
:
'AccountManagement/account/Detail'
,
title
:
'查看账号'
,
key
:
'63'
},
{
path
:
'AccountManagement/account/edit'
,
title
:
'编辑账号'
,
key
:
'64'
},
{
path
:
'AccountManagement/account/Add'
,
title
:
'添加账号'
,
key
:
'65'
},
];
const
permission
=
JSON
.
parse
(
localStorage
.
getItem
(
'permission'
)
||
'[]'
);
console
.
log
(
'验证权限'
+
location
.
pathname
);
console
.
log
(
'拿取所有权限'
+
permission
);
// 判断是否有权限
// if (perList.indexOf("")) {
// }
let
perObj
=
perList
.
filter
((
obj
)
=>
{
return
obj
.
path
===
location
.
pathname
;
});
console
.
log
(
perObj
);
if
(
perObj
.
length
!==
0
)
{
if
(
permission
.
indexOf
(
perObj
[
0
].
key
)
<
0
)
{
console
.
log
(
'无权限'
);
history
.
push
(
'/403'
);
}
}
...
...
src/pages/AccountManagement/account/Account.tsx
View file @
b2039d32
...
...
@@ -45,8 +45,10 @@ const Account = (props: any) => {
// 刷新加载
const
Refresh
=
()
=>
{
const
userInfo
=
JSON
.
parse
(
localStorage
.
getItem
(
'userInfo'
)
||
'[]'
);
let
obj
=
{
leaderID
:
getCookie
(
'id'
)
,
creatorId
:
userInfo
.
userModel
.
id
?
userInfo
.
userModel
.
id
:
''
,
pageNum
:
1
,
};
// RA(45, obj);
...
...
src/pages/runTest/Template.tsx
View file @
b2039d32
import
React
,
{
use
State
,
use
Effect
}
from
'react'
;
import
React
,
{
useEffect
}
from
'react'
;
import
styles
from
'./index.less'
;
import
{
Input
,
Menu
,
Table
,
Space
,
Pagination
,
Tooltip
,
Button
,
Form
,
Upload
}
from
'antd'
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
}
from
'umi'
;
import
{
useAccess
,
connect
}
from
'umi'
;
import
Line
from
'../../components/Line/Line'
;
import
BackButton
from
'../../components/BackButton/BackButton'
;
import
TitleGet
from
'../../components/TitleGet/TitleGet'
;
import
TableShow
from
'../../components/TableShow/TableShow'
;
import
{
getCookie
}
from
'@/utils/method'
;
import
PictureOptions
from
'@/components/PictureOptions/PictureOptions'
;
const
Guard
=
(
props
:
any
)
=>
{
// var name = pack.name;
// var version = pack.version;
const
{
dispatch
,
CommunityList
,
token
}
=
props
;
const
tosCommunityget
=
(
values
:
any
)
=>
{
dispatch
({
type
:
'Init/tosCommunityget'
,
playload
:
values
});
...
...
@@ -26,7 +22,7 @@ const Guard = (props: any) => {
return
(
<
div
className=
{
styles
.
base
}
>
<
TitleGet
title=
{
'Version 1.
2.4
'
}
/>
<
TitleGet
title=
{
'Version 1.
5.0
'
}
/>
{
/* <p>
token:{page.token}
name:{getCookie('name')}
...
...
src/utils/authority.ts
View file @
b2039d32
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-12-03 13:59:20
* @LastEditors: your name
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\authority.ts
*/
import
{
reloadAuthorized
}
from
'./Authorized'
;
// use localStorage to store the authority info, which might be sent from server in actual project.
...
...
@@ -29,7 +37,7 @@ export function getAuthority(str?: string): string | string[] {
export
function
setAuthority
(
authority
:
string
|
string
[]):
void
{
const
proAuthority
=
typeof
authority
===
'string'
?
[
authority
]
:
authority
;
localStorage
.
setItem
(
'antd-pro-authority'
,
JSON
.
stringify
(
proAuthority
));
//
localStorage.setItem('antd-pro-authority', JSON.stringify(proAuthority));
// auto reload
reloadAuthorized
();
}
src/utils/params.ts
View file @
b2039d32
...
...
@@ -128,4 +128,5 @@ export const requestList = [
[
'/tos/users/quitAndUser'
,
'52 修改账号状态'
,
{}],
[
'/tos/tosServiceScope/cancel'
,
'53 删除服务范围'
],
[
'/tos/user/permission/get'
,
'54 根据用户名称获取用户权限'
,
{}],
[
'/tos/tosCommunity/get/user'
,
'55 根据用户id获取用户管辖小区名'
,
{}],
];
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