dev_forum
杨树林 6 years ago
parent 6903658524
commit 806e81e3a5

@ -94,14 +94,14 @@ class LoginRegisterComponent extends Component {
} }
//倒计时 //倒计时
getverificationcode = () => { getverificationcode = () => {
debugger
if(this.state.login === undefined || this.state.login.length===0){ if(this.state.login === undefined || this.state.login.length===0){
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入手机号或邮箱");
return; return;
} }
//这是判断是否手机正确 //这是判断是否手机正确
if(this.state.Phonenumberisnotcobool === true){ if(this.state.Phonenumberisnotcobool === false){
this.openNotification(this.state.Phonenumberisnotco); this.openNotification(this.state.Phonenumberisnotco);
this.setState({ this.setState({
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
@ -109,7 +109,7 @@ class LoginRegisterComponent extends Component {
return; return;
} }
//拖动滑动验证 //拖动滑动验证
if(this.state.dragOk===undefined||this.state.dragOk === false){ if(this.state.dragOk === false){
this.openNotification("拖动滑块验证"); this.openNotification("拖动滑块验证");
return; return;
} }
@ -180,12 +180,11 @@ class LoginRegisterComponent extends Component {
//找回密码 //找回密码
Retrievepassword = () => { Retrievepassword = () => {
if (this.state.Phonenumberisnotcobool === false) { if (this.state.Phonenumberisnotcobool === false) {
if (this.state.login.length === 0) { this.openNotification(this.state.Phonenumberisnotco);
this.setState({ this.setState({
Phonenumberisnotco:"请输入正确的邮箱或手机号", Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return return;
}
} }
if (this.state.login === undefined|| this.state.login.length ===0 || this.state.login === "") { if (this.state.login === undefined|| this.state.login.length ===0 || this.state.login === "") {
this.setState({ this.setState({
@ -365,7 +364,7 @@ class LoginRegisterComponent extends Component {
if (value.length === 0) { if (value.length === 0) {
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: true,
}) })
return; return;
} }
@ -418,20 +417,20 @@ class LoginRegisterComponent extends Component {
if(this.state.login===""||this.state.login.length===0){ if(this.state.login===""||this.state.login.length===0){
this.setState({ this.setState({
Phonenumberisnotco: "账号不能为空", Phonenumberisnotco: "账号不能为空",
Phonenumberisnotcobool: true, Phonenumberisnotcobool: false,
dragOk:false, dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return return
} }
console.log(e.target.value.length); // console.log(e.target.value.length);
if (e.target.value.length === 0) { // if (e.target.value.length === 0) {
this.setState({ // this.setState({
Phonenumberisnotco: undefined, // Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, // Phonenumberisnotcobool: false,
}) // })
return; // return;
} // }
// var telephone = $("#telephoneAdd.tianjia_phone").val(); // var telephone = $("#telephoneAdd.tianjia_phone").val();
var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/;
// var email = $("#add_email.tianjia_email").val(); // var email = $("#add_email.tianjia_email").val();
@ -485,12 +484,63 @@ class LoginRegisterComponent extends Component {
if (this.state.login === "" || this.state.login.length === 0) { if (this.state.login === "" || this.state.login.length === 0) {
this.setState({ this.setState({
Phonenumberisnotco: "账号不能为空", Phonenumberisnotco: "账号不能为空",
Phonenumberisnotcobool: true, Phonenumberisnotcobool: false,
dragOk: false, dragOk: false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify: this.state.Whethertoverify === true ? false : true,
}) })
return return
} }
// var telephone = $("#telephoneAdd.tianjia_phone").val();
var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/;
// var email = $("#add_email.tianjia_email").val();
var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
// [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。
var stringdata = undefined;
if (!regph.test(this.state.login)) {
stringdata = "手机号格式不正确";
this.setState({
Phonenumberisnotco: stringdata,
Phonenumberisnotcobool: false,
dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true,
})
} else {
this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: true,
dragOk: true,
});
this.Emailphonenumberverification(this.state.login)
return
}
if (!regemail.test(this.state.login)) {
if ((this.state.login.indexOf("@") != -1) === true) {
stringdata = "邮箱格式不正确";
} else {
stringdata = "手机号格式不正确";
}
this.setState({
Phonenumberisnotco: stringdata,
Phonenumberisnotcobool: false,
dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true,
})
return
} else {
this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: true,
dragOk: true,
})
this.Emailphonenumberverification(this.state.login)
return
}
this.setState({ this.setState({
Phonenumberisnotcosytdhk: undefined, Phonenumberisnotcosytdhk: undefined,
}) })
@ -513,7 +563,7 @@ class LoginRegisterComponent extends Component {
console.log(value.length); console.log(value.length);
this.setState({ this.setState({
Phonenumberisnotco: result.data.message, Phonenumberisnotco: result.data.message,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: false,
dragOk:false, dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
@ -521,7 +571,7 @@ class LoginRegisterComponent extends Component {
}else { }else {
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: true,
dragOk:true, dragOk:true,
}) })
return; return;

@ -206,7 +206,65 @@ class LoginRegisterComponent extends Component {
} }
//是否验证通过 //是否验证通过
dragOkCallback = () => { dragOkCallback = () => {
console.log(this.state.logins); debugger
if (this.state.logins.length === 0) {
this.setState({
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false,
dragOk:true,
})
return;
}
// var telephone = $("#telephoneAdd.tianjia_phone").val();
var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/;
// var email = $("#add_email.tianjia_email").val();
var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
// [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。
var stringdata = undefined;
if (!regph.test(this.state.logins)) {
stringdata = "手机号格式不正确";
this.setState({
Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: true,
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
} else {
this.setState({
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false,
dragOk:true,
});
this.Emailphonenumberverification(this.state.logins, 2);
return
}
if (!regemail.test(this.state.logins)) {
if ((this.state.logins.indexOf("@") != -1) === true) {
stringdata = "邮箱格式不正确";
} else {
stringdata = "手机号格式不正确";
}
this.setState({
Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: true,
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
return
} else {
this.setState({
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false,
dragOk:true,
})
this.Emailphonenumberverification(this.state.logins, 2);
return
}
this.setState({ this.setState({
Phonenumberisnotcosytdhk:undefined, Phonenumberisnotcosytdhk:undefined,
}) })
@ -416,7 +474,6 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
dragOk:true, dragOk:true,
}) })
}else { }else {
this.setState({ this.setState({
@ -499,8 +556,9 @@ class LoginRegisterComponent extends Component {
//倒计时 //倒计时
getverificationcode = () => { getverificationcode = () => {
console.log(this.state.Phonenumberisnotcobool); debugger
console.log(this.state.dragOk); // console.log(this.state.Phonenumberisnotcobool);
// console.log(this.state.dragOk);
if(this.state.logins === undefined || this.state.logins.length===0){ if(this.state.logins === undefined || this.state.logins.length===0){
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入手机号或邮箱");
return; return;
@ -513,7 +571,7 @@ class LoginRegisterComponent extends Component {
}) })
return; return;
} }
if(this.state.dragOk===undefined||this.state.dragOk === false){ if(this.state.dragOk === false){
this.openNotification("拖动滑块验证"); this.openNotification("拖动滑块验证");
return; return;
} }
@ -669,6 +727,7 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
}) })
return return
} }
@ -691,6 +750,7 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
}) })
this.Emailphonenumberverification(e.target.value, id); this.Emailphonenumberverification(e.target.value, id);
return return

Loading…
Cancel
Save