Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
miss 2017-09-06 09:57:01 +08:00
commit f83bcbcaaa
22 changed files with 206 additions and 291 deletions

View File

@ -516,15 +516,19 @@ class AccountController < ApplicationController
end
if @user.save && @se.save
@user.update_attributes(:professional_certification => 0)
diskfile2 = disk_auth_filename('UserAuthentication', @user.id, 'PRO')
diskfilePRO = diskfile2 + 'temp'
begin
FileUtils.mv diskfilePRO, diskfile2, force: true if File.exist? diskfilePRO
ensure
File.delete(diskfilePRO) if File.exist?(diskfilePRO)
end
if File.exist?(diskfile2)
if @se.identity == 1
ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2)
else
diskfile2 = disk_auth_filename('UserAuthentication', @user.id, 'PRO')
diskfilePRO = diskfile2 + 'temp'
begin
FileUtils.mv diskfilePRO, diskfile2, force: true if File.exist? diskfilePRO
ensure
File.delete(diskfilePRO) if File.exist?(diskfilePRO)
end
if File.exist?(diskfile2)
ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2)
end
end
end
redirect_to professional_certification_account_path

View File

@ -86,7 +86,7 @@ class GamesController < ApplicationController
had_test = Output.where(:game_id => @game.id, :query_index => (@game.query_index - 1))
@had_test_count = had_test.count
@had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count
@had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count
#@had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count
@had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count
@had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count
@final_score = ((@game.answer_open? || @shixun.status <= 1) ? 0 : @game.final_score.to_i)
@ -271,7 +271,7 @@ class GamesController < ApplicationController
had_test = Output.where(:game_id => @game.id, :query_index => (@game.query_index - 1))
@had_test_count = had_test.count
@had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count
@had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count
#@had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count
@had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count
@had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count
@final_score = ((@game.answer_open? || shixun.status <= 1) ? 0 : @game.final_score.to_i)

View File

@ -154,7 +154,7 @@ class MyController < ApplicationController
if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || ue.try(:location).nil? || ue.try(:location).nil?
@require_auth = true
else
if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 24*60*60) < Time.now.to_i))
if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 5*60) < Time.now.to_i))
@require_trail_auth = true
end
end

View File

@ -463,14 +463,20 @@ class ShixunsController < ApplicationController
@shixun = Shixun.new(params[:shixun])
@shixun.user_id = User.current.id
@shixun.language = params[:language]
@shixun.major_id = params[:major_id]
#@shixun.major_id = params[:major_id]
@shixun.trainee = params[:trainee]
@shixun.webssh = params[:webssh].to_i
@shixun.identifier = identifier
if params[:course_id]
params[:course_id].each do |course_id|
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
end
# if params[:course_id]
# params[:course_id].each do |course_id|
# @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
# end
# end
if CourseList.where(:name => params[:course_list].strip).count > 0
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => params[:course_list].strip).first.id)
else
course_list = CourseList.create(:name => params[:course_list].strip, :user_id => User.current.id, :is_admin => 0)
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id)
end
(params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false)
ActiveRecord::Base.transaction do
@ -534,13 +540,20 @@ class ShixunsController < ApplicationController
@shixun.language = params[:language]
@shixun.trainee = params[:trainee]
@shixun.webssh = params[:webssh].to_i
if params[:course_id]
@shixun.shixun_major_courses.destroy_all
params[:course_id].each do |course_id|
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
end
# if params[:course_id]
# @shixun.shixun_major_courses.destroy_all
# params[:course_id].each do |course_id|
# @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
# end
# end
# @shixun.major_id = params[:major_id]
@shixun.shixun_major_courses.destroy_all
if CourseList.where(:name => params[:course_list].strip).count > 0
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => params[:course_list].strip).first.id)
else
course_list = CourseList.create(:name => params[:course_list].strip, :user_id => User.current.id, :is_admin => 0)
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id)
end
@shixun.major_id = params[:major_id]
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
ActiveRecord::Base.transaction do
begin

View File

