From fc965a3030b9929959a2d4c90ad16cb10bfb946f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 25 Jul 2019 11:34:14 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index f5830adff..230e7f387 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -906,7 +906,6 @@ class CoursesController < ApplicationController CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id) - logger.info("#####################{course.id}") end end @@ -927,14 +926,18 @@ class CoursesController < ApplicationController role = course_message.content == 2 ? '7' : '9' # 7:老师 9:助教 ApplyTeacherRoleJoinCourseNotifyJob.perform_later(current_user.id, course.id, role) + teacher_role = 1 + message = "#{course_message.content == 2 ? '教师' : '助教'}申请已提交,请等待审核" end end end - if current_user.student_of_course?(course) || current_user.teacher_of_course?(course) - render json: { status: 0, message: "成功", course_id: course.id} + if teacher_role && current_user.student_of_course?(course) + render json: { status: 0, message: message, course_id: course.id} + elsif current_user.student_of_course?(course) + render json: { status: 0, message: "加入成功", course_id: course.id} else - normal_status("申请已提交,请等待审核") + normal_status(message) end rescue => e uid_logger(e.message) From 4992ea6d61bc120d8f25872e4654dd7ad2df0158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 25 Jul 2019 13:08:27 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/user/FindPasswordComponent.js | 54 ++++++++- .../modules/user/LoginRegisterComponent.js | 113 +++++++++++++++++- 2 files changed, 158 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js index 19b5a7388..22fcd97de 100644 --- a/public/react/src/modules/user/FindPasswordComponent.js +++ b/public/react/src/modules/user/FindPasswordComponent.js @@ -424,10 +424,56 @@ class LoginRegisterComponent extends Component { }) return } - this.setState({ - Phonenumberisnotcosytdhk:undefined, - }) - this.Emailphonenumberverification(e.target.value) + console.log(e.target.value.length); + if (e.target.value.length === 0) { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + }) + return; + } + // var telephone = $("#telephoneAdd.tianjia_phone").val(); + var regph = /^[1][3,4,5,6,7,8][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({ + Phonenumberisnotco: stringdata, + Phonenumberisnotcobool: false, + }) + } else { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: true, + }) + return + } + + if (!regemail.test(e.target.value)) { + if ((e.target.value.indexOf("@") != -1) === true) { + stringdata = "邮箱格式不正确"; + } else { + stringdata = "手机号格式不正确"; + + } + this.setState({ + Phonenumberisnotco: stringdata, + Phonenumberisnotcobool: false, + }) + return + } else { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: true, + }) + this.Emailphonenumberverification(e.target.value) + return + } + this.Emailphonenumberverification(e.target.value) } } diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index b27fe8cec..dcbaf4730 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -402,6 +402,7 @@ class LoginRegisterComponent extends Component { type: 1, } }).then((result) => { + debugger //验证有问题{"status":1,"message":"success"} // console.log(result); // this.setState({dragOk: true}) @@ -409,12 +410,12 @@ class LoginRegisterComponent extends Component { if(result){ if(result.data.status===-2){ if (id === 1) { - console.log(value.length); if(result.data.message==="该手机号码或邮箱已被注册"){ this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, dragOk:true, + }) }else { this.setState({ @@ -436,7 +437,6 @@ class LoginRegisterComponent extends Component { } }else { if (id === 1) { - console.log(value.length); this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, @@ -585,13 +585,116 @@ class LoginRegisterComponent extends Component { } //失去焦点判断 inputOnBlur = (e, id) => { - this.isCorrectname(e.target.value, id); + // this.isCorrectname(e.target.value, id); // this.Emailphonenumberverification(e.target.value, id); + if (e.target.value.length === 0) { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + }) + return; + } + // var telephone = $("#telephoneAdd.tianjia_phone").val(); + var regph = /^[1][3,4,5,6,7,8][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({ + Phonenumberisnotco: stringdata, + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + } else { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + }) + return + } + + if (!regemail.test(e.target.value)) { + if ((e.target.value.indexOf("@") != -1) === true) { + stringdata = "邮箱格式不正确"; + } else { + stringdata = "手机号格式不正确"; + + } + this.setState({ + Phonenumberisnotco: stringdata, + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + return + } else { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + }) + this.Emailphonenumberverification(e.target.value, 1); + return + } + this.Emailphonenumberverification(e.target.value, 1); } inputOnBlurzhuche = (e, id) => { - if(this.state.pciphone===false) { + 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][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) => { From a4910c2f8f61a051c06ae220f4034fc89a56d4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 25 Jul 2019 13:40:12 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/login/EducoderLogin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 713593100..eed3a9add 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -148,7 +148,7 @@ class EducoderLogin extends Component { "align-items": "center", "width": "100%" }}> -