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

dev_local
caishi 6 years ago
commit 4a670b6e98

@ -142,6 +142,13 @@ class ApplicationController < ActionController::Base
end
end
# 本地考试使用
def local_exam
if LocalSetting.first.try(:exam) && !User.current.admin?
render_403
end
end
def user_agent
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
end

@ -18,6 +18,7 @@
class BoardsController < ApplicationController
layout 'base_projects'#by young
default_search_scope :messages
before_filter :local_exam
# before_filter :check_authentication, :except => []
before_filter :find_project_by_project_id, :find_board_if_available, :except => [:join_to_org_subfields]
before_filter :authorize, :except => [:new, :show, :create, :index, :join_to_org_subfields, :update_position, :update_name, :update_boards_position, :update_boards_name]

@ -13,6 +13,7 @@ class CoursesController < ApplicationController
include ApplicationHelper
helper SyllabusesHelper
before_filter :local_exam, :except => [:show, :index]
# before_filter :auth_login1, :only => [:show, :course_activity, :feedback]
if Redmine::Configuration['gitlab_address'].include?("test")
skip_before_filter :verify_authenticity_token, :only => [:update_course_module, :join_course_multi_role]
@ -1617,6 +1618,8 @@ class CoursesController < ApplicationController
end
def show
if LocalSetting.first.try(:exam) && !User.current.admin?
else
# 被删除的课程只有超级管理员才能看到is_delete为1的时候标记课程被删除
# if @course.is_delete == 1 && !User.current.admin?
# render_403
@ -1745,6 +1748,7 @@ class CoursesController < ApplicationController
@left_nav_type = 1
@show_page = true
end
respond_to do |format|
format.js
format.html{render :layout => 'base_courses'}

@ -9,11 +9,11 @@ class ExerciseController < ApplicationController
:send_to_course, :get_student_uncomplete_question, :edit_question_score, :setting, :set_public,
:ex_setting, :add_to_exercise_bank, :choose_shixuns, :shixun_question, :back_to_answer, :export_blank_exercise, :export_student_result,
:choose_student, :redo_exercise, :cancel_commit_confirm, :cancel_commit,
:update_shixun_block, :delete_shixun_question]
:update_shixun_block, :delete_shixun_question, :delete_choose_shixun]
before_filter :find_course, :only => [:index,:new,:create]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :create_exercise_question, :publish_exercise, :publish_notice, :end_exercise, :cancel_publish,
:update_question_num, :send_to_course, :edit_question_score, :set_public, :ex_setting, :export_blank_exercise, :export_student_result,
:choose_shixuns, :shixun_question, :update_shixun_block, :delete_shixun_question]
:choose_shixuns, :shixun_question, :update_shixun_block, :delete_shixun_question, :delete_choose_shixun]
before_filter :require_login, :only => [:student_exercise_list, :show]
include ExerciseHelper
include ApplicationHelper
@ -27,6 +27,10 @@ class ExerciseController < ApplicationController
return
end
if LocalSetting.first.try(:exam) && !User.current.admin?
params[:type] = 2
end
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @is_teacher
exercises = @course.exercises.order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC")
@ -76,12 +80,12 @@ class ExerciseController < ApplicationController
if @exercise_user.nil?
@exercise_user = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false, :commit_status => 0)
if @exercise.exercise_level_settings.where("num != exercise_questions_count").count > 0
@exercise.create_user_question_list(@exercise_user)
@exercise.create_user_question_list(@exercise_user.id)
end
# @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
elsif @exercise_user.start_at.nil?
if @exercise.exercise_level_settings.where("num != exercise_questions_count").count > 0
@exercise.create_user_question_list(@exercise_user)
@exercise.create_user_question_list(@exercise_user.id)
end
@exercise_user.update_attributes(:start_at => Time.now)
end
@ -112,7 +116,7 @@ class ExerciseController < ApplicationController
@can_edit_excercise = false
end
@exercise_questions = user_question_list @exercise_user.id
@exercise_questions = @exercise.user_question_list @exercise_user.id
# @percent = get_percent(@exercise,User.current)
#@exercise_questions = @exercise.exercise_questions
@ -221,6 +225,10 @@ class ExerciseController < ApplicationController
@exercise.exercise_level_settings.destroy_all
end
def delete_choose_shixun
@exercise.exercise_questions.where(question_type: 5, exercise_level_setting_id: 0).destroy_all
end
def create
if params[:exercise]
exercise = Exercise.new
@ -1315,7 +1323,7 @@ class ExerciseController < ApplicationController
if @is_teacher || (User.current.member_of_course?(@exercise.course) && @exercise.exercise_status > 2)
@user = User.find params[:user_id]
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
@exercise_questions = @exercise.user_question_list @exercise_user.id
@exercise_questions = (@exercise.user_question_list @exercise_user.id).reorder("question_number = 0 asc, question_number asc")
respond_to do |format|
if params[:pdf]
format.html { render :layout => "pdf" }

