Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
hjm 5 years ago
commit 684b351012

@ -1,5 +1,5 @@
class AddSchoolAppliesController < ApplicationController class AddSchoolAppliesController < ApplicationController
before_action :require_login, :check_auth before_action :require_login
def create def create
school = CreateAddSchoolApplyService.call(current_user, create_params) school = CreateAddSchoolApplyService.call(current_user, create_params)

@ -914,7 +914,7 @@ class CoursesController < ApplicationController
teacher_already_exist = current_user.teacher_of_course_non_active? course teacher_already_exist = current_user.teacher_of_course_non_active? course
unless teacher_already_exist unless teacher_already_exist
existing_course_message = CourseMessage.find_by(course_id: course.id, course_message_id: current_user.id, existing_course_message = CourseMessage.find_by(course_id: course.id, course_message_id: current_user.id,
course_message_type: "JoinCourseRequest", status: 0, viewed: false) course_message_type: "JoinCourseRequest", status: 0)
if existing_course_message.blank? if existing_course_message.blank?
course_message = CourseMessage.new(course_id: course.id, user_id: course.tea_id, status: 0, course_message = CourseMessage.new(course_id: course.id, user_id: course.tea_id, status: 0,
course_message_id: current_user.id, course_message_type: "JoinCourseRequest", course_message_id: current_user.id, course_message_type: "JoinCourseRequest",
@ -924,10 +924,12 @@ class CoursesController < ApplicationController
course_message.save! course_message.save!
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 teacher_role = 1
message = "#{course_message.content == 2 ? '教师' : '助教'}申请已提交,请等待审核" message = "#{course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核"
else
message = "#{existing_course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核"
end end
end end
end end
@ -941,7 +943,7 @@ class CoursesController < ApplicationController
end end
rescue => e rescue => 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

@ -38,7 +38,7 @@ class HomeworkCommonsController < ApplicationController
tip_exception("子目录id有误") if !@category.present? tip_exception("子目录id有误") if !@category.present?
@homework_commons = @homework_commons.where(course_second_category_id: params[:category]) @homework_commons = @homework_commons.where(course_second_category_id: params[:category])
elsif @homework_type == 4 elsif @homework_type == 4
@homework_commons = @homework_commons.where(course_second_category_id: 0) @homework_commons = @homework_commons
end end
@all_count = @homework_commons.size @all_count = @homework_commons.size
@ -540,7 +540,7 @@ class HomeworkCommonsController < ApplicationController
tip_exception("补交结束时间必须晚于截止时间") if params[:late_time] <= strf_time(@homework.end_time) tip_exception("补交结束时间必须晚于截止时间") if params[:late_time] <= strf_time(@homework.end_time)
tip_exception("补交结束时间不能晚于课堂结束时间") if @course.end_date.present? && params[:late_time] > tip_exception("补交结束时间不能晚于课堂结束时间") if @course.end_date.present? && params[:late_time] >
strf_time(@course.end_date.end_of_day) strf_time(@course.end_date.end_of_day)
tip_exception("迟交扣分应为正整数") if params[:late_penalty] && params[:late_penalty].to_i < 0 tip_exception("迟交扣分不能小于0") if params[:late_penalty] && params[:late_penalty].to_i < 0
@homework.allow_late = true @homework.allow_late = true
@homework.late_time = params[:late_time] @homework.late_time = params[:late_time]
@ -560,7 +560,7 @@ class HomeworkCommonsController < ApplicationController
tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil? tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil?
tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil? tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil?
tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank? tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank?
tip_exception("效率分应为正整数") if params[:eff_score] && params[:eff_score].to_i < 0 tip_exception("效率分不能小于等于0") if params[:eff_score] && params[:eff_score].to_i <= 0
tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank? tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank?
tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank? tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank?
# tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank? # tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank?
@ -734,16 +734,16 @@ class HomeworkCommonsController < ApplicationController
if !@homework_detail_manual.final_mode if !@homework_detail_manual.final_mode
tip_exception("教师评分比例不能为空") if params[:te_proportion].blank? tip_exception("教师评分比例不能为空") if params[:te_proportion].blank?
te_proportion = params[:te_proportion].to_f.round(2) te_proportion = params[:te_proportion].to_f.round(2)
tip_exception("教师评分比例不能小于") if te_proportion < 0 tip_exception("教师评分比例不能小于0") if te_proportion < 0
tip_exception("助教评分比例不能为空") if params[:ta_proportion].blank? tip_exception("助教评分比例不能为空") if params[:ta_proportion].blank?
ta_proportion = params[:ta_proportion].to_f.round(2) ta_proportion = params[:ta_proportion].to_f.round(2)
tip_exception("助教评分比例不能小于") if ta_proportion < 0 tip_exception("助教评分比例不能小于0") if ta_proportion < 0
if !@homework.anonymous_comment if !@homework.anonymous_comment
tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion) > 1.0 tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion) > 1.0
else else
tip_exception("学生评分比例不能为空") if params[:st_proportion].blank? tip_exception("学生评分比例不能为空") if params[:st_proportion].blank?
st_proportion = params[:st_proportion].to_f.round(2) st_proportion = params[:st_proportion].to_f.round(2)
tip_exception("学生评分比例不能小于") if st_proportion < 0 tip_exception("学生评分比例不能小于0") if st_proportion < 0
tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion + st_proportion) > 1.0 tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion + st_proportion) > 1.0
end end

