Merge remote-tracking branch 'origin/master'

dev_forum
杨树明 6 years ago
commit 2d307bdc6d

@ -53,7 +53,7 @@ class CoursesBanner extends Component {
this.onloadupdatabanner() this.onloadupdatabanner()
this.setState({ this.setState({
user_phone_binded :this.props.user_phone_binded, user_phone_binded :this.props.current_user.user_phone_binded,
}) })
} }
onloadupdatabanner=()=>{ onloadupdatabanner=()=>{

@ -149,7 +149,7 @@ class EducoderLogin extends Component {
"align-items": "center", "align-items": "center",
"width": "100%", "width": "100%",
}}> }}>
<div style={{"margin-top": "40px","height":"500px"}}> <div style={{"margin-top": "40px","height":"530px"}}>
<LoginRegisterComponent {...this.props} {...this.state} <LoginRegisterComponent {...this.props} {...this.state}
Setshowbool={this.Setshowbool} ></LoginRegisterComponent> Setshowbool={this.Setshowbool} ></LoginRegisterComponent>
@ -163,7 +163,7 @@ class EducoderLogin extends Component {
"align-items": "center", "align-items": "center",
"width": "100%", "width": "100%",
}}> }}>
<div style={{"margin-top": "40px","height":"500px"}}> <div style={{"margin-top": "40px","height":"530px"}}>
<FindPasswordComponent {...this.props} {...this.state} <FindPasswordComponent {...this.props} {...this.state}
Setshowbool={this.Setshowbool}></FindPasswordComponent> Setshowbool={this.Setshowbool}></FindPasswordComponent>
@ -171,7 +171,7 @@ class EducoderLogin extends Component {
</div> </div>
} }
<div style={{"height":"250px", <div style={{"height":"180px",
"display": "flex", "display": "flex",
"justify-content": "center", "justify-content": "center",
"align-items": "center", "align-items": "center",

@ -12,7 +12,7 @@ import {broadcastChannelPostMessage} from 'educoder'
import {Tabs, Input, Checkbox, Button, notification, Menu} from 'antd'; import {Tabs, Input, Checkbox, Button, notification, Menu} from 'antd';
//试用申请页面 //试用申请
class Trialapplication extends Component { class Trialapplication extends Component {
// isRender控制弹出窗口显示 // isRender控制弹出窗口显示
constructor(props) { constructor(props) {

@ -9,315 +9,315 @@ import './common.css'
const TabPane = Tabs.TabPane const TabPane = Tabs.TabPane
const loginInputsyl = { const loginInputsyl = {
"width": " 100%", "width": " 100%",
"height": "40px", "height": "40px",
} }
//父组件 EducoderLogin.js //父组件 EducoderLogin.js
class LoginRegisterComponent extends Component { class LoginRegisterComponent extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
login: "", login: "",
password: "", password: "",
passwords: "", passwords: "",
seconds: 60, seconds: 60,
codes: "", codes: "",
getverificationcodes: true, getverificationcodes: true,
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
s: 'text', s: 'text',
classpass: "text", classpass: "text",
readonlyInput: true, readonlyInput: true,
} }
} }
openNotification = (messge) => { openNotification = (messge) => {
notification.open({ notification.open({
message: "提示", message: "提示",
description: description:
messge, messge,
onClick: () => { onClick: () => {
console.log('Notification Clicked!'); console.log('Notification Clicked!');
}, },
}); });
}; };
StudyMakeMoney = () => { // 调用父组件方法 StudyMakeMoney = () => { // 调用父组件方法
this.props.Setshowbool(); this.props.Setshowbool();
} }
// 点击表单后改变type // 点击表单后改变type
changeType = () => { changeType = () => {
this.setState({classpass: 'password'}); this.setState({classpass: 'password'});
} }
changeTypey = () => { changeTypey = () => {
} }
//倒计时 //倒计时
getverificationcode = () => { getverificationcode = () => {
if (this.state.Phonenumberisnotcobool === false ||this.state.Phonenumberisnotcobool === undefined) { if (this.state.Phonenumberisnotcobool === false || this.state.Phonenumberisnotcobool === undefined) {
if (this.state.login&&this.state.login.length === 0) { if (this.state.login && this.state.login.length === 0) {
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入手机号或邮箱");
return return
} else { } else {
this.openNotification("请输入正确的手机号或邮箱"); this.openNotification("请输入正确的手机号或邮箱");
} }
return; return;
} }
if (this.state.getverificationcodes === true) { if (this.state.getverificationcodes === true) {
this.setState({ this.setState({
getverificationcodes: undefined, getverificationcodes: undefined,
}) })
let timer = setInterval(() => { let timer = setInterval(() => {
this.setState((preState) => ({ this.setState((preState) => ({
seconds: preState.seconds - 1, seconds: preState.seconds - 1,
}), () => { }), () => {
if (this.state.seconds == 0) { if (this.state.seconds == 0) {
clearInterval(timer); clearInterval(timer);
this.setState({ this.setState({
getverificationcodes: false, getverificationcodes: false,
seconds: 60, seconds: 60,
}) })
} }
}); });
}, 1000) }, 1000)
this.SMSverification(); this.SMSverification();
} else { } else {
this.setState({ this.setState({
getverificationcodes: undefined, getverificationcodes: undefined,
}) })
let timer = setInterval(() => { let timer = setInterval(() => {
this.setState((preState) => ({ this.setState((preState) => ({
seconds: preState.seconds - 1, seconds: preState.seconds - 1,
}), () => { }), () => {
if (this.state.seconds == 0) { if (this.state.seconds == 0) {
clearInterval(timer); clearInterval(timer);
this.setState({ this.setState({
getverificationcodes: false, getverificationcodes: false,
seconds: 60, seconds: 60,
}) })
} }
}); });
}, 1000) }, 1000)
this.SMSverification(); this.SMSverification();
} }
} }
//短信验证 //短信验证
SMSverification = () => { SMSverification = () => {
var url = `/accounts/get_verification_code.json`; var url = `/accounts/get_verification_code.json`;
axios.get((url), { axios.get((url), {
params: { params: {
login: this.state.login, login: this.state.login,
type: 2, type: 2,
} }
}).then((result) => { }).then((result) => {
//验证有问题{"status":1,"message":"success"} //验证有问题{"status":1,"message":"success"}
console.log(result); console.log(result);
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
}) })
} }
cancelReadOnly = () => { cancelReadOnly = () => {
this.setState({ this.setState({
readonlyInput: false, readonlyInput: false,
}) })
} }
//找回密码 //找回密码
Retrievepassword = () => { Retrievepassword = () => {
if (this.state.Phonenumberisnotcobool === false) { if (this.state.Phonenumberisnotcobool === false) {
if (this.state.login.length === 0) { if (this.state.login.length === 0) {
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入手机号或邮箱");
return return
} }
this.openNotification("请输入正确的手机号或邮箱"); this.openNotification("请输入正确的手机号或邮箱");
return; return;
} }
if (this.state.login === undefined || this.state.login == "") { if (this.state.login === undefined || this.state.login == "") {
this.openNotification(`请输入登录手机号码或邮箱`); this.openNotification(`请输入登录手机号码或邮箱`);
return return
} else if (this.state.password === undefined || this.state.password == "") { } else if (this.state.password === undefined || this.state.password == "") {
this.openNotification(`请输入密码`); this.openNotification(`请输入密码`);
return return
} else if (this.state.passwords === undefined || this.state.passwords == "") { } else if (this.state.passwords === undefined || this.state.passwords == "") {
this.openNotification(`请输入密码`); this.openNotification(`请输入密码`);
return return
} else if (this.state.password !== this.state.passwords) { } else if (this.state.password !== this.state.passwords) {
this.openNotification(`两次密码不相同`); this.openNotification(`两次密码不相同`);
return return
} else if (this.state.codes === undefined || this.state.codes == "") { } else if (this.state.codes === undefined || this.state.codes == "") {
this.openNotification(`请输入验证码`); this.openNotification(`请输入验证码`);
return return
} }
var url = "/accounts/reset_password.json"; var url = "/accounts/reset_password.json";
axios.post(url, { axios.post(url, {
login: this.state.login, login: this.state.login,
code: this.state.codes, code: this.state.codes,
new_password: this.state.password, new_password: this.state.password,
new_password_confirmation: this.state.passwords, new_password_confirmation: this.state.passwords,
}).then((result) => { }).then((result) => {
// console.log(result); // console.log(result);
//登录成功会生成session //登录成功会生成session
this.openNotification("找回密码成功,请重新登入。"); this.openNotification("找回密码成功,请重新登入。");
window.location.href = "/login" window.location.href = "/login"
}).catch((error) => { }).catch((error) => {
}) })
} }
openNotification = (messge) => { openNotification = (messge) => {
notification.open({ notification.open({
message: "提示", message: "提示",
description: description:
messge, messge,
onClick: () => { onClick: () => {
console.log('Notification Clicked!'); console.log('Notification Clicked!');
}, },
}); });
}; };
loginInputonChange = (e) => { loginInputonChange = (e) => {
// console.log(e.target.value); // console.log(e.target.value);
this.setState({ this.setState({
login: e.target.value, login: e.target.value,
}) })
} }
loginInputonChanges = (e) => { loginInputonChanges = (e) => {
// console.log(e.target.value); // console.log(e.target.value);
this.setState({ this.setState({
password: e.target.value, password: e.target.value,
}) })
} }
loginInputonChangess = (e) => { loginInputonChangess = (e) => {
// console.log(e.target.value); // console.log(e.target.value);
this.setState({ this.setState({
passwords: e.target.value, passwords: e.target.value,
}) })
} }
//获取code //获取code
codesonChange = (e) => { codesonChange = (e) => {
this.setState({ this.setState({
codes: e.target.value codes: e.target.value
}) })
} }
inputOnBlur = (e) => { inputOnBlur = (e) => {
this.isCorrectname(e.target.value); this.isCorrectname(e.target.value);
// this.Emailphonenumberverification(e.target.value, id); // this.Emailphonenumberverification(e.target.value, id);
} }
isCorrectname = (value) => { isCorrectname = (value) => {
console.log(value.length); console.log(value.length);
if (value.length === 0) { if (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();
var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; 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的任意数字。 // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。
var stringdata = undefined; var stringdata = undefined;
if (!regph.test(value)) { if (!regph.test(value)) {
stringdata = "手机号格式不正确"; stringdata = "手机号格式不正确";
this.setState({ this.setState({
Phonenumberisnotco: stringdata, Phonenumberisnotco: stringdata,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
}) })
} else { } else {
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
}) })
return return
} }
if (!regemail.test(value)) { if (!regemail.test(value)) {
if ((value.indexOf("@") != -1) === true) { if ((value.indexOf("@") != -1) === true) {
stringdata = "邮箱格式不正确"; stringdata = "邮箱格式不正确";
} else { } else {
stringdata = "手机号格式不正确"; stringdata = "手机号格式不正确";
} }
this.setState({ this.setState({
Phonenumberisnotco: stringdata, Phonenumberisnotco: stringdata,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
}) })
this.Emailphonenumberverification(value) this.Emailphonenumberverification(value)
return return
} else { } else {
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
}) })
return return
} }
} }
//邮箱手机号验证 //邮箱手机号验证
Emailphonenumberverification = (value) => { Emailphonenumberverification = (value) => {
var url = `/accounts/valid_email_and_phone.json`; var url = `/accounts/valid_email_and_phone.json`;
axios.get((url), { axios.get((url), {
params: { params: {
login: value, login: value,
type: 2, type: 2,
} }
}).then((result) => { }).then((result) => {
//验证有问题{"status":1,"message":"success"} //验证有问题{"status":1,"message":"success"}
// console.log(result); // console.log(result);
this.openNotification("验证码已发送,请注意查收!",2); this.openNotification("验证码已发送,请注意查收!", 2);
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
// this.setState({ // this.setState({
// login:"", // login:"",
// logins:"", // logins:"",
// }) // })
}) })
} }
render() { render() {
const { const {
activeKey, activeKey,
// 登录 // 登录
autoLogin, autoLogin,
// 注册 // 注册
readAgreement, dragOk, readAgreement, dragOk,
login, login,
password, password,
passwords, passwords,
classpass, classpass,
seconds, seconds,
getverificationcodes, getverificationcodes,
Phonenumberisnotco, Phonenumberisnotco,
readonlyInput, readonlyInput,
codes, codes,
} = this.state } = this.state
// height: 346px; // height: 346px;
return ( return (
<div className="login_register_content" style={{height: "482px"}}> <div className="login_register_content" style={{height: "520px"}}>
<Input type="text" name="username" value={"namename"} <Input type="text" name="username" value={"namename"}
style={{height: '0', width: '0', border: 'none', display: "none"}}/> style={{height: '0', width: '0', border: 'none', display: "none"}}/>
<Input type="password" name="password" id="password" value={"123123123"} <Input type="password" name="password" id="password" value={"123123123"}
style={{height: '0', width: '0', border: 'none', display: "none"}}/> style={{height: '0', width: '0', border: 'none', display: "none"}}/>
<style>{` <style>{`
.login_section .section_header { .login_section .section_header {
margin-bottom: 16px; margin-bottom: 16px;
@ -339,15 +339,14 @@ class LoginRegisterComponent extends Component {
`}</style> `}</style>
<div className="login_section">
<div className="login_section"> <div className="section_header font-18" style={{color:"#05101A"}}>
<div className="section_header"> 找回密码
找回密码 </div>
</div> <div style={{width: '340px'}}>
<div style={{width: '340px'}}> <style>
<style> {
{ `
`
.ant-input { .ant-input {
font-family: "Monospaced Number", "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Monospaced Number", "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
@ -372,73 +371,74 @@ class LoginRegisterComponent extends Component {
transition: all .3s; transition: all .3s;
} }
` `
} }
</style> </style>
<Input style={loginInputsyl} type="text" autoComplete="off" onClick={this.changeTypey} <Input style={loginInputsyl} type="text" autoComplete="off" onClick={this.changeTypey}
className={"loginInputzhuche"} className={"loginInputzhuche"}
placeholder="输入注册手机号或邮箱" value={this.state.login} onBlur={(e) => this.inputOnBlur(e)} placeholder="输入注册手机号或邮箱" value={this.state.login} onBlur={(e) => this.inputOnBlur(e)}
onChange={this.loginInputonChange} style={{marginTop: '10px',height: "38px"}}></Input> onChange={this.loginInputonChange} style={{marginTop: '10px', height: "38px"}}></Input>
{ {
Phonenumberisnotco && Phonenumberisnotco != "" ? Phonenumberisnotco && Phonenumberisnotco != "" ?
<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:"center",width: " 100%"}}>{Phonenumberisnotco}</span> <span className="fl" style={{textAlign: "center", width: " 100%"}}>{Phonenumberisnotco}</span>
</p> </p>
: <div style={{height: "25px"}}></div> : <div style={{height: "25px"}}></div>
} }
<DragValidator <DragValidator
height={38} successGreenColor="#45E15F" height={38} successGreenColor="#45E15F"
style={{height:"38px",width:"100%"}} style={{height: "38px", width: "100%"}}
dragOkCallback={this.dragOkCallback} dragOkCallback={this.dragOkCallback}
></DragValidator> ></DragValidator>
<Input type={classpass} <Input type={classpass}
className={"loginInputzhuche"} className={"loginInputzhuche"}
onClick={this.changeType} autoComplete="new-password" onChange={this.loginInputonChanges} onClick={this.changeType} autoComplete="new-password" onChange={this.loginInputonChanges}
value={this.state.password} style={{width:"100%",height:"38px",marginTop:'25px'}} placeholder="输入8~16位密码区分大小写"></Input> value={this.state.password} style={{width: "100%", height: "38px", marginTop: '25px'}}
<Input type={classpass} placeholder="输入8~16位密码区分大小写"></Input>
className={"loginInputzhuche"} <Input type={classpass}
onClick={this.changeType} autoComplete="new-password" className={"loginInputzhuche"}
onChange={this.loginInputonChangess} value={this.state.passwords} onClick={this.changeType} autoComplete="new-password"
style={{height:"38px",marginTop:'25px',width:"100%"}} onChange={this.loginInputonChangess} value={this.state.passwords}
placeholder="再次输入新密码"></Input> style={{height: "38px", marginTop: '25px', width: "100%"}}
placeholder="再次输入新密码"></Input>
<div className={"mt25"}>
<Input className="fl mr5 loginInputzhuche" type="text" autoComplete="off" style={{ <div className={"mt25"}>
width: "210px", <Input className="fl mr5 loginInputzhuche" type="text" autoComplete="off" style={{
height: "38px", width: "210px",
}} placeholder="请输入验证码" height: "38px",
onChange={this.codesonChange} }} placeholder="请输入验证码"
value={codes} onChange={this.codesonChange}
> value={codes}
</Input> >
{ </Input>
getverificationcodes === undefined ? {
<Button className="fl ml5 " disabled getverificationcodes === undefined ?
style={{"width": "120px", "text-align": "center", "height": "45px",}} <Button className="fl ml5 " disabled
size={"large"}>重新发送{seconds}s</Button> style={{"width": "120px", "text-align": "center", "height": "45px",}}
: getverificationcodes === true ? size={"large"}>重新发送{seconds}s</Button>
<Button className="fl ml5 " : getverificationcodes === true ?
style={{"width": "120px", "text-align": "center", "height": "45px"}} <Button className="fl ml5 "
type="primary" style={{"width": "120px", "text-align": "center", "height": "45px"}}
onClick={() => this.getverificationcode()} size={"large"}>获取验证码</Button> type="primary"
: onClick={() => this.getverificationcode()} size={"large"}>获取验证码</Button>
<Button className="fl ml5 " :
style={{"width": "120px", "text-align": "center", "height": "45px"}} <Button className="fl ml5 "
type="primary" style={{"width": "120px", "text-align": "center", "height": "45px"}}
onClick={() => this.getverificationcode()} size={"large"}>重新发送</Button> type="primary"
} onClick={() => this.getverificationcode()} size={"large"}>重新发送</Button>
}
</div>
</div>
<Button className="login_btn" size={"large"} type="primary"
style={{height:"46px"}} <Button className="login_btn" size={"large"} type="primary"
onClick={this.Retrievepassword}>完成</Button> style={{height: "46px"}}
</div> onClick={this.Retrievepassword}>完成</Button>
</div> </div>
</div>
</div>
); </div>
} );
}
} }
export default (LoginRegisterComponent); export default (LoginRegisterComponent);

