From c74b55e38fff8e4e2e98693f9caa7ebf20ae3266 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sat, 20 Jul 2019 12:29:22 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/user/FindPasswordComponent.js | 72 +++++++++++++++----
.../modules/user/LoginRegisterComponent.js | 47 +++++++++---
2 files changed, 98 insertions(+), 21 deletions(-)
diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js
index 7542bc4ee..18243ea4a 100644
--- a/public/react/src/modules/user/FindPasswordComponent.js
+++ b/public/react/src/modules/user/FindPasswordComponent.js
@@ -42,11 +42,32 @@ class LoginRegisterComponent extends Component {
dragOk: false,
Whethertoverify:false,
modalsType:false,
-
+ pciphone:true,
}
}
+ //判断是否是手机端
+ IsPC=()=> {
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone",
+ "SymbianOS", "Windows Phone",
+ "iPad", "iPod"];
+ var flag = true;//这个意思是说自己的是pc 端
+ for (var v = 0; v < Agents.length; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+ }
+ componentDidMount = () => {
+ let pcipns=this.IsPC();
+ this.setState({
+ pciphone:pcipns,
+ })
+ }
openNotification = (messge) => {
notification.open({
message: "提示",
@@ -170,13 +191,16 @@ class LoginRegisterComponent extends Component {
})
return
}
- if (this.state.dragOk === false) {
- // this.openNotification(`请拖动滑块完成验证`,2);
- this.setState({
- Phonenumberisnotcosytdhk:"请拖动滑块完成验证",
- })
- return
+ if(this.state.pciphone===true){
+ if (this.state.dragOk === false) {
+ // this.openNotification(`请拖动滑块完成验证`,2);
+ this.setState({
+ Phonenumberisnotcosytdhk:"请拖动滑块完成验证",
+ })
+ return
+ }
}
+
if (this.state.password === undefined || this.state.password.length ===0 || this.state.password === "") {
this.setState({
Phonenumberisnotcosmmm:"密码不能为空",
@@ -379,9 +403,8 @@ class LoginRegisterComponent extends Component {
return
}
}
- //是否验证通过
- dragOkCallback = () => {
- console.log(this.state.login);
+
+ inputOnBlurzhuche = (e)=>{
if(this.state.login===""||this.state.login.length===0){
this.setState({
Phonenumberisnotco: "账号不能为空",
@@ -394,7 +417,28 @@ class LoginRegisterComponent extends Component {
this.setState({
Phonenumberisnotcosytdhk:undefined,
})
- this.Emailphonenumberverification(this.state.login)
+ this.Emailphonenumberverification(e.target.value)
+ }
+ //是否验证通过
+ dragOkCallback = () => {
+ console.log(this.state.login);
+ if(this.state.pciphone===false) {
+
+ if (this.state.login === "" || this.state.login.length === 0) {
+ this.setState({
+ Phonenumberisnotco: "账号不能为空",
+ Phonenumberisnotcobool: true,
+ dragOk: false,
+ Whethertoverify: this.state.Whethertoverify === true ? false : true,
+ })
+ return
+ }
+ this.setState({
+ Phonenumberisnotcosytdhk: undefined,
+ })
+ this.Emailphonenumberverification(this.state.login)
+
+ }
}
//邮箱手机号验证
@@ -454,6 +498,7 @@ class LoginRegisterComponent extends Component {
readonlyInput,
codes,
Whethertoverify,
+ pciphone,
} = this.state
// height: 346px;
return (
@@ -528,6 +573,7 @@ class LoginRegisterComponent extends Component {
this.inputOnBlurzhuche(e)}
onChange={this.loginInputonChange} style={{marginTop: '10px', height: "38px"}}>
{
Phonenumberisnotco && Phonenumberisnotco !== "" ?
@@ -538,7 +584,7 @@ class LoginRegisterComponent extends Component {
}
{
- Whethertoverify===false?
+ Whethertoverify===false&&pciphone===true?
{
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone",
+ "SymbianOS", "Windows Phone",
+ "iPad", "iPod"];
+ var flag = true;//这个意思是说自己的是pc 端
+ for (var v = 0; v < Agents.length; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+ }
// 点击表单后,改变type
changeType = () => {
this.setState({classpass: 'password'});
@@ -106,17 +123,21 @@ class LoginRegisterComponent extends Component {
componentDidMount = () => {
// console.log("componentDidUpdate");
// console.log(this.props);
+ let pcipns=this.IsPC();
if (this.props.match.url === "/login") {
console.log("11111111111111111111111111");
this.state = {
tab:["0"],
+ pciphone:pcipns,
}
} else if (this.props.match.url === "/register") {
this.state = {
tab:["1"],
+ pciphone:pcipns,
}
}
+
}
openNotification = (messge,type) => {
// type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色
@@ -286,17 +307,20 @@ class LoginRegisterComponent extends Component {
// this.openNotification(`请同意服务协议条款`,2);
// return;
// }
+ if(this.state.pciphone===true){
+ if (this.state.dragOk === false) {
+ // this.openNotification(`请拖动滑块完成验证`,2);
+ this.setState({
+ Phonenumberisnotcosytdhk:"请拖动滑块完成验证",
+ })
+ return
+ }
+ }
if (this.state.logins === undefined || this.state.logins === ""||this.state.logins.length===0) {
this.setState({
Phonenumberisnotcos:"账号不能为空",
})
return
- } else if (this.state.dragOk === false) {
- // this.openNotification(`请拖动滑块完成验证`,2);
- this.setState({
- Phonenumberisnotcosytdhk:"请拖动滑块完成验证",
- })
- return
} else if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) {
// this.openNotification(`请输入验证码`,2);
this.setState({
@@ -557,6 +581,11 @@ class LoginRegisterComponent extends Component {
this.isCorrectname(e.target.value, id);
// this.Emailphonenumberverification(e.target.value, id);
}
+ inputOnBlurzhuche = (e, id) => {
+ if(this.state.pciphone===false) {
+ this.Emailphonenumberverification(e.target.value, id);
+ }
+ }
//获取登入密码
passwordonChange = (e) => {
// console.log(e.target.value);
@@ -673,6 +702,7 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcodmm,
// 注册
readAgreement,
+ pciphone,
} = this.state
// height: 346px;
if (this.state.seconds === 0) {
@@ -780,6 +810,7 @@ class LoginRegisterComponent extends Component {
value={this.state.logins}
type="text" autoComplete="off"
onChange={this.loginInputonChanges}
+ onBlur={(e) => this.inputOnBlurzhuche(e, 2)}
style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}>
{
Phonenumberisnotcos && Phonenumberisnotcos !== "" ?
@@ -790,7 +821,7 @@ class LoginRegisterComponent extends Component {
}
{
- Whethertoverify===false?
+ Whethertoverify===false&&pciphone===true?