From cbfb9c3ffe4a5c0524854ee36c26cea73c333fe5 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 18 Nov 2020 11:31:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=89=88=E6=9C=AC-=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/merge.css | 111 ++ src/App.js | 14 +- src/forge/Order/order.js | 2 +- src/modules/login/EducoderLogin.js | 213 ++- src/modules/login/LoginDialog.js | 14 +- src/modules/tpm/NewHeader.js | 4 +- src/modules/user/LoginRegisterComponent.js | 1364 ++------------------ src/modules/user/register.css | 22 + 8 files changed, 325 insertions(+), 1419 deletions(-) create mode 100755 public/css/merge.css create mode 100644 src/modules/user/register.css diff --git a/public/css/merge.css b/public/css/merge.css new file mode 100755 index 000000000..b6d923ced --- /dev/null +++ b/public/css/merge.css @@ -0,0 +1,111 @@ + +.CodeMirror-merge { + position: relative; + white-space: pre; +} + +.CodeMirror-merge, .CodeMirror-merge .CodeMirror { + min-height:50px; +} + +.CodeMirror-merge-2pane .CodeMirror-merge-pane { width: 48%; } +.CodeMirror-merge-2pane .CodeMirror-merge-gap { width: 4%; } +.CodeMirror-merge-3pane .CodeMirror-merge-pane { width: 31%; } +.CodeMirror-merge-3pane .CodeMirror-merge-gap { width: 3.5%; } + +.CodeMirror-merge-pane { + display: inline-block; + white-space: normal; + vertical-align: top; +} +.CodeMirror-merge-pane-rightmost { + position: absolute; + right: 0px; + z-index: 1; +} + +.CodeMirror-merge-gap { + z-index: 2; + display: inline-block; + height: 100%; + -moz-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + position: relative; + background: #515151; +} + +.CodeMirror-merge-scrolllock-wrap { + position: absolute; + bottom: 0; left: 50%; +} +.CodeMirror-merge-scrolllock { + position: relative; + left: -50%; + cursor: pointer; + color: #d8d8d8; + line-height: 1; +} + +.CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right { + position: absolute; + left: 0; top: 0; + right: 0; bottom: 0; + line-height: 1; +} + +.CodeMirror-merge-copy { + position: absolute; + cursor: pointer; + color: #ce374b; + z-index: 3; +} + +.CodeMirror-merge-copy-reverse { + position: absolute; + cursor: pointer; + color: #44c; +} + +.CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy { left: 2px; } +.CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy { right: 2px; } + +.CodeMirror-merge-r-inserted, .CodeMirror-merge-l-inserted { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12MwuCXy3+CWyH8GBgYGJgYkAABZbAQ9ELXurwAAAABJRU5ErkJggg==); + background-position: bottom left; + background-repeat: repeat-x; +} + +.CodeMirror-merge-r-deleted, .CodeMirror-merge-l-deleted { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12M4Kyb2/6yY2H8GBgYGJgYkAABURgPz6Ks7wQAAAABJRU5ErkJggg==); + background-position: bottom left; + background-repeat: repeat-x; +} + +.CodeMirror-merge-r-chunk { background: #9a6868; } +.CodeMirror-merge-r-chunk-start { /*border-top: 1px solid #ee8; */} +.CodeMirror-merge-r-chunk-end {/* border-bottom: 1px solid #ee8; */} +.CodeMirror-merge-r-connect { fill:#9a6868;} + +.CodeMirror-merge-l-chunk { background: #eef; } +.CodeMirror-merge-l-chunk-start { border-top: 1px solid #88e; } +.CodeMirror-merge-l-chunk-end { border-bottom: 1px solid #88e; } +.CodeMirror-merge-l-connect { fill: #eef; stroke: #88e; stroke-width: 1px; } + +.CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk { background: #dfd; } +.CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start { border-top: 1px solid #4e4; } +.CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #4e4; } + +.CodeMirror-merge-collapsed-widget:before { + content: "(...)"; +} +.CodeMirror-merge-collapsed-widget { + cursor: pointer; + color: #88b; + background: #eef; + border: 1px solid #ddf; + font-size: 90%; + padding: 0 3px; + border-radius: 4px; +} +.CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt { display: none; } diff --git a/src/App.js b/src/App.js index 8d734bc5e..041ab5e12 100644 --- a/src/App.js +++ b/src/App.js @@ -76,6 +76,10 @@ const OrganizeIndex = Loadable({ loader: () => import('./forge/Team/Index'), loading: Loading, }) +const EducoderLogin = Loadable({ + loader: () => import('./modules/login/EducoderLogin'), + loading: Loading, +}) class App extends Component { constructor(props) { @@ -240,7 +244,15 @@ class App extends Component { } }> - + { + + return () + } + } + /> {/*403*/} diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js index dc9cfe196..10e25951b 100644 --- a/src/forge/Order/order.js +++ b/src/forge/Order/order.js @@ -341,7 +341,7 @@ class order extends Component { }); }; - islogin() { + islogin=()=>{ this.props.showLoginDialog(); } renderNew =()=>{ diff --git a/src/modules/login/EducoderLogin.js b/src/modules/login/EducoderLogin.js index 5663c69c8..65c7d3612 100644 --- a/src/modules/login/EducoderLogin.js +++ b/src/modules/login/EducoderLogin.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; +import React, { Component } from "react"; import moment from 'moment'; -import { SnackbarHOC,getImageUrl } from 'educoder'; +import { getImageUrl } from 'educoder'; import '../courses/css/members.css'; import "../courses/common/formCommon.css" import '../courses/css/Courses.css'; @@ -8,121 +8,90 @@ import beijintulogontwo from '../../../src/images/login/beijintulogontwo.png'; import educodernet from '../../../src/images/login/educodernet.png'; import LoginRegisterComponent from '../user/LoginRegisterComponent'; import FindPasswordComponent from '../user/FindPasswordComponent'; -import passopen from "../../images/login/passopen.png"; //educoder登入页面 -var sectionStyle = { - "height": "100%", - "width": "100%", - "min-width": "1000px", -// makesure here is String确保这里是一个字符串,以下是es6写法 - - -}; -var imgback = { - " background-size":"cover", -"background-repeat":"no-repeat", - backgroundImage: `url(${beijintulogontwo})`, -} -var imgmian ={ - width: "100%", - background: `url(${beijintulogontwo})`, - position: "relative", - -} - -var newContainer={ +var newContainer = { background: `url(${beijintulogontwo})`, - backgroundPosition: "center" , + backgroundPosition: "center", backgroundRepeat: "no-repeat", backgroundAttachment: "fixed", backgroundSize: "100% 100%", - height:" 100%", - width:" 100%", + height: " 100%", + width: " 100%", position: "absolute", top: "0px", bottom: "0px", - minHeight: "100%", + minHeight: "100%", paddingTop: "40px", - + display:"flex", + alignItems:"center", + justifyContent:"center" } class EducoderLogin extends Component { constructor(props) { super(props); - if( props.match.url === "/changepassword" ){ + if (props.match.url === "/changepassword") { this.state = { showbool: 3, - logini:3, - namezh:"", - passmm:"", - loginstatus:true, + logini: 3, + namezh: "", + passmm: "", + loginstatus: true, } - }else { - if(props.match.url === "/login"){ + } else { + if (props.match.url === "/login") { this.state = { showbool: 1, - loginstatus:true, - logini:1, - namezh:"", - passmm:"" + loginstatus: true, + logini: 1, + namezh: "", + passmm: "" } - }else if(props.match.url === "/register"){ - // showbool: 1, - this.state = { - showbool: 1, - loginstatus:false, - logini:2, - namezh:"", - passmm:"" - } - }else{ + } else if (props.match.url === "/register") { this.state = { showbool: 1, - logini:1, - namezh:"", - passmm:"", - loginstatus:true, + loginstatus: false, + logini: 2, + namezh: "", + passmm: "" + } + } else { + this.state = { + showbool: 1, + logini: 1, + namezh: "", + passmm: "", + loginstatus: true, } } - } - } - componentDidMount() { - // console.log("EducoderLogin"); - // console.log(this.props); - } - - Setlogins=(i)=>{ + Setlogins = (i) => { console.log("96ye"); console.log(i) this.setState({ - logini:i + logini: i }) } - gohome=()=>{ - window.location.href="/" + gohome = () => { + window.location.href = "/" } - Setshowbool = (e,name,pass) => { - if (e===1) { + Setshowbool = (e, name, pass) => { + if (e === 1) { this.setState({ showbool: 1 }) - } else if(e===3){ + } else if (e === 3) { this.setState({ showbool: 3 }) } } - render() { - let {showbool,loginstatus,logini} = this.state; - // console.log("EducoderLogingetHelmetapi"); - // console.log(this.props); - // console.log(this.props.mygetHelmetapi); + let { showbool } = this.state; return (
@@ -133,13 +102,13 @@ class EducoderLogin extends Component { "align-items": "center", "width": "100%" }}> -
+
{this.props.mygetHelmetapi === null ? "" - : - this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.login_logo_url===null|| this.props.mygetHelmetapi.login_logo_url===undefined? - this.gohome()} src={educodernet}/> - : - this.gohome()} src={getImageUrl(this.props.mygetHelmetapi.login_logo_url)}/> + : + this.props.mygetHelmetapi === undefined || this.props.mygetHelmetapi.login_logo_url === null || this.props.mygetHelmetapi.login_logo_url === undefined ? + this.gohome()} src={educodernet} /> + : + this.gohome()} src={getImageUrl(this.props.mygetHelmetapi.login_logo_url)} /> }
@@ -157,48 +126,48 @@ class EducoderLogin extends Component {
this.Setshowbool(e)} > + Setshowbool={(e) => this.Setshowbool(e)} >
- : -
-
- this.Setshowbool(e)}> + : +
+
+ this.Setshowbool(e)}> -
-
+
+
+ } + {this.props.mygetHelmetapi === null ?
+
© {moment().year()} EduCoder湘ICP备17009477号Trustie   &   IntelliDE inside.
+
: + this.props.mygetHelmetapi === undefined || this.props.mygetHelmetapi.main_site === null || this.props.mygetHelmetapi.main_site === undefined ?
+
© {moment().year()} EduCoder湘ICP备17009477号Trustie   &   IntelliDE inside.
+
: this.props.mygetHelmetapi.main_site === true ? +
+
© {moment().year()} EduCoder湘ICP备17009477号Trustie   &   IntelliDE inside.
+
+ : "" } - {this.props.mygetHelmetapi === null ?
-
© {moment().year()} EduCoder湘ICP备17009477号Trustie   &   IntelliDE inside.
-
: - this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.main_site===null|| this.props.mygetHelmetapi.main_site===undefined?
-
© {moment().year()} EduCoder湘ICP备17009477号Trustie   &   IntelliDE inside.
-
:this.props.mygetHelmetapi.main_site===true? -
-
© {moment().year()} EduCoder湘ICP备17009477号Trustie   &   IntelliDE inside.
-
- :"" - }
@@ -206,16 +175,4 @@ class EducoderLogin extends Component { } } -export default EducoderLogin ; -// showbool === 2 ? -//
-// -// -//
-// : +export default EducoderLogin; diff --git a/src/modules/login/LoginDialog.js b/src/modules/login/LoginDialog.js index 441975249..61815d822 100644 --- a/src/modules/login/LoginDialog.js +++ b/src/modules/login/LoginDialog.js @@ -1,13 +1,7 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import Dialog, { - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, -} from 'material-ui/Dialog'; -import { notification, Modal } from 'antd'; +import { Link } from 'react-router-dom'; +import Dialog from 'material-ui/Dialog'; +import { notification } from 'antd'; import axios from 'axios'; @@ -582,7 +576,7 @@ class LoginDialog extends Component { this.getloginurl("https://www.trustie.net/account/lost_password")} className="mr3 color-grey-9">找回密码 - this.getloginurl("https://www.trustie.net/login?login=false")} className="color-grey-9">注册 + 注册

diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index d2f77f3e3..aea00792e 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -815,7 +815,7 @@ class NewHeader extends Component { this.educoderlogin()} className="mr5 color-grey-6">登录 { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.register_url && - 注册 + 注册 } : user.login === "" ? @@ -823,7 +823,7 @@ class NewHeader extends Component { this.educoderlogin()} className="mr5 color-grey-6">登录 { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.register_url && - 注册 + 注册 } : diff --git a/src/modules/user/LoginRegisterComponent.js b/src/modules/user/LoginRegisterComponent.js index db369458b..a19dcc3b7 100644 --- a/src/modules/user/LoginRegisterComponent.js +++ b/src/modules/user/LoginRegisterComponent.js @@ -1,1308 +1,118 @@ -import React, {Component} from 'react'; -import {setmiyah,broadcastChannelPostMessage} from 'educoder'; -import {Tabs, Input, Checkbox, Button, notification,Menu} from 'antd'; -import passopen from '../../../src/images/login/passopen.png'; -import passoff from '../../../src/images/login/passoff.png'; +import React, { Component } from 'react'; +import { Input, Form, Button, notification, Menu } from 'antd'; import axios from 'axios'; -import CheckInputysl1 from './CheckInputysl'; -import CheckInputysl2 from './CheckInputysl'; -import Notcompletedysl from './Notcompletedysl'; -import './common.css' -import './commontwo.css' -const { TabPane } = Tabs; -const loginInputsyl = { - "width":"434px", - "height": "462px", - "-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)", - "border-radius": "6px", - "background": "#fff" -} - -//父组件EducoderLogin.js +import './register.css'; class LoginRegisterComponent extends Component { constructor(props) { - super(props) - - - // - // console.log("LoginRegisterComponent"); - // console.log("29"); - // console.log(props.loginstatus); - if(props.loginstatus === true){ - // console.log(props.loginstatus); - this.state = { - tab:["0"], - 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, - 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); - 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 - } + super(props); + this.state = { + password:undefined, + Rpassword:undefined } } - //判断是否是手机端 - IsPC=()=> { - var userAgentInfo = navigator.userAgent; - var Agents = ["Android", "iPhone", - "SymbianOS", "Windows Phone", - "iPad", "iPod"]; - var flag = true;//这个意思是说自己的是pc 端 - for (var v = 0; v < Agents.length; v++) { - if (userAgentInfo.indexOf(Agents[v]) > 0) { - flag = false; - break; - } - } - return flag; - } -// 点击表单后,改变type - 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:flag - }) - // console.log("componentDidUpdate"); - // console.log(this.props); - let pcipns=this.IsPC(); - if (this.props.match.url === "/login") { - - // this.state = { - // tab:["0"], - // - // } - this.setState({ - tab:["0"] - }) - } else if (this.props.match.url === "/register") { - - // this.state = { - // tab:["1"], - // - // } - this.setState({ - tab:["1"] - }) - } - this.setState({ - pciphone:pcipns, - }) - - - } - openNotification = (messge,type) => { - // type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色 + openNotification = (messge) => { notification.open({ - message: "提示", - description: messge, - onClick: () => { - - }, - }); - } - openNotifications = (btn) => { - // type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色 - notification.open({ - message: "提示", - description: btn, - onClick: () => { - - }, + message: '提示', + description:messge, }); } - - StudyMakeMoney = () => { // 调用父组件方法 - - // this.props.Setlogins(3); - this.setState({ - login: "", - password: "", - logins: "", - passwords: "", - codes: "", - }); - try { - this.props.Setshowbool(3); - }catch (e) { - - } - } - onTabChange = (activeKey) => { - - } - // -------------------- LOGIN START - //下次自动登入 - onAutoLoginChange = (e) => { - this.setState({autoLogin: e.target.checked}) - } - - // -------------------- LOGIN END - - isCorrectname = (value, id) => { - if (id === 1) { - - if (value.length === 0) { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - }) - return; - } - } else if (id === 2) { - if (value.length === 0) { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - }) - return; - } - } - this.Emailphonenumberverification(value, id) - - } - // -------------------- REGISTER START - onReadAgreementChange = (e) => { - this.setState({readAgreement: e.target.checked}) - } - //是否验证通过 - dragOkCallback = () => { - this.setState({ - Phonenumberisnotcosytdhk:undefined, - }) - if (this.state.logins.length === 0) { - this.setState({ - Phonenumberisnotcos:"账号不能为空", - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - - - return; - } - // var telephone = $("#telephoneAdd.tianjia_phone").val(); - 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]+$/; - - // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 - var stringdata = undefined; - if (!regph.test(this.state.logins)) { - stringdata = "手机号格式不正确"; - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - - } else { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }); - this.Emailphonenumberverification(this.state.logins, 2); - return - } - - if (!regemail.test(this.state.logins)) { - if ((this.state.logins.indexOf("@") != -1) === true) { - stringdata = "邮箱格式不正确"; - } else { - stringdata = "手机号格式不正确"; - - } - this.setState({ - Phonenumberisnotcos: stringdata, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }); - - - return - } else { - - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - this.Emailphonenumberverification(this.state.logins, 2); - return - } - - this.setState({ - Phonenumberisnotcosytdhk:undefined, - }) - this.Emailphonenumberverification(this.state.logins, 2) - - } - // -------------------- REGISTER END - - //是否同意 - onChange = (e) => { - this.setState({ - Agreetotheterms: e.target.checked, - }) - } - - //登入接口 - postLogin = () => { - - if (this.state.login === undefined || this.state.login == "") { - this.setState({ - Phonenumberisnotco:"账号不能为空", - }) - return - } else if (this.state.password === undefined || this.state.password == "") { - this.setState({ - Phonenumberisnotcodmm:"密码不能为空", - }) - return - } - var url = "/accounts/login.json"; - axios.post(url, { - login: this.state.login, - password: this.state.password, - }).then((response) => { - - if (response === undefined) { - return - } - - if(response.data.status === -2){ - if(response.data.message==="该手机号尚未注册" || response.data.message==="该邮箱尚未注册"){ - this.setState({ - Phonenumberisnotco:response.data.message, - }) - return; - } - else if(response.data.message==="错误的账号或密码"){ - this.setState({ - Phonenumberisnotcodmms:response.data.message, - }) - return; - } - else if(response.data.message==="违反平台使用规范,账号已被锁定"){ - this.setState({ - Phonenumberisnotco:response.data.message, - }) - - return; - } else if (response.data.message === "登录密码出错已达上限,账号已被锁定, 请10分钟后重新登录或找回密码") { - const messge = ( -
-

