调整登录注册

dev_local_2
杨树林 5 years ago
parent 6566e59fd4
commit 955af9db26

@ -594,10 +594,7 @@ class LoginRegisterComponent extends Component {
}) })
} }
gobackshowbool=()=>{
this.props.history.push("/login");
this.props.Setshowbool(1)
}
render() { render() {
const { const {
// 登录 // 登录
@ -624,7 +621,7 @@ class LoginRegisterComponent extends Component {
// height: 346px; // height: 346px;
return ( return (
<div className="login_register_content" > <div className="login_register_content" style={{height: "470px"}}>
<ReadPassword <ReadPassword
modalsType={this.state.modalsType} modalsType={this.state.modalsType}
StudyMakeMoney={()=>this.StudyMakeMoney()} StudyMakeMoney={()=>this.StudyMakeMoney()}
@ -804,9 +801,6 @@ class LoginRegisterComponent extends Component {
<Button size={"large"} type="primary" <Button size={"large"} type="primary"
style={{height:"46px", width: "100%",marginBottom:"26px"}} style={{height:"46px", width: "100%",marginBottom:"26px"}}
onClick={this.Retrievepassword}>完成</Button> onClick={this.Retrievepassword}>完成</Button>
<p className="clearfix mb20 textcenter">
<a className={"startlogin color-blue"} onClick={()=>this.gobackshowbool()}>返回登录注册</a>
</p>
</div> </div>
</div> </div>

@ -48,7 +48,7 @@ class LoginRegisterComponent extends Component {
readAgreement: false, readAgreement: false,
getverificationcodes: true, getverificationcodes: true,
dragOk: false, dragOk: false,
Agreetotheterms: true, // Agreetotheterms: true,
login: "", login: "",
password: "", password: "",
logins: "", logins: "",
@ -67,7 +67,7 @@ class LoginRegisterComponent extends Component {
MyEduCoderModals:false, MyEduCoderModals:false,
registered:undefined, registered:undefined,
Phonenumberisnotcodmms:undefined, Phonenumberisnotcodmms:undefined,
weixinlogin:false,
} }
} }
if(props.loginstatus === false){ if(props.loginstatus === false){
@ -86,7 +86,7 @@ class LoginRegisterComponent extends Component {
readAgreement: false, readAgreement: false,
getverificationcodes: true, getverificationcodes: true,
dragOk: false, dragOk: false,
Agreetotheterms: true, // Agreetotheterms: true,
login: "", login: "",
password: "", password: "",
logins: "", logins: "",
@ -105,7 +105,6 @@ class LoginRegisterComponent extends Component {
MyEduCoderModals:false, MyEduCoderModals:false,
registered:undefined, registered:undefined,
Phonenumberisnotcodmms:undefined, Phonenumberisnotcodmms:undefined,
weixinlogin:false,
} }
} }
@ -130,46 +129,21 @@ class LoginRegisterComponent extends Component {
changeType = () => { changeType = () => {
this.setState({classpass: 'password'}); 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 = () => { componentDidMount = () => {
let flag = this.IsPC(); //true为PC端false为手机端
this.setState({
isphone:false
})
// console.log("componentDidUpdate"); // console.log("componentDidUpdate");
// console.log(this.props); // console.log(this.props);
let pcipns=this.IsPC(); let pcipns=this.IsPC();
if (this.props.match.url === "/login") { if (this.props.match.url === "/login") {
console.log("11111111111111111111111111"); console.log("11111111111111111111111111");
// this.state = { this.state = {
// tab:["0"], tab: ["0"],
//
// } }
this.setState({
tab:["0"]
})
} else if (this.props.match.url === "/register") { } else if (this.props.match.url === "/register") {
console.log("11111111111111111111111111"); this.state = {
// this.state = { tab: ["1"],
// tab:["1"],
// }
// }
this.setState({
tab:["1"]
})
} }
this.setState({ this.setState({
pciphone:pcipns, pciphone:pcipns,
@ -319,11 +293,11 @@ class LoginRegisterComponent extends Component {
// -------------------- REGISTER END // -------------------- REGISTER END
//是否同意 //是否同意
onChange = (e) => { // onChange = (e) => {
this.setState({ // this.setState({
Agreetotheterms: e.target.checked, // Agreetotheterms: e.target.checked,
}) // })
} // }
//登入接口 //登入接口
postLogin = () => { postLogin = () => {
@ -450,13 +424,14 @@ class LoginRegisterComponent extends Component {
} }
} }
if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) { // if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) {
// this.openNotification(`请输入验证码`,2); // // this.openNotification(`请输入验证码`,2);
this.setState({ // this.setState({
Phonenumberisnotcosyzm:"验证码不能为空", // Phonenumberisnotcosyzm:"验证码不能为空",
}) // })
return // return
} else if (this.state.passwords === undefined || this.state.passwords == "" ||this.state.passwords.length===0) { // } else
if (this.state.passwords === undefined || this.state.passwords == "" || this.state.passwords.length === 0) {
this.setState({ this.setState({
Phonenumberisnotcosymmm:"密码不能为空", Phonenumberisnotcosymmm:"密码不能为空",
}) })
@ -471,10 +446,11 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcosymmm:"密码不能超过16位", Phonenumberisnotcosymmm:"密码不能超过16位",
}) })
return 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"; var url = "/accounts/register.json";
axios.post(url, { axios.post(url, {
login: this.state.logins, login: this.state.logins,
@ -486,14 +462,14 @@ class LoginRegisterComponent extends Component {
if(result.data.message==="验证码不正确"){ if(result.data.message==="验证码不正确"){
this.setState({ this.setState({
Phonenumberisnotcosyzm:"验证码不正确", Phonenumberisnotcosyzm:"验证码不正确",
}) });
this.openNotification(result.data.message);
return; return;
}else if(result.data.message==="验证码已失效"){ }else if(result.data.message==="验证码已失效"){
this.setState({ this.setState({
Phonenumberisnotcosyzm:"验证码不正确", Phonenumberisnotcosyzm: "验证码已失效",
}) })
this.openNotification(result.data.message);
return; return;
}else { }else {
this.openNotification(result.data.message); this.openNotification(result.data.message);
@ -712,6 +688,7 @@ class LoginRegisterComponent extends Component {
}) })
} }
} }
//失去焦点判断 //失去焦点判断
inputOnBlur = (e, id) => { inputOnBlur = (e, id) => {
@ -883,18 +860,6 @@ class LoginRegisterComponent extends Component {
registered:"注册成功" registered:"注册成功"
}) })
}; };
openweixinlogin=()=>{
this.setState({
weixinlogin:true
})
}
hideweixinlogin=()=>{
this.setState({
weixinlogin:false,
tab:["0"]
})
}
render() { render() {
const { const {
// 登录 // 登录
@ -919,19 +884,17 @@ class LoginRegisterComponent extends Component {
readAgreement, readAgreement,
pciphone, pciphone,
Phonenumberisnotcodmms, Phonenumberisnotcodmms,
weixinlogin
} = this.state } = this.state
// height: 346px; // height: 346px;
if (this.state.seconds === 0) { if (this.state.seconds === 0) {
// window.location.href='http://www.cnblogs.com/a-cat/'; // window.location.href='http://www.cnblogs.com/a-cat/';
} }
console.log(classpass);
return ( return (
<div className="login_register_content login_register_contents" <div className="login_register_content login_register_contents"
// style={ parseInt(tab[0])==0?{height: "366px"} :{height: "510px"}} style={parseInt(tab[0]) == 0 ? {height: "366px"} : {height: "398px"}}>
>
<style> <style>
{ {
` `
@ -944,13 +907,13 @@ class LoginRegisterComponent extends Component {
</style> </style>
<div> <div>
{weixinlogin===false?<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab} className="mt20"> <Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab} className="mt20">
<Menu.Item key="0" className={tab===0?"active font-18":"font-18"} > 登录</Menu.Item> <Menu.Item key="0" className={tab===0?"active font-18":"font-18"} > 登录</Menu.Item>
<Menu.Item key="1" className={tab===1?"active font-18 ":"font-18 "} style={{marginLeft:"10px"}} >注册</Menu.Item> <Menu.Item key="1" className={tab===1?"active font-18 ":"font-18 "} style={{marginLeft:"10px"}} >注册</Menu.Item>
</Menu>:""} </Menu>
{ {
weixinlogin===false&&parseInt(tab[0])==0 && parseInt(tab[0]) == 0 &&
<div style={{width: '340px'}}> <div style={{width: '340px'}}>
<style> <style>
{ {
@ -1033,29 +996,20 @@ class LoginRegisterComponent extends Component {
<Button className="login_btn font-16" type="primary" style={{height:"46px"}} onClick={() => this.postLogin()} <Button className="login_btn font-16" type="primary" style={{height:"46px"}} onClick={() => this.postLogin()}
size={"large"}>登录</Button> size={"large"}>登录</Button>
{/*{this.state.isphone===true?<p className="clearfix mb10 textcenter">*/}
{/*<span className={"startlogin"}>———————— 快速登录 ————————</span>*/}
{/* <div className={"mt10"}>*/}
{/* <a onClick={()=>this.openweixinlogin()}>*/}
{/* <img src={require('./img/WeChat.png')} alt="微信登录"/>*/}
{/* </a>*/}
{/* </div>*/}
{/*</p>:""}*/}
</div> </div>
} }
{ {
weixinlogin===false&&parseInt(tab[0])==1 && parseInt(tab[0]) == 1 &&
<div style={{width: '340px'}}> <div style={{width: '340px'}}>
<Input placeholder="请使用手机号/邮箱账号进行注册" <Input placeholder="请使用手机号/邮箱账号进行注册"
className={Phonenumberisnotcos && Phonenumberisnotcos !== "" ?" color-grey-9 loginInputzhucheyslass bor-reds":" color-grey-9 loginInputzhuche"} className={Phonenumberisnotcos && Phonenumberisnotcos !== "wdrag335" ? " color-grey-9 wdrag335 loginInputzhucheyslass bor-reds" : " color-grey-9 wdrag335 loginInputzhuche"}
value={this.state.logins} value={this.state.logins}
type="text" autoComplete="off" type="text" autoComplete="off"
onChange={this.loginInputonChanges} onChange={this.loginInputonChanges}
// onBlur={(e) => this.inputOnBlurzhuche(e, 2)} // onBlur={(e) => this.inputOnBlurzhuche(e, 2)}
style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}></Input> style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}></Input>
{ {
Phonenumberisnotcos && Phonenumberisnotcos !== "" ? Phonenumberisnotcos && Phonenumberisnotcos !== "" ?
<p className="color-red mt5 mb5 " style={{width: " 100%", height: "20px"}}> <p className="color-red mt5 mb5 " style={{width: " 100%", height: "20px"}}>
@ -1106,43 +1060,42 @@ class LoginRegisterComponent extends Component {
</div> </div>
{/*<div className="yslbutondls " style={{display: "none"}}>*/}
<div className="yslbutondls">
{/* <Input*/}
<Input {/* className={Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ?" mr5 font-14 color-grey-9 loginInputzhucheyslass bor-reds":" mr5 font-14 color-grey-9 loginInputzhuche"}*/}
className={Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ?" mr5 font-14 color-grey-9 loginInputzhucheyslass bor-reds":" mr5 font-14 color-grey-9 loginInputzhuche"} {/* name="codes" type="text" autoComplete="off" readonly*/}
name="codes" type="text" autoComplete="off" readonly {/* onfocus="this.removeAttribute('readonly')" style={{*/}
onfocus="this.removeAttribute('readonly')" style={{ {/* width:'210px',*/}
width:'210px', {/* height:'38px',*/}
height:'38px', {/* }} placeholder="请输入验证码"*/}
}} placeholder="请输入验证码" {/* onChange={this.codesonChange}*/}
onChange={this.codesonChange} {/* value={codes}*/}
value={codes} {/* >*/}
> {/* </Input>*/}
</Input> {/* {*/}
{ {/* getverificationcodes === undefined ?*/}
getverificationcodes === undefined ? {/* <Button className=" ml5 font-14" disabled style={{"width": "120px","text-align":"center", "height": "45px",}}*/}
<Button className=" ml5 font-14" disabled style={{"width": "120px","text-align":"center", "height": "45px",}} {/* size={"large"}>重新发送{seconds}s</Button>*/}
size={"large"}>重新发送{seconds}s</Button> {/* : getverificationcodes === true ?*/}
: getverificationcodes === true ? {/* <Button className=" ml5 font-14" type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}}*/}
<Button className=" ml5 font-14" type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}} {/* onClick={() => this.getverificationcode()} size={"large"}>获取验证码</Button>*/}
onClick={() => this.getverificationcode()} size={"large"}>获取验证码</Button> {/* :*/}
: {/* <Button className=" ml5 font-14 " type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}}*/}
<Button className=" ml5 font-14 " type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}} {/* onClick={() => this.getverificationcode()} size={"large"}>重新发送</Button>*/}
onClick={() => this.getverificationcode()} size={"large"}>重新发送</Button> {/* }*/}
}
{/*</div>*/}
</div> {/*<div style={{display: "none"}}>*/}
<div> {/* {*/}
{ {/* Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ?*/}
Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ? {/* <p className="color-red mt5 mb5 " style={{width: " 100%", height: "20px"}}>*/}
<p className="color-red mt5 mb5 " style={{width: " 100%", height: "20px"}}> {/* <span className="fl" style={{textAlign:"left",width: " 100%"}}>{Phonenumberisnotcosyzm}</span>*/}
<span className="fl" style={{textAlign:"left",width: " 100%"}}>{Phonenumberisnotcosyzm}</span> {/* </p>*/}
</p> {/* : <div style={{height:"25px"}}></div>*/}
: <div style={{height:"25px"}}></div>
{/* }*/}
} {/*</div>*/}
</div>
@ -1183,39 +1136,23 @@ class LoginRegisterComponent extends Component {
: <div style={{height:"25px"}}></div> : <div style={{height:"25px"}}></div>
} }
<Checkbox onChange={this.onChange} {/*<Checkbox onChange={this.onChange}*/}
checked={Agreetotheterms} {/* checked={Agreetotheterms}*/}
><span className="font-14 " style={{ {/*><span className="font-14 " style={{*/}
color: '#676767', {/* color: '#676767',*/}
}}>我已阅读并同意 {/*}}>我已阅读并同意*/}
<span> {/* <span>*/}
<a href={'https://forge.educoder.net/help?index=4'} target="_blank" className={"color-blue"}>服务协议条款</a> {/* <a href={'/help?index=4'} target="_blank" >《服务协议条款》</a>*/}
</span></span></Checkbox> {/* </span></span></Checkbox>*/}
<Button className=" font-16 mb20" type="primary" style={{height:"46px", width: "100%",marginTop:"26px"}} onClick={() => this.postregistered()} <Button className=" font-16 wdrag335" type="primary"
style={{height: "46px", width: "100%", marginTop: "9px"}}
onClick={() => this.postregistered()}
size={"large"}>注册</Button> size={"large"}>注册</Button>
{/*{this.state.isphone===true?<p className="clearfix mb10 textcenter">*/}
{/* <span className={"startlogin"}>———————— 快速登录 ————————</span>*/}
{/* <div className={"mt10"}>*/}
{/* <a onClick={()=>this.openweixinlogin()}>*/}
{/* <img src={require('./img/WeChat.png')} alt="微信登录"/>*/}
{/* </a>*/}
{/* </div>*/}
{/*</p>:""}*/}
</div> </div>
} }
{weixinlogin===true?<iframe
className={"weixinheight390 mt20"}
frameBorder="0"
sandbox="allow-scripts allow-same-origin allow-top-navigation"
scrolling="no"
src={`https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginstart&response_type=code&scope=snsapi_login#wechat_redirect`}></iframe>:""}
{weixinlogin===true?<p className="clearfix mb20 textcenter">
<a className={"startlogin color-blue"} onClick={()=>this.hideweixinlogin()}>返回登录注册</a>
</p>:""}
</div> </div>
</div> </div>
); );
} }

Loading…
Cancel
Save