@ -99,32 +99,32 @@ module StudentWorkHelper
project = cur_user_projects_for_homework homework
if work.nil? && homework.end_time >= Time.now
if homework.homework_type == 4
link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true
link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8',:remote => true
else
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8'
end
elsif work.nil? && homework.end_time < Time.now
if homework.allow_late && homework.homework_detail_manual.comment_status < 6
if homework.homework_type == 4
link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true
link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8',:remote => true
else
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8'
end
end
elsif work
if homework.homework_type == 4
myshixun = Myshixun.find work.myshixun_id
link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10",:target => "_blank" if myshixun
link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10 mt8",:target => "_blank" if myshixun
else
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品"
link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评已结束"
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "匿评已结束"
elsif homework.end_time >= Time.now && work.user_id == User.current.id
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr'
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr mr10 mt8'
else
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mt8 mr15', :title => "作业截止后不可修改作品"
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "作业截止后不可修改作品"
end
end
end

View File

@ -35,14 +35,14 @@
</select>
<div class="cl"></div>
<span class="color-orange fl hint none" id="identity_hint" style="margin-left:90px;"><i class="fa fa-exclamation-circle mr5"></i>请选择你的职业/职称</span>
<span class="color-orange fl hint none" id="identity_hint" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5"></i>请选择你的职业/职称</span>
</li>
<li class="clearfix mt20" id="number">
<label class="rz-label fl"><span class="color-red">*</span>学号:</label>
<input type="text" nhname="tag_1" nh_tag_1="true" id="user_student_id" class="input-height select-width panel-box-sizing fl" name="no" value="<%= @user.user_extensions.student_id %>" placeholder="填写您的学号">
<div class="cl"></div>
<span class="color-orange fl hint none" id="student_id_hint" style="margin-left:90px;"><i class="fa fa-exclamation-circle mr5"></i>学号不能为空</span>
<span class="color-orange fl hint none" id="student_id_hint" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5"></i>学号不能为空</span>
</li>
<li class="clearfix mt20">
<label class="rz-label fl"><span class="color-red">*</span>单位名称:</label>
@ -50,7 +50,7 @@
<input nhname="tag" nh_tag_4="true" class="fl" id="occupation" name="occupation" style="display: none;" type="text" value="<%= @user.user_extensions.school.try(:id) %>"/> <!-- 单位名称的test框选中下拉列表框的id -->
<p id="no_school_hint" class="none fl ml10 mt8">你的单位不在列表中?请点击<a href="javascript:void(0);" class="link-color-blue">申请添加</a></p>
<div class="cl"></div>
<span class="color-orange fl none" id="school_name_hint" style="margin-left:90px;"><i class="fa fa-exclamation-circle mr5"></i>请从下拉列表中选择你的单位</span>
<span class="color-orange fl none" id="school_name_hint" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5"></i>请从下拉列表中选择你的单位</span>
</li>
<li class="clearfix mt20 <%= @user.user_extensions.school.blank? ? 'none' : '' %>" id="user_department_li">
<label class="rz-label fl">部门名称:</label>
@ -61,7 +61,7 @@
</li>
<li class="clearfix mt20">
<label class="rz-label fl"><span class="color-red">*</span>职业证正面照:</label>
<label class="rz-label fl"><span id="pro_cer_img_notice" class="color-red">*</span>职业证正面照:</label>
<%= file_field_tag 'avatar[image]',
:id => "upload_img_pro",
:style => 'display:none;',#added by young
@ -398,7 +398,37 @@
var title = "<%= "#{title}" %>";
init_identity_and_title(document.getElementById('userIdentity'), identity, title);
$("#userIdentity").change();
if(identity == "1"){
$("#pro_cer_img_notice").html("");
}
$("#userIdentity").change(function(){
var option = $("#userIdentity option:selected");
if(option.val()=="1"){
$("#identity_hint").hide();
$("#number").show();
$("#user_student_id").show();
$("#teacher").hide();
$("#profession").hide();
$("#pro_cer_img_notice").html("");
}else if(option.val()=="2"){
$("#number").hide();
$("#user_student_id").hide();
$("#identity_hint").hide();
$("#teacher").hide();
$("#profession").show();
$("#pro_cer_img_notice").html("*");
}else if(option.val()=="0"){
$("#number").hide();
$("#user_student_id").hide();
$("#identity_hint").hide();
$("#profession").hide();
$("#teacher").show();
$("#pro_cer_img_notice").html("*");
}else{
$("#identity_hint").hide();
$("#pro_cer_img_notice").html("*");
}
});
var image = $("#nh_source_pro");
var element = $("<a></a>").attr("href", image.attr('src')+".png");