- 登录密码出错已达上限,账号已被锁定; -

-

- 请10分钟后重新登录或找回密码 -

-
- ) - this.openNotifications(messge); - return; - } else { - this.openNotification(response.data.message); - return; - } - - - } - - // if(response.data.profile_completed !== null || response.data.profile_completed === false){ - // this.setMyEduCoderModals(); - // return; - // } - - if (response.status === 200) { - if (response.data.status === 402) { - window.location.href = response.data.url; - } else { - broadcastChannelPostMessage('refreshPage') - this.setState({ - isRender: false - }) - var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls')); - if(weekArray===undefined){ - weekArray="/"; - } - if(weekArray===null){ - weekArray="/"; - } - if(weekArray==="null"){ - weekArray="/"; - } - window.location.href = weekArray; - } - } - - - }).catch((error) => { - - }) - - } //注册接口 postregistered = () => { - // 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({ - Phonenumberisnotcos:"账号不能为空", - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - 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.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:"密码不能为空", - }) - return - } else if (this.state.passwords !==undefined &&this.state.passwords.length>0&&this.state.passwords.length<8){ - this.setState({ - Phonenumberisnotcosymmm:"密码不能少于8位", - }) - 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; - if(this.props.weixinlogin){ - url= '/weapps/register.json'; - }else{ - url = "/accounts/register.json"; - } - - axios.post(url, { - login: this.state.logins, - password: this.state.passwords, - code: this.state.codes, - }).then((result) => { - if(result){ - if(result.data.status===-2){ - if(result.data.message==="验证码不正确"){ - this.setState({ - Phonenumberisnotcosyzm:"验证码不正确", - }) - - return; - }else if(result.data.message==="验证码已失效"){ - this.setState({ - Phonenumberisnotcosyzm:"验证码不正确", - }) - - return; - }else { - this.openNotification(result.data.message); - return; + this.props.form.validateFieldsAndScroll((err, values) => { + if(!err){ + const url = `/accounts/register.json`; + axios.post(url,{ + ...values + }).then(result=>{ + if(result){ + this.openNotification("注册成功,现在可以登录啦!"); + this.props.history.push('/') } - }else { - // this.setState({ - // logins: "", - // dragOk: false, - // codes: "", - // passwords: "", - // Agreetotheterms: "", - // }) - this.setMyEduCoderModals(); - } + }).catch(error=>{this.openNotification("注册失败,请稍后再试!")}) } - }).catch((error) => { - }) } - //邮箱手机号验证 - Emailphonenumberverification = (value, id) => { - var url = `/accounts/valid_email_and_phone.json`; - axios.get((url), { - params: { - login: value, - type: 1, - } - }).then((result) => { - - //验证有问题{"status":1,"message":"success"} - // console.log(result); - // this.setState({dragOk: true}) - - if(result){ - if(result.data.status===-2){ - if (id === 1) { - if(result.data.message==="该手机号码或邮箱已被注册"){ - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - }else { - this.setState({ - Phonenumberisnotco: result.data.message, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - - - } - return; - } else if (id === 2) { - this.setState({ - Phonenumberisnotcos: result.data.message, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - - - return; - } - }else { - if (id === 1) { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - return; - } else if (id === 2) { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - return; - } - } - } - - }).catch((error) => { - - }) - }; - //短信验证 - SMSverification = () => { - let logins=this.state.logins; - var url = `/accounts/get_verification_code.json`; - axios.get((url), { - params: { - login: this.state.logins, - type: 1, - smscode:setmiyah(logins) - } - }).then((result) => { - //验证有问题{"status":1,"message":"success"} - // console.log(result); - if(result.data.status===1){ - this.openNotification("验证码已发送,请注意查收"); - }else if(result.data.status===-2){ - this.openNotification(result.data.message); - } - }).catch((error) => { - - - }) - } - //显示和不显示密码 - Showandhide = (e) => { - - if (this.state.classpassbool === true) { - this.setState({ - passopens:passoff , - classpass: "text", - classpassbool: false, - }) - } else { - this.setState({ - passopens: passopen , - classpass: "password", - classpassbool: true, - }) - } - - } - - //倒计时 - getverificationcode = () => { - // console.log(this.state.Phonenumberisnotcobool); - // console.log(this.state.dragOk); - if(this.state.logins === undefined || this.state.logins.length===0){ - this.openNotification("请输入手机号或邮箱"); - return; - } - //这是判断是否手机正确 - if(this.state.Phonenumberisnotcobool === true){ - this.openNotification(this.state.Phonenumberisnotcos); - this.setState({ - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - return; - } - if(this.state.pciphone===true) { - if (this.state.dragOk === false) { - this.openNotification("请拖动滑块验证"); - return; - } - } - - if (this.state.getverificationcodes === true) { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - }) - } - }); - }, 1000) - this.SMSverification(); - } else { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - - }) - } - }); - }, 1000) - this.SMSverification(); - } - } - //滑动验证手机号 - - //获取登入 - loginInputonChange = (e) => { - // console.log(e.target.value); - var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; - } - - if (e.target.value.length === 0) { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - Phonenumberisnotcodmms:undefined, - login: stirngt, - }) - }else{ - this.setState({ - login: stirngt, - Phonenumberisnotco:undefined, - Phonenumberisnotcodmms:undefined, - }) - } - - } - //失去焦点判断 - inputOnBlur = (e, id) => { - this.Emailphonenumberverification(e.target.value, 1); - } - inputOnBlurzhuche = (e, id) => { - if (e.target.value.length === 0) { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - }) - return; - } - // var telephone = $("#telephoneAdd.tianjia_phone").val(); - 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]+$/; - - // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 - var stringdata = undefined; - if (!regph.test(e.target.value)) { - stringdata = "手机号格式不正确"; - this.setState({ - Phonenumberisnotcos: stringdata, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - } else { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - - }) - return - } - - if (!regemail.test(e.target.value)) { - if ((e.target.value.indexOf("@") != -1) === true) { - stringdata = "邮箱格式不正确"; - } else { - stringdata = "手机号格式不正确"; - - } - this.setState({ - Phonenumberisnotcos: stringdata, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - return - } else { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - - }) - this.Emailphonenumberverification(e.target.value, id); - return - } - this.Emailphonenumberverification(e.target.value, id); - } - //获取登入密码 - passwordonChange = (e) => { - // console.log(e.target.value); - var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; - } + changeFirst=(e)=>{ this.setState({ - password: stirngt, - Phonenumberisnotcodmm:undefined, - Phonenumberisnotcodmms:undefined, + password:e.target.value }) - // this.setState({ - // password: e.target.value - // }) } - //获取注册登入 - loginInputonChanges = (e) => { - - var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; + changeSecond=(e)=>{ + this.setState({ + Rpassword:e.target.value + }) + } + checkPass=(rule, value, callback)=>{ + const { Rpassword } = this.state; + if(!value){ + callback("请输入密码!"); + } + else if(value.length < 8 || value.length>16){ + callback("请输入8至16位的密码!"); + } + else if(Rpassword && value !== Rpassword){ + callback("两次输入的密码不一致!"); }else{ - stirngt= e.target.value; + callback(); } - if (e.target.value.length === 0) { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - logins: stirngt, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) + } + checkreplyPass=(rule, value, callback)=>{ + const { password } = this.state; + if(!value){ + callback("请再一次输入密码!"); + } + else if(value.length<8 || value.length>16){ + callback("请输入8至16位的密码!"); + } + else if(value !== password){ + callback("两次输入的密码不一致!"); }else{ - this.setState({ - logins: stirngt, - Phonenumberisnotcos: undefined, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) + callback(); } - } - //获取注册密码 - passwordonChanges = (e) => { - // console.log(e.target.value); - var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; - } - this.setState({ - passwords: stirngt, - Phonenumberisnotcosymmm:undefined, - }) - } - //获取code - codesonChange = (e) => { - this.setState({ - codes: e.target.value, - Phonenumberisnotcosyzm:undefined, - }) - } - //切换tab - changeTab=(e)=>{ - this.setState({ - tab:e.key - }) - - if(e.key === 0){ - this.setState({ - Phonenumberisnotcos:undefined - }) - }else{ - this.setState({ - Phonenumberisnotco:undefined - }) - - } - - // this.props.history.push(`/classrooms/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/student_exercise_list?tab=`+e.key) - - } - loginonkeyup =(e)=>{ - if(e.keyCode==32){ - - return false; - } - }; - setNotcompleteds=()=>{ - this.setState({ - Notcompleteds:true, - 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() { - 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/'; - } - - + const { getFieldDecorator } = this.props.form; return ( +
-
- - -
- {weixinlogin===false&&this.props.weixinlogin===undefined? - 登录 - 注册 - :""} - - { - weixinlogin===false&&parseInt(tab[0])==0 && -
- - - this.inputOnBlur(e, 1)} - style={{marginTop: '30px', height: '38px'}} - onPressEnter={() => this.postLogin()} - > - - { - Phonenumberisnotco && Phonenumberisnotco != "" ? -

- {Phonenumberisnotco} -

- :
- } - - this.postLogin()} - className={Phonenumberisnotcodmm && Phonenumberisnotcodmm !== "" ?" color-grey-9 loginInputzhucheyslass bor-reds":" color-grey-9 loginInputzhuche"} - placeholder="密码"> - { - Phonenumberisnotcodmm && Phonenumberisnotcodmm != "" ? -

- {Phonenumberisnotcodmm} -

- : (Phonenumberisnotcodmms=== undefined?
:"") - } - { - Phonenumberisnotcodmms && Phonenumberisnotcodmms != "" ? -

- {Phonenumberisnotcodmms} -

- : "" - } - - - - - {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?

- - ———————— 快速登录 ———————— -

-

:

- ———————— 快速登录 ———————— -

-

:""} -
- } - - - - { - weixinlogin===false&&parseInt(tab[0])==1 && -
- this.inputOnBlurzhuche(e, 2)} - style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}> - { - Phonenumberisnotcos && Phonenumberisnotcos !== "" ? -

- {Phonenumberisnotcos} -

- :
- - } - {this.state.MyEduCoderModals===true? {this.setNotcompleteds()}} - />:""} - - { - Whethertoverify===false&&pciphone===true? - - - : - "" - - } - { - Whethertoverify===true&&pciphone===true? - - - : - "" - } - -
- { - pciphone===true? - ( - Phonenumberisnotcosytdhk && Phonenumberisnotcosytdhk !== "" ? -

- {Phonenumberisnotcosytdhk} -

- :
- - ) - :"" - } -
- - - -
- - - - { - getverificationcodes === undefined ? - - : getverificationcodes === true ? - - : - - } - -
-
- { - Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ? -

- {Phonenumberisnotcosyzm} -

- :
- - } -
- - - - - this.Showandhide(key)}> - - }> - { - Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ? -

- {Phonenumberisnotcosymmm} -

- :
- - } - {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?我已阅读并同意 - - 《服务协议条款》 - :""} - - - {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?

- - ———————— 快速登录 ———————— -

-

:

- ———————— 快速登录 ———————— -

-

:"" - } -
- } - - - - - {weixinlogin===true?:""} - {weixinlogin===true?

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

:""} -
- -
+
+ + 注册 + +
+ + {getFieldDecorator("login", { + rules: [{ + required: true, + message: "请输入邮箱地址", + }], + })()} + + + {getFieldDecorator("password", { + rules: [{ + validator:this.checkPass + }], + })()} + + + {getFieldDecorator("passagain", { + rules: [{ + validator:this.checkreplyPass + }], + })()} + + +
+
+
); } } - -export default (LoginRegisterComponent); +const WrappedNewMerge = Form.create({ name: "NewMergeForm" })(LoginRegisterComponent); +export default WrappedNewMerge; diff --git a/src/modules/user/register.css b/src/modules/user/register.css new file mode 100644 index 000000000..54ae76446 --- /dev/null +++ b/src/modules/user/register.css @@ -0,0 +1,22 @@ +.registerPanel{ + padding:20px 40px 25px 40px; +} +.registerPanel input{ + height: 40px; +} +.registerPanel .ant-row.ant-form-item{ + margin-bottom: 25px; +} +.registerPanel .ant-form.ant-form-horizontal{ + margin-top: 20px; +} +.registerPanel .ant-menu-item{ + margin-left: 0px!important; + padding: 0px; +} +.ant-form-explain{ + position: absolute; +} +form .has-feedback .ant-input-affix-wrapper .ant-input-suffix{ + padding-right: 0px!important; +} \ No newline at end of file