From 955af9db26316387c3c9f44112d798edaad08470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 18 Oct 2019 16:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=99=BB=E5=BD=95=E6=B3=A8?= =?UTF-8?q?=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/user/FindPasswordComponent.js | 10 +- .../modules/user/LoginRegisterComponent.js | 249 +++++++----------- 2 files changed, 95 insertions(+), 164 deletions(-) diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js index e95ea2b7f..b6e9dda22 100644 --- a/public/react/src/modules/user/FindPasswordComponent.js +++ b/public/react/src/modules/user/FindPasswordComponent.js @@ -594,10 +594,7 @@ class LoginRegisterComponent extends Component { }) } - gobackshowbool=()=>{ - this.props.history.push("/login"); - this.props.Setshowbool(1) - } + render() { const { // 登录 @@ -624,7 +621,7 @@ class LoginRegisterComponent extends Component { // height: 346px; return ( -
+
this.StudyMakeMoney()} @@ -804,9 +801,6 @@ class LoginRegisterComponent extends Component { -

- this.gobackshowbool()}>返回登录注册 -

diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index b1e6d14da..4e2f0ee5b 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -48,7 +48,7 @@ class LoginRegisterComponent extends Component { readAgreement: false, getverificationcodes: true, dragOk: false, - Agreetotheterms: true, + // Agreetotheterms: true, login: "", password: "", logins: "", @@ -67,7 +67,7 @@ class LoginRegisterComponent extends Component { MyEduCoderModals:false, registered:undefined, Phonenumberisnotcodmms:undefined, - weixinlogin:false, + } } if(props.loginstatus === false){ @@ -86,7 +86,7 @@ class LoginRegisterComponent extends Component { readAgreement: false, getverificationcodes: true, dragOk: false, - Agreetotheterms: true, + // Agreetotheterms: true, login: "", password: "", logins: "", @@ -105,7 +105,6 @@ class LoginRegisterComponent extends Component { MyEduCoderModals:false, registered:undefined, Phonenumberisnotcodmms:undefined, - weixinlogin:false, } } @@ -130,46 +129,21 @@ class LoginRegisterComponent extends Component { changeType = () => { this.setState({classpass: 'password'}); } - IsPC=()=>{ - var userAgentInfo = navigator.userAgent; - var Agents = ["Android", "iPhone", - "SymbianOS", "Windows Phone", - "iPad", "iPod"]; - var flag = true; - for (var v = 0; v < Agents.length; v++) { - if (userAgentInfo.indexOf(Agents[v]) > 0) { - flag = false; - break; - } - } - return flag; - } componentDidMount = () => { - let flag = this.IsPC(); //true为PC端,false为手机端 - this.setState({ - isphone:false - }) // console.log("componentDidUpdate"); // console.log(this.props); let pcipns=this.IsPC(); if (this.props.match.url === "/login") { console.log("11111111111111111111111111"); - // this.state = { - // tab:["0"], - // - // } - this.setState({ - tab:["0"] - }) + this.state = { + tab: ["0"], + + } } else if (this.props.match.url === "/register") { - console.log("11111111111111111111111111"); - // this.state = { - // tab:["1"], - // - // } - this.setState({ - tab:["1"] - }) + this.state = { + tab: ["1"], + + } } this.setState({ pciphone:pcipns, @@ -319,11 +293,11 @@ class LoginRegisterComponent extends Component { // -------------------- REGISTER END //是否同意 - onChange = (e) => { - this.setState({ - Agreetotheterms: e.target.checked, - }) - } + // onChange = (e) => { + // this.setState({ + // Agreetotheterms: e.target.checked, + // }) + // } //登入接口 postLogin = () => { @@ -450,13 +424,14 @@ class LoginRegisterComponent extends Component { } } - if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) { - // this.openNotification(`请输入验证码`,2); - this.setState({ - Phonenumberisnotcosyzm:"验证码不能为空", - }) - return - } else if (this.state.passwords === undefined || this.state.passwords == "" ||this.state.passwords.length===0) { + // if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) { + // // this.openNotification(`请输入验证码`,2); + // this.setState({ + // Phonenumberisnotcosyzm:"验证码不能为空", + // }) + // return + // } else + if (this.state.passwords === undefined || this.state.passwords == "" || this.state.passwords.length === 0) { this.setState({ Phonenumberisnotcosymmm:"密码不能为空", }) @@ -471,10 +446,11 @@ class LoginRegisterComponent extends Component { Phonenumberisnotcosymmm:"密码不能超过16位", }) return - } else if (this.state.Agreetotheterms === false) { - this.openNotification(`请同意服务协议条款`,2); - return; } + // else if (this.state.Agreetotheterms === false) { + // this.openNotification(`请同意服务协议条款`,2); + // return; + // } var url = "/accounts/register.json"; axios.post(url, { login: this.state.logins, @@ -486,14 +462,14 @@ class LoginRegisterComponent extends Component { if(result.data.message==="验证码不正确"){ this.setState({ Phonenumberisnotcosyzm:"验证码不正确", - }) - + }); + this.openNotification(result.data.message); return; }else if(result.data.message==="验证码已失效"){ this.setState({ - Phonenumberisnotcosyzm:"验证码不正确", + Phonenumberisnotcosyzm: "验证码已失效", }) - + this.openNotification(result.data.message); return; }else { this.openNotification(result.data.message); @@ -712,6 +688,7 @@ class LoginRegisterComponent extends Component { }) } + } //失去焦点判断 inputOnBlur = (e, id) => { @@ -883,18 +860,6 @@ class LoginRegisterComponent extends Component { registered:"注册成功" }) }; - - openweixinlogin=()=>{ - this.setState({ - weixinlogin:true - }) - } - hideweixinlogin=()=>{ - this.setState({ - weixinlogin:false, - tab:["0"] - }) - } render() { const { // 登录 @@ -919,19 +884,17 @@ class LoginRegisterComponent extends Component { readAgreement, pciphone, Phonenumberisnotcodmms, - weixinlogin } = this.state // height: 346px; if (this.state.seconds === 0) { // window.location.href='http://www.cnblogs.com/a-cat/'; } - + console.log(classpass); return ( -
+
- {weixinlogin===false? + 登录 注册 - :""} + { - weixinlogin===false&&parseInt(tab[0])==0 && + parseInt(tab[0]) == 0 &&