@ -199,7 +199,8 @@ module CoursesHelper
# 获取课堂的作业数 # 获取课堂的作业数
def get_homework_commons_count(course, type, category_id) def get_homework_commons_count(course, type, category_id)
HomeworkCommon.where(course_id: course.id, homework_type: type, course_second_category_id: category_id).size category_id == 0 ? HomeworkCommon.where(course_id: course.id, homework_type: type).size :
HomeworkCommon.where(course_id: course.id, homework_type: type, course_second_category_id: category_id).size
end end

@ -161,7 +161,7 @@ class User < ApplicationRecord
end end
def git_mail def git_mail
mail || "#{login}@educoder.net" mail.blank? ? "#{login}@educoder.net" : mail
end end
# 学号 # 学号

@ -505,7 +505,7 @@ class Coursesleftnav extends Component{
}else if(NavmodalValue.length>20){ }else if(NavmodalValue.length>20){
this.setState({ this.setState({
NavmodalValuetype:true, NavmodalValuetype:true,
NavmodalValues:"名称不能超过20个字" NavmodalValues:"名称不能超过60个字"
}) })
return return
} }

@ -1017,6 +1017,7 @@ class Listofworksstudentone extends Component {
view_report: result.data.view_report, view_report: result.data.view_report,
allow_late:result.data.allow_late, allow_late:result.data.allow_late,
loadingstate: false, loadingstate: false,
computeTimetype:true,
}) })
this.seacthdatat(result.data,result.data.student_works,result.data.work_efficiency,result.data.course_group_info,1); this.seacthdatat(result.data,result.data.student_works,result.data.work_efficiency,result.data.course_group_info,1);