View File

@ -169,6 +169,8 @@
<%# end %>
<%# end %>
</ul>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @course %>
<span class="font-12 fr" style="color:#ccc;"><i class="fa fa-eye mr5" ></i><%= @course.visits %> 次访问</span>
</div>
</div>

View File

@ -42,9 +42,9 @@
<div class="alert alert-orange mb15 mt15" style="width: 1180px; margin:20px auto;">
试用申请已提交,我们将在一个工作日内完成审核
</div>
<% elsif User.current.certification == 2 || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 24*60*60) > Time.now.to_i) %>
<% elsif User.current.certification == 2 || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 5*60) > Time.now.to_i) %>
<div class="alert alert-orange mb15 mt15" style="width: 1180px; margin:20px auto;">
您的试用申请已被拒绝,原因:<%= @trail_authentication.reason %>,请于24小时后重新申请
您的试用申请已被拒绝,原因:<%= @trail_authentication.reason %>,请于5分钟后重新申请
</div>
<% end %>
<% end %>

View File

@ -24,7 +24,7 @@
<div id="shixun_top">
<%= render :partial => 'shixuns/shixun_top' %>
</div>
<div class="task-header-nav">
<div class="task-header-nav" style="background: #fff">
<ul class="task-header-navs clearfix">
<li><a href="<%= shixun_challenges_url(@shixun) %>" class="<%= params[:action] == "index" ? "active" : "" %>" >实训</a></li>
<li><a href="<%= propaedeutics_shixun_path(@shixun) %>" class="<%= params[:action] == "propaedeutics" ? "active" : "" %>" >背景知识</a></li>

View File

@ -28,7 +28,7 @@
<div class="new_content">
<div style="width: 598px; background:#fff; margin:20px auto; font-size:14px; ">
<div style="height:50px; width: 578px; background:#46484c; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
<a href="https://www.educoder.net/" >
<a href="https://www.educoder.net">
<img src="https://www.educoder.net/images/bigdata/bigdata-logo.png" width="45" height="45" style=" float:left;" >
<p style="color:#fff; float:left; margin-top:15px; margin-left:15px;">Educoder</p>
</a>
@ -56,7 +56,7 @@
</p>
</div>
<div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;">
<a href="https://www.educoder.net/" style="font-weight: normal; color:#fff;">www.educoder.net</a>
<a href="https://www.educoder.net" style="font-weight: normal; color:#fff;">www.educoder.net</a>
</div>
</div>
</div>

View File

@ -23,7 +23,7 @@
<div class="new_content">
<div style="width: 598px; background:#fff; margin:20px auto; font-size:14px; ">
<div style="height:50px; width: 578px; background:#46484c; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
<a href="https://www.educoder.net/" >
<a href="https://www.educoder.net">
<img src="https://www.educoder.net/images/bigdata/bigdata-logo.png" width="45" height="45" style=" float:left;" >
<p style="color:#fff; float:left; margin-top:15px; margin-left:15px;">Educoder</p>
</a>
@ -48,7 +48,7 @@
</div>
<div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;">
<a href="https://www.educoder.net/" style="font-weight: normal; color:#fff;">www.educoder.net</a>
<a href="https://www.educoder.net" style="font-weight: normal; color:#fff;">www.educoder.net</a>
</div>
</div>
</div>

View File