@ -20,6 +20,7 @@ class FilesController < ApplicationController
layout 'base_projects' #by young
menu_item :files
before_filter :local_exam
# before_filter :check_authentication, :except => []
# before_filter :auth_login1, :only => [:index]
# before_filter :logged_user_by_apptoken,:only => [:index]

@ -1,5 +1,6 @@
#encoding: utf-8
class GraduationTasksController < ApplicationController
before_filter :local_exam
before_filter :find_course, :only => [:index, :new, :create]
before_filter :find_task, :only => [:show, :edit, :update, :destroy, :task_discuss, :task_setting, :publish_task, :end_task]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy]
@ -20,18 +21,16 @@ class GraduationTasksController < ApplicationController
end
unless @order.blank?
case @order
when '4'
if @course.is_end
@tasks = @tasks
else
@tasks = @tasks.where("0=1")
end
else
if @course.is_end
@tasks = @tasks.where("0=1")
else
case @order
when '0', '1', '2', '3'
@tasks = @tasks.where(:status => @order)
when '4'
@tasks = @tasks.where("status > 1 and allow_late = 1 and late_time > '#{Time.now}'")
else
@tasks = @tasks.where("0=1")
end
end
end

@ -1,5 +1,6 @@
#encoding: utf-8
class GraduationTopicsController < ApplicationController
before_filter :local_exam
before_filter :find_course, :only => [:index, :new, :create, :search_teacher, :export]
before_filter :find_topic, :only => [:show, :edit, :update, :destroy, :set_public, :student_select_topic, :cancel_topic_select, :refuse_select,
:accept_select]

@ -8,6 +8,7 @@ class HomeworkCommonController < ApplicationController
include StudentWorkHelper
include ApplicationHelper
# before_filter :check_authentication, :except => []
before_filter :local_exam
before_filter :find_course, :only => [:index,:new,:create, :shixuns, :create_shixun_homework, :publish_shixun_homework]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,
:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,

@ -61,6 +61,12 @@ class LocalSettingsController < ApplicationController
respond_to do |format|
if @local_setting.update_attributes(params[:local_setting])
if params[:local_setting][:exam] == "0"
Shixun.where(local_status: 2).update_all(status: 2, local_status: 0)
elsif params[:local_setting][:exam] == "1"
Shixun.where(status: 2).update_all(status: 0, local_status: 2)
end
format.html { redirect_to @local_setting, notice: 'Local setting was successfully updated.' }
format.json { head :no_content }
else

@ -1,5 +1,6 @@
#encoding utf-8
class PollController < ApplicationController
before_filter :local_exam
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:publish_notice,:end_notice,:cancel_publish,:poll_result,
:close_poll,:export_poll,:save_poll,:update_question_num, :student_poll_list, :poll_setting, :set_public, :add_to_exercise_bank]
before_filter :find_container, :only => [:new,:create, :index]

@ -314,7 +314,7 @@ module ExerciseHelper
all_questions = questions.where("question_type = 5")
uncomplete_shixun = []
all_questions.each do |question|
myshixun = Myshixun.where(:shixun_id => question.shixun_id, :user_id => user.id).first
myshixun = Myshixun.where(:shixun_id => question.shixun_id, :user_id => exercise_user.user_id).first
unless myshixun && myshixun.is_complete?
uncomplete_shixun << question
end

