Merge branches 'dev_Ysm' and 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_aliyun_beta
杨树明 5 years ago
commit cfd748d9c6

@ -0,0 +1,62 @@
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-upload-file-modal');
if ($modal.length > 0) {
var $form = $modal.find('form.admin-upload-file-form')
var $sourceIdInput = $modal.find('input[name="source_id"]');
var $sourceTypeInput = $modal.find('input[name="source_type"]');
$modal.on('show.bs.modal', function(event){
var $link = $(event.relatedTarget);
var sourceId = $link.data('sourceId');
var sourceType = $link.data('sourceType');
$sourceIdInput.val(sourceId);
$sourceTypeInput.val(sourceType);
$modal.find('.upload-file-input').trigger('click');
});
$modal.find('.upload-file-input').on('change', function(e){
var file = $(this)[0].files[0];
if(file){
$modal.find('.file-names').html(file.name);
$modal.find('.submit-btn').trigger('click');
}
})
var formValid = function(){
if($form.find('input[name="file"]').val() == undefined || $form.find('input[name="file"]').val().length == 0){
$form.find('.error').html('请选择文件');
return false;
}
return true;
};
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
if (formValid()) {
var formDataString = $form.serialize();
$.ajax({
method: 'POST',
dataType: 'json',
url: '/admins/files?' + formDataString,
data: new FormData($form[0]),
processData: false,
contentType: false,
success: function(data){
$.notify({ message: '上传成功' });
$modal.trigger('upload:success', data);
$modal.modal('hide');
},
error: function(res){
var data = res.responseJSON;
$form.find('.error').html(data.message);
}
});
}
});
}
});

@ -28,6 +28,13 @@ $(document).on('turbolinks:load', function() {
data: json
})
})
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.shixun-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
}
});

