Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.

Commit 7f376ca

Browse files
committed
add register
1 parent 039f5b4 commit 7f376ca

File tree

6 files changed

+68
-7
lines changed

6 files changed

+68
-7
lines changed

src/components/AccessKeys/PopShowKey/PopShowKey.css

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.root {
22
width: 500px;
33
padding: 20px 0;
4-
color: #fff;
4+
color: #000;
55
text-align: center;
66
position: absolute;
77
top: 50%;
88
left: 50%;
99
margin: -165px 0 0 -238px;
10-
background: #008080;
10+
background: #E6E6FA;
1111
}
1212

1313
.close {
@@ -30,3 +30,25 @@ p input {
3030
padding-left: 8px;
3131
background-color: #D3D3D3;
3232
}
33+
34+
.btn {
35+
display: inline-block;
36+
padding: 6px 12px;
37+
margin-bottom: 0;
38+
font-size: 14px;
39+
font-weight: normal;
40+
line-height: 1.42857143;
41+
text-align: center;
42+
white-space: nowrap;
43+
vertical-align: middle;
44+
-ms-touch-action: manipulation;
45+
touch-action: manipulation;
46+
cursor: pointer;
47+
-webkit-user-select: none;
48+
-moz-user-select: none;
49+
-ms-user-select: none;
50+
user-select: none;
51+
background-image: none;
52+
border: 1px solid transparent;
53+
border-radius: 4px;
54+
}

src/components/AccessKeys/PopShowKey/PopShowKey.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class PopShowKey extends Component {
4747
readOnly
4848
/>
4949
</p>
50-
<p><button onClick={this.close} >关闭</button></p>
50+
<p><button className={s.btn} onClick={this.close} >关闭</button></p>
5151
</div>
5252
</Modal>
5353
)

src/components/Register/StepThree/StepThree.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,14 @@
4545
border-color: #0074c2;
4646
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(0, 116, 194, 0.6);
4747
}
48+
49+
.errorTip {
50+
color: red;
51+
margin-bottom: 20px;
52+
margin-left: 22%;
53+
}
54+
55+
.errorTip {
56+
color: red;
57+
margin-bottom: 20px;
58+
}

src/components/Register/StepThree/StepThree.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,36 @@ class StepThree extends Component {
2727

2828
constructor() {
2929
super();
30+
this.state = {field1: false, field2: false}
3031
this.setInputPassword = this.setInputPassword.bind(this);
3132
this.setInputPasswordConfirm = this.setInputPasswordConfirm.bind(this);
3233
}
3334

3435
setInputPassword(event) {
36+
this.setState({field1: true});
3537
this.props.passwordInputChange(event.target.value);
3638
}
3739

3840
setInputPasswordConfirm(event) {
41+
this.setState({field2: true});
3942
this.props.passwordConfirmInputChange(event.target.value);
4043
}
4144

4245
render() {
4346
let self = this;
47+
let passwordTips = '';
48+
let passwordConfirmTips = '';
49+
if (this.state.field1 && this.props.password.length < 6) {
50+
passwordTips = '密码长度至少为6位'
51+
}
52+
if (this.state.field2 && !_.eq(this.props.passwordConfirm, this.props.password) ) {
53+
passwordConfirmTips = '确认密码和密码不一致'
54+
}
55+
let isValidate = false;
56+
if (this.props.password.length>=6
57+
&& _.eq(this.props.passwordConfirm, this.props.password)) {
58+
isValidate = true;
59+
}
4460
return (
4561
<div className={s.root}>
4662
<div className={s.container}>
@@ -51,33 +67,38 @@ class StepThree extends Component {
5167
<input
5268
className={s.input}
5369
onChange={this.setInputPassword}
70+
onBlur={()=>this.setState({field1: true})}
5471
id="password"
5572
type="password"
5673
value={this.props.password}
5774
placeholder="请输入密码"
5875
autoFocus
5976
/>
6077
</div>
78+
<div className={s.errorTip}>{passwordTips}</div>
6179
<div className={s.formGroup}>
6280
<label className={s.label} htmlFor="passwordConfirm">
6381
确认密码:
6482
</label>
6583
<input
6684
className={s.input}
6785
onChange={this.setInputPasswordConfirm}
86+
onBlur={()=>this.setState({field2: true})}
6887
id="passwordConfirm"
6988
type="password"
7089
value={this.props.passwordConfirm}
7190
placeholder="请再次输入密码"
7291
/>
7392
</div>
93+
<div className={s.errorTip}>{passwordConfirmTips}</div>
7494
<br/>
95+
<div className={s.errorTip2}>{_.get(this.props, 'error.message')}</div>
7596
<div className={s.formGroup}>
7697
<Button
77-
style={this.props.isChecking ? { backgroundColor:'grey' } : null }
98+
style={this.props.isFetching || !isValidate ? { backgroundColor:'grey' } : null }
7899
value="注册"
79100
onClick={()=>{
80-
if (self.props.isChecking) {
101+
if (self.props.isFetching || !isValidate) {
81102
return;
82103
}
83104
self.props.submit();

src/components/Register/StepTwo/StepTwo.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,8 @@
7676
margin-left: 8px;
7777
text-align: center;
7878
}
79+
80+
.errorTip {
81+
color: red;
82+
margin-bottom: 20px;
83+
}

src/components/Register/StepTwo/StepTwo.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class StepTwo extends Component {
3030
}
3131

3232
componentDidMount() {
33-
if (60 - (parseInt(moment().format('X')) - this.props.lastSendTime) <= 0){
33+
if (120 - (parseInt(moment().format('X')) - this.props.lastSendTime) <= 0){
3434
this.props.sendValidateCode();
3535
}
3636
}
@@ -46,7 +46,7 @@ class StepTwo extends Component {
4646

4747
render() {
4848
let self = this;
49-
let leftTime = 60 - (parseInt(moment().format('X')) - this.props.lastSendTime);
49+
let leftTime = 120 - (parseInt(moment().format('X')) - this.props.lastSendTime);
5050
let isValidate = this.props.validateCode ? true : false;
5151
let countDownView = (
5252
<Countdown
@@ -99,6 +99,8 @@ class StepTwo extends Component {
9999
/>
100100
{countDownView}
101101
</div>
102+
<br/>
103+
<div className={s.errorTip}>{_.get(this.props, 'error.message')}</div>
102104
<div className={s.formGroup}>
103105
<Button
104106
style={this.props.isChecking || !isValidate ? { backgroundColor:'grey' } : null }

0 commit comments

Comments
 (0)