@ -31,14 +31,12 @@ class Exercise < ActiveRecord::Base
def create_user_question_list exercise_user_id
self.exercise_questions.where("question_type != 5").each do |question|
self.exercise_user_questions << ExerciseUserQuestion.new(exercise_user_id: exercise_user_id,
exercise_question_id: question)
ExerciseUserQuestion.create(exercise_id: self.id, exercise_user_id: exercise_user_id, exercise_question_id: question.id)
end
self.exercise_level_settings.each do |setting|
# 每个级别中随机挑选num个实训题
setting.exercise_questions.pluck(:id).sample(setting.num).each do |question_id|
self.exercise_user_questions << ExerciseUserQuestion.new(exercise_user_id: exercise_user_id,
exercise_question_id: question_id)
ExerciseUserQuestion.create(exercise_id: self.id, exercise_user_id: exercise_user_id, exercise_question_id: question_id)
end
end
end

@ -6,11 +6,11 @@ class ExerciseQuestion < ActiveRecord::Base
belongs_to :exercise
belongs_to :shixun
has_many :exercise_shixun_challenges, :order => "#{ExerciseShixunChallenge.table_name}.position",:dependent => :destroy
has_many :exercise_shixun_answers, :dependent => :destroy
has_many :exercise_shixun_answers
has_many :exercise_choices, :dependent => :destroy
has_many :exercise_answers, :dependent => :destroy
has_many :exercise_answer_comments, :dependent => :destroy
has_many :exercise_standard_answers, :dependent => :destroy
has_many :exercise_answers
has_many :exercise_answer_comments
has_many :exercise_standard_answers
belongs_to :exercise_level_setting, counter_cache: true
has_many :exercise_user_questions, :dependent => :destroy
@ -29,4 +29,12 @@ class ExerciseQuestion < ActiveRecord::Base
"实训题"
end
end
def ques_number index
question_number = self.question_number
if self.question_type == 5
question_number = exercise.exercise_questions.where("question_type != 5").count + index
end
question_number
end
end

@ -2,7 +2,7 @@ class ExerciseShixunAnswer < ActiveRecord::Base
belongs_to :exercise_question
belongs_to :user
belongs_to :exercise_shixun_challenge
has_many :exercise_answer_comments, :dependent => :destroy
has_many :exercise_answer_comments
# status 0: 未通过, 1通过
# attr_accessible :answer_text, :score, :status
end

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.80b6ec5e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.cf914e04.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.80b6ec5e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.9427ed60.js"></script></body></html>

@ -10,7 +10,11 @@
<div class="with78 fl">
<div class="ml20 clearfix">
<div id="course_activities_content">
<% if LocalSetting.first.try(:exam) && !User.current.admin? %>
<%= render :partial => 'welcome/no_data' %>
<% else %>
<%= render :partial => 'courses/course_activity_content', :locals => {:course_activities => @course_activities} %>
<% end %>
</div>
</div>
</div>

@ -161,9 +161,9 @@
</p>
<% end %>
</div>
<% if exercise_question.question_type == 5 %>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<% end %>
<%# if exercise_question.question_type == 5 %>
<!-- <p class="pl15 pr15 mb10"><%#= exercise_question.shixun.name %></p>-->
<%# end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= sanitize exercise_question.question_title %></div>
<% case exercise_question.question_type %>
<% when 1 %>