@ -37,24 +37,23 @@
<p id="e_tips_pr" style="margin-left: 10%" class="c_grey"></p>
<div class="cl"></div>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label>
<%#= select_tag :major_id, options_for_select(shixun_major_option, 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%>
<select class="fl task-form-30 task-height-40" id="shixun_major" name="major_id">
<option value="0" selected="selected">选择实训适用专业</option>
<% @support.each do |support| %>
<option value="<%= support.id %>"><%= support.name %></option>
<% end %>
</select>
<div class="cl"></div>
<p class="text-danger ml115" id="shixun_major_notice" style="display: none;">请选择适用专业</p>
</li>
<!--<li class="clearfix mb15">-->
<!--<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label>-->
<!--<%#= select_tag :major_id, options_for_select(shixun_major_option, 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%>-->
<!--<select class="fl task-form-30 task-height-40" id="shixun_major" name="major_id">-->
<!--<option value="0" selected="selected">选择实训适用专业</option>-->
<!--<%# @support.each do |support| %>-->
<!--<option value="<%#= support.id %>"><%#= support.name %></option>-->
<!--<%# end %>-->
<!--</select>-->
<!--<div class="cl"></div>-->
<!--<p class="text-danger ml115" id="shixun_major_notice" style="display: none;">请选择适用专业</p>-->
<!--</li>-->
<li class="clearfix mb15 pr">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用课程&nbsp;&nbsp;&nbsp;</label>
<div id="shixun[lesson]" class="fl task-form-28 task-height-40 lesson pr">
<input type="text" class="lesson_content" readonly placeholder="选择实训适用的课程">
<i class="fa fa-sort-desc lesson_img"></i>
<ul class="lesson_checkbox" showul="0">
<div id="shixun[lesson]" class="pr fl with30">
<input type="text" name="course_list" autocomplete="off" style="border: 1px solid #eee;width: 100%;padding: 5px;" id="new_course_list" class="task-height-40 panel-box-sizing fl color-grey" maxlength="100" placeholder="选择实训适用的课程">
<ul class="course_list_ul">
</ul>
</div>
<div class="cl"></div>
@ -88,93 +87,36 @@
$(function(){
$("#websh").on("click", function(){
$(this).val() == '0' ? $(this).val('1') : $(this).val("0");
})
});
// 实训简介自动保存
md_elocalStorage(shixun_editormd, "shixun_in_<%= User.current.id %>", "in");
md_elocalStorage(shixun_propaedeutics, "shixun_pr_<%= User.current.id %>", "pr");
//$("textarea[name='shixun[description]']").md_elocalStorage();
// 防止刷新页面后适用课程的下拉列表为空
$("#shixun_major").val("0");
$(".lesson_content").val("");
//多选适用课程
$("body").click(function(event){
$(".lesson_checkbox").hide();
$(".lesson_checkbox").attr("showul","0");
event.stopPropagation();
$("#new_course_list").on('input', function(e){
throttle(search_course_list, window, e);
});
$(".lesson").click(function(event){
if($("#shixun_major").val() == "0") {
$("#shixun_major_course_notice").html("请先选择适用专业").show();
$("#new_course_list").on('focus', function (e) {
if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
return;
} else{
var showul=$(this).find("ul").attr("showul");
if(showul=="0"){
$(this).find("ul").show();
$(this).find("ul").attr("showul","1");
if($(this).find("ul input").length>5){
$(this).find("ul").css("overflow-y","scroll");
}
event.stopPropagation();
}else{
$(this).find("ul").hide();
$(this).find("ul").attr("showul","0");
event.stopPropagation();
}
search_course_ajax('');
}
});
$(".lesson_checkbox").on('click', 'label', function(event) {
$(".course_list_ul").on('click', 'p',function(event) {
$("#new_course_list").val($(this).html());
$(".course_list_ul").hide();
event.stopPropagation();
});
$(".lesson_checkbox").on('click', 'input',function(event) {
if ($(this).is(':checked')) {
if ($(".lesson_content").val() == "") {
$(".lesson_content").val($(this).attr("data-val"));
} else {
$(".lesson_content").val($(".lesson_content").val() + "," + $(this).attr("data-val"));
}
$("#shixun_major_course_notice").hide();
event.stopPropagation();
} else {
var valueCon = $(".lesson_content").val().split(",");
var list = [];
for (var i = 0; i < valueCon.length; i++) {
if (valueCon[i] != $(this).attr("data-val")) {
list.push(valueCon[i]);
}
}
$(".lesson_content").val(list);
event.stopPropagation();
}
$("body").click(function(event){
$(".course_list_ul").hide();
event.stopPropagation();
});
});
$("#shixun_major").on("change", function(){
if($("#shixun_major").val() != "0"){
$.ajax({
url: '/shixuns/shixun_courses',
type: 'get',
data: {major_id:$("#shixun_major").val()},
success: function(data){
if (data.result == 1){
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
for(var i=0; i<data.options.length; i++){
$(".lesson_checkbox").append('<li><input type="checkbox" name="course_id[]" data-val="'+ data.options[i][0] +'" value="'+ data.options[i][1] +'" id="join_course_role_'+ i +'" class="ml-3 mr5 magic-checkbox"><label for="join_course_role_'+ i +'">'+ data.options[i][0] +'</label></li>');
}
$("#shixun_major_notice").hide();
}
else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
}
});
} else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
});
/* ------------------------------- 简介md ------------------------------*/
var shixun_editormd = editormd("shixun_introduction", {
width : "89.7%",
@ -235,7 +177,7 @@
//提交新建项目
function submit_new_project()
{
if(regex_shixun_name() && regex_major() && regex_major_course())
if(regex_shixun_name() && regex_major_course())
{
$("#new_shixun").submit();
}

View File

@ -14,18 +14,17 @@
<p id="e_tip_in" style="margin-left: 10%" class="c_grey"></p>
<p id="e_tips_in" style="margin-left: 10%" class="c_grey"></p>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label>
<%= select_tag :major_id, options_for_select(shixun_major_option, @shixun.major_id ? @shixun.major_id : 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%>
<div class="cl"></div>
<p class="-text-danger ml95" id="shixun_major_notice" style="display: none;">请选择适用专业</p>
</li>
<!--<li class="clearfix mb15">-->
<!--<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label>-->
<!--<%#= select_tag :major_id, options_for_select(shixun_major_option, @shixun.major_id ? @shixun.major_id : 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%>-->
<!--<div class="cl"></div>-->
<!--<p class="-text-danger ml95" id="shixun_major_notice" style="display: none;">请选择适用专业</p>-->
<!--</li>-->
<li class="clearfix pr">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用课程&nbsp;&nbsp;&nbsp;</label>
<div id="shixun[lesson]" class="fl task-form-28 task-height-40 lesson pr">
<input type="text" class="lesson_content" readonly placeholder="选择实训适用的课程">
<i class="fa fa-sort-desc lesson_img"></i>
<ul class="lesson_checkbox" showul="0">
<div id="shixun[lesson]" class="pr fl with30">
<input type="text" name="course_list" value="<%= @shixun.shixun_major_courses.blank? ? "" : CourseList.where(:id => @shixun.shixun_major_courses.map(&:course_list_id)).map(&:name).join(",") %>" autocomplete="off" style="border: 1px solid #eee;width: 100%;padding: 5px;" id="new_course_list" class="task-height-40 panel-box-sizing fl" maxlength="100" placeholder="选择实训适用的课程">
<ul class="course_list_ul">
</ul>
</div>
<div class="cl"></div>
@ -62,7 +61,7 @@
<script type="text/javascript">
//配置-信息提交
function submit_edit_shixun(id) {
if (regex_shixun_name() && regex_major() && regex_major_course()) {
if (regex_shixun_name() && regex_major_course()) {
$("#edit_shixun_" + id).submit();
}
}
@ -70,100 +69,30 @@
$(function(){
$("#webssh").on("click", function(){
$(this).val() == '0' ? $(this).val('1') : $(this).val("0");
})
<% if @shixun.major_id %>
<% major_courses = @shixun.major.major_courses %>
<% CourseList.where(:id => major_courses.map(&:course_list_id)).each_with_index do |course, index| %>
$(".lesson_checkbox").append('<li><input type="checkbox" name="course_id[]" data-val="<%= course.name %>" value="<%= course.id %>" id="join_course_role_<%= index %>" class="ml-3 mr5 magic-checkbox"><label for="join_course_role_<%= index %>"><%= course.name %></label></li>');
<% end %>
<% @shixun.shixun_major_courses.each_with_index do |shixun_course, index| %>
$(".lesson_content").val($(".lesson_content").val() + "<%= index == 0 ? '' : ',' %>" + "<%= shixun_course.course_list.name %>");
$("input[value='<%= shixun_course.course_list_id %>']").attr("checked", true);
<% end %>
<% end %>
//多选适用课程
$("body").click(function(event){
if ($(event.target).attr("id") != "shixun_operation"){
$(".lesson_checkbox").hide();
$(".lesson_checkbox").attr("showul","0");
event.stopPropagation();
}
});
$(".lesson").click(function(event){
if($("#shixun_major").val() == "0") {
$("#shixun_major_course_notice").html("请先选择适用专业").show();
$("#new_course_list").on('input', function(e){
throttle(search_course_list, window, e);
});
$("#new_course_list").on('focus', function (e) {
if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
return;
} else{
var showul=$(this).find("ul").attr("showul");
if(showul=="0"){
$(this).find("ul").show();
$(this).find("ul").attr("showul","1");
if($(this).find("ul input").length>5){
$(this).find("ul").css("overflow-y","scroll");
}
event.stopPropagation();
}else{
$(this).find("ul").hide();
$(this).find("ul").attr("showul","0");
event.stopPropagation();
}
search_course_ajax('');
}
});
$(".lesson_checkbox").on('click', 'label', function(event) {
$(".course_list_ul").on('click', 'p',function(event) {
$("#new_course_list").val($(this).html());
$(".course_list_ul").hide();
event.stopPropagation();
});
$(".lesson_checkbox").on('click', 'input',function(event) {
if ($(this).is(':checked')) {
if ($(".lesson_content").val() == "") {
$(".lesson_content").val($(this).attr("data-val"));
} else {
$(".lesson_content").val($(".lesson_content").val() + "," + $(this).attr("data-val"));
}
$("#shixun_major_course_notice").hide();
event.stopPropagation();
} else {
var valueCon = $(".lesson_content").val().split(",");
var list = [];
for (var i = 0; i < valueCon.length; i++) {
if (valueCon[i] != $(this).attr("data-val")) {
list.push(valueCon[i]);
}
}
$(".lesson_content").val(list);
event.stopPropagation();
}
$("body").click(function(event){
$(".course_list_ul").hide();
event.stopPropagation();
});
});
$("#shixun_major").on("change", function(){
if($("#shixun_major").val() != "0"){
$.ajax({
url: '/shixuns/shixun_courses',
type: 'get',
data: {major_id:$("#shixun_major").val()},
success: function(data){
if (data.result == 1){
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
for(var i=0; i<data.options.length; i++){
$(".lesson_checkbox").append('<li><input type="checkbox" name="course_id[]" data-val="'+ data.options[i][0] +'" value="'+ data.options[i][1] +'" id="join_course_role_'+ i +'" class="ml-3 mr5 magic-checkbox"><label for="join_course_role_'+ i +'">'+ data.options[i][0] +'</label></li>');
}
$("#shixun_major_notice").hide();
}
else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
}
});
} else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
// 实训简介自动保存
md_elocalStorage(setting_editormd, "challenge_in_<%= User.current.id %>", "in");
});
// md恢复上次数据
function md_rec_data(k,mdu,id){

View File

@ -24,12 +24,12 @@
<textarea style="display:none;"><%= @shixun.description %></textarea>
</div>
</li>
<li class="clearfix">
<label class="panel-form-label fl">适用专业:</label>
<div class="fl task-bg-grey panel-box-sizing panel-form-width-690">
<%= @shixun.major ? @shixun.major.try(:name) : "" %>
</div>
</li>
<!--<li class="clearfix">-->
<!--<label class="panel-form-label fl">适用专业:</label>-->
<!--<div class="fl task-bg-grey panel-box-sizing panel-form-width-690">-->
<!--<%= @shixun.major ? @shixun.major.try(:name) : "" %>-->
<!--</div>-->
<!--</li>-->
<li class="clearfix">
<label class="panel-form-label fl">适用课程:</label>
<div class="fl task-bg-grey panel-box-sizing panel-form-width-690">
@ -122,7 +122,7 @@
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>" //url
});
md_elocalStorage(setting_editormd,"shixun_in_<%= User.current.id %>_<%= @shixun.id %>","in");
md_elocalStorage(setting_editormd, "challenge_in_<%= User.current.id %>", "in");
editor = setting_editormd;
}

View File

@ -93,7 +93,7 @@
<% else %>
<%= user_work_status @homework %>
<% if @homework.homework_type == 4 && !@homework.student_works.where(:user_id => User.current.id, :work_status => 0).blank? %>
<%= link_to "开始实战", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'task-btn task-btn-blue fr mr10',:target => "_blank" %>
<%= link_to "开始实战", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'task-btn task-btn-blue fr mr10 mt8',:target => "_blank" %>
<% end %>
<%= link_to "查看设置", setting_homework_common_path(@homework), :class => 'edu-btn fr mr10 mt8' %>
<% end %>
@ -265,9 +265,9 @@
<%# if @homework.homework_detail_manual.comment_status < 3 %>
<%#= user_work_status @homework %>
<%# end %>
<% if @homework.homework_type == 4 && !@homework.student_works.where(:user_id => User.current.id, :work_status => 0).blank? %>
<%= link_to "开始实战", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'task-btn task-btn-blue fr mr10',:target => "_blank" %>
<% end %>
<%# if @homework.homework_type == 4 && !@homework.student_works.where(:user_id => User.current.id, :work_status => 0).blank? %>
<%#= link_to "开始实战", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'task-btn task-btn-blue fr mr10',:target => "_blank" %>
<%# end %>
<% end %>
<p class="color-grey font-12 clearfix mb15">

View File

@ -692,13 +692,6 @@ function submit_pro_certification(){
$("#identity_hint").hide();
}
if ($("#profession").is(":visible") == true && $("#profession").val() == "0") {
$("#identity_hint").show();
check = false;
} else{
$("#identity_hint").hide();
}
if ($("#user_student_id").parent().is(":visible") == true && $("#user_student_id").val() == "") {
$("#user_student_id").focus();
check = false;
@ -719,9 +712,11 @@ function submit_pro_certification(){
$("#school_name_hint").hide();
}
if($("#upload_img_pro_sign").val() != "1"){
check = false;
notice_box("请上传职业证的正面照");
if($("#user_student_id").parent().is(":visible") == false){
if($("#upload_img_pro_sign").val() != "1"){
check = false;
notice_box("请上传职业证的正面照");
}
}
if(check){

View File

@ -1095,8 +1095,8 @@ function regex_major()
function regex_major_course()
{
if($("input[name='course_id[]']:checked").length == 0){
$("#shixun_major_course_notice").html("请先选择适用的课程").show();
if($("#new_course_list").val().trim() == ""){
$("#shixun_major_course_notice").show();
return false;
} else{
$("#shixun_major_course_notice").hide();
@ -1186,6 +1186,40 @@ function editor_focus(id){
}
var d_lastSearchCondition = '';
function search_course_list(e){
var str = $(e.target).val().trim();
if (str == d_lastSearchCondition && str != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
d_lastSearchCondition = str;
$(".course_list_ul").empty();
search_course_ajax(str);
}
function search_course_ajax(str){
$.ajax({
url: '/courses/search_course_list',
data: {search: str},
type: 'post',
success: function (data) {
if(data.courses.length > 0){
$(".course_list_ul").empty();
for(var i=0; i<data.courses.length; i++){
$(".course_list_ul").append("<li><p data-val='"+data.courses[i][0]+"' id='course_list_"+data.courses[i][1]+"'>" + data.courses[i][0] + "</p></li>");
}
$(".course_list_ul").show();
if($(".course_list_ul").find("li").length>5){
$(".course_list_ul").css("overflow-y","scroll");
} else{
$(".course_list_ul").css("overflow-y","auto");
}
} else{
$(".course_list_ul").hide();
}
}
});
}
//for(i=0;i<$("i").length;i++){
// var $TipContent = $("i").eq(i).attr("title");

View File

@ -535,38 +535,3 @@ function submitCoursesBoard(){
$("#message-form").submit();
}
}
var d_lastSearchCondition = '';
function search_course_list(e){
var str = $(e.target).val().trim();
if (str == d_lastSearchCondition && str != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
d_lastSearchCondition = str;
$(".course_list_ul").empty();
search_course_ajax(str);
}
function search_course_ajax(str){
$.ajax({
url: '/courses/search_course_list',
data: {search: str},
type: 'post',
success: function (data) {
if(data.courses.length > 0){
$(".course_list_ul").empty();
for(var i=0; i<data.courses.length; i++){
$(".course_list_ul").append("<li><p data-val='"+data.courses[i][0]+"' id='course_list_"+data.courses[i][1]+"'>" + data.courses[i][0] + "</p></li>");
}
$(".course_list_ul").show();
if($(".course_list_ul").find("li").length>5){
$(".course_list_ul").css("overflow-y","scroll");
} else{
$(".course_list_ul").css("overflow-y","auto");
}
} else{
$(".course_list_ul").hide();
}
}
});
}

View File

@ -389,7 +389,7 @@ function code_evaluation(test_sets,
//第二块 测试结果
if (had_test_count != "0") {
if (had_passed_testsests_error_count == test_sets_count) {
if (had_passed_testsests_error_count != "0") {
$d = "<p class=\"-text-danger mb10\">" +
"<i class=\"fa fa-exclamation-circle font-16\" ></i>" +
" <span class=\"ml5 mr5 -text-danger\">" + had_passed_testsests_error_count + '/' + test_sets_count + "</span>" + latest_output + "</p>";

View File

@ -398,5 +398,3 @@ a.uploadIcon {width:100px; height:33px;color:#ffffff;}
/*课堂改版*/
.sy_member_div:hover{background:#EFF2F7;}
.real-name:hover,.operation:hover{color: #FF9e6a!important;}
.course_list_ul{display: none;position: absolute;top:40px;left: -1px;width: 100% !important;border:1px solid #eeeeee;background: #FFFFFF;padding-bottom: 5px; max-height: 150px;z-index: 10}
.course_list_ul li{height:20px;padding:5px 10px;clear:both;line-height:28px;margin-bottom: 0;cursor: pointer;}

View File

@ -201,7 +201,7 @@ a.course-bth-blue{cursor: pointer;background-color:#199ed8 ;color: #ffffff !impo
.with70{ width: 70%;}.with75{ width: 75%;}
.with80{ width: 80%;}.with85{ width: 85%;}
.with87{ width: 87%;}.with90{ width: 90%;}
.with75{ width: 75%;}.with100{ width: 100%;}
.with100{ width: 100%;}
.edu-bg{ background:#fff!important;}
.disabled-bg{ background:#eee !important;}
.disabled-grey-bg{ background: #a4a4a4 !important;}

View File

@ -368,3 +368,6 @@ input::-ms-input-placeholder,textarea::-ms-input-placeholder {color:#cccccc;}
.down-select p{height: 35px;line-height: 35px;padding-left: 5px;}
.down-select p:hover{background: #f3f4f6}
/*-----课程名称下拉框--------*/
.course_list_ul{display: none;position: absolute;top:40px;left: -1px;width: 100% !important;border:1px solid #eeeeee;background: #FFFFFF;padding-bottom: 5px; max-height: 150px;z-index: 10}
.course_list_ul li{height:20px;padding:5px 10px;clear:both;line-height:28px;margin-bottom: 0 !important;cursor: pointer;}