Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_forum
杨树明 5 years ago
commit fb44e88969

@ -8,7 +8,7 @@ class CourseSecondCategoriesController < ApplicationController
tip_exception("毕设子目录不能重命名") if @category.category_type == "graduation" tip_exception("毕设子目录不能重命名") if @category.category_type == "graduation"
tip_exception("名称不能为空") if params[:name].blank? tip_exception("名称不能为空") if params[:name].blank?
tip_exception("已存在同名子目录") if @course_module.course_second_categories.exists?(name: params[:name].strip) tip_exception("已存在同名子目录") if @course_module.course_second_categories.exists?(name: params[:name].strip)
@category.update_attributes(name: params[:name].strip) @category.update_attributes!(name: params[:name].strip)
normal_status(0, "更新成功") normal_status(0, "更新成功")
end end

@ -906,7 +906,6 @@ class CoursesController < ApplicationController
CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id])
StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id) StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id)
logger.info("#####################{course.id}")
end end
end end
@ -927,14 +926,18 @@ class CoursesController < ApplicationController
role = course_message.content == 2 ? '7' : '9' # 7:老师 9:助教 role = course_message.content == 2 ? '7' : '9' # 7:老师 9:助教
ApplyTeacherRoleJoinCourseNotifyJob.perform_later(current_user.id, course.id, role) ApplyTeacherRoleJoinCourseNotifyJob.perform_later(current_user.id, course.id, role)
teacher_role = 1
message = "#{course_message.content == 2 ? '教师' : '助教'}申请已提交,请等待审核"
end end
end end
end end
if current_user.student_of_course?(course) || current_user.teacher_of_course?(course) if teacher_role && current_user.student_of_course?(course)
render json: { status: 0, message: "成功", course_id: course.id} 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 else
normal_status("申请已提交,请等待审核") normal_status(message)
end end
rescue => e rescue => e
uid_logger(e.message) uid_logger(e.message)

@ -39,7 +39,7 @@ class StagesController < ApplicationController
def update def update
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@stage.update_attributes(stage_params) @stage.update_attributes!(stage_params)
@stage.stage_shixuns.destroy_all @stage.stage_shixuns.destroy_all
unless params[:shixun_id].blank? unless params[:shixun_id].blank?
params[:shixun_id].each do |shixun_id| params[:shixun_id].each do |shixun_id|
@ -50,7 +50,7 @@ class StagesController < ApplicationController
@subject.update_attributes(updated_at: Time.now) @subject.update_attributes(updated_at: Time.now)
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("章节更新失败") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end

@ -207,7 +207,7 @@ class SubjectsController < ApplicationController
end end
rescue Exception => e rescue Exception => e
uid_logger(e.message) uid_logger(e.message)
tip_exception("发送失败") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end

@ -6,6 +6,6 @@ class Stage < ApplicationRecord
has_many :stage_shixuns, -> { order("stage_shixuns.position ASC") }, dependent: :destroy has_many :stage_shixuns, -> { order("stage_shixuns.position ASC") }, dependent: :destroy
has_many :shixuns, :through => :stage_shixuns has_many :shixuns, :through => :stage_shixuns
validates :name, length: { maximum: 30 } validates :name, length: { maximum: 60 }
validates :description, length: { maximum: 300 } validates :description, length: { maximum: 300 }
end end

@ -102,7 +102,7 @@ class Cropper extends Component {
setTimeout(() => { setTimeout(() => {
const image = document.getElementById(this.props.imageId || '__image'); const image = document.getElementById(this.props.imageId || '__image');
this.cropper = new window.Cropper(image, this.options); this.cropper = new window.Cropper(image, this.options);
}, 1000) }, 1200)
} }
renew = (image) => { renew = (image) => {

@ -194,7 +194,7 @@ class UseBank extends Component{
display: -webkit-flex; display: -webkit-flex;
} }
.setImgW .edu-nodata-img{ .setImgW .edu-nodata-img{
width:218px !important; width: 170px !important;
} }
.bankwidth{ .bankwidth{
width:24% !important; width:24% !important;

@ -148,7 +148,7 @@ class EducoderLogin extends Component {
"align-items": "center", "align-items": "center",
"width": "100%" "width": "100%"
}}> }}>
<div > <div style={{cursor:"pointer"}}>
<img style={{cursor:"pointer"}} onClick={()=>this.gohome()} src={educodernet}/> <img style={{cursor:"pointer"}} onClick={()=>this.gohome()} src={educodernet}/>
</div> </div>

@ -424,10 +424,56 @@ class LoginRegisterComponent extends Component {
}) })
return return
} }
this.setState({ console.log(e.target.value.length);
Phonenumberisnotcosytdhk:undefined, if (e.target.value.length === 0) {
}) this.setState({
this.Emailphonenumberverification(e.target.value) 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)
} }
} }

@ -402,6 +402,7 @@ class LoginRegisterComponent extends Component {
type: 1, type: 1,
} }
}).then((result) => { }).then((result) => {
debugger
//验证有问题{"status":1,"message":"success"} //验证有问题{"status":1,"message":"success"}
// console.log(result); // console.log(result);
// this.setState({dragOk: true}) // this.setState({dragOk: true})
@ -409,12 +410,12 @@ class LoginRegisterComponent extends Component {
if(result){ if(result){
if(result.data.status===-2){ if(result.data.status===-2){
if (id === 1) { if (id === 1) {
console.log(value.length);
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({
@ -436,7 +437,6 @@ class LoginRegisterComponent extends Component {
} }
}else { }else {
if (id === 1) { if (id === 1) {
console.log(value.length);
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
@ -585,13 +585,116 @@ class LoginRegisterComponent extends Component {
} }
//失去焦点判断 //失去焦点判断
inputOnBlur = (e, id) => { inputOnBlur = (e, id) => {
this.isCorrectname(e.target.value, id); // this.isCorrectname(e.target.value, id);
// this.Emailphonenumberverification(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) => { 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); this.Emailphonenumberverification(e.target.value, id);
}
} }
//获取登入密码 //获取登入密码
passwordonChange = (e) => { passwordonChange = (e) => {

@ -105,11 +105,16 @@ class ChangeHeaderPicModal extends Component{
.then((response) => { .then((response) => {
// {"status":0,"message":"success","avatar_url":"avatars/User/15739"} // {"status":0,"message":"success","avatar_url":"avatars/User/15739"}
if (response.data.status == 0) { if (response.data.status == 0) {
// this.props.getBasicInfo() // this.props.getBasicInfo()
this.props.fetchUser() // https://www.trustie.net/issues/22461
// 头像更新后会触发AccountPage的DidUpdate然后会调用getBasicInfo if ( this.props.current_user.image_url.indexOf('avatars/User/b') != -1
this.props.showNotification && this.props.showNotification("修改头像成功") || this.props.current_user.image_url.indexOf('avatars/User/g') != -1 ) {
this.setVisible(false) this.setTimeout(() => {
this.doAfterUpdated()
}, 1000)
} else {
this.doAfterUpdated();
}
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -117,6 +122,12 @@ class ChangeHeaderPicModal extends Component{
}); });
}); });
} }
doAfterUpdated = () => {
this.props.fetchUser()
// 头像更新后会触发AccountPage的DidUpdate然后会调用getBasicInfo
this.props.showNotification && this.props.showNotification("修改头像成功")
this.setVisible(false)
}
render(){ render(){
const { course_lists } = this.state const { course_lists } = this.state

Loading…
Cancel
Save