@ -19,6 +19,7 @@ body {
align-items: stretch;
font-size: 14px;
background: #efefef;
overflow: hidden;
}
.simple_form {

@ -1,14 +1,22 @@
input[type="checkbox"]{
font-size:18px;
}
.select2 input::-webkit-input-placeholder{
color:#ccc;
}
.select2 .select2-selection__choice{
border: 1px solid #eee !important;
}
.setting-chosen{
font-weight: 400;
font-size: 10px;
color:#333;
.admins-shixun-settings-index-page {
input[type="checkbox"]{
font-size:18px;
}
.select2 input::-webkit-input-placeholder{
color:#ccc;
}
.select2 .select2-selection__choice{
border: 1px solid #eee !important;
}
.setting-chosen{
font-weight: 400;
font-size: 10px;
color:#333;
}
.shixun-setting-image {
display: flex;
flex-direction: column;
align-items: center;
}
}

@ -20,6 +20,11 @@ label.error {
input.form-control {
font-size: 14px;
}
.input-group-prepend {
.input-group-text {
font-size: 14px;
}
}
.flex-1 {
flex: 1;

@ -0,0 +1,54 @@
class Admins::FilesController < Admins::BaseController
before_action :convert_file!, only: [:create]
def create
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
Util.write_file(@file, file_path)
render_ok(source_id: params[:source_id], source_type: params[:source_type].to_s, url: file_url)
rescue StandardError => ex
logger_error(ex)
render_error('上传失败')
end
private
def convert_file!
max_size = 10 * 1024 * 1024 # 10M
if params[:file].class == ActionDispatch::Http::UploadedFile
@file = params[:file]
render_error('请上传文件') if @file.size.zero?
render_error('文件大小超过限制') if @file.size > max_size
else
file = params[:file].to_s.strip
return render_error('请上传正确的图片') if file.blank?
@file = Util.convert_base64_image(file, max_size: max_size)
end
rescue Base64ImageConverter::Error => ex
render_error(ex.message)
end
def file_path
@_file_path ||= begin
case params[:source_type].to_s
when 'Shixun' then
disk_filename('Shixun', params[:source_id])
else
disk_filename(params[:source_type].to_s, params[:source_id].to_s)
end
end
end
def disk_filename(type, id)
File.join(storage_path, type.to_s, id.to_s)
end
def storage_path
@_storage_path ||= File.join(Rails.root, 'public', 'images', 'avatars')
end
def file_url
File.join('/images/avatars/', params[:source_type].to_s, params[:source_id].to_s)
end
end

@ -46,9 +46,10 @@ module GitCommon
# 为版本库添加文件
def add_file
@path, message, content = params[:path].strip, params[:message], params[:content]
author_name, author_email = current_user.real_name, current_user.current_user.git_mail
author_name, author_email = current_user.real_name, current_user.git_mail
Rails.logger.info(" good repo_name is #{@repo_path}")
@content = GitService.update_file(repo_path: @repo_path,
file_path: path,
file_path: @path,
message: message,
content: content,
author_name: author_name,

@ -1100,13 +1100,19 @@ class CoursesController < ApplicationController
def export_member_act_score
search = params[:search] ? "#{params[:search].strip}" : "" #用户名或学生学号id搜索
group_id = params[:group_id] #分班的班级id
@all_members = student_act_score group_id, search
@all_members = @course.students
@all_members = @all_members.where(course_group_id: group_id) unless group_id.blank?
unless search.blank?
@all_members = @all_members.joins(user: [:user_extension]).where('concat(users.lastname, users.firstname) like ? or user_extensions.student_id like ?',"%#{search}%","%#{search}%")
end
if @all_members.size == 0
normal_status(-1,"课堂暂时没有学生")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
set_export_cookies
@all_members = student_act_score group_id, search
act_score_to_xlsx(@all_members)
filename_ = "#{current_user.real_name}_#{@course.name}_活跃度_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{format_sheet_name filename_.strip}",template: "courses/export_member_act_score.xlsx.axlsx",
@ -1238,7 +1244,8 @@ class CoursesController < ApplicationController
end
tip_exception("课堂所属单位不能为空!") if params[:school].blank?
tip_exception("请至少添加一个课堂模块") if params[:course_module_types].blank?
@school = School.find_by!(name: params[:school].strip)
@school = School.find_by(name: params[:school].strip)
tip_exception("所属单位不存在") unless @school.present?
end
def validate_start_end_date

@ -11,7 +11,12 @@ class HomeworkBanksController < ApplicationController
def update
ActiveRecord::Base.transaction do
@bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer])
if @bank.homework_type == 1
@bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer])
elsif @bank.homework_type == 3
@bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer],
base_on_project: params[:base_on_project], min_num: params[:min_num], max_num: params[:max_num])
end
# 作业描述的附件
Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids]

@ -3,14 +3,17 @@ class ShixunsController < ApplicationController
include ApplicationHelper
before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list,
:discusses, :collaborators, :fork_list, :propaedeutics]
:discusses, :collaborators, :fork_list, :propaedeutics, :add_file]
before_action :check_account, only: [:new, :create, :shixun_exec]
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file]
before_action :find_shixun, :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy]
before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :add_file,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file]
before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish,
:shixun_members_added, :change_manager, :collaborators_delete,

@ -1,4 +1,5 @@
class Users::QuestionBanksController < Users::BaseController
before_action :require_login
before_action :check_query_params!
before_action :check_user_permission!
@ -62,12 +63,10 @@ class Users::QuestionBanksController < Users::BaseController
end
def check_user_permission!
return if User.current.admin? || (observed_logged_user? && read_question_bank_permission?)
render_forbidden
end
def read_question_bank_permission?
params[:type] == 'personal' ? User.current.is_teacher? : User.current.certification_teacher?
if params[:type] == 'publicly'
render_error("未通过职业认证") unless User.current.admin? || User.current.certification_teacher?
else
render_forbidden unless User.current.admin? || User.current.is_teacher?
end
end
end

@ -314,8 +314,8 @@ class HomeworksService
if work.work_status != 0
if myshixun_endtime.present?
work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
work_cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
work.cost_time = work_cost_time > 0 ? work_cost_time : games.select{|game| game.status == 2}.pluck(:cost_time).sum
efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
work.efficiency = format("%.2f", efficiency)