@ -76,9 +76,10 @@
</p>
</div>
<div class="clearfix ml80 mt10 mb5">
<% exercise_questions.where(:question_type => [1, 2, 3, 5]).each do |eq| %>
<% que_count = exercise_questions.where(:question_type => [1, 2, 3]).count %>
<% exercise_questions.where(:question_type => [1, 2, 3, 5]).each_with_index do |eq, index| %>
<% is_correct = answer_is_correct(eq, user) %>
<a href="javascript:void(0);" onclick="scroll_70height(<%= eq.question_number%>);" style="cursor:pointer" class="checkstatus_box_big color_white <%= is_correct ? 'post_btn_green' : 'post_btn_red' %>"><%= eq.question_number %></a>
<a href="javascript:void(0);" onclick="scroll_70height(<%= eq.id %>);" style="cursor:pointer" class="checkstatus_box_big color_white <%= is_correct ? 'post_btn_green' : 'post_btn_red' %>"><%= eq.ques_number(index-que_count + 1) %></a>
<% end %>
</div>
<div class="clearfix">
@ -90,16 +91,16 @@
<div class="clearfix ml80 mt10">
<% exercise_questions.where(:question_type => 4).each do |eq| %>
<% ea = @exercise_user.user.exercise_answer.where(:exercise_question_id => eq.id).first %>
<a href="javascript:void(0);" onclick="scroll_70height(<%= eq.question_number%>);" style="cursor:pointer" id="ex_comment_status_<%= eq.id %>" class="checkstatus_box_big <%= (ea && ea.score == -1) ? 'post_btn_grey' : 'post_btn_white' %>"><%= eq.question_number %></a>
<a href="javascript:void(0);" onclick="scroll_70height(<%= eq.id%>);" style="cursor:pointer" id="ex_comment_status_<%= eq.id %>" class="checkstatus_box_big <%= (ea && ea.score == -1) ? 'post_btn_grey' : 'post_btn_white' %>"><%= eq.question_number %></a>
<% end %>
</div>
</div>
<div class="clearfix" id="problem_main">
<% question_list = exercise_questions.includes(:exercise_shixun_answers, :exercise_choices => [:exercise_answers]) %>
<% question_list.each do |exercise_question| %>
<% question_list.each_with_index do |exercise_question, index| %>
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">
<p class="fl font-15" id="mao<%= exercise_question.question_number %>">第<%= exercise_question.question_number %>
<p class="fl font-15" id="mao<%= exercise_question.id %>">第<%= index + 1 %>
题:<span class="color-orange03 ml10">[<%= exercise_question.question_type_name %>
]</span><span class="ml10"><%= exercise_question.question_score %>
分</span><span class="ml10 color-red"><%= question_commit_status exercise_question, @exercise_user.user %></span>

