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
fa28ac36
Commit
fa28ac36
authored
Feb 24, 2021
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdf加限制、公司信息加默认
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
da71641e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
24 deletions
+105
-24
PdfUpload.tsx
src/components/Form/PdfUpload.tsx
+13
-1
AvatarDropdown.tsx
src/components/GlobalHeader/AvatarDropdown.tsx
+12
-2
Account.ts
src/models/CommunityManagement/Account.ts
+8
-2
CompanyInformation.tsx
...countManagement/CompanyInformation/CompanyInformation.tsx
+48
-11
editAdmin.tsx
src/pages/AccountManagement/account/editAdmin.tsx
+24
-8
No files found.
src/components/Form/PdfUpload.tsx
View file @
fa28ac36
/*
/*
* @Author: your name
* @Author: your name
* @Date: 2021-02-01 14:54:48
* @Date: 2021-02-01 14:54:48
* @LastEditTime: 2021-02-2
3 10:42
:27
* @LastEditTime: 2021-02-2
4 16:25
:27
* @LastEditors: Please set LastEditors
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
...
@@ -122,6 +122,12 @@ const PdfUpload: React.FC<PriceInputProps> = ({
...
@@ -122,6 +122,12 @@ const PdfUpload: React.FC<PriceInputProps> = ({
// 上传前检测
// 上传前检测
function
beforeUpload
(
file
:
any
)
{
function
beforeUpload
(
file
:
any
)
{
// 先看看有没有图片正在上传中,有的话跳出新增
if
(
loading
.
filter
((
item
)
=>
item
).
length
>
0
)
{
message
.
info
(
'Please wait for the picture to be uploaded !'
);
return
false
;
}
const
isJpgOrPng
=
file
.
type
===
'application/pdf'
||
file
.
type
===
'pdf'
;
const
isJpgOrPng
=
file
.
type
===
'application/pdf'
||
file
.
type
===
'pdf'
;
if
(
!
isJpgOrPng
)
{
if
(
!
isJpgOrPng
)
{
message
.
error
(
'You can only upload PDF file!'
);
message
.
error
(
'You can only upload PDF file!'
);
...
@@ -181,6 +187,12 @@ const PdfUpload: React.FC<PriceInputProps> = ({
...
@@ -181,6 +187,12 @@ const PdfUpload: React.FC<PriceInputProps> = ({
const
add
=
()
=>
{
const
add
=
()
=>
{
let
list
=
JSON
.
parse
(
JSON
.
stringify
(
imgList
));
let
list
=
JSON
.
parse
(
JSON
.
stringify
(
imgList
));
let
valve
=
false
;
// 控制阀
let
valve
=
false
;
// 控制阀
// 先看看有没有图片正在上传中,有的话跳出新增
if
(
loading
.
filter
((
item
)
=>
item
).
length
>
0
)
{
message
.
info
(
'Please wait for the picture to be uploaded !'
);
return
false
;
}
for
(
let
i
in
list
)
{
for
(
let
i
in
list
)
{
if
(
list
[
i
].
name
==
''
||
list
[
i
].
fileList
.
length
==
0
)
{
if
(
list
[
i
].
name
==
''
||
list
[
i
].
fileList
.
length
==
0
)
{
list
[
i
].
tip
=
true
;
list
[
i
].
tip
=
true
;
...
...
src/components/GlobalHeader/AvatarDropdown.tsx
View file @
fa28ac36
/*
* @Author: your name
* @Date: 2020-11-24 11:24:06
* @LastEditTime: 2021-02-24 11:47:56
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\GlobalHeader\AvatarDropdown.tsx
*/
import
{
LogoutOutlined
}
from
'@ant-design/icons'
;
import
{
LogoutOutlined
}
from
'@ant-design/icons'
;
import
{
Avatar
,
Menu
,
Spin
}
from
'antd'
;
import
{
Avatar
,
Menu
,
Spin
}
from
'antd'
;
import
{
ClickParam
}
from
'antd/es/menu'
;
import
{
ClickParam
}
from
'antd/es/menu'
;
...
@@ -9,6 +17,8 @@ import HeaderDropdown from '../HeaderDropdown';
...
@@ -9,6 +17,8 @@ import HeaderDropdown from '../HeaderDropdown';
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
logOut
}
from
'@/utils/log'
;
import
{
logOut
}
from
'@/utils/log'
;
import
Logo
from
'@/assets/logo.png'
;
export
interface
GlobalHeaderRightProps
extends
Partial
<
ConnectProps
>
{
export
interface
GlobalHeaderRightProps
extends
Partial
<
ConnectProps
>
{
currentUser
?:
CurrentUser
;
currentUser
?:
CurrentUser
;
menu
?:
boolean
;
menu
?:
boolean
;
...
@@ -32,7 +42,7 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
...
@@ -32,7 +42,7 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
const
{
const
{
currentUser
=
{
currentUser
=
{
avatar
:
'http://120.77.240.215:5205/file/ce90a1cd01cf4c2bb6ab12b295c25c16.png'
,
avatar
:
Logo
,
name
:
'Login Again Please'
,
name
:
'Login Again Please'
,
userModel
:
{
userModel
:
{
tosAccountName
:
'Tos'
,
tosAccountName
:
'Tos'
,
...
@@ -52,7 +62,7 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
...
@@ -52,7 +62,7 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
return
(
return
(
<
HeaderDropdown
overlay=
{
menuHeaderDropdown
}
>
<
HeaderDropdown
overlay=
{
menuHeaderDropdown
}
>
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
Avatar
size=
"small"
className=
{
styles
.
avatar
}
src=
{
currentUser
.
avatar
}
alt=
"avatar"
/>
<
Avatar
size=
"small"
className=
{
styles
.
avatar
}
src=
{
Logo
}
alt=
"avatar"
/>
<
span
className=
{
styles
.
name
}
>
<
span
className=
{
styles
.
name
}
>
{
currentUser
.
userModel
?
currentUser
.
userModel
.
tosAccountName
:
'Tos'
}
{
currentUser
.
userModel
?
currentUser
.
userModel
.
tosAccountName
:
'Tos'
}
</
span
>
</
span
>
...
...
src/models/CommunityManagement/Account.ts
View file @
fa28ac36
...
@@ -65,9 +65,15 @@ export default {
...
@@ -65,9 +65,15 @@ export default {
*
RA
({
playload
},
{
call
,
put
})
{
*
RA
({
playload
},
{
call
,
put
})
{
const
resp
=
yield
call
(
service
.
RA
,
playload
);
const
resp
=
yield
call
(
service
.
RA
,
playload
);
if
(
resp
.
error_code
!=
'0000'
)
{
// 0002 是没有账户了(多端操作)
if
(
resp
.
error_code
!=
'0000'
&&
resp
.
error_code
!=
'0002'
)
{
printf
(
playload
,
resp
);
printf
(
playload
,
resp
);
message
.
error
(
`
${
resp
.
error_code
}
:
${
resp
.
error_msg
}
`
);
message
.
error
(
`
${
resp
.
error_code
}
:
${
resp
.
error_msg
}
`
);
}
else
if
(
resp
.
error_code
==
'0002'
)
{
let
Data
=
null
;
yield
put
({
type
:
'returnPage'
,
Data
});
message
.
error
(
`The account has been deleted by another user!`
);
history
.
push
(
'/AccountManagement/account'
);
}
else
{
}
else
{
switch
(
playload
.
index
)
{
switch
(
playload
.
index
)
{
case
67
:
// 编辑admin
case
67
:
// 编辑admin
...
@@ -160,7 +166,7 @@ export default {
...
@@ -160,7 +166,7 @@ export default {
case
66
:
// 获取公司信息
case
66
:
// 获取公司信息
{
{
let
Means
=
resp
.
data
;
let
Means
=
resp
.
data
||
{}
;
yield
put
({
type
:
'returnMeans'
,
Means
});
yield
put
({
type
:
'returnMeans'
,
Means
});
}
}
break
;
break
;
...
...
src/pages/AccountManagement/CompanyInformation/CompanyInformation.tsx
View file @
fa28ac36
/*
/*
* @Author: your name
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2021-02-2
3 10:33:29
* @LastEditTime: 2021-02-2
4 17:28:32
* @LastEditors: Please set LastEditors
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\pages\AccountManagement\CompanyInformation\CompanyInformation.tsx
* @FilePath: \tostumi\src\pages\AccountManagement\CompanyInformation\CompanyInformation.tsx
...
@@ -28,6 +28,18 @@ const CompanyInformation = (props: any) => {
...
@@ -28,6 +28,18 @@ const CompanyInformation = (props: any) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
Means
!=
null
)
{
if
(
Means
!=
null
)
{
let
name
=
Means
.
companyName
&&
Means
.
companyName
!==
''
?
Means
.
companyName
:
'TOS Pte Ltd'
;
let
phone
=
Means
.
companyPhone
&&
Means
.
companyPhone
!==
''
?
Means
.
companyPhone
:
'67441692'
;
let
email
=
Means
.
companyEmail
&&
Means
.
companyEmail
!==
''
?
Means
.
companyEmail
:
'admin.tos@crems.com.sg'
;
// 先给默认
Means
.
companyName
=
name
;
Means
.
companyPhone
=
phone
;
Means
.
companyEmail
=
email
;
// 再给表单
form
.
setFieldsValue
({
form
.
setFieldsValue
({
companyName
:
Means
.
companyName
,
companyName
:
Means
.
companyName
,
companyPhone
:
Means
.
companyPhone
,
companyPhone
:
Means
.
companyPhone
,
...
@@ -44,6 +56,7 @@ const CompanyInformation = (props: any) => {
...
@@ -44,6 +56,7 @@ const CompanyInformation = (props: any) => {
setModelExcel
(
!
ModelExcel
);
setModelExcel
(
!
ModelExcel
);
if
(
ModelExcel
==
false
)
{
if
(
ModelExcel
==
false
)
{
form
.
setFieldsValue
({
form
.
setFieldsValue
({
companyName
:
Means
.
companyName
,
companyPhone
:
Means
.
companyPhone
,
companyPhone
:
Means
.
companyPhone
,
companyEmail
:
Means
.
companyEmail
,
companyEmail
:
Means
.
companyEmail
,
});
});
...
@@ -52,10 +65,26 @@ const CompanyInformation = (props: any) => {
...
@@ -52,10 +65,26 @@ const CompanyInformation = (props: any) => {
//表单提交
//表单提交
const
onFinish
=
(
values
:
any
)
=>
{
const
onFinish
=
(
values
:
any
)
=>
{
values
.
id
=
Means
.
id
;
//
values.id = Means.id;
RA
(
65
,
values
);
RA
(
65
,
values
);
};
};
// 电话提示
const
inputNumberTel
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
if
(
value
)
{
if
(
(
/^
[
0-9
]
+$/g
.
test
(
value
)
&&
value
.
length
==
8
)
||
(
/^
[
0-9
]
+$/g
.
test
(
value
)
&&
value
.
length
==
11
)
)
{
callback
();
}
else
{
callback
(
new
Error
(
'Please input (8 or 11 digits)!'
));
}
}
else
{
callback
(
new
Error
(
'Please input companyPhone!'
));
}
};
return
(
return
(
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
div
className=
{
styles
.
base
}
>
<
div
className=
{
styles
.
base
}
>
...
@@ -79,11 +108,13 @@ const CompanyInformation = (props: any) => {
...
@@ -79,11 +108,13 @@ const CompanyInformation = (props: any) => {
<
div
className=
{
styles
.
box1
}
>
<
div
className=
{
styles
.
box1
}
>
<
div
className=
{
styles
.
box1item1
}
>
Management Company :
</
div
>
<
div
className=
{
styles
.
box1item1
}
>
Management Company :
</
div
>
<
div
style=
{
{
position
:
'absolute'
,
left
:
160
}
}
>
<
div
style=
{
{
position
:
'absolute'
,
left
:
160
}
}
>
<
p
>
{
Means
?
Means
.
companyName
:
null
}
</
p
>
{
ModelExcel
?
(
{
/* <Input style={{ width: 200 }} value="TOS Pte Ltd" /> */
}
<
Form
.
Item
label=
""
name=
"companyName"
rules=
{
[{
required
:
true
}]
}
>
<
Form
.
Item
label=
""
name=
"companyName"
style=
{
{
display
:
'none'
}
}
>
<
Input
maxLength=
{
11
}
/>
<
Input
value=
"TOS Pte Ltd"
/>
</
Form
.
Item
>
</
Form
.
Item
>
)
:
(
<
p
>
{
Means
?
Means
.
companyName
:
'TOS Pte Ltd'
}
</
p
>
)
}
</
div
>
</
div
>
{
/* <div className={styles.box1item3}> <Button>Edit</Button></div> */
}
{
/* <div className={styles.box1item3}> <Button>Edit</Button></div> */
}
...
@@ -96,12 +127,12 @@ const CompanyInformation = (props: any) => {
...
@@ -96,12 +127,12 @@ const CompanyInformation = (props: any) => {
<
Form
.
Item
<
Form
.
Item
label=
""
label=
""
name=
"companyPhone"
name=
"companyPhone"
rules=
{
[{
required
:
true
,
message
:
'Please input companyPhone!'
}]
}
rules=
{
[{
required
:
true
,
validator
:
inputNumberTel
}]
}
>
>
<
Input
maxLength=
{
11
}
/>
<
Input
maxLength=
{
11
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
)
:
(
)
:
(
<
p
>
{
Means
?
Means
.
companyPhone
:
null
}
</
p
>
<
p
>
{
Means
?
Means
.
companyPhone
:
'67441692'
}
</
p
>
)
}
)
}
{
/* <Input style={{ width: 200 }} value="67441692" /> */
}
{
/* <Input style={{ width: 200 }} value="67441692" /> */
}
</
div
>
</
div
>
...
@@ -113,12 +144,18 @@ const CompanyInformation = (props: any) => {
...
@@ -113,12 +144,18 @@ const CompanyInformation = (props: any) => {
<
Form
.
Item
<
Form
.
Item
label=
""
label=
""
name=
"companyEmail"
name=
"companyEmail"
rules=
{
[{
required
:
true
,
message
:
'Please input companyEmail!'
}]
}
rules=
{
[
{
required
:
true
,
type
:
'email'
,
message
:
'Please enter the correct email address!'
,
},
]
}
>
>
<
Input
/>
<
Input
/>
</
Form
.
Item
>
</
Form
.
Item
>
)
:
(
)
:
(
<
p
>
{
Means
?
Means
.
companyEmail
:
null
}
</
p
>
<
p
>
{
Means
?
Means
.
companyEmail
:
'admin.tos@crems.com.sg'
}
</
p
>
)
}
)
}
{
/* <Input style={{ width: 200 }} value="admin.tos@crems.com.sg" /> */
}
{
/* <Input style={{ width: 200 }} value="admin.tos@crems.com.sg" /> */
}
</
div
>
</
div
>
...
...
src/pages/AccountManagement/account/editAdmin.tsx
View file @
fa28ac36
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Button
,
Spin
,
Input
}
from
'antd'
;
import
{
Form
,
Button
,
Spin
,
Input
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
EditOutlined
,
LeftOutlined
,
EyeInvisibleOutlined
,
EyeTwoTone
}
from
'@ant-design/icons'
;
import
'./Account.less'
;
import
'./Account.less'
;
...
@@ -79,6 +79,22 @@ const Account = (props: any) => {
...
@@ -79,6 +79,22 @@ const Account = (props: any) => {
setPass
(
!
pass
);
setPass
(
!
pass
);
};
};
// 电话提示
const
inputNumberTel
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
if
(
value
)
{
if
(
(
/^
[
0-9
]
+$/g
.
test
(
value
)
&&
value
.
length
==
8
)
||
(
/^
[
0-9
]
+$/g
.
test
(
value
)
&&
value
.
length
==
11
)
)
{
callback
();
}
else
{
callback
(
new
Error
(
'Please input (8 or 11 digits)!'
));
}
}
else
{
callback
(
new
Error
(
'Please input Contact Information!'
));
}
};
return
(
return
(
<
Spin
spinning=
{
load
}
>
<
Spin
spinning=
{
load
}
>
<
div
className=
"contop editadmin"
style=
{
{
padding
:
'12px 20px'
}
}
>
<
div
className=
"contop editadmin"
style=
{
{
padding
:
'12px 20px'
}
}
>
...
@@ -120,7 +136,7 @@ const Account = (props: any) => {
...
@@ -120,7 +136,7 @@ const Account = (props: any) => {
<
Form
.
Item
<
Form
.
Item
name=
"tosUserPhone"
name=
"tosUserPhone"
label=
"Contact Information"
label=
"Contact Information"
rules=
{
[{
required
:
true
}]
}
rules=
{
[{
required
:
true
,
validator
:
inputNumberTel
}]
}
style=
{
{
display
:
'inline-block'
,
margin
:
'0 8px'
}
}
style=
{
{
display
:
'inline-block'
,
margin
:
'0 8px'
}
}
>
>
<
Input
maxLength=
{
11
}
minLength=
{
8
}
placeholder=
"Please enter Contact Information"
/>
<
Input
maxLength=
{
11
}
minLength=
{
8
}
placeholder=
"Please enter Contact Information"
/>
...
@@ -132,28 +148,28 @@ const Account = (props: any) => {
...
@@ -132,28 +148,28 @@ const Account = (props: any) => {
<
div
style=
{
{
width
:
'100%'
,
marginBottom
:
5
}
}
>
<
div
style=
{
{
width
:
'100%'
,
marginBottom
:
5
}
}
>
<
Form
.
Item
label=
"Change Password"
>
<
Form
.
Item
label=
"Change Password"
>
<
Form
.
Item
name=
"oldPassword"
style=
{
{
marginBottom
:
15
}
}
>
<
Form
.
Item
name=
"oldPassword"
style=
{
{
marginBottom
:
15
}
}
>
<
Input
<
Input
.
Password
type=
"password"
maxLength=
{
24
}
maxLength=
{
24
}
placeholder=
"Old password"
placeholder=
"Old password"
style=
{
{
width
:
240
}
}
style=
{
{
width
:
240
}
}
iconRender=
{
(
visible
)
=>
(
visible
?
<
EyeTwoTone
/>
:
<
EyeInvisibleOutlined
/>)
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
name=
"tosUserPwd"
style=
{
{
marginBottom
:
15
}
}
>
<
Form
.
Item
name=
"tosUserPwd"
style=
{
{
marginBottom
:
15
}
}
>
<
Input
<
Input
.
Password
type=
"password"
maxLength=
{
24
}
maxLength=
{
24
}
placeholder=
"New password"
placeholder=
"New password"
style=
{
{
width
:
240
}
}
style=
{
{
width
:
240
}
}
iconRender=
{
(
visible
)
=>
(
visible
?
<
EyeTwoTone
/>
:
<
EyeInvisibleOutlined
/>)
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
name=
"tosUserPwd1"
style=
{
{
marginBottom
:
15
}
}
>
<
Form
.
Item
name=
"tosUserPwd1"
style=
{
{
marginBottom
:
15
}
}
>
<
Input
<
Input
.
Password
type=
"password"
maxLength=
{
24
}
maxLength=
{
24
}
placeholder=
"New password again"
placeholder=
"New password again"
style=
{
{
width
:
240
}
}
style=
{
{
width
:
240
}
}
iconRender=
{
(
visible
)
=>
(
visible
?
<
EyeTwoTone
/>
:
<
EyeInvisibleOutlined
/>)
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Form
.
Item
>
</
Form
.
Item
>
...
...
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