Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app
Project
Overview
Details
Activity
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
姜雷
wx-school-app
Commits
22320dc2
Commit
22320dc2
authored
Mar 06, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
限制密码输入
parent
db9e2f7b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
25 deletions
+34
-25
index.js
src/constants/index.js
+2
-1
Register.tsx
src/pages/Register/Register.tsx
+15
-12
ResetPwd.tsx
src/pages/ResetPwd/ResetPwd.tsx
+15
-12
pwd.ts
src/utils/pwd.ts
+2
-0
No files found.
src/constants/index.js
View file @
22320dc2
...
@@ -3,5 +3,6 @@ export const APP_ID = 'wxf5912b79bba23663';
...
@@ -3,5 +3,6 @@ export const APP_ID = 'wxf5912b79bba23663';
export
const
BASE_SERVER_URL
=
'https://ex-test-dcxy-base-app.168cad.top'
;
export
const
BASE_SERVER_URL
=
'https://ex-test-dcxy-base-app.168cad.top'
;
export
const
CUSTOMER_SERVER_URL
=
export
const
CUSTOMER_SERVER_URL
=
'https://ex-test-dcxy-customer-app.168cad.top'
;
'https://ex-test-dcxy-customer-app.168cad.top'
;
export
const
SCHOOL_MAIN_URL
=
'https://internal-test-school-main.168cad.top'
;
export
const
SCHOOL_MAIN_URL
=
'https://internal-test-school-home-bg.168cad.top'
;
export
const
ANN_LINK_URL
=
'https://ex-test-wx.168cad.top/announcement/'
;
export
const
ANN_LINK_URL
=
'https://ex-test-wx.168cad.top/announcement/'
;
src/pages/Register/Register.tsx
View file @
22320dc2
...
@@ -17,6 +17,7 @@ import agreeNotIcon from '../../images/login/icon_zhuce_nor@2x.png';
...
@@ -17,6 +17,7 @@ import agreeNotIcon from '../../images/login/icon_zhuce_nor@2x.png';
import
{
connect
}
from
'@tarojs/redux'
;
import
{
connect
}
from
'@tarojs/redux'
;
import
{
UserState
,
updateUserInfo
}
from
'../../store/rootReducers/userinfo'
;
import
{
UserState
,
updateUserInfo
}
from
'../../store/rootReducers/userinfo'
;
import
{
wxUserRegister
}
from
'../../api/customer'
;
import
{
wxUserRegister
}
from
'../../api/customer'
;
import
{
replaceIllegalPwd
}
from
'../../utils/pwd'
;
type
PageStateProps
=
{
type
PageStateProps
=
{
userinfo
:
UserState
;
userinfo
:
UserState
;
...
@@ -79,6 +80,14 @@ class Register extends Component {
...
@@ -79,6 +80,14 @@ class Register extends Component {
});
});
}
}
setPwdValue
(
key
:
string
,
value
:
string
)
{
let
val
=
replaceIllegalPwd
(
value
);
this
.
setState
({
[
key
]:
val
,
});
return
val
;
}
validateRegisterEntity
():
boolean
{
validateRegisterEntity
():
boolean
{
const
{
name
,
cellphone
,
pwd
,
checkPwd
}
=
this
.
state
;
const
{
name
,
cellphone
,
pwd
,
checkPwd
}
=
this
.
state
;
const
{
const
{
...
@@ -290,12 +299,9 @@ class Register extends Component {
...
@@ -290,12 +299,9 @@ class Register extends Component {
placeholder=
'密码由6-20位组成'
placeholder=
'密码由6-20位组成'
maxLength=
{
20
}
maxLength=
{
20
}
value=
{
pwd
}
value=
{
pwd
}
onInput=
{
({
detail
:
{
value
}
})
=>
{
onInput=
{
({
detail
:
{
value
}
})
=>
this
.
setState
({
this
.
setPwdValue
(
'pwd'
,
value
)
pwd
:
value
,
}
});
return
value
;
}
}
/>
/>
<
Image
<
Image
className=
'registerBox-pwdIcon'
className=
'registerBox-pwdIcon'
...
@@ -311,12 +317,9 @@ class Register extends Component {
...
@@ -311,12 +317,9 @@ class Register extends Component {
placeholder=
'确认密码'
placeholder=
'确认密码'
maxLength=
{
20
}
maxLength=
{
20
}
value=
{
checkPwd
}
value=
{
checkPwd
}
onInput=
{
({
detail
:
{
value
}
})
=>
{
onInput=
{
({
detail
:
{
value
}
})
=>
this
.
setState
({
this
.
setPwdValue
(
'checkPwd'
,
value
)
checkPwd
:
value
,
}
});
return
value
;
}
}
/>
/>
<
Image
<
Image
className=
'registerBox-pwdIcon'
className=
'registerBox-pwdIcon'
...
...
src/pages/ResetPwd/ResetPwd.tsx
View file @
22320dc2
...
@@ -8,6 +8,7 @@ import ToastBox from '../../components/ToastBox/ToastBox';
...
@@ -8,6 +8,7 @@ import ToastBox from '../../components/ToastBox/ToastBox';
import
'./ResetPwd.scss'
;
import
'./ResetPwd.scss'
;
import
{
changePwdByCellphone
}
from
'../../api/customer'
;
import
{
changePwdByCellphone
}
from
'../../api/customer'
;
import
{
replaceIllegalPwd
}
from
'../../utils/pwd'
;
type
PageOwnProps
=
{};
type
PageOwnProps
=
{};
type
PageState
=
{
type
PageState
=
{
...
@@ -40,6 +41,14 @@ class ResetPwd extends Component {
...
@@ -40,6 +41,14 @@ class ResetPwd extends Component {
};
};
}
}
setPwdValue
(
key
:
string
,
value
:
string
)
{
let
val
=
replaceIllegalPwd
(
value
);
this
.
setState
({
[
key
]:
val
,
});
return
val
;
}
togglePwdBox
()
{
togglePwdBox
()
{
this
.
setState
(({
showPwd
}:
PageState
)
=>
({
this
.
setState
(({
showPwd
}:
PageState
)
=>
({
showPwd
:
!
showPwd
,
showPwd
:
!
showPwd
,
...
@@ -169,12 +178,9 @@ class ResetPwd extends Component {
...
@@ -169,12 +178,9 @@ class ResetPwd extends Component {
placeholder=
'输入6-20位新密码'
placeholder=
'输入6-20位新密码'
maxLength=
{
20
}
maxLength=
{
20
}
value=
{
pwd
}
value=
{
pwd
}
onInput=
{
({
detail
:
{
value
}
})
=>
{
onInput=
{
({
detail
:
{
value
}
})
=>
this
.
setState
({
this
.
setPwdValue
(
'pwd'
,
value
)
pwd
:
value
,
}
});
return
value
;
}
}
/>
/>
<
Image
<
Image
className=
'registerBox-pwdIcon'
className=
'registerBox-pwdIcon'
...
@@ -190,12 +196,9 @@ class ResetPwd extends Component {
...
@@ -190,12 +196,9 @@ class ResetPwd extends Component {
placeholder=
'确认6-20位新密码'
placeholder=
'确认6-20位新密码'
maxLength=
{
20
}
maxLength=
{
20
}
value=
{
checkPwd
}
value=
{
checkPwd
}
onInput=
{
({
detail
:
{
value
}
})
=>
{
onInput=
{
({
detail
:
{
value
}
})
=>
this
.
setState
({
this
.
setPwdValue
(
'checkPwd'
,
value
)
checkPwd
:
value
,
}
});
return
value
;
}
}
/>
/>
<
Image
<
Image
className=
'registerBox-pwdIcon'
className=
'registerBox-pwdIcon'
...
...
src/utils/pwd.ts
0 → 100644
View file @
22320dc2
export
const
replaceIllegalPwd
=
(
val
:
string
)
=>
val
.
replace
(
/
[^
a-zA-Z0-9
]
+/g
,
''
);
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