@ -2,7 +2,7 @@
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">拒绝原因</h5>
<h5 class="modal-title">拒绝原因</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>

@ -0,0 +1,32 @@
<div class="modal fade admin-upload-file-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><%= title ||= '上传文件' %></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form class="admin-upload-file-form" enctype="multipart/form-data">
<%= hidden_field_tag(:source_type, nil) %>
<%= hidden_field_tag(:source_id, nil) %>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">文件</span>
</div>
<div class="custom-file">
<input type="file" name="file" class="upload-file-input" id="upload-file-input">
<label class="custom-file-label file-names" for="upload-file-input">选择文件</label>
</div>
</div>
<div class="error text-danger"></div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary submit-btn" data-disable-with="上传中...">上传</button>
</div>
</div>
</div>
</div>

@ -74,3 +74,4 @@
<%= render partial: 'admins/shixun_settings/shared/list', locals: { shixun_settings: @shixun_settings } %>
</div>
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片' } %>

@ -15,19 +15,11 @@
<td>
<%= select_tag(:tag_repertoires, options_for_select(@shixun_tags,shixun.tag_repertoires.pluck(:id)),multiple:true,class:"form-control shixun-setting-form",data:{id:shixun.id},id:"tags-chosen-#{shixun.id}") %>
</td>
<td>
<!-- 图片上传,稍后添加-->
--
<!-- <a href="javascript:void(0);" id="object_upload_img_<%#= shixun.id %>" onclick="$('#upload_img_<%= shixun.id %>').click();">-->
<%#= File.exist?(disk_filename("Shixun",shixun.id)) ? "重新上传" : "上传图片" %>
<!-- </a>-->
<%# if File.exist?(disk_filename("Shixun",shixun.id)) %>
<%#= image_tag(url_to_avatar(shixun), :class => "w80 h80 fl ml5 shixun_image_show", :id => "shixun_image_show_#{shixun.id}") %>
<%# else %>
<!-- <img src="" class="w80 h80 fl ml5 shixun_image_show none" id="shixun_image_show_<%#= shixun.id %>"/>-->
<%# end %>
<td class="shixun-setting-image">
<% imageExists = File.exist?(disk_filename("Shixun",shixun.id)) %>
<% imageUrl = imageExists ? '/' + url_to_avatar(shixun) + "?#{Time.now.to_i}" : '' %>
<%= image_tag(imageUrl, width: 60, height: 40, class: "preview-image shixun-image-#{shixun.id}", data: { toggle: 'tooltip', title: '点击预览' }, style: imageExists ? '' : 'display:none') %>
<%= javascript_void_link imageExists ? '重新上传' : '上传图片', class: 'action upload-shixun-image-action', data: { source_id: shixun.id, source_type: 'Shixun', toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td><%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.login}",target:'_blank' %></td>
<td>

@ -9,7 +9,7 @@
<th width="5%">选择</th>
<th width="6%">状态</th>
<th width="7%">创建者</th>
<th class="eud-pointer" width="13%"><%= sort_tag('创建于', name: 'created_at', path: admins_shixuns_path) %></th>
<th width="13%"><%= sort_tag('创建于', name: 'created_on', path: admins_shixuns_path) %></th>
<th width="5%">单测</th>
<th width="6%">操作</th>
</thead>

@ -1,5 +1,5 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">
<a class="navbar-brand" href="/">
<img src="/images/educoder/headNavLogo.png" width="40" height="40" alt="">
</a>

@ -1,18 +0,0 @@
json.question do
json.id question.id
json.question_number question.question_number
json.question_title question.question_title
json.question_type question.question_type
json.is_necessary question.is_necessary
if question.question_type == 2
json.max_choices question.max_choices
json.min_choices question.min_choices
end
json.answers do
json.array! answers do | a|
json.answer_id a.id
json.answer_position a.choice_position
json.answer_text a.choice_text.nil? ? "other_choices" : a.choice_text ##
end
end
end