@ -1,5 +1,5 @@
<% if @exercise.id %>
<div nhname="new_exercise_mc_q">
<div>
<%= form_for('',
:html => { :multipart => true, :id => "new_shixun_question"},
:url=>update_shixun_block_exercise_path(@exercise.id)) do |f| %>
@ -41,7 +41,7 @@
<div class="fl mt15 font-16 mb10 padding10 practicalTitlefont">实训题</div>
<ul class="fl" id="ul">
<ul class="fl" id="shixun_question_ul">
<% for i in 1..4 %>
<% questions_list = @exercise.exercise_questions.where(question_type: 5, level: i) %>
@ -53,7 +53,7 @@
<div class="fr mr40 shixun-title-font">
<span class="color-red mr5 shixun-title-font">*</span>分值:
<input id="minute<%= i %>" value="<%= @exercise.level_setting(i).try(:score) %>" name="ques_scores[]" class="borderFF8121"/> 分/题
<input id="minute<%= i %>" value="<%= @exercise.level_setting(i).try(:score) %>" name="ques_scores[]" class="inputwidth80p"/> 分/题
<div class="colorFF8121sum none" id="scoregreater<%= i %>">*大于等于0且不能大于100</div>
<div class="colorFF8121sum none" id="scorenull<%= i %>">*不能为空</div>
<div class="colorFF8121sum none" id="scorezero<%= i %>">*必须大于等于0</div>
@ -62,7 +62,7 @@
<div class="fr mr40 shixun-title-font">
<span class="color-red mr5 shixun-title-font">*</span>
随机出题量:<input id="topic<%= i %>" value="<%= @exercise.level_setting(i).try(:num) || questions_list.try(:count) %>" name="ques_nums[]" class="borderFF8121"/> 题
随机出题量:<input id="topic<%= i %>" value="<%= @exercise.level_setting(i).try(:num) || questions_list.try(:count) %>" name="ques_nums[]" class="inputwidth80p"/> 题
<div class="colorFF8121 none" id="topicnull<%= i %>">*不能为空</div>
<div class="colorFF8121 none" id="topicinteger<%= i %>">*必须为正整数</div>
<div class="colorFF8121 none" id="topicreater<%= i %>">*不能大于可用题数</div>
@ -89,39 +89,42 @@
</li>
<% end %>
</ul>
<div style="clear: both;"></div>
<div class="fl mb10 shixunsboxs">
<div class="newshixunbox">
<div class="newshixunboxfont" onclick="add_shixun();">新增实训题</div>
<div class="newshixunbox" onclick="add_shixun();">
新增实训题
</div>
</div>
<div style="clear: both;"></div>
<li class="fl clearfix mb20 shixunsboxs">
<p class="mr40">
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr30" onclick="$('#show_shixun_questions').show(); $('#edit_shixun_questions').hide();">取消</a>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_shixun_question" onclick="add_shixun_question()">保存</a>
<a href="<%= delete_choose_shixun_exercise_path(@exercise) %>" data-remote="true" data-method="delete" class="fr task-btn mr30">取消</a>
<span class=" fr font-12 color-grey mt5 mr25" style="display: block;">
<span class="color-orange-tip ">温馨提示:</span>[实训题]属于客观题将由系统自动评分
</span>
</p>
</li>
<div style="clear: both;"></div>
</div>
<% end %>
<div style="clear: both;"></div>
</div>
<% end %>
<script type="text/javascript">
$(function(){
//保存
$("#add_new_question").one('click', function(){
add_shixun_question();
});
});
// $(function(){
// //保存
// $("#add_new_shixun_question").one('click', function(){
// add_shixun_question();
// });
// });
function add_shixun_question(){
var result = true;
var Uarry=$("#ul li:visible");//获取ul中所有的li元素
var result = true;
var Uarry=$("#shixun_question_ul li:visible");//获取ul中所有的li元素
let resulttype=[]
for(var i = 1; i <= Uarry.length; i++){
var first = parseInt($("#minute"+i).val());
@ -133,50 +136,66 @@
if(first<0){
$("#scorezero"+i).show();
result = false;
$("#minute"+i).addClass("borderFF8121");
resulttype.push(false)
}else if(isNaN(first)){
$("#scorenull"+i).show();
result = false;
$("#minute"+i).addClass("borderFF8121");
resulttype.push(false)
}else if(first>100){
$("#scoreone"+i).show();
result = false;
$("#minute"+i).addClass("borderFF8121");
resulttype.push(false)
} else {
$("#scorezero"+i).hide();
$("#scorenull"+i).hide();
$("#scoreone"+i).hide();
$("#minute"+i).removeClass("borderFF8121");
resulttype.push(true)
}
if(last<0){
$("#topicnull"+i).show();
result = false;
$("#topic"+i).addClass("borderFF8121");
resulttype.push(false)
}else if(isNaN(last)){
$("#topicinteger"+i).show();
result = false;
$("#topic"+i).addClass("borderFF8121");
resulttype.push(false)
}else if(last>available){
$("#topicreater"+i).show();
result = false;
$("#topic"+i).addClass("borderFF8121");
resulttype.push(false)
} else {
$("#topicnull"+i).hide();
$("#topicinteger"+i).hide();
$("#topicreater"+i).hide();
$("#topic"+i).removeClass("borderFF8121");
resulttype.push(true)
}
}
for(var i=0; i<resulttype.length; i++){
if(resulttype[i]===false){
result=false
return
}
console.log(result);
}
if(result){
$("#new_shixun_question").submit();
} else{
$("#add_new_question").one('click', function(){
// $("#add_new_shixun_question").one('click', function(){
//
// });
add_shixun_question();
});
}
}
function shixunboxdelete(num,key){
var div=$("#shixunsbox"+num+" div");//获取所有子元素
$("#shixunsbox"+num+" div")[key].remove();
$("#available"+num).html($("#shixunsbox"+num+" div").length);
console.log($("#shixunsbox"+num+" div").length);
}
</script>