@ -196,8 +196,8 @@ class Trainingjobsetting extends Component {
array.push({ array.push({
course_group_id: result.data.group_settings[i].group_id, course_group_id: result.data.group_settings[i].group_id,
course_group_name: result.data.group_settings[i].group_name, course_group_name: result.data.group_settings[i].group_name,
publish_time: result.data.group_settings[i].publish_time, publish_time: moment(result.data.group_settings[i].publish_time).format('YYYY-MM-DD HH:mm'),
end_time: result.data.group_settings[i].end_time, end_time: moment(result.data.group_settings[i].end_time).format('YYYY-MM-DD HH:mm'),
publish_flag: "", publish_flag: "",
end_flag: "", end_flag: "",
class_flag: "", class_flag: "",
@ -215,8 +215,8 @@ class Trainingjobsetting extends Component {
arrays.push({ arrays.push({
course_group_id:result.data.group_settings[i].group_id, course_group_id:result.data.group_settings[i].group_id,
course_group_name:result.data.group_settings[i].group_name, course_group_name:result.data.group_settings[i].group_name,
publish_time:result.data.group_settings[i].publish_time, publish_time:moment( result.data.group_settings[i].publish_time).format('YYYY-MM-DD HH:mm') ,
end_time:result.data.group_settings[i].end_time, end_time:moment(result.data.group_settings[i].end_time ).format('YYYY-MM-DD HH:mm'),
course_choosed:0, course_choosed:0,
}) })
@ -447,8 +447,8 @@ class Trainingjobsetting extends Component {
} else { } else {
let rulesdata=this.state.rulesdata; let rulesdata=this.state.rulesdata;
// console.log("pustdate123131312321321321"); console.log("pustdate123131312321321321");
// console.log(rulesdata); console.log(rulesdata);
if( if(
rulesdata.length === 0){ rulesdata.length === 0){
this.props.showNotification(`分班发布设置不能为空`); this.props.showNotification(`分班发布设置不能为空`);
@ -577,6 +577,8 @@ class Trainingjobsetting extends Component {
this.props.showNotification(`没有关卡不能更新设置`); this.props.showNotification(`没有关卡不能更新设置`);
return; return;
} }
if(this.state.unifiedsetting === true){ if(this.state.unifiedsetting === true){
console.log("统一设置"); console.log("统一设置");
data = { data = {
@ -588,23 +590,37 @@ class Trainingjobsetting extends Component {
late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间 late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间
answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项
work_efficiency: this.state.completionefficiencyscore, //完成效率评分占比 work_efficiency: this.state.completionefficiencyscore, //完成效率评分占比
eff_score: this.state.completionefficiencyscore === true ? this.state.latedeductiontwo : 0,//占比分 eff_score: this.state.completionefficiencyscore === true ? this.state.latedeductiontwo : undefined,//占比分
shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array, challenge_settings: array,
score_open: this.state.publicwork, score_open: this.state.publicwork,
} }
}else{ }else{
//非统一配置 // //非统一配置
console.log("非统一设置"); // console.log("非统一设置");
let rulesdata=this.state.rulesdata;
let newlist=[]
rulesdata.map((item,key)=>{
if(item.publish_time==="Invalid date"||item.end_time==="Invalid date"||item.publiend_timesh_time==="Invalid date"){
}else{
newlist.push(item)
}
})
data = { data = {
unified_setting: this.state.unifiedsetting, //非统一配置 unified_setting: this.state.unifiedsetting, //非统一配置
group_settings: this.state.rulesdata, group_settings: newlist,
allow_late: this.state.allowreplenishment, //补交 allow_late: this.state.allowreplenishment, //补交
late_penalty: parseInt(this.state.latededuction), //迟交扣分 late_penalty: parseInt(this.state.latededuction), //迟交扣分
late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间 late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间
answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项
work_efficiency: this.state.completionefficiencyscore, //完成效率评分占比 work_efficiency: this.state.completionefficiencyscore, //完成效率评分占比
eff_score: this.state.completionefficiencyscore === true ? this.state.latedeductiontwo : 0,//占比分 eff_score: this.state.completionefficiencyscore === true ? this.state.latedeductiontwo : undefined,//占比分
shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array, challenge_settings: array,
score_open: this.state.publicwork, score_open: this.state.publicwork,
@ -1710,8 +1726,8 @@ class Trainingjobsetting extends Component {
} }
} }
console.log(rules) console.log(rules);
console.log(datas) console.log(datas);
this.setState({ this.setState({
rules, rules,
rulesdata:datas, rulesdata:datas,

@ -469,7 +469,7 @@ class DetailCards extends Component{
{ {
showparagraphkey===key&&showparagraphindex===index?<div> showparagraphkey===key&&showparagraphindex===index?<div>
<Link to={'/shixuns/'+line.identifier+'/challenges'} className="mr30 color-blue_4C shixun_detail pointer fl" target="_blank">查看详情</Link> <Link to={'/shixuns/'+line.identifier+'/challenges'} className="mr30 color-blue_4C shixun_detail pointer fl" target="_blank">查看详情</Link>
<a onClick={()=>this.startgameid(line.identifier)} className="btn_auto user_bluebg_btn fl" id="shixun_operation" >开始实战</a> {line.shixun_status==="暂未公开"?"":<a onClick={()=>this.startgameid(line.identifier)} className="btn_auto user_bluebg_btn fl" id="shixun_operation" >开始实战</a>}
</div>:"" </div>:""
} }

@ -31,7 +31,7 @@ class LoginRegisterComponent extends Component {
seconds: 60, seconds: 60,
codes: "", codes: "",
getverificationcodes: true, getverificationcodes: true,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: true,
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcosytdhk:undefined, Phonenumberisnotcosytdhk:undefined,
Phonenumberisnotcosmmm: undefined, Phonenumberisnotcosmmm: undefined,
@ -109,12 +109,13 @@ class LoginRegisterComponent extends Component {
return; return;
} }
//拖动滑动验证 //拖动滑动验证
if(this.state.dragOk === false){ if(this.state.pciphone===true) {
this.openNotification("拖动滑块验证"); if (this.state.dragOk === false) {
return; this.openNotification("拖动滑块验证");
return;
}
} }
if (this.state.getverificationcodes === true) { if (this.state.getverificationcodes === true) {
this.setState({ this.setState({
getverificationcodes: undefined, getverificationcodes: undefined,
@ -508,11 +509,10 @@ class LoginRegisterComponent extends Component {
if (!regph.test(this.state.login)) { if (!regph.test(this.state.login)) {
stringdata = "手机号格式不正确"; stringdata = "手机号格式不正确";
this.setState({ this.setState({
Phonenumberisnotco: stringdata, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: true,
Phonenumberisnotcosytdhk:undefined, Phonenumberisnotcosytdhk:undefined,
dragOk:false, dragOk: true,
Whethertoverify: this.state.Whethertoverify === true ? false : true,
}) })
} else { } else {
this.setState({ this.setState({

@ -206,7 +206,6 @@ class LoginRegisterComponent extends Component {
} }
//是否验证通过 //是否验证通过
dragOkCallback = () => { dragOkCallback = () => {
debugger
this.setState({ this.setState({
Phonenumberisnotcosytdhk:undefined, Phonenumberisnotcosytdhk:undefined,
}) })
@ -217,6 +216,8 @@ class LoginRegisterComponent extends Component {
dragOk:false, dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
console.log("s0");
return; return;
} }
// var telephone = $("#telephoneAdd.tianjia_phone").val(); // var telephone = $("#telephoneAdd.tianjia_phone").val();
@ -229,11 +230,11 @@ class LoginRegisterComponent extends Component {
if (!regph.test(this.state.logins)) { if (!regph.test(this.state.logins)) {
stringdata = "手机号格式不正确"; stringdata = "手机号格式不正确";
this.setState({ this.setState({
Phonenumberisnotcos: stringdata, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: false,
dragOk:false, dragOk:true,
Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
console.log("s1");
} else { } else {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
@ -256,9 +257,12 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
dragOk:false, dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) });
console.log("s2");
return return
} else { } else {
console.log("s222222");
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
@ -492,6 +496,8 @@ class LoginRegisterComponent extends Component {
dragOk:false, dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
console.log("s5");
} }
return; return;
} else if (id === 2) { } else if (id === 2) {
@ -501,7 +507,9 @@ class LoginRegisterComponent extends Component {
dragOk:false, dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return; console.log("s6");
return;
} }
}else { }else {
if (id === 1) { if (id === 1) {
@ -581,10 +589,12 @@ class LoginRegisterComponent extends Component {
}) })
return; return;
} }
if(this.state.dragOk === false){ if(this.state.pciphone===true) {
this.openNotification("拖动滑块验证"); if (this.state.dragOk === false) {
return; this.openNotification("拖动滑块验证");
} return;
}
}
if (this.state.getverificationcodes === true) { if (this.state.getverificationcodes === true) {
this.setState({ this.setState({

Loading…
Cancel
Save