@ -28,9 +28,24 @@ else
json.q_mains @poll_question_mains
end
json.questions do
json.array! @exercise_questions do | question|
json.partial! "exercise_banks/poll_questions", question: question, answers: question.exercise_bank_choices
json.questions @exercise_questions do | question|
json.question do
json.id question.id
json.question_number question.question_number
json.question_title question.question_title
json.question_type question.question_type
json.is_necessary question.is_necessary
if question.question_type == 2
json.max_choices question.max_choices
json.min_choices question.min_choices
end
json.answers do
json.array! question.exercise_bank_choices do | a|
json.answer_id a.id
json.answer_position a.choice_position
json.answer_text a.choice_text.nil? ? "other_choices" : a.choice_text ##
end
end
end
end
end

@ -19,7 +19,7 @@ if @type == "image"
end
elsif @type == "html"
json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe
json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe if @user_picture[0].present?
elsif @type == "txt"
json.contents @contents.to_s
elsif @type =="qrcode"

@ -1,9 +1,14 @@
json.count @count
json.course_list @course_lists, partial: 'users/question_banks/shared/course_list', as: :course_list
json.question_banks do
json.array! @question_banks do |question_bank|
json.partial! 'users/question_banks/shared/question_bank', locals: { question_bank: question_bank }
json.solve_count @solve_count_map.fetch(question_bank.id, 0)
end
json.question_banks @question_banks do |question_bank|
json.id question_bank.id
json.name question_bank.name
json.is_public question_bank.is_public
json.quotes_count question_bank.quotes
json.creator_name question_bank.user.name
json.course_list_name question_bank.course_list.name
json.updated_at question_bank.updated_at
json.solve_count @solve_count_map.fetch(question_bank.id, 0)
end

@ -198,6 +198,7 @@ Rails.application.routes.draw do
post :file_content
post :update_file
post :close
post :add_file
get :fork_list
post :update_propaedeutics
get :add_collaborators
@ -778,6 +779,7 @@ Rails.application.routes.draw do
namespace :admins do
get '/', to: 'dashboards#index'
resources :files, only: [:create]
resources :daily_school_statistics, only: [:index] do
get :export, on: :collection

@ -0,0 +1,10 @@
class AddAnnouncementToCourseModules < ActiveRecord::Migration[5.2]
def change
Course.all.each do |course|
unless course.course_modules.exists?(module_type: "announcement")
course.course_modules.where.not(module_type: "activity").update_all("position = position + 1")
course.course_modules << CourseModule.new(module_type: "announcement", hidden: 1, module_name: "公告栏", position: 2)
end
end
end
end

@ -0,0 +1,5 @@
class AddTagToLibraries < ActiveRecord::Migration[5.2]
def change
execute "insert into library_tags(name) values('企业案例')"
end
end

File diff suppressed because one or more lines are too long

@ -38171,6 +38171,68 @@ $(document).on('turbolinks:load', function() {
});
}
});
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-upload-file-modal');
if ($modal.length > 0) {
var $form = $modal.find('form.admin-upload-file-form')
var $sourceIdInput = $modal.find('input[name="source_id"]');
var $sourceTypeInput = $modal.find('input[name="source_type"]');
$modal.on('show.bs.modal', function(event){
var $link = $(event.relatedTarget);
var sourceId = $link.data('sourceId');
var sourceType = $link.data('sourceType');
$sourceIdInput.val(sourceId);
$sourceTypeInput.val(sourceType);
$modal.find('.upload-file-input').trigger('click');
});
$modal.find('.upload-file-input').on('change', function(e){
var file = $(this)[0].files[0];
if(file){
$modal.find('.file-names').html(file.name);
$modal.find('.submit-btn').trigger('click');
}
})
var formValid = function(){
if($form.find('input[name="file"]').val() == undefined || $form.find('input[name="file"]').val().length == 0){
$form.find('.error').html('请选择文件');
return false;
}
return true;
};
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
if (formValid()) {
var formDataString = $form.serialize();
$.ajax({
method: 'POST',
dataType: 'json',
url: '/admins/files?' + formDataString,
data: new FormData($form[0]),
processData: false,
contentType: false,
success: function(data){
$.notify({ message: '上传成功' });
$modal.trigger('upload:success', data);
$modal.modal('hide');
},
error: function(res){
var data = res.responseJSON;
$form.find('.error').html(data.message);
}
});
}
});
}
});
$(document).on('turbolinks:load', function() {
if ($('body.admins-professional-authentications-index-page').length > 0) {
var $searchFrom = $('.professional-authentication-list-form');
@ -38389,6 +38451,13 @@ $(document).on('turbolinks:load', function() {
data: json
})
})
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.shixun-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
}
});