@ -1,5 +1,6 @@
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">
<% if false %>
<!--<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">-->
<!-- <div class="clearfix pl15 pr15">-->
<!-- <p class="fl font-15">第<%#= exercise_question.question_number %>题:<span class="color-orange03 ml10">[实训题]</span><span class="ml10"><%#= exercise_question.question_score %></span>分</p>-->
<%# if @exercise.exercise_status == 1 %>
<!-- <p class="fr exam_operator font-18">-->
@ -26,6 +27,7 @@
<!-- <span class="fl ml20" style="display: block;"><%#= exercise_challenge.question_score %>分</span>-->
<!-- </li>-->
<%# end %>
<% end %>
<div class="user_bg_shadow bor-grey-e mb20 answer_Temp edu-back-white practicalTemp <%= @exercise.has_shixun_questions? ? '' : 'none' %>">
@ -34,7 +36,7 @@
<!-- 试卷列表不展示三个按钮-->
<% if @exercise.exercise_status == 1 %>
<a href="javascript:void(0)" onclick="shixunQuestionEdit();"><i data-tip-down="编辑" class="fa fa-pencil color-orange05 fr mr10"></i></a>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%= delete_shixun_question_exercise_path(@exercise) %>', '确定要删除该题目吗?')">
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_shixun_question_exercise_path(@exercise) %>', '确定要删除所有的实训题吗?')">
<i data-tip-down="删除" class="fa fa-times-circle mr10 color-orange05 fr"></i>
</a>
<% end %>
@ -49,11 +51,11 @@
<span class="Titlefont"><%= shixun_question_level i %></span>
<div class="fr mr40 shixun-title-font">
<div class="fr mr8 shixun-title-font">
分值:<%= @exercise.level_setting(i).try(:score) %> 分/题
</div>
<div class="fr mr40 shixun-title-font width200">
<div class="fr mr20 shixun-title-font width160">
随机出题量:<%= @exercise.level_setting(i).try(:num) || questions_list.try(:count) %>
</div>
</div>
@ -70,17 +72,22 @@
</div>
</li>
<% end %>
<div style="clear: both;"></div>
</ul>
<div style="clear: both;"></div>
</div>
</div>
</div>
<!-- </div>-->
<!--</div>-->
<script>
function shixunQuestionEdit(){
var forms = $("form.new_exercise_question");
if(forms.length > 0){
notice_box("请先保存正在编辑的题目再编辑。");
} else {
$("#show_shixun_questions").hide();
$("#edit_shixun_questions").show();
}
}
</script>

@ -0,0 +1,2 @@
$("#exercise_question_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_content') %>");
$("#shixun_question_block").remove();