@ -212,8 +212,8 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
}) })
this.Emailphonenumberverification(value, id)
} }
this.Emailphonenumberverification(value, id)
return return
} }
@ -222,8 +222,11 @@ class LoginRegisterComponent extends Component {
stringdata = "邮箱格式不正确"; stringdata = "邮箱格式不正确";
} else { } else {
stringdata = "手机号格式不正确"; stringdata = "手机号格式不正确";
// if (!regph.test(value)) {
} // // 这里先判断是不是手机号然后在判断是不是邮箱然后又判断是不是手机号,如果不是手机号就是账号
// stringdata=undefined;
// }
}
if (id === 1) { if (id === 1) {
this.setState({ this.setState({
Phonenumberisnotco: stringdata, Phonenumberisnotco: stringdata,
@ -234,8 +237,8 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcos: stringdata, Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
}) })
this.Emailphonenumberverification(value, id)
} }
this.Emailphonenumberverification(value, id)
return return
} else { } else {
if (id === 1) { if (id === 1) {
@ -248,8 +251,8 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
}) })
this.Emailphonenumberverification(value, id)
} }
this.Emailphonenumberverification(value, id)
return return
} }
} }
@ -548,13 +551,13 @@ class LoginRegisterComponent extends Component {
// console.log(activeKey); // console.log(activeKey);
return ( return (
<div className="login_register_content" style={ parseInt(tab[0])==0?{height: "346px"} :{height: "462px"}}> <div className="login_register_content" style={ parseInt(tab[0])==0?{height: "346px"} :{height: "490px"}}>
<div> <div>
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}> <Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item key="0">登录</Menu.Item> <Menu.Item key="0" className="font-18" style={{color:"#05101A"}}> 登录</Menu.Item>
<Menu.Item key="1">注册</Menu.Item> <Menu.Item key="1" className="font-18" style={{color:"#05101A"}}>注册</Menu.Item>
</Menu> </Menu>
{ {

Loading…
Cancel
Save