@ -18444,27 +18444,32 @@ input.form-control {
}
/* line 24, app/assets/stylesheets/common.scss */
.input-group-prepend .input-group-text {
font-size: 14px;
}
/* line 29, app/assets/stylesheets/common.scss */
.flex-1 {
-webkit-box-flex: 1;
flex: 1;
}
/* line 28, app/assets/stylesheets/common.scss */
/* line 33, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 29, app/assets/stylesheets/common.scss */
/* line 34, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 30, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 31, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}
@ -18763,28 +18768,39 @@ input.form-control {
color: #6c757d;
}
/* line 1, app/assets/stylesheets/admins/shixun_settings.scss */
input[type="checkbox"] {
/* line 2, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page input[type="checkbox"] {
font-size: 18px;
}
/* line 4, app/assets/stylesheets/admins/shixun_settings.scss */
.select2 input::-webkit-input-placeholder {
/* line 5, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .select2 input::-webkit-input-placeholder {
color: #ccc;
}
/* line 7, app/assets/stylesheets/admins/shixun_settings.scss */
.select2 .select2-selection__choice {
/* line 8, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .select2 .select2-selection__choice {
border: 1px solid #eee !important;
}
/* line 10, app/assets/stylesheets/admins/shixun_settings.scss */
.setting-chosen {
/* line 11, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .setting-chosen {
font-weight: 400;
font-size: 10px;
color: #333;
}
/* line 17, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .shixun-setting-image {
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-align: center;
align-items: center;
}
/* line 1, app/assets/stylesheets/admins/sidebar.scss */
#sidebar {
min-width: 200px;
@ -19106,36 +19122,37 @@ body {
align-items: stretch;
font-size: 14px;
background: #efefef;
overflow: hidden;
}
/* line 26, app/assets/stylesheets/admin.scss */
/* line 27, app/assets/stylesheets/admin.scss */
.simple_form .form-group .collection_radio_buttons {
margin-bottom: 0px;
}
/* line 30, app/assets/stylesheets/admin.scss */
/* line 31, app/assets/stylesheets/admin.scss */
.simple_form .form-group .form-check-inline {
height: calc(1.5em + 0.75rem + 2px);
}
/* line 36, app/assets/stylesheets/admin.scss */
/* line 37, app/assets/stylesheets/admin.scss */
input.form-control {
font-size: 14px;
}
/* line 40, app/assets/stylesheets/admin.scss */
/* line 41, app/assets/stylesheets/admin.scss */
.btn-default {
color: #666;
background: #e1e1e1 !important;
}
/* line 44, app/assets/stylesheets/admin.scss */
/* line 45, app/assets/stylesheets/admin.scss */
.export-absolute {
right: 20px;
position: absolute;
}
/* line 48, app/assets/stylesheets/admin.scss */
/* line 49, app/assets/stylesheets/admin.scss */
.position-r {
position: relative;
}

@ -38171,6 +38171,68 @@ $(document).on('turbolinks:load', function() {
});
}
});
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-upload-file-modal');
if ($modal.length > 0) {
var $form = $modal.find('form.admin-upload-file-form')
var $sourceIdInput = $modal.find('input[name="source_id"]');
var $sourceTypeInput = $modal.find('input[name="source_type"]');
$modal.on('show.bs.modal', function(event){
var $link = $(event.relatedTarget);
var sourceId = $link.data('sourceId');
var sourceType = $link.data('sourceType');
$sourceIdInput.val(sourceId);
$sourceTypeInput.val(sourceType);
$modal.find('.upload-file-input').trigger('click');
});
$modal.find('.upload-file-input').on('change', function(e){
var file = $(this)[0].files[0];
if(file){
$modal.find('.file-names').html(file.name);
$modal.find('.submit-btn').trigger('click');
}
})
var formValid = function(){
if($form.find('input[name="file"]').val() == undefined || $form.find('input[name="file"]').val().length == 0){
$form.find('.error').html('请选择文件');
return false;
}
return true;
};
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
if (formValid()) {
var formDataString = $form.serialize();
$.ajax({
method: 'POST',
dataType: 'json',
url: '/admins/files?' + formDataString,
data: new FormData($form[0]),
processData: false,
contentType: false,
success: function(data){
$.notify({ message: '上传成功' });
$modal.trigger('upload:success', data);
$modal.modal('hide');
},
error: function(res){
var data = res.responseJSON;
$form.find('.error').html(data.message);
}
});
}
});
}
});
$(document).on('turbolinks:load', function() {
if ($('body.admins-professional-authentications-index-page').length > 0) {
var $searchFrom = $('.professional-authentication-list-form');
@ -38389,6 +38451,13 @@ $(document).on('turbolinks:load', function() {
data: json
})
})
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.shixun-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
}
});