@ -1,2 +1,3 @@
$("#exercise_question_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_content') %>");
$("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question') %>');
$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>");

@ -1,6 +1,2 @@
<% if @exercise.has_shixun_questions? %>
$("#insert_new_poll_question_<%= params[:quest_id] %>").html("<%= escape_javascript(render :partial => 'new_shixun', :locals => {:exercise=>@exercise}) %>");
$("#quest_id").val(<%= params[:quest_id] %>);
<% else %>
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_shixun') %>");
<% end %>
$("#show_shixun_questions").hide();
$("#edit_shixun_questions").html("<%= escape_javascript(render :partial => 'new_shixun') %>").show();

@ -243,7 +243,7 @@
</div>
<div class="clearfix">
<% @exercise.exercise_questions.includes(:exercise_choices, :exercise_standard_answers, exercise_shixun_challenges: :challenge).each_with_index do |exercise_question, i| %>
<% @exercise.exercise_questions.where("question_type != 5").includes(:exercise_choices, :exercise_standard_answers, exercise_shixun_challenges: :challenge).each_with_index do |exercise_question, i| %>
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">
<p class="fl font-15" id="mao<%= exercise_question.question_number %>">第<%= exercise_question.question_number %>
@ -328,19 +328,59 @@
});
</script>
</div>
<% when 5 %>
<div class="pl15 pr15 pt10 pb10 bor-top-greyE">
<% exercise_question.exercise_shixun_challenges.each_with_index do |exercise_challenge, index| %>
<div class="clearfix">
<span class="fl">第<%= index + 1 %>关</span>
<span class="fl task-hide ml20" style="display: block; max-width: 80%"><%= exercise_challenge.challenge.subject %></span>
<span class="fl ml20" style="display: block;"><%= exercise_challenge.question_score %>分</span>
<%# when 5 %>
<!-- <div class="pl15 pr15 pt10 pb10 bor-top-greyE">-->
<%# exercise_question.exercise_shixun_challenges.each_with_index do |exercise_challenge, index| %>
<!-- <div class="clearfix">-->
<!-- <span class="fl">第<%#= index + 1 %>关</span>-->
<!-- <span class="fl task-hide ml20" style="display: block; max-width: 80%"><%#= exercise_challenge.challenge.subject %></span>-->
<!-- <span class="fl ml20" style="display: block;"><%#= exercise_challenge.question_score %>分</span>-->
<!-- </div>-->
<%# end %>
<!-- </div>-->
<% end %>
</div>
<% end %>
<div class="user_bg_shadow bor-grey-e mb20 answer_Temp edu-back-white practicalTemp <%= @exercise.has_shixun_questions? ? '' : 'none' %>">
<div class="fl mt15 font-16 mb10 padding10 practicalTitlefont">
<span class="colorFF8121s">[实训题]</span><%= @exercise.shixun_question_score %>分)
</div>
<ul class="fl">
<% for i in 1..4 %>
<% questions_list = @exercise.exercise_questions.where(question_type: 5, level: i) %>
<li class="<%= questions_list.try(:count).to_i > 0 ? '' : 'none' %>">
<div class="fl font-16 mb10 practicalTitle">
<span class="Titlefont"><%= shixun_question_level i %></span>
<div class="fr mr40 shixun-title-font">
分值:<%= @exercise.level_setting(i).try(:score) %> 分/题
</div>
<div class="fr mr40 shixun-title-font width200">
随机出题量:<%= @exercise.level_setting(i).try(:num) || questions_list.try(:count) %>
</div>
</div>
<div class="fl mb10 shixunsbox">
<% questions_list.each_with_index do |question| %>
<div>
<span class="shixunsboxfont"><%= question.question_title %></span>
<span class="shixundelect">
<a href="<%= shixun_path(question.shixun) %>" class="white-btn orange-btn fr mr20 mt3" target="_blank">+&nbsp;实训详情</a>
</span>
</div>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
</div>
</div>
</div>

@ -1049,7 +1049,8 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'cancel_commit_confirm'
get 'adjust_question_score'
post 'update_shixun_block'
get 'delete_shixun_question'
delete 'delete_shixun_question'
delete 'delete_choose_shixun'
end
collection do #生成路径为 /exercise/方法名

@ -0,0 +1,12 @@
class AddLocalStatusToShixuns < ActiveRecord::Migration
def change
add_column :shixuns, :local_status, :integer, :limit => 1
Shixun.find_each do |shixun|
begin
shixun.local_status = shixun.status.to_i
shixun.save!
rescue Exception => e
end
end
end
end

