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

video_transcode
dinglink 5 years ago
commit 41d7f1f84d

@ -36,8 +36,8 @@ class ExaminationBanksController < ApplicationController
end
current_user.item_baskets.destroy_all
render_ok({exam_id: exam.id})
end
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
end

@ -289,21 +289,14 @@ class HomeworkCommonsController < ApplicationController
def update_score
tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now
begin
@homework.update_homework_work_score
normal_status("更新成功")
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
def update_student_score
work = @homework.student_works.find_by(user_id: current_user.id)
myshixun = Myshixun.find_by(shixun_id: params[:shixun_id], user_id: current_user.id)
ActiveRecord::Base.transaction do
begin
if work && myshixun
challenge_settings = @homework.homework_challenge_settings
games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id))
@ -312,11 +305,6 @@ class HomeworkCommonsController < ApplicationController
else
normal_status("还未开启挑战,暂不能更新成绩")
end
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
end
@ -382,7 +370,6 @@ class HomeworkCommonsController < ApplicationController
end
ActiveRecord::Base.transaction do
begin
@homework = HomeworkCommon.new(homework_params)
@homework.reference_answer = params[:reference_answer].to_s.strip
@homework.homework_type = @homework_type
@ -413,11 +400,6 @@ class HomeworkCommonsController < ApplicationController
else
tip_exception("创建失败")
end
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
end
@ -432,7 +414,6 @@ class HomeworkCommonsController < ApplicationController
end
ActiveRecord::Base.transaction do
begin
@homework.update_attributes!(homework_params)
@homework.reference_answer = params[:reference_answer].to_s.strip
@ -451,11 +432,7 @@ class HomeworkCommonsController < ApplicationController
Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids]
normal_status(0, "更新成功")
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
end
@ -467,7 +444,6 @@ class HomeworkCommonsController < ApplicationController
end
def update_settings
begin
# 课堂结束后不能再更新
unless @course.is_end
@ -760,11 +736,6 @@ class HomeworkCommonsController < ApplicationController
# uid_logger(ex.message)
# render_error(ex.message)
# raise ActiveRecord::Rollback
rescue Exception => e
uid_logger(e.backtrace)
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
# 选用实训
@ -935,16 +906,14 @@ class HomeworkCommonsController < ApplicationController
if params[:detail].blank?
tip_exception("缺少截止时间参数") if params[:end_time].blank?
tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
else
tip_exception("缺少分班截止时间参数") if params[:group_end_times].blank?
group_end_times = params[:group_end_times].reject(&:blank?)&.map {|time| time.to_time}
tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length
group_end_times.each do |time|
tip_exception("分班截止时间不能早于当前时间") if time <= Time.now
tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && time > @course.end_date.end_of_day
tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if @course.end_date.present? && time > @course.end_date.end_of_day
end
end
@ -955,7 +924,6 @@ class HomeworkCommonsController < ApplicationController
publish_groups = charge_group_ids & group_ids if group_ids
# ActiveRecord::Base.transaction do
begin
homeworks.each do |homework|
# 作业未发布时
if homework.homework_detail_manual.try(:comment_status) == 0
@ -1038,11 +1006,7 @@ class HomeworkCommonsController < ApplicationController
# HomeworkPublishUpdateWorkStatusJob.perform_later(tiding_group_ids, homework.id)
end
normal_status(0, "发布成功")
rescue Exception => e
uid_logger(e.message)
tip_exception("发布失败")
raise ActiveRecord::Rollback
end
# end
end
@ -1074,7 +1038,6 @@ class HomeworkCommonsController < ApplicationController
group_ids = params[:group_ids]&.reject(&:blank?)&.map(&:to_i)
end_groups = charge_group_ids & group_ids if group_ids
begin
homeworks.each do |homework|
ActiveRecord::Base.transaction do
homework_detail_manual = homework.homework_detail_manual
@ -1119,11 +1082,6 @@ class HomeworkCommonsController < ApplicationController
HomeworkEndUpdateScoreJob.perform_later(homework.id) if !homework.allow_late && homework.end_time <= time
end
normal_status(0, "更新成功")
rescue Exception => e
uid_logger(e.message)
tip_exception("操作失败")
raise ActiveRecord::Rollback
end
end
def set_public
@ -1156,7 +1114,6 @@ class HomeworkCommonsController < ApplicationController
# 删除多个作业
def multi_destroy
ActiveRecord::Base.transaction do
begin
homeworks = @course.homework_commons.where(id: params[:homework_ids])
homeworks.destroy_all
@ -1164,11 +1121,6 @@ class HomeworkCommonsController < ApplicationController
StudentWork.where(homework_common_id: homeworks.pluck(:id)).destroy_all
normal_status(0, "删除成功")
rescue Exception => e
uid_logger(e.message)
tip_exception("删除失败")
raise ActiveRecord::Rollback
end
end
end
@ -1178,7 +1130,6 @@ class HomeworkCommonsController < ApplicationController
homeworks.each do |homework|
ActiveRecord::Base.transaction do
begin
homework_bank = current_user.homework_banks.find_by(homework_common_id: homework.id)
if homework_bank.present?
# 如果作业加入过题库则更新参数
@ -1208,11 +1159,6 @@ class HomeworkCommonsController < ApplicationController
homework.update_attributes!(homework_bank_id: new_homework_bank.id)
end
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
end
normal_status(0, "加入成功")

@ -229,22 +229,9 @@ class ChoquesEditor extends Component{
var texts;
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
texts=JSON.stringify(value);
}catch (e) {
texts="";
}
} else {
if(_text.length>=500){
var result = _text.substring(0,450);
@ -298,66 +285,46 @@ class ChoquesEditor extends Component{
// debugger
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
// 提交到后台的内容需要处理一下;
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl: JSON.stringify(value)
question_titleysl:texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
// 提交到后台的内容需要处理一下;
try {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl: JSON.stringify(value)
question_titlesysl:texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}
}

@ -303,72 +303,50 @@ class JudquestionEditor extends Component{
// console.log(quill);
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
// console.log(_text);
// console.log(_text.length);
if(this.isNull(_text)===true){
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
this.setState({
question_titleysl:JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
// console.log("空");
} else {
// console.log("有");
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
this.setState({
question_titlesysl:JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
try {
texts = JSON.stringify(value);
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
}
}
render() {

@ -140,7 +140,13 @@ class SingleEditor extends Component{
// this.refs['titleEditor'].showError()
this.props.showNotification('请您输入题干');
return editordata;
}else{
console.log("question_titleysl");
console.log(question_titleysl);
}
for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) {
// this.refs[`optionEditor${i}`].showError()
@ -244,6 +250,7 @@ class SingleEditor extends Component{
this.setState({ standard_answers })
}
onOptionContentChange = (value,quill,index) => {
debugger
if (index >= this.state.question_choices.length) {
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return;
@ -251,18 +258,9 @@ class SingleEditor extends Component{
var texts;
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
texts= JSON.stringify(value)
}catch (e) {
texts="";
}
} else {
if(_text.length>=500){
var result = _text.substring(0,450);
@ -315,61 +313,47 @@ class SingleEditor extends Component{
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl: JSON.stringify(value)
question_titleysl:texts===undefined|| null?"":texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
} else {
let texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
try {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:JSON.stringify(value)
question_titlesysl:texts===undefined|| null?"":texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}
}
handleShowImage = (url) => {

Loading…
Cancel
Save