Merge pull request 'merge' (#241) from caishi/forgeplus-react:gitlink_server into gitlink_server

This commit is contained in:
jasder 2021-10-28 18:26:10 +08:00
commit 48c21ac245
2 changed files with 456 additions and 257 deletions

View File

@ -97,9 +97,9 @@ class EducoderLogin extends Component {
<div style={{cursor:"pointer"}}> <div style={{cursor:"pointer"}}>
{ {
mygetHelmetapi && mygetHelmetapi.login_logo_url ? mygetHelmetapi && mygetHelmetapi.login_logo_url ?
<img style={{cursor:"pointer"}} alt="" onClick={()=>this.gohome()} width="80px" src={getImageUrl(mygetHelmetapi.login_logo_url)}/> <img style={{cursor:"pointer"}} alt="" onClick={()=>this.gohome()} src={getImageUrl(mygetHelmetapi.login_logo_url)}/>
: :
<img style={{cursor:"pointer"}} alt="" onClick={()=>this.gohome()} src={educodernet} width="80px"/> <img style={{cursor:"pointer"}} alt="" onClick={()=>this.gohome()} src={educodernet}/>
} }
</div> </div>
{ {

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, {Component} from 'react';
import { setmiyah, broadcastChannelPostMessage } from 'educoder'; import {setmiyah,broadcastChannelPostMessage} from 'educoder';
import { Tabs, Input, Checkbox, Button, notification, Menu } from 'antd'; import {Tabs, Input, Checkbox, Button, notification,Menu} from 'antd';
import passopen from '../../../src/images/login/passopen.png'; import passopen from '../../../src/images/login/passopen.png';
import passoff from '../../../src/images/login/passoff.png'; import passoff from '../../../src/images/login/passoff.png';
import axios from 'axios'; import axios from 'axios';
@ -12,7 +12,7 @@ import './common.css'
import './commontwo.css' import './commontwo.css'
const { TabPane } = Tabs; const { TabPane } = Tabs;
const loginInputsyl = { const loginInputsyl = {
"width": "434px", "width":"434px",
"height": "462px", "height": "462px",
"-webkit-box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", "-webkit-box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)",
"box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", "box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)",
@ -25,48 +25,15 @@ class LoginRegisterComponent extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
if (props.loginstatus === true) {
this.state = { //
tab: ["0"], // console.log("LoginRegisterComponent");
classpass: "text", // console.log("29");
// 登录 // console.log(props.loginstatus);
passopens: passoff, if(props.loginstatus === true){
seconds: 60,
discodeBtn: false,
clearInterval: false,
autoLogin: true,
classpassbool: false,
// 注册
readAgreement: false,
getverificationcodes: true,
dragOk: false,
Agreetotheterms: true,
login: "",
password: "",
logins: "",
passwords: "",
codes: "",
Phonenumberisnotco: undefined,
Phonenumberisnotcos: undefined,
Phonenumberisnotcosyzm: undefined,
Phonenumberisnotcosymmm: undefined,
Phonenumberisnotcosytdhk: undefined,
Phonenumberisnotcosyfwtk: undefined,
Phonenumberisnotcodmm: undefined,
Phonenumberisnotcobool: false,
Whethertoverify: false,
pciphone: true,
MyEduCoderModals: false,
registered: undefined,
Phonenumberisnotcodmms: undefined,
weixinlogin: false,
qqlogin: false
}
}
if (props.loginstatus === false) {
// console.log(props.loginstatus); // console.log(props.loginstatus);
this.state = { this.state = {
tab: ["1"], tab:["0"],
classpass: "text", classpass: "text",
// 登录 // 登录
passopens: passoff, passopens: passoff,
@ -87,25 +54,64 @@ class LoginRegisterComponent extends Component {
codes: "", codes: "",
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcosyzm: undefined, Phonenumberisnotcosyzm:undefined,
Phonenumberisnotcosymmm: undefined, Phonenumberisnotcosymmm:undefined,
Phonenumberisnotcosytdhk: undefined, Phonenumberisnotcosytdhk:undefined,
Phonenumberisnotcosyfwtk: undefined, Phonenumberisnotcosyfwtk:undefined,
Phonenumberisnotcodmm:undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
Phonenumberisnotcodmm: undefined, Whethertoverify:false,
Whethertoverify: false, pciphone:true,
pciphone: true, MyEduCoderModals:false,
MyEduCoderModals: false, registered:undefined,
registered: undefined, Phonenumberisnotcodmms:undefined,
Phonenumberisnotcodmms: undefined, weixinlogin:false,
weixinlogin: false, qqlogin:false
qqlogin: false }
}
if(props.loginstatus === false){
// console.log(props.loginstatus);
this.state = {
tab:["1"],
classpass: "text",
// 登录
passopens: passoff,
seconds: 60,
discodeBtn: false,
clearInterval: false,
autoLogin: true,
classpassbool: false,
// 注册
readAgreement: false,
getverificationcodes: true,
dragOk: false,
Agreetotheterms: true,
login: "",
password: "",
logins: "",
passwords: "",
codes: "",
Phonenumberisnotco: undefined,
Phonenumberisnotcos: undefined,
Phonenumberisnotcosyzm:undefined,
Phonenumberisnotcosymmm:undefined,
Phonenumberisnotcosytdhk:undefined,
Phonenumberisnotcosyfwtk:undefined,
Phonenumberisnotcobool: false,
Phonenumberisnotcodmm:undefined,
Whethertoverify:false,
pciphone:true,
MyEduCoderModals:false,
registered:undefined,
Phonenumberisnotcodmms:undefined,
weixinlogin:false,
qqlogin:false
} }
} }
} }
//判断是否是手机端 //判断是否是手机端
IsPC = () => { IsPC=()=> {
var userAgentInfo = navigator.userAgent; var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone", "SymbianOS", "Windows Phone",
@ -119,11 +125,11 @@ class LoginRegisterComponent extends Component {
} }
return flag; return flag;
} }
// 点击表单后改变type // 点击表单后改变type
changeType = () => { changeType = () => {
this.setState({ classpass: 'password' }); this.setState({classpass: 'password'});
} }
IsPC = () => { IsPC=()=>{
var userAgentInfo = navigator.userAgent; var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone", "SymbianOS", "Windows Phone",
@ -140,27 +146,37 @@ class LoginRegisterComponent extends Component {
componentDidMount = () => { componentDidMount = () => {
let flag = this.IsPC(); //true为PC端false为手机端 let flag = this.IsPC(); //true为PC端false为手机端
this.setState({ this.setState({
isphone: flag isphone:flag
}) })
let pcipns = this.IsPC(); // console.log("componentDidUpdate");
// console.log(this.props);
let pcipns=this.IsPC();
if (this.props.match.url === "/login") { if (this.props.match.url === "/login") {
// this.state = {
// tab:["0"],
//
// }
this.setState({ this.setState({
tab: ["0"] tab:["0"]
}) })
} else if (this.props.match.url === "/register") { } else if (this.props.match.url === "/register") {
// this.state = {
// tab:["1"],
//
// }
this.setState({ this.setState({
tab: ["1"] tab:["1"]
}) })
} }
this.setState({ this.setState({
pciphone: pcipns, pciphone:pcipns,
}) })
} }
openNotification = (messge, type) => { openNotification = (messge,type) => {
// type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色 // type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色
notification.open({ notification.open({
message: "提示", message: "提示",
@ -183,6 +199,8 @@ class LoginRegisterComponent extends Component {
StudyMakeMoney = () => { // 调用父组件方法 StudyMakeMoney = () => { // 调用父组件方法
// this.props.Setlogins(3);
this.setState({ this.setState({
login: "", login: "",
password: "", password: "",
@ -192,7 +210,7 @@ class LoginRegisterComponent extends Component {
}); });
try { try {
this.props.Setshowbool(3); this.props.Setshowbool(3);
} catch (e) { }catch (e) {
} }
} }
@ -202,7 +220,7 @@ class LoginRegisterComponent extends Component {
// -------------------- LOGIN START // -------------------- LOGIN START
//下次自动登入 //下次自动登入
onAutoLoginChange = (e) => { onAutoLoginChange = (e) => {
this.setState({ autoLogin: e.target.checked }) this.setState({autoLogin: e.target.checked})
} }
// -------------------- LOGIN END // -------------------- LOGIN END
@ -231,19 +249,19 @@ class LoginRegisterComponent extends Component {
} }
// -------------------- REGISTER START // -------------------- REGISTER START
onReadAgreementChange = (e) => { onReadAgreementChange = (e) => {
this.setState({ readAgreement: e.target.checked }) this.setState({readAgreement: e.target.checked})
} }
//是否验证通过 //是否验证通过
dragOkCallback = () => { dragOkCallback = () => {
this.setState({ this.setState({
Phonenumberisnotcosytdhk: undefined, Phonenumberisnotcosytdhk:undefined,
}) })
if (this.state.logins.length === 0) { if (this.state.logins.length === 0) {
this.setState({ this.setState({
Phonenumberisnotcos: "账号不能为空", Phonenumberisnotcos:"账号不能为空",
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
@ -261,14 +279,14 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
dragOk: true, dragOk:true,
}) })
} else { } else {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
dragOk: true, dragOk:true,
}); });
this.Emailphonenumberverification(this.state.logins, 2); this.Emailphonenumberverification(this.state.logins, 2);
return return
@ -284,8 +302,8 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotcos: stringdata, Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}); });
@ -295,14 +313,14 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
dragOk: true, dragOk:true,
}) })
this.Emailphonenumberverification(this.state.logins, 2); this.Emailphonenumberverification(this.state.logins, 2);
return return
} }
this.setState({ this.setState({
Phonenumberisnotcosytdhk: undefined, Phonenumberisnotcosytdhk:undefined,
}) })
this.Emailphonenumberverification(this.state.logins, 2) this.Emailphonenumberverification(this.state.logins, 2)
@ -321,12 +339,12 @@ class LoginRegisterComponent extends Component {
if (this.state.login === undefined || this.state.login == "") { if (this.state.login === undefined || this.state.login == "") {
this.setState({ this.setState({
Phonenumberisnotco: "账号不能为空", Phonenumberisnotco:"账号不能为空",
}) })
return return
} else if (this.state.password === undefined || this.state.password == "") { } else if (this.state.password === undefined || this.state.password == "") {
this.setState({ this.setState({
Phonenumberisnotcodmm: "密码不能为空", Phonenumberisnotcodmm:"密码不能为空",
}) })
return return
} }
@ -340,22 +358,22 @@ class LoginRegisterComponent extends Component {
return return
} }
if (response.data.status === -2) { if(response.data.status === -2){
if (response.data.message === "该手机号尚未注册" || response.data.message === "该邮箱尚未注册") { if(response.data.message==="该手机号尚未注册" || response.data.message==="该邮箱尚未注册"){
this.setState({ this.setState({
Phonenumberisnotco: response.data.message, Phonenumberisnotco:response.data.message,
}) })
return; return;
} }
else if (response.data.message === "错误的账号或密码") { else if(response.data.message==="错误的账号或密码"){
this.setState({ this.setState({
Phonenumberisnotcodmms: response.data.message, Phonenumberisnotcodmms:response.data.message,
}) })
return; return;
} }
else if (response.data.message === "违反平台使用规范,账号已被锁定") { else if(response.data.message==="违反平台使用规范,账号已被锁定"){
this.setState({ this.setState({
Phonenumberisnotco: response.data.message, Phonenumberisnotco:response.data.message,
}) })
return; return;
@ -383,6 +401,11 @@ class LoginRegisterComponent extends Component {
} }
// if(response.data.profile_completed !== null || response.data.profile_completed === false){
// this.setMyEduCoderModals();
// return;
// }
if (response.status === 200) { if (response.status === 200) {
if (response.data.status === 402) { if (response.data.status === 402) {
window.location.href = response.data.url; window.location.href = response.data.url;
@ -392,14 +415,14 @@ class LoginRegisterComponent extends Component {
isRender: false isRender: false
}) })
var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls')); var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls'));
if (weekArray === undefined) { if(weekArray===undefined){
weekArray = "/"; weekArray="/";
} }
if (weekArray === null) { if(weekArray===null){
weekArray = "/"; weekArray="/";
} }
if (weekArray === "null") { if(weekArray==="null"){
weekArray = "/"; weekArray="/";
} }
window.location.href = weekArray; window.location.href = weekArray;
} }
@ -413,37 +436,74 @@ class LoginRegisterComponent extends Component {
} }
//注册接口 //注册接口
postregistered = () => { postregistered = () => {
if (this.state.logins === undefined || this.state.logins === "" || this.state.logins.length === 0) { // if (this.state.logins === undefined || this.state.logins === "") {
// this.openNotification(`请输入登录手机号码或邮箱`,2);
//
// return
// } else if (this.state.dragOk === false) {
// this.openNotification(`请拖动滑块验证`,2);
// return
// } else if (this.state.codes === undefined || this.state.codes == "") {
// this.openNotification(`请输入验证码`,2);
// return
// } else if (this.state.passwords === undefined || this.state.passwords == "") {
// this.openNotification(`请输入密码`,2);
// return
// } else if (this.state.Agreetotheterms === false) {
// this.openNotification(`请同意服务协议条款`,2);
// return;
// }
if (this.state.logins === undefined || this.state.logins === ""||this.state.logins.length===0) {
this.setState({ this.setState({
Phonenumberisnotcos: "账号不能为空", Phonenumberisnotcos:"账号不能为空",
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return return
} }
if(this.state.pciphone===true){
if (this.state.dragOk === false) {
// this.openNotification(`请拖动滑块完成验证`,2);
this.setState({
Phonenumberisnotcosytdhk:"请拖动滑块完成验证",
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
return
}
}
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({ this.setState({
Phonenumberisnotcosymmm: "密码不能为空", Phonenumberisnotcosyzm:"验证码不能为空",
}) })
return return
} else if (this.state.passwords !== undefined && this.state.passwords.length > 0 && this.state.passwords.length < 8) { } else if (this.state.passwords === undefined || this.state.passwords == "" ||this.state.passwords.length===0) {
this.setState({ this.setState({
Phonenumberisnotcosymmm: "密码不能少于8位", Phonenumberisnotcosymmm:"密码不能为空",
}) })
return return
} else if (this.state.passwords !== undefined && this.state.passwords.length > 0 && this.state.passwords.length > 16) { } else if (this.state.passwords !==undefined &&this.state.passwords.length>0&&this.state.passwords.length<8){
this.setState({ this.setState({
Phonenumberisnotcosymmm: "密码不能超过16位", Phonenumberisnotcosymmm:"密码不能少于8位",
}) })
return return
} else if (this.state.passwords !==undefined &&this.state.passwords.length>0&&this.state.passwords.length>16){
this.setState({
Phonenumberisnotcosymmm:"密码不能超过16位",
})
return
} else if (this.state.Agreetotheterms === false) {
this.openNotification(`请同意服务协议条款`,2);
return;
} }
let url; let url;
if (this.props.weixinlogin) { if(this.props.weixinlogin){
url = '/weapps/register.json'; url= '/weapps/register.json';
} else { }else{
url = "/accounts/register.json"; url = "/accounts/register.json";
} }
@ -452,9 +512,34 @@ class LoginRegisterComponent extends Component {
password: this.state.passwords, password: this.state.passwords,
code: this.state.codes, code: this.state.codes,
}).then((result) => { }).then((result) => {
if (result && result.data) { if(result){
this.openNotification("注册成功!"); if(result.data.status===-2){
this.props.history.push('/'); if(result.data.message==="验证码不正确"){
this.setState({
Phonenumberisnotcosyzm:"验证码不正确",
})
return;
}else if(result.data.message==="验证码已失效"){
this.setState({
Phonenumberisnotcosyzm:"验证码不正确",
})
return;
}else {
this.openNotification(result.data.message);
return;
}
}else {
// this.setState({
// logins: "",
// dragOk: false,
// codes: "",
// passwords: "",
// Agreetotheterms: "",
// })
this.setMyEduCoderModals();
}
} }
}).catch((error) => { }).catch((error) => {
@ -475,21 +560,21 @@ class LoginRegisterComponent extends Component {
// console.log(result); // console.log(result);
// this.setState({dragOk: true}) // this.setState({dragOk: true})
if (result) { if(result){
if (result.data.status === -2) { if(result.data.status===-2){
if (id === 1) { if (id === 1) {
if (result.data.message === "该手机号码或邮箱已被注册") { if(result.data.message==="该手机号码或邮箱已被注册"){
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
dragOk: true, dragOk:true,
}) })
} else { }else {
this.setState({ this.setState({
Phonenumberisnotco: result.data.message, Phonenumberisnotco: result.data.message,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
@ -499,26 +584,26 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotcos: result.data.message, Phonenumberisnotcos: result.data.message,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return; return;
} }
} else { }else {
if (id === 1) { if (id === 1) {
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
dragOk: true, dragOk:true,
}) })
return; return;
} else if (id === 2) { } else if (id === 2) {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
dragOk: true, dragOk:true,
}) })
return; return;
} }
@ -531,20 +616,20 @@ class LoginRegisterComponent extends Component {
}; };
//短信验证 //短信验证
SMSverification = () => { SMSverification = () => {
let logins = this.state.logins; let logins=this.state.logins;
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.logins, login: this.state.logins,
type: 1, type: 1,
smscode: setmiyah(logins) smscode:setmiyah(logins)
} }
}).then((result) => { }).then((result) => {
//验证有问题{"status":1,"message":"success"} //验证有问题{"status":1,"message":"success"}
// console.log(result); // console.log(result);
if (result.data.status === 1) { if(result.data.status===1){
this.openNotification("验证码已发送,请注意查收"); this.openNotification("验证码已发送,请注意查收");
} else if (result.data.status === -2) { }else if(result.data.status===-2){
this.openNotification(result.data.message); this.openNotification(result.data.message);
} }
}).catch((error) => { }).catch((error) => {
@ -557,13 +642,13 @@ class LoginRegisterComponent extends Component {
if (this.state.classpassbool === true) { if (this.state.classpassbool === true) {
this.setState({ this.setState({
passopens: passoff, passopens:passoff ,
classpass: "text", classpass: "text",
classpassbool: false, classpassbool: false,
}) })
} else { } else {
this.setState({ this.setState({
passopens: passopen, passopens: passopen ,
classpass: "password", classpass: "password",
classpassbool: true, classpassbool: true,
}) })
@ -575,19 +660,19 @@ class LoginRegisterComponent extends Component {
getverificationcode = () => { getverificationcode = () => {
// console.log(this.state.Phonenumberisnotcobool); // console.log(this.state.Phonenumberisnotcobool);
// console.log(this.state.dragOk); // console.log(this.state.dragOk);
if (this.state.logins === undefined || this.state.logins.length === 0) { if(this.state.logins === undefined || this.state.logins.length===0){
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入手机号或邮箱");
return; return;
} }
//这是判断是否手机正确 //这是判断是否手机正确
if (this.state.Phonenumberisnotcobool === true) { if(this.state.Phonenumberisnotcobool === true){
this.openNotification(this.state.Phonenumberisnotcos); this.openNotification(this.state.Phonenumberisnotcos);
this.setState({ this.setState({
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return; return;
} }
if (this.state.pciphone === true) { if(this.state.pciphone===true) {
if (this.state.dragOk === false) { if (this.state.dragOk === false) {
this.openNotification("请拖动滑块验证"); this.openNotification("请拖动滑块验证");
return; return;
@ -639,25 +724,25 @@ class LoginRegisterComponent extends Component {
loginInputonChange = (e) => { loginInputonChange = (e) => {
// console.log(e.target.value); // console.log(e.target.value);
var stirngt; var stirngt;
if (e.target.value.length > 0) { if(e.target.value.length>0){
var str = e.target.value.replace(/\s*/g, "") var str= e.target.value.replace(/\s*/g,"")
stirngt = str; stirngt=str;
} else { }else{
stirngt = e.target.value; stirngt= e.target.value;
} }
if (e.target.value.length === 0) { if (e.target.value.length === 0) {
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
Phonenumberisnotcodmms: undefined, Phonenumberisnotcodmms:undefined,
login: stirngt, login: stirngt,
}) })
} else { }else{
this.setState({ this.setState({
login: stirngt, login: stirngt,
Phonenumberisnotco: undefined, Phonenumberisnotco:undefined,
Phonenumberisnotcodmms: undefined, Phonenumberisnotcodmms:undefined,
}) })
} }
@ -674,17 +759,20 @@ class LoginRegisterComponent extends Component {
}) })
return; return;
} }
// var telephone = $("#telephoneAdd.tianjia_phone").val();
var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
// 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的任意数字。
var stringdata = undefined; var stringdata = undefined;
if (!regph.test(e.target.value)) { if (!regph.test(e.target.value)) {
stringdata = "手机号格式不正确"; stringdata = "手机号格式不正确";
this.setState({ this.setState({
Phonenumberisnotcos: stringdata, Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
} else { } else {
this.setState({ this.setState({
@ -705,8 +793,8 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotcos: stringdata, Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return return
} else { } else {
@ -722,43 +810,47 @@ class LoginRegisterComponent extends Component {
} }
//获取登入密码 //获取登入密码
passwordonChange = (e) => { passwordonChange = (e) => {
// console.log(e.target.value);
var stirngt; var stirngt;
if (e.target.value.length > 0) { if(e.target.value.length>0){
var str = e.target.value.replace(/\s*/g, "") var str= e.target.value.replace(/\s*/g,"")
stirngt = str; stirngt=str;
} else { }else{
stirngt = e.target.value; stirngt= e.target.value;
} }
this.setState({ this.setState({
password: stirngt, password: stirngt,
Phonenumberisnotcodmm: undefined, Phonenumberisnotcodmm:undefined,
Phonenumberisnotcodmms: undefined, Phonenumberisnotcodmms:undefined,
}) })
// this.setState({
// password: e.target.value
// })
} }
//获取注册登入 //获取注册登入
loginInputonChanges = (e) => { loginInputonChanges = (e) => {
var stirngt; var stirngt;
if (e.target.value.length > 0) { if(e.target.value.length>0){
var str = e.target.value.replace(/\s*/g, "") var str= e.target.value.replace(/\s*/g,"")
stirngt = str; stirngt=str;
} else { }else{
stirngt = e.target.value; stirngt= e.target.value;
} }
if (e.target.value.length === 0) { if (e.target.value.length === 0) {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
logins: stirngt, logins: stirngt,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
} else { }else{
this.setState({ this.setState({
logins: stirngt, logins: stirngt,
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
dragOk: false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
} }
@ -767,50 +859,129 @@ class LoginRegisterComponent extends Component {
passwordonChanges = (e) => { passwordonChanges = (e) => {
// console.log(e.target.value); // console.log(e.target.value);
var stirngt; var stirngt;
if (e.target.value.length > 0) { if(e.target.value.length>0){
var str = e.target.value.replace(/\s*/g, "") var str= e.target.value.replace(/\s*/g,"")
stirngt = str; stirngt=str;
} else { }else{
stirngt = e.target.value; stirngt= e.target.value;
} }
this.setState({ this.setState({
passwords: stirngt, passwords: stirngt,
Phonenumberisnotcosymmm: undefined, Phonenumberisnotcosymmm:undefined,
}) })
} }
//获取code //获取code
codesonChange = (e) => { codesonChange = (e) => {
this.setState({ this.setState({
codes: e.target.value, codes: e.target.value,
Phonenumberisnotcosyzm: undefined, Phonenumberisnotcosyzm:undefined,
}) })
} }
//切换tab //切换tab
changeTab = (e) => { changeTab=(e)=>{
this.setState({ this.setState({
tab: e.key tab:e.key
}) })
if (e.key === 0) {
if(e.key === 0){
this.setState({ this.setState({
Phonenumberisnotcos: undefined Phonenumberisnotcos:undefined
}) })
} else { }else{
this.setState({ this.setState({
Phonenumberisnotco: undefined Phonenumberisnotco:undefined
}) })
} }
// this.props.history.push(`/classrooms/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/student_exercise_list?tab=`+e.key)
} }
setMyEduCoderModals = () => { loginonkeyup =(e)=>{
if(e.keyCode==32){
return false;
}
};
setNotcompleteds=()=>{
this.setState({ this.setState({
MyEduCoderModals: true, Notcompleteds:true,
registered: "注册成功" MyEduCoderModals:false,
registered:undefined,
})
};
setMyEduCoderModals=()=>{
this.setState({
MyEduCoderModals:true,
registered:"注册成功"
}) })
}; };
openweixinlogin=()=>{
this.setState({
weixinlogin:true
})
}
hideweixinlogin=()=>{
this.setState({
weixinlogin:false,
qqlogin:false,
tab:["0"]
})
}
openqqlogin=()=>{
this.setState({
qqlogin:true
})
//window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code`
window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code`
// window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code`
}
openphoneqqlogin=()=>{
window.open(
`https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code`
)
}
render() { render() {
const {passopens,Agreetotheterms,Phonenumberisnotcos,tab,classpassbool,Phonenumberisnotcosymmm} = this.state const {
// 登录
autoLogin,
classpass,
passopens,
seconds,
getverificationcodes,
Agreetotheterms,
Phonenumberisnotco,
Phonenumberisnotcos,
codes,
tab,
dragOk,
Whethertoverify,
classpassbool,
Phonenumberisnotcosytdhk,
Phonenumberisnotcosyzm,
Phonenumberisnotcosymmm,
Phonenumberisnotcodmm,
// 注册
readAgreement,
pciphone,
Phonenumberisnotcodmms,
weixinlogin
} = this.state
// height: 346px;
if (this.state.seconds === 0) {
// window.location.href='http://www.cnblogs.com/a-cat/';
}
return ( return (
<div className={"login_register_content login_register_contents"}>
<div className={this.props.weixinlogin?"weixinregister":"login_register_content login_register_contents"}
// style={ parseInt(tab[0])==0?{height: "366px"} :{height: "510px"}}
>
<style> <style>
{ {
` `
@ -823,26 +994,52 @@ class LoginRegisterComponent extends Component {
</style> </style>
<div> <div>
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab} className="mt20"> {weixinlogin===false&&this.props.weixinlogin===undefined?<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab} className="mt20">
<Menu.Item key="1" className={"active font-18"} style={{ marginLeft: "10px" }} >注册</Menu.Item> <Menu.Item key="0" className={tab===0?"active font-18":"font-18"} > 登录</Menu.Item>
</Menu> <Menu.Item key="1" className={tab===1?"active font-18 ":"font-18 "} style={{marginLeft:"10px"}} >注册</Menu.Item>
</Menu>:""}
<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}
style={{ marginTop: '30px', height: '38px', color: '#999999', fontSize: "14px" }}></Input>
{ {
Phonenumberisnotcos && Phonenumberisnotcos !== "" ? weixinlogin===false&&parseInt(tab[0])==0 &&
<p className="color-red mt5 mb5 " style={{ width: " 100%", height: "20px" }}> <div style={{width: '340px'}}>
<span className="fl" style={{ textAlign: "left", width: " 100%" }}>{Phonenumberisnotcos}</span> <style>
</p> {
: <div style={{ height: "25px" }}></div> `
.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;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
list-style: none;
position: relative;
display: inline-block;
padding: 4px 11px;
width: 100%;
height: 38px;
font-size: 14px;
line-height: 1.5;
color: rgba(0, 0, 0, 0.65);
background-color: #fff;
background-image: none;
border: 1px solid #d9d9d9;
border-radius: 4px;
-webkit-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
}
.loginInputzhuche{
width: 100%;
background-color: #fff!important;
height: 45px !important;
padding: 5px;
} }
`
}
</style>
<Input placeholder="请输入邮箱账号" value={this.state.login} <Input placeholder="请输入邮箱账号" value={this.state.login}
onChange={this.loginInputonChange} onChange={this.loginInputonChange}
name="username" name="username"
@ -898,6 +1095,7 @@ class LoginRegisterComponent extends Component {
</div> </div>
</p> </p>
</div> </div>
}
@ -1021,8 +1219,8 @@ class LoginRegisterComponent extends Component {
} }
</style> </style>
<Input placeholder="输入8~16位密码区分大小写" <Input placeholder="输入8~16位密码区分大小写"
type={classpassbool === false ? "text" : "password"} type={classpassbool===false?"text":"password"}
className={Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "mymimasysl" ? " font-14 color-grey-9 loginInputzhucheysl mymimasysl" : " font-14 color-grey-9 loginInputzhuche mymimasysl"} className={Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "mymimasysl" ?" font-14 color-grey-9 loginInputzhucheysl mymimasysl":" font-14 color-grey-9 loginInputzhuche mymimasysl"}
autoComplete="new-password" autoComplete="new-password"
onClick={this.changeType} onClick={this.changeType}
value={this.state.passwords} onChange={this.passwordonChanges} value={this.state.passwords} onChange={this.passwordonChanges}
@ -1032,8 +1230,8 @@ class LoginRegisterComponent extends Component {
}></Input> }></Input>
{ {
Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ? Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ?
<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%" }}>{Phonenumberisnotcosymmm}</span> <span className="fl" style={{textAlign:"left",width: " 100%"}}>{Phonenumberisnotcosymmm}</span>
</p> </p>
: <div style={{height:"25px"}}></div> : <div style={{height:"25px"}}></div>
@ -1080,3 +1278,4 @@ class LoginRegisterComponent extends Component {
} }
export default (LoginRegisterComponent); export default (LoginRegisterComponent);