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
4ac63b98
Commit
4ac63b98
authored
Nov 06, 2020
by
Sixiang_Zzb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会计页面
parent
9bb79978
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
156 additions
and
21 deletions
+156
-21
config.ts
config/config.ts
+5
-0
SecurityLayout.tsx
src/layouts/SecurityLayout.tsx
+69
-16
login.ts
src/models/login.ts
+1
-5
UploadAccount.css
...serManagement/ServiceProviderManagement/UploadAccount.css
+18
-0
UploadAccount.less
...erManagement/ServiceProviderManagement/UploadAccount.less
+21
-0
UploadAccount.tsx
...serManagement/ServiceProviderManagement/UploadAccount.tsx
+28
-0
Authorized.ts
src/utils/Authorized.ts
+2
-0
request.ts
src/utils/request.ts
+12
-0
No files found.
config/config.ts
View file @
4ac63b98
...
...
@@ -146,8 +146,13 @@ export default defineConfig({
// },
],
},
{},
],
},
{
path
:
'UploadAccount'
,
component
:
'./UserManagement/ServiceProviderManagement/UploadAccount'
,
},
{
path
:
'/PropertyManagement'
,
name
:
'propertymanagement'
,
...
...
src/layouts/SecurityLayout.tsx
View file @
4ac63b98
...
...
@@ -6,6 +6,7 @@ import { ConnectState } from '@/models/connect';
import
{
CurrentUser
}
from
'@/models/user'
;
import
login
from
'@/pages/user/login'
;
import
{
getCookie
}
from
'@/utils/method'
;
import
{
message
}
from
'antd'
;
interface
SecurityLayoutProps
extends
ConnectProps
{
loading
?:
boolean
;
...
...
@@ -14,21 +15,21 @@ interface SecurityLayoutProps extends ConnectProps {
}
interface
SecurityLayoutState
{
token
:
String
,
token
:
String
;
isReady
:
boolean
;
}
class
SecurityLayout
extends
React
.
Component
<
SecurityLayoutProps
,
SecurityLayoutState
>
{
state
:
SecurityLayoutState
=
{
isReady
:
false
,
token
:
"abc123"
,
token
:
'abc123'
,
};
componentDidMount
()
{
this
.
setState
({
isReady
:
true
,
});
const
{
dispatch
,
login
}
=
this
.
props
;
const
{
dispatch
,
login
}
=
this
.
props
;
// console.log("安全登录中")
// console.log(login)
if
(
dispatch
)
{
...
...
@@ -43,38 +44,90 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
}
render
()
{
const
{
isReady
,
token
}
=
this
.
state
;
const
{
children
,
loading
,
currentUser
,
logi
n
}
=
this
.
props
;
const
{
isReady
,
token
}
=
this
.
state
;
const
{
children
,
loading
,
currentUser
,
login
,
history
,
locatio
n
}
=
this
.
props
;
// You can replace it to your authentication rule (such as check token exists)
// 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
// 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
// console.log(
"是否已登录" + getCookie("token"))
// console.log(
'是否已登录' + getCookie('token'));
// const isLogin = currentUser && currentUser.name;//isLogin为关键点
var
isLogin
=
false
if
(
getCookie
(
"token"
).
length
!=
0
)
{
isLogin
=
true
// const isLogin = currentUser && currentUser.name;//isLogin为关键点
const
routeAuth
=
[
[
1
,
'/manager/data/lookUp'
],
[
2
,
'/manager/account/lookUp'
],
[
3
,
'/manager/account/edit'
],
[
4
,
'/manager/account/addProfile'
],
[
5
,
'/manager/account/logOutProfile'
],
[
6
,
'/manager/vps/lookUp'
],
[
7
,
'/manager/vps/edit'
],
[
8
,
'/manager/vps/add'
],
[
9
,
'/manager/vps/logOut'
],
[
10
,
'/manager/tosMoney/lookUp'
],
[
11
,
'/manager/tosMoney/add'
],
[
12
,
'/manager/tosServices/lookUp'
],
[
13
,
'/manager/tosServices/edit'
],
[
14
,
'/manager/tosServices/logOut'
],
[
15
,
'/manager/order/lookUp'
],
[
16
,
'/manager/order/edit'
],
[
17
,
'/manager/contract/lookUp'
],
[
18
,
'/manager/contract/edit'
],
[
19
,
'/manager/contract/add'
],
[
20
,
'/manager/village/lookUp'
],
[
21
,
'/manager/village/edit'
],
[
22
,
'/manager/village/add'
],
[
23
,
'/manager/notice/lookUp'
],
[
24
,
'/manager/notice/edit'
],
[
25
,
'/manager/notice/add'
],
[
26
,
'/manager/visitor/lookUp'
],
[
27
,
'/manager/bookingService/lookUp'
],
[
28
,
'/manager/bookingService/edit'
],
[
29
,
'/manager/bookingService/add'
],
[
30
,
'/manager/backgroundAccount/lookUp'
],
[
31
,
'/manager/backgroundAccount/edit'
],
[
32
,
'/manager/lifeAccount/lookUp'
],
[
33
,
'/manager/lifeAccount/edit'
],
[
34
,
'/manager/lifeAccount/add'
],
[
35
,
'/manager/lifeAccount/logOut'
],
[
36
,
'/manager/lifeAccount/familyMembers/add'
],
[
37
,
'/manager/lifeAccount/familyMembers/logOut'
],
];
var
isLogin
=
false
;
// 权限判断
let
auth
=
false
;
if
(
getCookie
(
'token'
).
length
!=
0
)
{
console
.
log
(
'是否有权限'
);
isLogin
=
true
;
// console.log(currentUser?.permission);
// console.log(location.pathname);
// const flag = routeAuth.some((v) => {
// return v[1] === location.pathname;
// });
// console.log(flag);
}
const
queryString
=
stringify
({
redirect
:
window
.
location
.
href
,
});
if
((
!
isLogin
&&
loading
)
||
!
isReady
)
{
// console.log("页面加载")
console
.
log
(
'页面加载'
);
return
<
PageLoading
/>;
}
if
(
!
isLogin
&&
window
.
location
.
pathname
!==
'/user/login'
)
{
// message.error('Please Re Login!', 3, () => {
console
.
log
(
'未登录返回登录页!'
);
return
<
Redirect
to=
{
`/user/login?${queryString}`
}
/>;
// });
}
return
children
;
}
}
export
default
connect
(({
user
,
loading
,
login
}:
ConnectState
)
=>
({
export
default
connect
(({
user
,
loading
,
login
}:
ConnectState
)
=>
({
currentUser
:
user
.
currentUser
,
loading
:
loading
.
models
.
user
,
login
:
login
login
:
login
,
}))(
SecurityLayout
);
src/models/login.ts
View file @
4ac63b98
...
...
@@ -67,11 +67,7 @@ const Model: LoginModelType = {
console
.
log
(
userMessage
);
console
.
log
(
userMessage
.
token
);
setCookie
(
'token'
,
userMessage
.
token
);
// tosUserName: "admin"
// tosUserPhone: "18818881888"
setCookie
(
'name'
,
response
.
token
.
tosUserName
);
setCookie
(
'phone'
,
response
.
token
.
tosUserPhone
);
setCookie
(
'id'
,
response
.
token
.
id
);
setCookie
(
'permission'
,
userMessage
.
permission
);
console
.
log
(
'获取到Token:'
+
getCookie
(
'token'
));
yield
put
({
type
:
'saveToken'
,
...
...
src/pages/UserManagement/ServiceProviderManagement/UploadAccount.css
0 → 100644
View file @
4ac63b98
.container
{
width
:
100vw
;
height
:
100vh
;
}
.box
{
position
:
absolute
;
top
:
40%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
.btn
{
position
:
absolute
;
right
:
0px
;
bottom
:
-50px
;
}
.ant-btn
{
width
:
100px
;
}
src/pages/UserManagement/ServiceProviderManagement/UploadAccount.less
0 → 100644
View file @
4ac63b98
.container {
width: 100vw;
height: 100vh;
}
.box {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
}
.btn {
position: absolute;
right: 0px;
bottom: -50px;
}
.ant-btn {
width: 100px;
}
src/pages/UserManagement/ServiceProviderManagement/UploadAccount.tsx
0 → 100644
View file @
4ac63b98
import
React
from
'react'
;
import
{
Form
,
Input
,
Button
,
Divider
}
from
'antd'
;
import
styles
from
'./UploadAccount.less'
;
const
UploadAccount
=
()
=>
{
const
handleLogin
=
(
value
:
string
)
=>
{
console
.
log
(
value
);
};
return
(
<
div
className=
{
styles
.
container
}
>
<
Form
className=
{
styles
.
box
}
onFinish=
{
handleLogin
}
>
<
Form
.
Item
name=
{
'password'
}
>
<
Input
.
Password
style=
{
{
width
:
220
}
}
placeholder=
{
'Please enter your password'
}
></
Input
.
Password
>
</
Form
.
Item
>
<
Divider
/>
<
Form
.
Item
className=
{
styles
.
btn
}
>
<
Button
htmlType=
{
'submit'
}
>
登录
</
Button
>
</
Form
.
Item
>
</
Form
>
</
div
>
);
};
export
default
UploadAccount
;
src/utils/Authorized.ts
View file @
4ac63b98
...
...
@@ -2,6 +2,8 @@ import RenderAuthorize from '@/components/Authorized';
import
{
getAuthority
}
from
'./authority'
;
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable import/no-mutable-exports */
// console.log(RenderAuthorize);
let
Authorized
=
RenderAuthorize
(
getAuthority
());
// Reload the rights component
...
...
src/utils/request.ts
View file @
4ac63b98
...
...
@@ -4,6 +4,7 @@
*/
import
{
extend
}
from
'umi-request'
;
import
{
notification
}
from
'antd'
;
import
getRequest
from
'umi-request'
;
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
...
...
@@ -45,6 +46,17 @@ const errorHandler = (error: { response: Response }): Response => {
return
response
;
};
// request拦截器, 改变url 或 options.
// getRequest.interceptors.request.use((url, options) => {
// console.log(url);
// console.log(options);
// return {
// url: `${url}&interceptors=yes`,
// options: { ...options, interceptors: true },
// };
// });
/**
* 配置request请求时的默认参数
*/
...
...
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