Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
2bb7f4e0
Commit
2bb7f4e0
authored
May 24, 2022
by
张子雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改密码
parent
c3d034e7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
2 deletions
+126
-2
config.js
config/config.js
+6
-0
AvatarDropdown.jsx
src/components/GlobalHeader/AvatarDropdown.jsx
+9
-2
index.jsx
src/pages/password/index.jsx
+83
-0
style.less
src/pages/password/style.less
+28
-0
No files found.
config/config.js
View file @
2bb7f4e0
...
@@ -182,6 +182,12 @@ export default {
...
@@ -182,6 +182,12 @@ export default {
icon
:
'
smile
'
,
icon
:
'
smile
'
,
component
:
'
./PaymentMange
'
,
component
:
'
./PaymentMange
'
,
},
},
{
path
:
'
/password
'
,
name
:
'
password
'
,
icon
:
'
smile
'
,
component
:
'
./password
'
,
},
// {
// {
// path: '/GoodsManage-new',
// path: '/GoodsManage-new',
// name: 'GoodsManageNew',
// name: 'GoodsManageNew',
...
...
src/components/GlobalHeader/AvatarDropdown.jsx
View file @
2bb7f4e0
import
{
LogoutOutlined
,
SettingOutlined
,
UserOutlined
}
from
'
@ant-design/icons
'
;
import
{
LogoutOutlined
,
SettingOutlined
,
UserOutlined
,
EditOutlined
}
from
'
@ant-design/icons
'
;
import
{
Avatar
,
Menu
,
Spin
}
from
'
antd
'
;
import
{
Avatar
,
Menu
,
Spin
}
from
'
antd
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
...
@@ -21,6 +21,10 @@ class AvatarDropdown extends React.Component {
...
@@ -21,6 +21,10 @@ class AvatarDropdown extends React.Component {
return
;
return
;
}
}
if
(
key
===
'
password
'
)
{
history
.
push
(
'
/password
'
);
return
;
}
history
.
push
(
`/account/
${
key
}
`
);
history
.
push
(
`/account/
${
key
}
`
);
};
};
...
@@ -48,7 +52,10 @@ class AvatarDropdown extends React.Component {
...
@@ -48,7 +52,10 @@ class AvatarDropdown extends React.Component {
</
Menu
.
Item
>
</
Menu
.
Item
>
)
}
)
}
{
menu
&&
<
Menu
.
Divider
/>
}
{
menu
&&
<
Menu
.
Divider
/>
}
<
Menu
.
Item
key=
"password"
>
<
EditOutlined
/>
修改密码
</
Menu
.
Item
>
<
Menu
.
Item
key=
"logout"
>
<
Menu
.
Item
key=
"logout"
>
<
LogoutOutlined
/>
<
LogoutOutlined
/>
退出登录
退出登录
...
...
src/pages/password/index.jsx
0 → 100644
View file @
2bb7f4e0
import
React
,
{
useRef
,
useState
}
from
'
react
'
;
import
{
Form
,
Input
,
Button
,
Checkbox
,
Card
}
from
'
antd
'
;
import
{
history
}
from
'
umi
'
;
import
styles
from
'
./style.less
'
;
const
Password
=
props
=>
{
const
formRef
=
useRef
();
const
onFinish
=
values
=>
{
console
.
log
(
'
Success:
'
,
values
);
};
const
onFinishFailed
=
errorInfo
=>
{
console
.
log
(
'
Failed:
'
,
errorInfo
);
};
const
goHome
=
()
=>
{
formRef
.
current
.
resetFields
();
history
.
push
(
'
/
'
);
};
return
(
<
div
className=
{
styles
.
div
}
>
<
Card
className=
{
styles
.
card
}
>
<
p
>
修改密码
</
p
>
<
Form
initialValues=
{
{
remember
:
true
}
}
onFinish=
{
onFinish
}
onFinishFailed=
{
onFinishFailed
}
autoComplete=
"off"
className=
{
styles
.
form
}
ref=
{
formRef
}
>
<
Form
.
Item
name=
"val"
rules=
{
[{
required
:
true
,
message
:
'
请输入原密码!
'
}]
}
>
<
Input
.
Password
placeholder=
"输入原密码"
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"loginpass"
rules=
{
[
{
required
:
true
,
message
:
'
请输入新密码!
'
},
{
message
:
'
至少13最多18位且必须包含大小写字母、数字和特殊字符
'
,
pattern
:
/^
(?=
.*
[
a-z
])(?=
.*
[
A-Z
])(?=
.*
\d)(?=
.*
[
$@$!%*?&
])[
A-Za-z
\d
$@$!%*?&
]
{13,18}/
,
},
]
}
>
<
Input
.
Password
placeholder=
"输入新密码"
maxLength=
{
18
}
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"cfmloginpass"
rules=
{
[
{
required
:
true
,
message
:
'
请输入新密码!
'
},
{
message
:
'
至少13位最多18位且必须包含大小写字母、数字和特殊字符
'
,
pattern
:
/^
(?=
.*
[
a-z
])(?=
.*
[
A-Z
])(?=
.*
\d)(?=
.*
[
$@$!%*?&
])[
A-Za-z
\d
$@$!%*?&
]
{13,18}/
,
},
({
getFieldValue
})
=>
({
validator
(
rule
,
value
)
{
if
(
value
&&
getFieldValue
(
'
loginpass
'
)
!==
value
)
{
// eslint-disable-next-line prefer-promise-reject-errors
return
Promise
.
reject
(
'
两次密码输入不一致
'
);
}
return
Promise
.
resolve
();
},
}),
]
}
>
<
Input
.
Password
placeholder=
"输入新密码"
maxLength=
{
18
}
/>
</
Form
.
Item
>
<
Form
.
Item
className=
{
styles
.
btn
}
>
<
Button
type=
"primary"
htmlType=
"submit"
>
{
'
'
}
确认修改
</
Button
>
<
Button
type=
"primary"
ghost
onClick=
{
goHome
}
>
返回首页
</
Button
>
</
Form
.
Item
>
</
Form
>
</
Card
>
</
div
>
);
};
export
default
Password
;
src/pages/password/style.less
0 → 100644
View file @
2bb7f4e0
.div {
width: 100%;
}
.card {
width: 70%;
margin: 0 auto;
padding: 30px 0;
.form {
width: 40%;
margin: 0 auto;
}
p {
margin-bottom: 30px;
font-weight: bold;
font-size: 18px;
text-align: center;
}
.btn {
margin: 0 auto;
text-align: center;
button {
&:first-child {
width: 200px;
margin-right: 10px;
}
}
}
}
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