调整登录注册

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

@ -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 (
<div className="login_register_content login_register_contents"
// style={ parseInt(tab[0])==0?{height: "366px"} :{height: "510px"}}
>
<div className="login_register_content login_register_contents"
style={parseInt(tab[0]) == 0 ? {height: "366px"} : {height: "398px"}}>
<style>
{
`
@ -944,13 +907,13 @@ class LoginRegisterComponent extends Component {
</style>
<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="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'}}>
<style>
{
@ -1033,29 +996,20 @@ class LoginRegisterComponent extends Component {
<Button className="login_btn font-16" type="primary" style={{height:"46px"}} onClick={() => this.postLogin()}
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>
}
{
weixinlogin===false&&parseInt(tab[0])==1 &&
parseInt(tab[0]) == 1 &&
<div style={{width: '340px'}}>
<Input placeholder="请使用手机号/邮箱账号进行注册"
className={Phonenumberisnotcos && Phonenumberisnotcos !== "" ?" color-grey-9 loginInputzhucheyslass bor-reds":" color-grey-9 loginInputzhuche"}
value={this.state.logins}
type="text" autoComplete="off"
onChange={this.loginInputonChanges}
<Input placeholder="请使用手机号/邮箱账号进行注册"
className={Phonenumberisnotcos && Phonenumberisnotcos !== "wdrag335" ? " color-grey-9 wdrag335 loginInputzhucheyslass bor-reds" : " color-grey-9 wdrag335 loginInputzhuche"}
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"}}></Input>
style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}></Input>
{
Phonenumberisnotcos && Phonenumberisnotcos !== "" ?
<p className="color-red mt5 mb5 " style={{width: " 100%", height: "20px"}}>
@ -1106,43 +1060,42 @@ class LoginRegisterComponent extends Component {
</div>
<div className="yslbutondls">
<Input
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
onfocus="this.removeAttribute('readonly')" style={{
width:'210px',
height:'38px',
}} placeholder="请输入验证码"
onChange={this.codesonChange}
value={codes}
>
</Input>
{
getverificationcodes === undefined ?
<Button className=" ml5 font-14" disabled style={{"width": "120px","text-align":"center", "height": "45px",}}
size={"large"}>重新发送{seconds}s</Button>
: getverificationcodes === true ?
<Button className=" ml5 font-14" type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}}
onClick={() => this.getverificationcode()} size={"large"}>获取验证码</Button>
:
<Button className=" ml5 font-14 " type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}}
onClick={() => this.getverificationcode()} size={"large"}>重新发送</Button>
}
</div>
<div>
{
Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ?
<p className="color-red mt5 mb5 " style={{width: " 100%", height: "20px"}}>
<span className="fl" style={{textAlign:"left",width: " 100%"}}>{Phonenumberisnotcosyzm}</span>
</p>
: <div style={{height:"25px"}}></div>
}
</div>
{/*<div className="yslbutondls " style={{display: "none"}}>*/}
{/* <Input*/}
{/* 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*/}
{/* onfocus="this.removeAttribute('readonly')" style={{*/}
{/* width:'210px',*/}
{/* height:'38px',*/}
{/* }} placeholder="请输入验证码"*/}
{/* onChange={this.codesonChange}*/}
{/* value={codes}*/}
{/* >*/}
{/* </Input>*/}
{/* {*/}
{/* getverificationcodes === undefined ?*/}
{/* <Button className=" ml5 font-14" disabled style={{"width": "120px","text-align":"center", "height": "45px",}}*/}
{/* size={"large"}>重新发送{seconds}s</Button>*/}
{/* : getverificationcodes === true ?*/}
{/* <Button className=" ml5 font-14" type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}}*/}
{/* onClick={() => this.getverificationcode()} size={"large"}>获取验证码</Button>*/}
{/* :*/}
{/* <Button className=" ml5 font-14 " type="primary" style={{"width": "120px","text-align":"center", "height": "45px",}}*/}
{/* onClick={() => this.getverificationcode()} size={"large"}>重新发送</Button>*/}
{/* }*/}
{/*</div>*/}
{/*<div style={{display: "none"}}>*/}
{/* {*/}
{/* Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ?*/}
{/* <p className="color-red mt5 mb5 " style={{width: " 100%", height: "20px"}}>*/}
{/* <span className="fl" style={{textAlign:"left",width: " 100%"}}>{Phonenumberisnotcosyzm}</span>*/}
{/* </p>*/}
{/* : <div style={{height:"25px"}}></div>*/}
{/* }*/}
{/*</div>*/}
@ -1183,39 +1136,23 @@ class LoginRegisterComponent extends Component {
: <div style={{height:"25px"}}></div>
}
<Checkbox onChange={this.onChange}
checked={Agreetotheterms}
><span className="font-14 " style={{
color: '#676767',
}}>我已阅读并同意
<span>
<a href={'https://forge.educoder.net/help?index=4'} target="_blank" className={"color-blue"}>服务协议条款</a>
</span></span></Checkbox>
<Button className=" font-16 mb20" type="primary" style={{height:"46px", width: "100%",marginTop:"26px"}} onClick={() => this.postregistered()}
{/*<Checkbox onChange={this.onChange}*/}
{/* checked={Agreetotheterms}*/}
{/*><span className="font-14 " style={{*/}
{/* color: '#676767',*/}
{/*}}>我已阅读并同意*/}
{/* <span>*/}
{/* <a href={'/help?index=4'} target="_blank" >《服务协议条款》</a>*/}
{/* </span></span></Checkbox>*/}
<Button className=" font-16 wdrag335" type="primary"
style={{height: "46px", width: "100%", marginTop: "9px"}}
onClick={() => this.postregistered()}
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>
}
{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>
);
}

Loading…
Cancel
Save