@ -18444,27 +18444,32 @@ input.form-control {
}
/* line 24, app/assets/stylesheets/common.scss */
.input-group-prepend .input-group-text {
font-size: 14px;
}
/* line 29, app/assets/stylesheets/common.scss */
.flex-1 {
-webkit-box-flex: 1;
flex: 1;
}
/* line 28, app/assets/stylesheets/common.scss */
/* line 33, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 29, app/assets/stylesheets/common.scss */
/* line 34, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 30, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 31, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}
@ -18763,28 +18768,39 @@ input.form-control {
color: #6c757d;
}
/* line 1, app/assets/stylesheets/admins/shixun_settings.scss */
input[type="checkbox"] {
/* line 2, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page input[type="checkbox"] {
font-size: 18px;
}
/* line 4, app/assets/stylesheets/admins/shixun_settings.scss */
.select2 input::-webkit-input-placeholder {
/* line 5, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .select2 input::-webkit-input-placeholder {
color: #ccc;
}
/* line 7, app/assets/stylesheets/admins/shixun_settings.scss */
.select2 .select2-selection__choice {
/* line 8, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .select2 .select2-selection__choice {
border: 1px solid #eee !important;
}
/* line 10, app/assets/stylesheets/admins/shixun_settings.scss */
.setting-chosen {
/* line 11, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .setting-chosen {
font-weight: 400;
font-size: 10px;
color: #333;
}
/* line 17, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .shixun-setting-image {
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-align: center;
align-items: center;
}
/* line 1, app/assets/stylesheets/admins/sidebar.scss */
#sidebar {
min-width: 200px;
@ -19106,36 +19122,37 @@ body {
align-items: stretch;
font-size: 14px;
background: #efefef;
overflow: hidden;
}
/* line 26, app/assets/stylesheets/admin.scss */
/* line 27, app/assets/stylesheets/admin.scss */
.simple_form .form-group .collection_radio_buttons {
margin-bottom: 0px;
}
/* line 30, app/assets/stylesheets/admin.scss */
/* line 31, app/assets/stylesheets/admin.scss */
.simple_form .form-group .form-check-inline {
height: calc(1.5em + 0.75rem + 2px);
}
/* line 36, app/assets/stylesheets/admin.scss */
/* line 37, app/assets/stylesheets/admin.scss */
input.form-control {
font-size: 14px;
}
/* line 40, app/assets/stylesheets/admin.scss */
/* line 41, app/assets/stylesheets/admin.scss */
.btn-default {
color: #666;
background: #e1e1e1 !important;
}
/* line 44, app/assets/stylesheets/admin.scss */
/* line 45, app/assets/stylesheets/admin.scss */
.export-absolute {
right: 20px;
position: absolute;
}
/* line 48, app/assets/stylesheets/admin.scss */
/* line 49, app/assets/stylesheets/admin.scss */
.position-r {
position: relative;
}
@ -19425,27 +19442,38 @@ input.form-control {
.admins-shixun-authorizations-index-page .shixun-authorization-list-container span.apply-status-3 {
color: #6c757d;
}
/* line 1, app/assets/stylesheets/admins/shixun_settings.scss */
input[type="checkbox"] {
/* line 2, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page input[type="checkbox"] {
font-size: 18px;
}
/* line 4, app/assets/stylesheets/admins/shixun_settings.scss */
.select2 input::-webkit-input-placeholder {
/* line 5, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .select2 input::-webkit-input-placeholder {
color: #ccc;
}
/* line 7, app/assets/stylesheets/admins/shixun_settings.scss */
.select2 .select2-selection__choice {
/* line 8, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .select2 .select2-selection__choice {
border: 1px solid #eee !important;
}
/* line 10, app/assets/stylesheets/admins/shixun_settings.scss */
.setting-chosen {
/* line 11, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .setting-chosen {
font-weight: 400;
font-size: 10px;
color: #333;
}
/* line 17, app/assets/stylesheets/admins/shixun_settings.scss */
.admins-shixun-settings-index-page .shixun-setting-image {
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-align: center;
align-items: center;
}
/* line 1, app/assets/stylesheets/admins/sidebar.scss */
#sidebar {
min-width: 200px;
@ -48622,27 +48650,32 @@ input.form-control {
}
/* line 24, app/assets/stylesheets/common.scss */
.input-group-prepend .input-group-text {
font-size: 14px;
}
/* line 29, app/assets/stylesheets/common.scss */
.flex-1 {
-webkit-box-flex: 1;
flex: 1;
}
/* line 28, app/assets/stylesheets/common.scss */
/* line 33, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 29, app/assets/stylesheets/common.scss */
/* line 34, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 30, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 31, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}
@ -49028,27 +49061,32 @@ input.form-control {
}
/* line 24, app/assets/stylesheets/common.scss */
.input-group-prepend .input-group-text {
font-size: 14px;
}
/* line 29, app/assets/stylesheets/common.scss */
.flex-1 {
-webkit-box-flex: 1;
flex: 1;
}
/* line 28, app/assets/stylesheets/common.scss */
/* line 33, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 29, app/assets/stylesheets/common.scss */
/* line 34, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 30, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 31, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}

@ -15757,27 +15757,32 @@ input.form-control {
}
/* line 24, app/assets/stylesheets/common.scss */
.input-group-prepend .input-group-text {
font-size: 14px;
}
/* line 29, app/assets/stylesheets/common.scss */
.flex-1 {
-webkit-box-flex: 1;
flex: 1;
}
/* line 28, app/assets/stylesheets/common.scss */
/* line 33, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 29, app/assets/stylesheets/common.scss */
/* line 34, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 30, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 31, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}

@ -21,7 +21,7 @@ class EvaluateSuccessEffectDisplay extends Component {
componentDidMount() {
if (this.props.type == 'html') {
const iframe = document.getElementById('_displayIframe')
if (iframe && iframe.contentWindow) {
if (iframe && iframe.contentWindow && this.props.iframe_src) {
iframe.contentWindow.open()
iframe.contentWindow.document.write(this.props.iframe_src);
iframe.contentWindow.document.close();

@ -462,27 +462,25 @@ class CoursesIndex extends Component{
return (
<Switch {...this.props}>
{/*毕设任务题库详情*/}
<Route path="/courses/completetask/:workid"
<Route path="/banks/gtopic_topics/:workid"
render={
(props) => (<Completetaskpage {...this.props} {...props} {...this.state} />)
}
></Route>
{/*毕设内容题库详情*/}
<Route path="/courses/completetopic/:workid"
<Route path="/banks/gtask_topics/:workid"
render={
(props) => (<CompletetopicdePage {...this.props} {...props} {...this.state} />)
}
></Route>
{/*GroupjobbankPage*/}
{/*分组作业题库详情*/}
<Route path="/courses/groupingwork/:workid"
<Route path="/banks/group_topics/:workid"
render={
(props) => (<GroupjobbankPage {...this.props} {...props} {...this.state} />)
}
></Route>
{/*Generaljobbankdetails*/}
{/* 普通作业题库详情*/}
<Route path="/courses/ordinarywork/:workid"
<Route path="/banks/normal_topics/:workid"
render={
(props) => (<Generaljobbankdetails {...this.props} {...props} {...this.state} />)
}

@ -2123,6 +2123,12 @@ class PollNew extends Component {
//最小值
HandleGradationGroupChangee = (value, index, max, length) => {
console.log("最小值");
console.log(value);
console.log(index);
console.log(max);
console.log(length);
// debugger
var minbool = false;
var maxbool = false;
@ -2137,7 +2143,7 @@ class PollNew extends Component {
if (minbool === true && maxbool === true) {
for (var i = 0; i < arr.length; i++) {
if (index === i) {
arr[i].question.min_choices = parseInt(value);
arr[i].question.min_choices = parseInt(value);
}
}
this.setState({
@ -2146,18 +2152,8 @@ class PollNew extends Component {
} else {
for (var i = 0; i < arr.length; i++) {
if (index === i) {
try {
if(parseInt(value)===0){
arr[i].question.min_choices = 2;
arr[i].question.max_choices = length;
}else{
arr[i].question.min_choices = parseInt(value);
arr[i].question.max_choices = length;
}
}catch (e) {
arr[i].question.min_choices = 2;
arr[i].question.max_choices = length;
}
break;
}
}
@ -2169,19 +2165,32 @@ class PollNew extends Component {
}
//最大值
HandleGradationGroupChangeee = (value, index,minchoices) => {
HandleGradationGroupChangeee = (value, index,minchoices,length) => {
// console.log("2112");
// console.log(value);
// console.log(minchoices);
console.log("最大值");
console.log(value);
console.log(index);
console.log(minchoices);
console.log(length);
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
if (index === i) {
if(parseInt(value)===0&&parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(0);
arr[i].question.max_choices = parseInt(0);
}else if(parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(2);
arr[i].question.max_choices = parseInt(value);
}
else if(parseInt(value)===0&&parseInt(minchoices)>0){
arr[i].question.min_choices= parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
}else {
}
else {
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
arr[i].question.max_choices = parseInt(value);
}
}
}
@ -2455,7 +2464,7 @@ class PollNew extends Component {
// console.log(this.state.projects===undefined?"":this.state.projects.poll_questions)
var displaymysave = (mysave === true) ? "" : "display:none;";
return (
<div className="newMain">
<div>
{/*提示*/}
{Modalstype && Modalstype === true ? <Modals
modalsType={this.state.Modalstype}
@ -2465,7 +2474,14 @@ class PollNew extends Component {
modalsBottomval={this.state.ModalsBottomval}
loadtype={this.state.Loadtype}
/> : ""}
<div className="educontent mb50">
<style>
{
`
.newMains{ margin: 0 auto; padding-bottom: 235px !important; min-width:1200px; min-height: 800px !important;}
`
}
</style>
<div className="educontent newMains">
<p className="clearfix mb20 mt10">
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
@ -2867,7 +2883,7 @@ class PollNew extends Component {
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices}
>
<Option value={String("0")}>--</Option>
<Option value={"0"}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return (
indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : ""
@ -2878,10 +2894,10 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
>
<Option value={String("0")}>--</Option>
<Option value={"0"}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return (
indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : ""
@ -3121,7 +3137,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
>
<Option value={String("0")}>--</Option>
@ -3373,7 +3389,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
>
<Option value={String("0")}>--</Option>

Loading…
Cancel
Save