@ -1716,7 +1716,7 @@ function copy_course(url){
pop_box_new(htmlvalue, 550, 300);
}
function new_shixun_exercise(id){
function new_shixun_exercise(){
if($("input[name='shixun_exercise[]']:checked").length == 0){
$("#exercise_type_notice").show();
} else{

@ -67,8 +67,8 @@
"./static/js/9.2971266e.chunk.js.map": "./static/js/9.2971266e.chunk.js.map",
"main.css": "./static/css/main.80b6ec5e.css",
"main.css.map": "./static/css/main.80b6ec5e.css.map",
"main.js": "./static/js/main.cf914e04.js",
"main.js.map": "./static/js/main.cf914e04.js.map",
"main.js": "./static/js/main.9427ed60.js",
"main.js.map": "./static/js/main.9427ed60.js.map",
"static\\media\\ERASBD.ttf": "static/media/ERASBD.d5213044.ttf",
"static\\media\\background1.png": "static/media/background1.a34df396.png",
"static\\media\\background2.png": "static/media/background2.22ee659e.png",

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/css/css_min_all.css"><link rel="stylesheet" href="http://testbdweb.educoder.net/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.80b6ec5e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/js/js_min_all.js"></script><script type="text/javascript" src="http://testbdweb.educoder.net/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/js/create_kindeditor.js"></script><script type="text/javascript" src="http://testbdweb.educoder.net/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.cf914e04.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/css/css_min_all.css"><link rel="stylesheet" href="http://testbdweb.educoder.net/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.80b6ec5e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/js/js_min_all.js"></script><script type="text/javascript" src="http://testbdweb.educoder.net/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/js/create_kindeditor.js"></script><script type="text/javascript" src="http://testbdweb.educoder.net/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.9427ed60.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -169,6 +169,7 @@ class Index extends Component {
{/* 区分下repo和evaluate模块的以及子模块的 */}
<MainContentContainer
{...context}
onDrawerButtonClick={this.onDrawerButtonClick}
user={context.user}

@ -162,11 +162,11 @@ class LeftView extends Component {
style={{display: 'none'}}>
<a href="javascript:void(0);" className="tab_type" style={{fontSize: '16px'}}>TA人解答</a>
</li>
<li id="tab_nav_4" className={ tabIndex === 3 ? `tab_hover` : ''} onClick={() => tabIndexChange(3)}>
{ this.props.local_exam !== true && <li id="tab_nav_4" className={ tabIndex === 3 ? `tab_hover` : ''} onClick={() => tabIndexChange(3)}>
<a href="javascript:void(0)" className="tab_type" style={{fontSize: '16px'}} data-remote="true">
评论<span id="discusses_count" className="edu-cir-grey1" style={{lineHeight: '18px!important'}}>{discusses_count||""}</span>
</a>
</li>
</li> }
{/*<span className="btn-cir-big fr mt8 mr15">经验值:{challenge.score}</span>*/}
</ul>
<div className="cl"></div>
@ -237,10 +237,10 @@ class LeftView extends Component {
</div>
</div>
<div id="mini_comment_section">
{ this.props.local_exam === true ? '' : <div id="mini_comment_section">
{/*说点什么 */}
<CommentInput challenge={challenge} {...this.props}></CommentInput>
</div>
</div> }
</div>
</div>

@ -892,7 +892,7 @@ html>body #ajax-indicator { position: fixed; }
.practicalTemp{
width:1200px;
min-height:950px;
min-height:450px;
background:rgba(255,255,255,1);
border:1px solid rgba(238,238,238,1);
}
@ -967,7 +967,7 @@ html>body #ajax-indicator { position: fixed; }
.shixunsboxfont{
width:1060px;
min-height:12px;
font-size:4px;
font-size:14px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(122,122,122,1);
@ -1009,22 +1009,35 @@ html>body #ajax-indicator { position: fixed; }
line-height: 40px;
margin: 0 auto;
margin-top: 20px;
}
.newshixunboxfont{
width:71px;
height:12px;
font-size:4px;
text-align: center;
color:rgba(255,104,0,1);
font-size:14px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(255,104,0,1);
margin: 0 auto;
}
/*.newshixunboxfont{*/
/*width:71px;*/
/*height:12px;*/
/*font-size:4px;*/
/*font-family:MicrosoftYaHei;*/
/*font-weight:400;*/
/*color:rgba(255,104,0,1);*/
/*margin: 0 auto;*/
/*}*/
.width200{
width:200px;
}
.width160{
width:160px;
}
.colorFF8121s{
color:#FF8121;
}
.inputwidth80p{
width: 80px;
text-align: center;
}
Loading…
Cancel
Save