Merge branch 'dev_aliyun' into dev_cxt

dev_ec
cxt 5 years ago
commit 1c6a718c63

@ -83,4 +83,4 @@ $(document).on("turbolinks:before-cache", function () {
// });
$(function () {
});
});

@ -3,6 +3,7 @@ $(document).on('turbolinks:load', function() {
if ($refuseModal.length > 0) {
var $form = $refuseModal.find('form.admin-common-refuse-form');
var $applyIdInput = $refuseModal.find('.modal-body input[name="apply_id"]');
var $applyTitle = $refuseModal.find('.modal-title');
$form.validate({
errorElement: 'span',
@ -21,9 +22,19 @@ $(document).on('turbolinks:load', function() {
var applyId = $link.data('id');
var url = $link.data('url');
var title = $link.data('title');
var type = $link.data('type');
var form_method = "POST";
if(typeof title !== 'undefined'){
$applyTitle.html(title)
}
if(typeof type !== 'undefined'){
form_method = type;
}
$applyIdInput.val(applyId);
$form.data('url', url);
$form.data('type', form_method);
});
// modal visited fire
$refuseModal.on('shown.bs.modal', function(){
@ -40,9 +51,10 @@ $(document).on('turbolinks:load', function() {
if ($form.valid()) {
var url = $form.data('url');
var form_method = $form.data('type');
$.ajax({
method: 'POST',
method: form_method,
dataType: 'script',
url: url,
data: $form.serialize(),

@ -0,0 +1,22 @@
$(document).on('turbolinks:load', function() {
var $editModal = $('.department-apply-edit-modal');
if($editModal.length > 0){
var $form = $editModal.find('form.department-apply-form');
var $applyIdInput = $form.find('input[name="id"]');
$editModal.on('show.bs.modal', function (event) {
var $link = $(event.relatedTarget);
var applyId = $link.data('id');
$applyIdInput.val(applyId);
});
$editModal.on('click', '.submit-btn', function(){
$.ajax({
method: "PUT",
dataType: 'script',
url: "/admins/department_applies/"+ $applyIdInput.val(),
data: $form.serialize(),
}).done(function(){
$editModal.modal('hide');
});
});
}
});

@ -1,14 +1,22 @@
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-message-modal');
var $submitBtn = $modal.find('.submit-btn');
if ($modal.length > 0) {
$modal.on('hide.bs.modal', function(){
$modal.find('.modal-body').html('');
$submitBtn.unbind();
});
}
});
function showMessageModal(html) {
function showMessageModal(html, callback) {
var $modal = $('.modal.admin-message-modal');
var $submitBtn = $modal.find('.submit-btn');
$submitBtn.unbind();
if(callback !== undefined && typeof callback === 'function'){
$submitBtn.on('click', callback);
}
$modal.find('.modal-body').html(html);
$modal.modal('show');
}

@ -0,0 +1,78 @@
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-import-course-member-modal');
if ($modal.length > 0) {
var $form = $modal.find('form.admin-import-course-member-form');
var resetFileInputFunc = function(file){
file.after(file.clone().val(""));
file.remove();
}
$modal.on('show.bs.modal', function(){
$modal.find('.file-names').html('选择文件');
$modal.find('.upload-file-input').trigger('click');
});
$modal.on('hide.bs.modal', function(){
resetFileInputFunc($modal.find('.upload-file-input'));
});
$modal.on('change', '.upload-file-input', function(e){
var file = $(this)[0].files[0];
$modal.find('.file-names').html(file ? file.name : '请选择文件');
})
var importFormValid = 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;
};
var buildResultMessage = function(data){
var messageHtml = "<div>导入结果:成功" + data.success + "条,失败"+ data.fail.length + "条</div>";
if(data.fail.length > 0){
messageHtml += '<table class="table"><thead class="thead-light"><tr><th>数据</th><th>失败原因</th></tr></thead><tbody>';
data.fail.forEach(function(item){
messageHtml += '<tr><td>' + item.data + '</td><td>' + item.message + '</td></tr>';
});
messageHtml += '</tbody></table>'
}
return messageHtml;
}
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
if (importFormValid()) {
$('body').mLoading({ text: '正在导入...' });
$.ajax({
method: 'POST',
dataType: 'json',
url: '/admins/import_course_members',
data: new FormData($form[0]),
processData: false,
contentType: false,
success: function(data){
$('body').mLoading('destroy');
$modal.modal('hide');
showMessageModal(buildResultMessage(data), function(){
window.location.reload();
});
},
error: function(res){
$('body').mLoading('destroy');
var data = res.responseJSON;
$form.find('.error').html(data.message);
}
});
}
});
}
});

@ -122,14 +122,18 @@ $(document).on('turbolinks:load', function(){
// 导入学生
var $importUserModal = $('.modal.admin-import-user-modal');
var $importUserForm = $importUserModal.find('form.admin-import-user-form')
var resetFileInputFunc = function(file){
file.after(file.clone().val(""));
file.remove();
}
$importUserModal.on('show.bs.modal', function(){
resetFileInputFunc($importUserModal.find('.upload-file-input'));
$importUserModal.find('.file-names').html('选择文件');
$importUserModal.find('.upload-file-input').trigger('click');
});
$importUserModal.find('.upload-file-input').on('change', function(e){
$importUserModal.on('change', '.upload-file-input', function(e){
var file = $(this)[0].files[0];
$importUserModal.find('.file-names').html(file ? file.name : '请选择文件');
})
@ -175,7 +179,9 @@ $(document).on('turbolinks:load', function(){
$('body').mLoading('destroy');
$importUserModal.modal('hide');
showMessageModal(buildResultMessage(data));
showMessageModal(buildResultMessage(data), function(){
window.location.reload();
});
},
error: function(res){
$('body').mLoading('destroy');

@ -0,0 +1,71 @@
class Admins::DepartmentAppliesController < Admins::BaseController
before_action :get_apply,only:[:agree,:edit,:update,:destroy]
def index
params[:status] ||= 0
params[:sort_by] = params[:sort_by].presence || 'created_at'
params[:sort_direction] = params[:sort_direction].presence || 'desc'
applies = Admins::DepartmentApplyQuery.call(params)
@depart_applies = paginate applies.preload(:school,user: :user_extension)
end
def agree
ActiveRecord::Base.transaction do
@depart_apply.update_attribute("status",1)
@depart_apply&.applied_messages&.update_all(status:1)
@depart_apply&.department&.update_attribute("is_auth",1)
@depart_apply&.user&.user_extension&.update_attribute("department_id",@depart_apply.department_id)
render_success_js
end
end
def update
depart_name = params[:name]
ActiveRecord::Base.transaction do
@depart_apply.update_attribute("name",depart_name)
@depart_apply&.department&.update_attribute("name",depart_name)
extra = depart_name + "(#{@depart_apply&.department&.school&.try(:name)})"
tiding_params = {
user_id: @depart_apply.user_id,
trigger_user_id: 0,
container_id: @depart_apply.id,
container_type: 'ApplyAddDepartment',
belong_container_id: @depart_apply.department.school_id,
belong_container_type: "School",
tiding_type: "System",
status: 3,
extra: extra
}
Tiding.create(tiding_params)
render_success_js
end
end
def destroy
ActiveRecord::Base.transaction do
@depart_apply.update_attribute("status",3)
@depart_apply&.applied_messages&.update_all(status:3)
@depart_apply&.department&.destroy
@depart_apply&.user&.user_extension&.update_attribute("department_id", nil)
tiding_params = {
user_id: @depart_apply.user_id,
trigger_user_id: 0,
container_id: @depart_apply.id,
container_type: 'ApplyAddDepartment',
belong_container_id: @depart_apply.department.school_id,
belong_container_type: "School",
tiding_type: "System",
status: 2,
extra: params[:reason]
}
Tiding.create(tiding_params)
render_success_js
end
end
private
def get_apply
@depart_apply = ApplyAddDepartment.find_by(id:params[:id])
end
end

@ -0,0 +1,10 @@
class Admins::ImportCourseMembersController < Admins::BaseController
def create
return render_error('请上传正确的文件') if params[:file].blank? || !params[:file].is_a?(ActionDispatch::Http::UploadedFile)
result = Admins::ImportCourseMemberService.call(params[:file].to_io)
render_ok(result)
rescue Admins::ImportCourseMemberService::Error => ex
render_error(ex)
end
end

@ -27,7 +27,7 @@ class CoursesController < ApplicationController
:attahcment_category_list,:export_member_scores_excel, :duplicate_course,
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course,
:informs, :update_informs, :online_learning, :update_task_position, :tasks_list,
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs]
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs, :delete_informs]
before_action :user_course_identity, except: [:join_excellent_course, :index, :create, :new, :apply_to_join_course,
:search_course_list, :get_historical_course_students, :mine, :search_slim, :board_list]
before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate,
@ -36,7 +36,7 @@ class CoursesController < ApplicationController
:add_teacher, :export_couser_info, :export_member_act_score]
before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin,
:set_course_group, :create_group_by_importing_file, :update_informs, :new_informs,
:update_task_position, :tasks_list]
:update_task_position, :tasks_list, :delete_informs]
before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group,
:change_course_teacher, :course_group_list,
:teacher_application_review, :apply_teachers, :delete_course_teacher]
@ -212,7 +212,7 @@ class CoursesController < ApplicationController
@course.update_attributes!(course_params.merge(extra_params))
@course.update_course_modules(params[:course_module_types])
Rails.logger.info("###############course_update_end")
normal_status(0, "成功")
rescue => e
uid_logger_error(e.message)
@ -257,6 +257,12 @@ class CoursesController < ApplicationController
normal_status("更新成功")
end
def delete_informs
inform = @course.informs.find_by(id: params[:inform_id])
inform.destroy!
normal_status("删除成功")
end
def online_learning
@subject = @course.subject
@stages = @subject&.stages
@ -1478,8 +1484,10 @@ class CoursesController < ApplicationController
shixun_titles = shixun_homeworks.pluck(:name) + ["总得分"]
# 更新实训作业成绩
shixun_homeworks.includes(:homework_challenge_settings, :published_settings, :homework_commons_shixun).each do |homework|
homework.update_homework_work_score
unless course.is_end
shixun_homeworks.includes(:homework_challenge_settings, :published_settings, :homework_commons_shixun).each do |homework|
homework.update_homework_work_score
end
end
shixun_homeworks = shixun_homeworks&.includes(score_student_works: :user)

@ -916,7 +916,8 @@ class GamesController < ApplicationController
# 更新关卡状态和一些学习进度
def update_game_parameter game
game.update_attribute(:status, 0) if game.status == 1
game.update_attributes(status: 0, open_time: Time.now) if game.status == 3
# 第一次进入关卡更新时间
game.update_attributes(status: 0, open_time: Time.now) if game.open_time.blank? || game.status == 3
# 开启实训更新myshixuns的时间方便跟踪用于的学习进度。
game.myshixun.update_column(:updated_at, Time.now)
end

@ -230,6 +230,7 @@ class GraduationTopicsController < ApplicationController
topic_repeat: topic.topic_repeat,
province: topic.province,
city: topic.city,
topic_type: topic.topic_type,
course_list_id: @course.course_list_id)
topic_bank.attachments.destroy_all
else
@ -241,6 +242,7 @@ class GraduationTopicsController < ApplicationController
topic_repeat: topic.topic_repeat,
province: topic.province,
city: topic.city,
topic_type: topic.topic_type,
course_list_id: @course.course_list_id,
user_id: current_user.id,
graduation_topic_id: topic.id)

@ -82,8 +82,7 @@ class HomeworkCommonsController < ApplicationController
end
@task_count = @homework_commons.size
@homework_commons = @homework_commons.order("IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
homework_commons.created_at DESC").page(page).per(15)
@homework_commons = @homework_commons.order("position DESC").page(page).per(15)
if @homework_type == 4
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns)
@ -931,6 +930,7 @@ class HomeworkCommonsController < ApplicationController
shixuns.each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, @category, current_user
@homework_ids << homework.id
CreateStudentWorkJob.perform_later(homework.id)
end
rescue Exception => e
uid_logger(e.message)
@ -1032,6 +1032,7 @@ class HomeworkCommonsController < ApplicationController
stage.shixuns.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, category, current_user
@homework_ids << homework.id
CreateStudentWorkJob.perform_later(homework.id)
end
end
end

@ -8,11 +8,11 @@ class ShixunsController < ApplicationController
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file]
:get_mirror_script, :download_file, :shixun_list]
before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file]
:get_mirror_script, :download_file, :shixun_list]
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,
@ -98,6 +98,50 @@ class ShixunsController < ApplicationController
.each_with_object({}) { |r, obj| obj[r.shixun_id] = r.name }
end
def shixun_list
# 全部实训/我的实训
type = params[:type] || "all"
# 状态:已发布/未发布
status = params[:status] || "all"
# 超级管理员用户显示所有未隐藏的实训、非管理员显示所有已发布的实训(对本单位公开且未隐藏未关闭)
if type == "mine"
@shixuns = current_user.shixuns.none_closed
else
if current_user.admin?
@shixuns = Shixun.none_closed.where(hidden: 0)
else
none_shixun_ids = ShixunSchool.where("school_id != #{current_user.school_id}").pluck(:shixun_id)
@shixuns = Shixun.where.not(id: none_shixun_ids).none_closed.where(hidden: 0)
end
end
unless status == "all"
@shixuns = status == "published" ? @shixuns.where(status: 2) : @shixuns.where(status: [0, 1])
end
## 搜索关键字创建者、实训名称、院校名称
unless params[:search].blank?
keyword = params[:search].strip
@shixuns = @shixuns.joins(user: [user_extension: :school]).
where("schools.name like '%#{keyword}%'
or concat(lastname, firstname) like '%#{keyword}%'
or shixuns.name like '%#{keyword.split(" ").join("%")}%'").distinct
end
## 筛选 难度
if params[:diff].present? && params[:diff].to_i != 0
@shixuns = @shixuns.where(trainee: params[:diff])
end
@total_count = @shixuns.count
page = params[:page] || 1
limit = params[:limit] || 15
@shixuns = @shixuns.order("myshixuns_count desc").page(page).per(limit).includes(:shixun_info, :subjects, user: [user_extension: :school])
end
## 获取顶部菜单
def menus
@repertoires = Repertoire.includes(sub_repertoires: [:tag_repertoires]).order("updated_at asc")
@ -601,7 +645,7 @@ class ShixunsController < ApplicationController
challenges.each_with_index do |challenge, index|
status = (index == 0 ? 0 : 3)
game_identifier = generate_identifier(Game, 12)
worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now,
worker.add(base_attr.merge(challenge_id: challenge.id, status: status,
identifier: game_identifier, modify_time: challenge.modify_time))
end
end
@ -865,6 +909,7 @@ class ShixunsController < ApplicationController
def send_to_course
@course = Course.find(params[:course_id])
homework = HomeworksService.new.create_homework @shixun, @course, nil, current_user
CreateStudentWorkJob.perform_later(homework.id)
end
# 二维码扫描下载

@ -214,6 +214,7 @@ class SubjectsController < ApplicationController
stage.shixuns.where(id: params[:shixun_ids], status: 2).each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, category, current_user
CreateStudentWorkJob.perform_later(homework.id)
end
end
rescue Exception => e

@ -1,5 +1,6 @@
class Users::QuestionBanksController < Users::BaseController
before_action :require_login
before_action :private_user_resources!
before_action :check_query_params!
before_action :check_user_permission!

@ -0,0 +1,11 @@
class Wechats::JsSdkSignaturesController < ApplicationController
def create
timestamp = (Time.now.to_f * 1000).to_i
noncestr = ('A'..'z').to_a.sample(8).join
signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp)
render_ok(appid: Util::Wechat.appid, timestamp: timestamp, noncestr: noncestr, signature: signature)
rescue Util::Wechat::Error => ex
render_error(ex.message)
end
end

@ -108,6 +108,8 @@ module CoursesHelper
course_board.present? ? course_board.messages.size : 0
when "course_group"
course.course_groups_count
when "announcement"
course.informs.count
end
end

@ -0,0 +1,20 @@
class Admins::ImportCourseMemberExcel < BaseImportXlsx
Data = Struct.new(:student_id, :name, :course_id, :role, :course_group_name, :school_id)
def read_each(&block)
sheet.each_row_streaming(pad_cells: true, offset: 1) do |row|
data = row.map(&method(:cell_value))[0..5]
block.call Data.new(*data)
end
end
private
def check_sheet_valid!
raise_import_error('请按照模板格式导入') if sheet.row(1).size != 6
end
def cell_value(obj)
obj&.cell_value&.to_s&.strip
end
end

@ -0,0 +1,9 @@
module Util::Redis
class << self
def online_user_count
if Rails.cache.is_a?(ActiveSupport::Cache::RedisStore)
Rails.cache.data.scan(0, match: 'cache:_session_id:*', count: 100000).last.uniq.size
end
end
end
end

@ -0,0 +1,74 @@
module Util::Wechat
BASE_SITE = 'https://api.weixin.qq.com'.freeze
Error = Class.new(StandardError)
class << self
attr_accessor :appid, :secret
def js_sdk_signature(url, noncestr, timestamp)
str = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }.to_query
Digest::SHA1.hexdigest(str)
end
def access_token
# 7200s 有效时间
Rails.cache.fetch(access_token_cache_key, expires_in: 100.minutes) do
result = request(:get, '/cgi-bin/token', appid: appid, secret: secret, grant_type: 'client_credential')
result['access_token']
end
end
def refresh_access_token
Rails.cache.delete(access_token_cache_key)
access_token
end
def jsapi_ticket
# 7200s 有效时间
Rails.cache.fetch(jsapi_ticket_cache_key, expires_in: 100.minutes) do
result = request(:get, '/cgi-bin/ticket/getticket', access_token: access_token, type: 'jsapi')
result['ticket']
end
end
def refresh_jsapi_ticket
Rails.cache.delete(jsapi_ticket_cache_key)
jsapi_ticket
end
def access_token_cache_key
"#{base_cache_key}/access_token"
end
def jsapi_ticket_cache_key
"#{base_cache_key}/jsapi_ticket"
end
def base_cache_key
"wechat/#{appid}"
end
private
def request(method, url, **params)
Rails.logger.error("[wechat] request: #{method} #{url} #{params.inspect}")
client = Faraday.new(url: BASE_SITE)
response = client.public_send(method, url, params)
result = JSON.parse(response.body)
Rails.logger.error("[wechat] response:#{response.status} #{result.inspect}")
if response.status != 200
raise Error, result.inspect
end
if result['errcode'].present? && result['errcode'].to_i.nonzero?
raise Error, result.inspect
end
result
end
end
end

@ -59,6 +59,7 @@ class Shixun < ApplicationRecord
scope :visible, -> { where.not(status: -1) }
scope :published, lambda{ where(status: 2) }
scope :published_closed, lambda{ where(status: [2, 3]) }
scope :none_closed, lambda{ where(status: [0, 1, 2]) }
scope :unhidden, lambda{ where(hidden: 0, status: 2) }
scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) }
scope :find_by_ids,lambda{|k| where(id:k)}

@ -0,0 +1,25 @@
class Admins::DepartmentApplyQuery < ApplicationQuery
include CustomSortable
attr_reader :params
sort_columns :created_at, default_by: :created_at, default_direction: :desc
def initialize(params)
@params = params
end
def call
status = params[:status]
applies = ApplyAddDepartment.where(status: status) if status.present?
# 关键字模糊查询
keyword = params[:keyword].to_s.strip
if keyword.present?
applies = applies.where('name LIKE :keyword', keyword: "%#{keyword}%")
end
custom_sort(applies, params[:sort_by], params[:sort_direction])
end
end

@ -0,0 +1,63 @@
class Admins::ImportCourseMemberService < ApplicationService
Error = Class.new(StandardError)
attr_reader :file, :result
def initialize(file)
@file = file
@result = { success: 0, fail: [] }
end
def call
raise Error, '文件不存在' if file.blank?
excel = Admins::ImportCourseMemberExcel.new(file)
excel.read_each(&method(:create_course_member))
result
rescue ApplicationImport::Error => ex
raise Error, ex.message
end
private
def create_course_member(data)
raise '课堂角色必须为 2、3、4' unless [2, 3, 4].include?(data.role.to_i)
user = User.joins(:user_extension).where(user_extensions: { student_id: data.student_id, school_id: data.school_id }).first
raise '该学号的用户不存在' if user.blank?
course = Course.find_by(id: data.course_id)
raise '该课堂不存在' if course.blank?
course_group = nil
if data.course_group_name.present?
course_group = course.course_groups.find_or_create_by!(name: data.course_group_name)
end
member = course.course_members.find_by(user_id: user.id, role: data.role.to_i)
# 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班
if member.present? && member.role == :STUDENT && course_group && member.course_group_id != course_group&.id
member.update!(course_group_id: course_group&.id)
elsif member.blank?
course.course_members.create!(user_id: user.id, role: data.role.to_i, course_group_id: course_group&.id)
extra =
case data.role.to_i
when 2 then 9
when 3 then 7
else 10
end
Tiding.create!(user_id: user.id, trigger_user_id: course.tea_id, container_id: course.id,
container_type: 'TeacherJoinCourse', belong_container_id: course.id,
belong_container_type: 'Course', tiding_type: 'System', extra: extra)
end
result[:success] += 1
rescue Exception => ex
fail_data = data.as_json
fail_data[:data] = fail_data.values.join(',')
fail_data[:message] = ex.message
result[:fail] << fail_data
end
end

@ -46,6 +46,7 @@ class Admins::ImportUserService < ApplicationService
department = school.departments.find_by(name: data.department_name)
attr = {
type: 'User',
status: User::STATUS_ACTIVE,
login: "#{prefix}#{data.student_id}",
firstname: '',
@ -54,7 +55,9 @@ class Admins::ImportUserService < ApplicationService
professional_certification: 1,
certification: 1,
password: '12345678',
phone: data.phone
phone: data.phone,
mail: "#{prefix}#{data.student_id}@qq.com",
profile_completed: true
}
ActiveRecord::Base.transaction do
user = User.create!(attr)
@ -66,8 +69,8 @@ class Admins::ImportUserService < ApplicationService
extension_attr[:technical_title] =
case data.identity.to_i
when 0 then %w(教授 副教授 讲师 助教).include?(data.technical_title) || '讲师'
when 2 then %w(企业管理者 部门管理者 高级工程师 工程师 助理工程师).include?(data.technical_title) || '助理工程师'
when 0 then %w(教授 副教授 讲师 助教).include?(data.technical_title) ? data.technical_title : '讲师'
when 2 then %w(企业管理者 部门管理者 高级工程师 工程师 助理工程师).include?(data.technical_title) ? data.technical_title : '助理工程师'
else nil
end

@ -15,7 +15,6 @@ class HomeworksService
homework_detail_manual.save! if homework_detail_manual
HomeworkCommonsShixun.create!(homework_common_id: homework.id, shixun_id: shixun.id)
HomeworksService.new.create_shixun_homework_cha_setting(homework, shixun)
CreateStudentWorkJob.perform_later(homework.id)
# HomeworksService.new.create_works_list(homework, course)
end
homework

@ -0,0 +1,30 @@
<div class="modal fade admin-import-course-member-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">导入课堂成员</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-import-course-member-form" enctype="multipart/form-data">
<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" id="import-course-member-input" class="upload-file-input" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
<label class="custom-file-label file-names" for="import-course-member-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">确认</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,2 @@
//$("#apply-id-<%= @depart_apply.id %>").remove()
//pop_box_new("批准成功", 400, 248);

@ -0,0 +1,18 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('部门审批') %>
<% end %>
<div class="box search-form-container flex-column mb-0 pb-0 department-applies-list-form">
<%= form_tag(admins_department_applies_path(unsafe_params), method: :get, class: 'form-inline search-form mt-3', remote: true) do %>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '部门名称检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with':"搜索中...") %>
<%= link_to "清除",admins_department_applies_path(keyword:nil),class:"btn btn-default",remote:true %>
<% end %>
</div>
<div class="box department-applies-list-container">
<%= render(partial: 'admins/department_applies/shared/list', locals: { applies: @depart_applies }) %>
</div>
<%= render(partial: 'admins/shared/admin_common_refuse_modal') %>
<%= render partial: 'admins/department_applies/shared/edit_modal' %>

@ -0,0 +1 @@
$(".department-applies-list-container").html("<%= j render partial: "admins/department_applies/shared/list",locals: {applies:@depart_applies} %>")

@ -0,0 +1,26 @@
<div class="modal fade department-apply-edit-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">修改为</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="department-apply-form" data-remote="true">
<%= hidden_field_tag(:id, nil) %>
<div class="form-group">
<label for="grade" class="col-form-label">名称:</label>
<%= text_field_tag(:name,nil,class:"form-control",placeholder:"输入新的名称") %>
</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">确认</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,40 @@
<table class="table table-hover text-center department_applies-list-table">
<thead class="thead-light">
<tr>
<th width="9%">ID</th>
<th width="25%" class="edu-txt-left">部门名称</th>
<th width="20%" class="edu-txt-left">单位名称</th>
<th width="15%">创建者</th>
<th width="15%"><%= sort_tag('创建于', name: 'created_at', path: admins_department_applies_path) %></th>
<th>操作</th>
</tr>
</thead>
<tbody>
<% if applies.present? %>
<% applies.each do |apply| %>
<tr class="department-apply-<%= apply.id %>">
<td><%= apply.id %></td>
<td class="edu-txt-left"> <%= apply.name %></td>
<td class="edu-txt-left"> <%= apply.school.try(:name) %></td>
<td><%= apply.user.show_real_name %></td>
<td><%= format_time apply.created_at %></td>
<td class="action-container">
<%= agree_link '批准', agree_admins_department_apply_path(apply, element: ".department-apply-#{apply.id}"), 'data-confirm': '确认批准通过?' %>
<%= javascript_void_link('删除', class: 'action refuse-action',
data: {
toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, title: "删除原因", type: "delete",
url: admins_department_apply_path(apply, element: ".department-apply-#{apply.id}")
}) %>
<%= javascript_void_link('修改', class: 'action department-apply-action', data: { toggle: 'modal', target: '.department-apply-edit-modal', id: apply.id }) %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %>

@ -56,15 +56,14 @@
<%= sidebar_item_group('#apply-review-submenu', '审核', icon: 'gavel') do %>
<li><%= sidebar_item(admins_identity_authentications_path, '实名认证', icon: 'id-card-o', controller: 'admins-identity_authentications') %></li>
<li><%= sidebar_item(admins_professional_authentications_path, '职业认证', icon: 'drivers-license', controller: 'admins-professional_authentications') %></li>
<li><%= sidebar_item(admins_department_applies_path, '部门审批', icon: 'building', controller: 'admins-department_applies') %></li>
<li><%= sidebar_item(admins_shixun_authorizations_path, '实训发布', icon: 'object-ungroup', controller: 'admins-shixun_authorizations') %></li>
<li><%= sidebar_item(admins_subject_authorizations_path, '实践课程发布', icon: 'object-group', controller: 'admins-subject_authorizations') %></li>
<li><%= sidebar_item(admins_library_applies_path, '教学案例发布', icon: 'language', controller: 'admins-library_applies') %></li>
<li><%= sidebar_item(admins_project_package_applies_path, '众包需求发布', icon: 'joomla', controller: 'admins-project_package_applies') %></li>
<li><%= sidebar_item(admins_video_applies_path, '视频发布', icon: 'film', controller: 'admins-video_applies') %></li>
<% end %>
<li><%= sidebar_item(admins_subject_authorizations_path, '实践课程发布', icon: 'object-group', controller: 'admins-subject_authorizations') %></li>
<li><%= sidebar_item(admins_library_applies_path, '教学案例发布', icon: 'language', controller: 'admins-library_applies') %></li>
<li><%= sidebar_item(admins_project_package_applies_path, '众包需求发布', icon: 'joomla', controller: 'admins-project_package_applies') %></li>
<li><%= sidebar_item(admins_video_applies_path, '视频发布', icon: 'film', controller: 'admins-video_applies') %></li>
<% end %>
</li>
<li><%= sidebar_item('/', '返回主站', icon: 'sign-out', controller: 'root') %></li>
</ul>
</nav>

@ -11,7 +11,7 @@
保存成功
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">确认</button>
<button type="button" class="btn btn-primary submit-btn" data-dismiss="modal">确认</button>
</div>
</div>
</div>

@ -28,6 +28,7 @@
<% end %>
<%= javascript_void_link '导入用户', class: 'btn btn-secondary btn-sm', data: { toggle: 'modal', target: '.admin-import-user-modal'} %>
<%= javascript_void_link '导入课堂成员', class: 'btn btn-secondary btn-sm ml-2', data: { toggle: 'modal', target: '.admin-import-course-member-modal'} %>
</div>
<div class="box users-list-container">
@ -35,4 +36,7 @@
</div>
<%= render partial: 'admins/users/shared/reward_grade_modal' %>
<%= render partial: 'admins/users/shared/import_user_modal' %>
<%= render partial: 'admins/users/shared/import_user_modal' %>
<!-- TODO: move to course list page -->
<%= render partial: 'admins/courses/shared/import_course_member_modal' %>

@ -14,8 +14,8 @@
<span class="input-group-text">文件</span>
</div>
<div class="custom-file">
<input type="file" name="file" class="upload-file-input" id="upload-file-input" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
<label class="custom-file-label file-names" for="upload-file-input">选择文件</label>
<input type="file" name="file" class="upload-file-input" id="import-user-input" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
<label class="custom-file-label file-names" for="import-user-input">选择文件</label>
</div>
</div>
<div class="error text-danger"></div>

@ -0,0 +1,15 @@
json.shixun_list @shixuns do |shixun|
json.shixun_id shixun.id
json.identifier shixun.identifier
json.shixun_name shixun.name
json.description shixun.description
json.myshixuns_count shixun.myshixuns_count
json.school shixun.user&.school_name
json.creator shixun.user&.full_name
json.level level_to_s(shixun.trainee)
json.subjects shixun.subjects do |subject|
json.(subject, :id, :name)
end
end
json.shixuns_count @total_count

@ -20,6 +20,7 @@ if @course
json.group_info @course.teacher_group(@user.id) if @course_identity < Course::STUDENT
end
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)
json.course_is_end @course.is_end
end
if params[:school]

@ -6,6 +6,9 @@ defaults: &defaults
cate_id: '-1'
callback_url: 'http://47.96.87.25:48080/api/callbacks/aliyun_vod.json'
signature_key: 'test12345678'
wechat:
appid: 'test'
secret: 'test'
development:
<<: *defaults

@ -4,7 +4,7 @@ aliyun_vod_config = {}
begin
config = Rails.application.config_for(:configuration)
aliyun_vod_config = config['aliyun_vod']
raise 'oauth wechat config missing' if aliyun_vod_config.blank?
raise 'aliyun vod config missing' if aliyun_vod_config.blank?
rescue => ex
raise ex if Rails.env.production?

@ -0,0 +1,16 @@
wechat_config = {}
begin
config = Rails.application.config_for(:configuration)
wechat_config = config['wechat']
raise 'wechat config missing' if wechat_config.blank?
rescue => ex
raise ex if Rails.env.production?
puts %Q{\033[33m [warning] wechat config or configuration.yml missing,
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
wechat_config = {}
end
Util::Wechat.appid = wechat_config['appid']
Util::Wechat.secret = wechat_config['secret']

@ -179,6 +179,7 @@ Rails.application.routes.draw do
get :get_mirror_script
post :apply_shixun_mirror
get :download_file
get :shixun_list
end
member do
@ -353,6 +354,7 @@ Rails.application.routes.draw do
get 'informs'
post 'update_informs'
post 'new_informs'
delete 'delete_informs'
get 'online_learning'
post 'join_excellent_course'
get 'tasks_list'
@ -778,6 +780,10 @@ Rails.application.routes.draw do
end
post 'callbacks/aliyun_vod', to: 'callbacks/aliyun_vods#create'
namespace :wechats do
resource :js_sdk_signature, only: [:create]
end
end
namespace :admins do
@ -807,6 +813,7 @@ Rails.application.routes.draw do
end
end
resource :import_users, only: [:create]
resource :import_course_members, only: [:create]
resources :library_applies, only: [:index] do
member do
@ -852,18 +859,21 @@ Rails.application.routes.draw do
end
resources :shixuns, only: [:index,:destroy]
resources :shixun_settings, only: [:index,:update]
resources :department_applies,only: [:index,:edit,:update,:destroy] do
member do
post :agree
end
end
resources :mirror_repositories, only: [:index, :new, :create, :edit, :update, :destroy] do
collection do
post :merge
get :for_select
end
resources :mirror_scripts, only: [:index, :new, :create, :edit, :update, :destroy]
end
resources :choose_mirror_repositories, only: [:new, :create]
resources :departments, only: [:index, :create, :edit, :update, :destroy] do
resource :department_member, only: [:create, :update, :destroy]
post :merge, on: :collection
end
resources :myshixuns, only: [:index]

Binary file not shown.

@ -0,0 +1,149 @@
#coding=utf-8
# 执行示例 bundle exec rake public_course:student args=149,2903
# args 第一个参数是subject_id第二个参数是课程course_id
# 第一期时间2018-12-16 至2019-03-31
# 第二期时间2019-04-07 至2019-07-28
#
# 这次学习很有收获,感谢老师提供这么好的资源和细心的服务🎉🎉🎉
#
desc "同步精品课数据"
namespace :public_classes do
if ENV['args']
subject_id = ENV['args'].split(",")[0] # 对应课程的id
course_id = ENV['args'].split(",")[1] # 对应课堂的id
start_time = ENV['args'].split(",")[2] # 表示课程模块
end_time = ENV['args'].split(",")[3] # 表示课程模块
limit = ENV['args'].split(",")[4] # 限制导入的数量
type = ENV['args'].split(",")[5] # 表示课程模块
end
task :student => :environment do
puts "subject_id is #{subject_id}"
puts "course_id is #{course_id}"
user_ids = Myshixun.find_by_sql("select distinct(user_id) from myshixuns where created_at between #{start_time} and #{end_time} and shixun_id in (select shixun_id from stage_shixuns
where stage_id in (select id from stages where subject_id=#{subject_id})) limit #{limit}").map(&:user_id)
puts user_ids
if user_ids.present?
user_ids.each do |user_id|
puts user_id
begin
CourseMember.create!(course_id: course_id, user_id: user_id, role: 4)
rescue Exception => e
Rails.logger(e.message)
end
end
end
end
task :test_user => :environment do
users = User.where(is_test: true)
users.limit(limit).find_each do |user|
puts user.id
CourseMember.create!(course_id: course_id, user_id: user.id, role: 4)
end
end
# 更新某个课程的某类时间
# 执行示例 RAILS_ENV=production bundle exec rake public_course:time args=-1,2932,1,1
task :time => :environment do
# course_id = ENV['args'].split(",")[0] # 对应课堂的id
# type = ENV['args'].split(",")[1]
course = Course.find(course_id)
case type.to_i
when 1
# 讨论区
messages = Message.where(board_id: course.boards)
messages.each do |message|
created_on = random_time start_time, end_time
puts created_on
message.update_columns(created_on: created_on, updated_on: created_on)
MessageDetail.where(message_id: message.id).each do |detail|
rand_created_on = random_time start_time, end_time
detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on)
end
end
when 2
# 作业
course.homework_commons.each do |homework|
created_at = random_time(start_time, end_time)
publish_time = random_larger_time created_at, start_time, end_time
end_time = random_larger_time publish_time, start_time, end_time
updated_at = end_time
homework.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at)
homework.homework_detail_manual.update_columns(comment_status: 6, created_at: created_at, updated_at: updated_at)
homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time)
end
when 3
# 试卷
course.exercises.each do |exercise|
created_at = random_time start_time, end_time
publish_time = random_larger_time created_at, start_time, end_time
end_time = random_larger_time publish_time, start_time, end_time
updated_at = end_time
exercise.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at, exercise_status: 3)
end
when 4
# 资源
course.attachments.each do |atta|
created_on = random_time start_time, end_time
atta.update_columns(is_publish: 1, created_on: created_on, publish_time: created_on)
end
end
end
task :create_homework_work => :environment do
course = Course.find(course_id)
course.practice_homeworks.each do |homework|
if homework.student_works.count == 0
str = ""
CourseMember.students(course).each do |student|
str += "," if str != ""
str += "(#{homework.id},#{student.user_id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
if str != ""
sql = "insert into student_works (homework_common_id, user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
end
def min_swith(time)
puts time
return time < 9 ? "0#{time}" : time
end
def random_time(start_time, end_time)
hour = (6..23).to_a.sample(1).first
min = rand(60)
sec = rand(60)
start_time = Date.parse(start_time)
end_time = Date.parse(end_time)
date = (start_time..end_time).to_a.sample(1).first
time = "#{date} #{min_swith(hour)}:#{min_swith(min)}:#{min_swith(sec)}"
puts time
time
end
def random_larger_time(time, start_time, end_time)
large_time = random_time(start_time, end_time)
while large_time <= time
large_time = random_time(start_time, end_time)
end
large_time
end
end

File diff suppressed because one or more lines are too long

@ -128079,6 +128079,7 @@ $(document).on('turbolinks:load', function() {
if ($refuseModal.length > 0) {
var $form = $refuseModal.find('form.admin-common-refuse-form');
var $applyIdInput = $refuseModal.find('.modal-body input[name="apply_id"]');
var $applyTitle = $refuseModal.find('.modal-title');
$form.validate({
errorElement: 'span',
@ -128097,9 +128098,19 @@ $(document).on('turbolinks:load', function() {
var applyId = $link.data('id');
var url = $link.data('url');
var title = $link.data('title');
var type = $link.data('type');
var form_method = "POST";
if(typeof title !== 'undefined'){
$applyTitle.html(title)
}
if(typeof type !== 'undefined'){
form_method = type;
}
$applyIdInput.val(applyId);
$form.data('url', url);
$form.data('type', form_method);
});
// modal visited fire
$refuseModal.on('shown.bs.modal', function(){
@ -128116,9 +128127,10 @@ $(document).on('turbolinks:load', function() {
if ($form.valid()) {
var url = $form.data('url');
var form_method = $form.data('type');
$.ajax({
method: 'POST',
method: form_method,
dataType: 'script',
url: url,
data: $form.serialize(),
@ -128208,6 +128220,28 @@ $(document).on('turbolinks:load', function() {
// });
}
});
$(document).on('turbolinks:load', function() {
var $editModal = $('.department-apply-edit-modal');
if($editModal.length > 0){
var $form = $editModal.find('form.department-apply-form');
var $applyIdInput = $form.find('input[name="id"]');
$editModal.on('show.bs.modal', function (event) {
var $link = $(event.relatedTarget);
var applyId = $link.data('id');
$applyIdInput.val(applyId);
});
$editModal.on('click', '.submit-btn', function(){
$.ajax({
method: "PUT",
dataType: 'script',
url: "/admins/department_applies/"+ $applyIdInput.val(),
data: $form.serialize(),
}).done(function(){
$editModal.modal('hide');
});
});
}
});
$(document).on('turbolinks:load', function() {
if ($('body.admins-departments-index-page').length > 0) {
var $searchContainer = $('.department-list-form');

File diff suppressed because one or more lines are too long

@ -23,7 +23,6 @@
<title>EduCoder</title>
<script type="text/javascript">
window.__isR = true;
// 不支持ie9 ie10
if (
( navigator.userAgent.indexOf('MSIE 9') != -1
@ -32,8 +31,11 @@
location.pathname.indexOf("/compatibility") == -1) {
// location.href = './compatibility'
location.href = '/compatibility.html'
location.href = '/compatibility.html'
}
const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
if (isMobile) {
document.write('<script type="text/javascript" src="/javascripts/wx/jweixin-1.3.0.js"><\/script>');
}
</script>

@ -281,7 +281,58 @@ class App extends Component {
mydisplay:true,
})
};
initWXShare = () => {
if (window.wx) {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
axios.post(url, {
url: 'http://pre-newweb.educoder.net',
}).then((response) => {
const data = response.data;
wx.config({
debug: false,
appId: data.appid,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: [
'onMenuShareTimeline',//
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function () {
var shareData = {
title: '这是是分享标题',
desc: '这是是摘要',
link: 'http://pre-newweb.educoder.net',
imgUrl: 'http://pre-newweb.educoder.net/images/educoder/index/subject/subject15.jpg'
};
wx.onMenuShareAppMessage(shareData);//分享给好友
wx.onMenuShareTimeline(shareData);//分享到朋友圈
wx.onMenuShareQQ(shareData);//分享给手机QQ
wx.onMenuShareWeibo(shareData);//分享腾讯微博
wx.onMenuShareQZone(shareData);//分享到QQ空间
});
wx.error(function (res) {
//alert(res.errMsg);//错误提示
});
}).catch((error) => {
console.log(error)
})
}
}
componentDidMount() {
// force an update if the URL changes
history.listen(() => {
this.forceUpdate()
@ -291,7 +342,7 @@ class App extends Component {
});
initAxiosInterceptors(this.props)
this.initWXShare()
//
// axios.interceptors.response.use((response) => {
// // console.log("response"+response);

@ -1,3 +1,6 @@
export function isDev() {
return window.location.port === "3007";
}
}
// const isMobile
export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));

@ -20,8 +20,7 @@ export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, ap
downloadFile, sortDirections } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil'
export { isDev as isDev } from './Env'
export { isDev as isDev, isMobile } from './Env'
export { toStore as toStore, fromStore as fromStore } from './Store'

File diff suppressed because one or more lines are too long

@ -383,12 +383,12 @@ class Comments extends Component {
{/* <span className="ml5 mr5 color-grey-8">|</span>*/}
<a href={`javascript:void(0)`} className="color-grey-8"
{(this.props.showReply == undefined || this.props.showReply == true) && <a href={`javascript:void(0)`} className="color-grey-8"
onClick={() => this.initReply(item) } >
<Tooltip title={ "回复" }>
<i className="iconfont icon-huifu1 mr5"></i>
</Tooltip>
</a>
</a>}
{/* <span className="ml5 mr5 color-grey-8">|</span>*/}

@ -284,6 +284,14 @@ const Completetaskpage =Loadable({
loader: () => import('../../modules/courses/completetaskdetails/Completetaskpage'),
loading: Loading,
});
//排序
const Ordering=Loadable({
loader: () => import('../../modules/courses/ordering/Ordering'),
loading: Loading,
});
class CoursesIndex extends Component{
constructor(props) {
super(props)
@ -470,6 +478,13 @@ class CoursesIndex extends Component{
// console.log(commons)
return (
<Switch {...this.props}>
{/*排序*/}
<Route path="/courses/:coursesId/ordering/:ordering_type/:main_id"
render={
(props) => (<Ordering {...this.props} {...props} {...this.state} />)
}
></Route>
{/*毕设任务题库详情*/}
<Route path="/banks/gtopic_topics/:workid"
render={

@ -181,15 +181,16 @@ class BoardsNew extends Component{
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList: appendFileSizeToUploadFileAll(fileList)
});
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) });
}
}
onAttachmentRemove = (file) => {
if(file.response!=undefined){
confirm({
if(!file.percent || file.percent == 100){
this.props.confirm({
// title: '确定要删除这个附件吗?',
title: '是否确认删除?',
content: '是否确认删除?',
okText: '确定',
cancelText: '取消',
@ -286,7 +287,7 @@ class BoardsNew extends Component{
const isAdmin = this.props.isAdmin()
const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId
const isCourseEnd = this.props.isCourseEnd()
return(
<div className="newMain ">
<AddDirModal {...this.props}
@ -380,7 +381,7 @@ class BoardsNew extends Component{
<div>
{menu}
{
isAdmin &&
isAdmin && !isCourseEnd &&
<React.Fragment>
<Divider style={{ margin: '4px 0' }} />
<div style={{ padding: '8px', cursor: 'pointer' }} onMouseDown={() => this.refs['addDirModal'].open()}>

@ -527,6 +527,7 @@ class TopicDetail extends Component {
// TODO 图片上传地址
const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId
const isCourseEnd = this.props.isCourseEnd()
return (
<div className="edu-back-white edu-class-container edu-position course-message topicDetail" id="yslforum_index_list"> {/* fl with100 */}
<style>{`
@ -678,8 +679,8 @@ class TopicDetail extends Component {
}
</div>
<MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么"
height={160} showError={true} buttonText={'发表'} className={comments && comments.length && 'borderBottom'}></MemoDetailMDEditor>
{!isCourseEnd && <MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么"
height={160} showError={true} buttonText={'发表'} className={comments && comments.length && 'borderBottom'}></MemoDetailMDEditor>}
{/* onClick={ this.createNewComment }
enableReplyTo={true}
@ -704,6 +705,7 @@ class TopicDetail extends Component {
loadMoreChildComments={this.loadMoreChildComments}
initReply={this.initReply}
showRewardButton={false}
showReply={!isCourseEnd}
onlySuperAdminCouldHide={true}
></Comments>
@ -720,7 +722,7 @@ class TopicDetail extends Component {
{ total_count > REPLY_PAGE_COUNT &&
<Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/>
}
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
{!isCourseEnd && <div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>}
</div>
</div>

@ -51,10 +51,7 @@ class Boards extends Component{
const sort_type = this.state.sort_type
// page_size
const url = `/boards/${bid}/messages.json?page_size=15&search=${_serachText || ''}&page=${_page}&sort=0&sort_type=${sort_type}`
axios.get(url, {
})
.then((response) => {
axios.get(encodeURI(url)).then((response) => {
if (response.data.status == 0 && response.data.data) {
let _newBoards = response.data.data.messages
// if (_page > 1) {
@ -327,6 +324,7 @@ class Boards extends Component{
}
render(){
const isAdmin = this.props.isAdmin()
const isCourseEnd = this.props.isCourseEnd()
const isAdminOrStudent = this.props.isAdminOrStudent()
let { boardName, searchValue, boards, messages, checkBoxValues,
checkAllValue, pagination, sort_type, parent_id } = this.state;
@ -350,9 +348,9 @@ class Boards extends Component{
searchPlaceholder={ '请输入帖子名称进行搜索' }
firstRowRight={
<React.Fragment>
{ isAdmin && !parent_id && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加目录</WordsBtn> }
{ !isCourseEnd && isAdmin && !parent_id && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加目录</WordsBtn> }
{ isAdmin && !!parent_id && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>目录重命名</WordsBtn> }
{ isAdminOrStudent && <WordsBtn style="blue" className="" onClick={()=>this.onToBoardsNew()}>我要发贴</WordsBtn> }
{ !isCourseEnd && isAdminOrStudent && <WordsBtn style="blue" className="" onClick={()=>this.onToBoardsNew()}>我要发贴</WordsBtn> }
</React.Fragment>
}
secondRowLeft={
@ -390,7 +388,7 @@ class Boards extends Component{
return <li onClick={() => this.moveTo(item)} title={item.name}>{item.name}</li>
})
}
{ isAdmin &&
{ isAdmin && !isCourseEnd &&
<p className="drop_down_btn">
<a href="javascript:void(0)" className="color-grey-6"
onClick={()=>this.addDir()}

@ -218,7 +218,8 @@ class CommonWorkAppraise extends Component{
</a>
<span className="color656565 mt2 color-grey-6 font-12 mr8">{item.filesize}</span>
{/*{item.delete===true?<i className="font-14 iconfont icon-guanbi " id={item.id} aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.id)}></i>:""}*/}
{item.delete===true?<i className="font-14 iconfont icon-guanbi " style={{display: 'none'}} id={item.id} aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.id)}></i>:""}
{item.delete===true?<i className="font-14 iconfont icon-guanbi " id={item.id} aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.id)}></i>:""}
{/* style={{display: 'none'}} */}
</div>
)
})}

@ -291,7 +291,7 @@ class CommonWorkPost extends Component{
}
// 附件相关 START
handleChange = (info) => {
if (info.file.status === 'uploading' || info.file.status === 'done') {
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) });
@ -320,11 +320,19 @@ class CommonWorkPost extends Component{
// ModalSave: ()=>this.deleteAttachment(file),
// ModalCancel:this.cancelAttachment
// })
if(file.response!=undefined){
this.deleteAttachment(file)
if(!file.percent || file.percent == 100){
this.props.confirm({
content: '是否确认删除?',
onOk: () => {
this.deleteAttachment(file)
},
onCancel() {
console.log('Cancel');
},
});
return false;
}
}
cancelAttachment=()=>{
@ -638,7 +646,7 @@ render(){
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/}
<span>{`${current_user ? current_user.username : ''} ${ this.isEdit ? '编辑' : '提交'}作品` }</span>
<span>{`${current_user ? current_user.real_name : ''} ${ this.isEdit ? '编辑' : '提交'}作品` }</span>
</p>
<div style={{ width:'100%',height:'75px'}} >

@ -3,7 +3,8 @@ import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Moda
import axios from 'axios'
import '../css/busyWork.css'
import '../css/Courses.css'
import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll
, getUploadActionUrl } from 'educoder'
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
import CBreadcrumb from '../common/CBreadcrumb'
@ -234,16 +235,20 @@ class NewWork extends Component{
}
handleContentUploadChange = (info) => {
let contentFileList = info.fileList;
this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let contentFileList = info.fileList;
this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) });
}
}
handleAnswerUploadChange = (info) => {
let answerFileList = info.fileList;
this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let answerFileList = info.fileList;
this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) });
}
}
onAttachmentRemove = (file, stateName) => {
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
this.props.confirm({
content: '是否确认删除?',
@ -331,7 +336,7 @@ class NewWork extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleContentUploadChange,
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
beforeUpload: (file) => {

@ -124,7 +124,7 @@ class commonWork extends Component{
if(search!=""){
url+="&search="+search;
}
axios.get((url)).then((result)=>{
axios.get(encodeURI(url)).then((result)=>{
if(result.status==200){
this.setState({
mainList:result.data,

@ -426,7 +426,7 @@ class CoursesBanner extends Component {
render() {
let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype} = this.state;
const isCourseEnd = this.props.isCourseEnd()
return (
<div>
{
@ -625,7 +625,7 @@ class CoursesBanner extends Component {
)
: ""}
{this.props.isStudent()?<a className="fr user_default_btn user_blue_btn mr20 font-18"
{this.props.isStudent()?this.props.current_user&&this.props.current_user.course_is_end===true?"":<a className="fr user_default_btn user_blue_btn mr20 font-18"
onClick={() => this.exitclass()}
> 退出课堂 </a>:""}
@ -714,24 +714,24 @@ class CoursesBanner extends Component {
position: "relative"
}}
>
<li className={"mt7 mr10im"}>
{!isCourseEnd && <li className={"mt7 mr10im"}>
<a onClick={()=>this.addTeacher(true)}>
<span className="color-white fl font-16 bannerurli width100f">添加老师</span>
</a>
</li>
</li>}
<li className={"mt7 mr10im"}>
{!isCourseEnd && <li className={"mt7 mr10im"}>
<a onClick={()=>this.addTeacher(false)}>
<span className="color-white fl font-16 bannerurli width100f">添加助教</span>
</a>
</li>
</li>}
<li className={"mt7 mr10im"}>
{!isCourseEnd && <li className={"mt7 mr10im"}>
<a onClick={()=>this.addStudent()}>
<span className={"color-white fl font-16 bannerurli width100f"}>添加学生</span>
</a>
</li>
</li>}
{excellent===false?
<li className={"mt7 mr10im ml10"} style={{overflow:"hidden"}}>
<a>

@ -749,9 +749,9 @@ class Coursesleftnav extends Component{
{/*毕业设计*/}
{/*{item.type==="graduation"?<div onClick={()=>this.Navmodalnames(1,"attachment",item.id)}>添加目录</div>:""}*/}
{/*讨论区*/}
{item.type==="board"?<div onClick={e=>this.Navmodalnames(e,6,"board",item.main_id)}>添加目录</div>:""}
{item.type==="board"?this.props.current_user&&this.props.current_user.course_is_end===true?"":<div onClick={e=>this.Navmodalnames(e,6,"board",item.main_id)}>添加目录</div>:""}
{/*分班*/}
{item.type==="course_group"?<div onClick={e=>this.Navmodalnames(e,2,"course_group",item.id)}>添加分班</div>:""}
{item.type==="course_group"?this.props.current_user&&this.props.current_user.course_is_end===true?"":<div onClick={e=>this.Navmodalnames(e,2,"course_group",item.id)}>添加分班</div>:""}
{/*分班*/}
{/*{item.type==="course_group"? :""}*/}
<div onClick={e=>this.Navmodalnames(e,3,"editname",item.id,item.name)}>重命名</div>
@ -798,7 +798,6 @@ class Coursesleftnav extends Component{
// console.log("778");
// console.log("CoursesLeftNav");
// console.log(this.props);
// console.log(course_modules);
return(

@ -40,15 +40,17 @@ class AccessoryModal extends Component{
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
console.log(fileList)
// for(var list of fileList ){
// console.log(fileList)
// }
this.setState({
fileList:fileList,
Errormessage:false,
});
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
console.log(fileList)
// for(var list of fileList ){
// console.log(fileList)
// }
this.setState({
fileList:fileList,
Errormessage:false,
});
}
}
onAttachmentRemove = (file) => {
@ -73,7 +75,7 @@ class AccessoryModal extends Component{
// ModalCancel:this.cancelAttachment
// })
// return false;
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
this.deleteAttachment(file);
}
}

@ -64,7 +64,7 @@ class AccessoryModal2 extends Component{
// ModalCancel:this.cancelAttachment
// })
// return false;
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
this.deleteAttachment(file);
}

@ -296,7 +296,7 @@ class Selectsetting extends Component{
onAttachmentRemove = (file) => {
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})

@ -132,7 +132,7 @@ class Sendresource extends Component{
onAttachmentRemove = (file) => {
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})

@ -1,80 +1,81 @@
.polllisthover:hover {
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
border-radius: 2px;
}
.workList_Item{
/* padding:20px 30px; */
display: flex;
background-color: #fff;
margin-bottom: 20px;
padding-top: 10px;
}
p span{
cursor: default;
}
.mt-5{ margin-top:-5px;}
/* <20><><EFBFBD>ѡ<EFBFBD><D1A1>tab */
.bankNav li{
float: left;
margin-right: 20px;
}
.bankNav li:last-child{
margin-right: 0px;
}
.bankNav li.active a{
color: #fff!important;
background-color: #4CACFF;
}
.bankNav li a{
display: block;
padding:0px 10px;
height: 28px;
line-height: 28px;
background-color: #F5F5F5;
border-radius: 36px;
color: #666666!important;
}
.task_menu_ul{
width: 600px;
}
.task_menu_ul .ant-menu-item,.task_menu_ul .ant-menu-submenu-title{
padding:0px;
margin-right: 30px;
line-height: 68px;
font-size: 16px;
}
.ant-menu{
color: #05101a;
}
.task_menu_ul .ant-menu-horizontal{
border-bottom: none;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item:hover{
border-bottom:2px solid transparent;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item-selected{
border-bottom: 2px solid #4CACFF !important;
}
.sourceTag a{
display: block;
float: left;
background-color:#E5F3FF;
padding: 0px 10px;
height: 24px;
line-height: 24px;
color: #4E7A9B;
margin:5px 0px 5px 10px;
}
.sourceTag a.active{
color: #FFFFFF;background-color:#4CACFF;
}
.polllisthover:hover {
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
border-radius: 2px;
}
.workList_Item{
/* padding:20px 30px; */
display: flex;
background-color: #fff;
margin-bottom: 20px;
padding-top: 10px;
}
p span{
cursor: default;
}
.mt-5{ margin-top:-5px;}
/* <20><><EFBFBD>ѡ<EFBFBD><D1A1>tab */
.bankNav li{
float: left;
margin-right: 20px;
}
.bankNav li:last-child{
margin-right: 0px;
}
.bankNav li.active a{
color: #fff!important;
background-color: #4CACFF;
}
.bankNav li a{
display: block;
padding:0px 10px;
height: 28px;
line-height: 28px;
background-color: #F5F5F5;
border-radius: 36px;
color: #666666!important;
}
.task_menu_ul{
width: 600px;
}
.task_menu_ul .ant-menu-item,.task_menu_ul .ant-menu-submenu-title{
padding:0px;
margin-right: 30px;
line-height: 68px;
font-size: 16px;
}
.ant-menu{
color: #05101a;
}
.task_menu_ul .ant-menu-horizontal{
border-bottom: none;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item:hover{
border-bottom:2px solid transparent;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item-selected{
border-bottom: 2px solid #4CACFF !important;
}
.sourceTag a{
display: block;
float: left;
background-color:#E5F3FF;
padding: 0px 10px;
height: 24px;
line-height: 24px;
color: #4E7A9B;
margin:5px 0px 5px 10px;
}
.sourceTag a.active{
color: #FFFFFF;background-color:#4CACFF;
}

@ -545,7 +545,7 @@ class ExerciseReviewAndAnswer extends Component{
width:100%;
cursor:pointer;
}
.setRadioStyle span:last-child{
.setRadioStyle > span:last-child{
flex:1;
display:flex;
}

@ -116,50 +116,50 @@ class GraduationTasksSubmitedit extends Component{
this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
}
if (info.file.status === 'done') {
if (info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
}
}
//onAttachmentRemove = (file) => {
// confirm({
// title: '确定要删除这个附件吗?',
// okText: '确定',
// cancelText: '取消',
// // content: 'Some descriptions',
// onOk: () => {
// this.deleteAttachment(file)
// },
// onCancel() {
// console.log('Cancel');
// },
// });
// return false;
// this.setState({
// Modalstype:true,
// Modalstopval:'确定要删除这个附件吗?',
// ModalSave: ()=>this.deleteAttachment(file),
// ModalCancel:this.cancelAttachment
// })
// return false;
//}
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachment(file),
ModalCancel:this.cancelAttachment
})
return false;
}
}
onAttachmentRemoves = (file) => {
if(!file.percent || file.percent == 100){
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachments(file),
ModalCancel:this.cancelAttachment
})
return false;
}
}
cancelAttachment=()=>{
this.setState({
Modalstype:false,
Modalstopval:'确定要删除这个附件吗?',
Modalstopval:'',
ModalSave:"",
ModalCancel:""
})
}
onAttachmentRemove = (file) => {
if(file.response!=undefined){
deleteAttachments = (id) => {
let {attachments,fileList}=this.state;
const url = `/attachments/${file}.json`
const url = `/attachments/${id}.json`
axios.delete(url, {
})
.then((response) => {
@ -168,25 +168,66 @@ class GraduationTasksSubmitedit extends Component{
if (response.data.status === 0) {
console.log('--- success')
let newattachments=attachments;
if(file.uid===undefined){
for(var i=0; i<newattachments.length; i++){
if(newattachments[i].id===file.id){
if(newattachments[i].id===id){
newattachments.splice(i, 1);
}
}
}
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
ModalSave:this.cancelAttachment,
Loadtype:true,
attachments:newattachments
})
this.cancelAttachment();
this.setState((state) => {
const index = state.fileList.indexOf(id);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
deleteAttachment = (file) => {
if(!file.percent || file.percent == 100){
let {attachments,fileList}=this.state;
let id=file.response ==undefined ? file.id : file.response.id;
const url = `/attachments/${id}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
// const { status } = response.data;
if (response.data.status === 0) {
console.log('--- success')
let newattachments=attachments;
if(file.uid===undefined){
for(var i=0; i<newattachments.length; i++){
if(newattachments[i].id===file.id){
newattachments.splice(i, 1);
}
}
}
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalSave:this.cancelAttachment,
// Loadtype:true,
// attachments:newattachments
// })
this.cancelAttachment();
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
@ -578,7 +619,7 @@ class GraduationTasksSubmitedit extends Component{
{/*<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/}
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/}
<span>{this.props.user&&this.props.user.username} 提交作品</span>
<span>{this.props.current_user&&this.props.current_user.real_name} 修改作品</span>
</p>
<div style={{ width:'100%',height:'75px'}} >
@ -653,7 +694,7 @@ class GraduationTasksSubmitedit extends Component{
{item.delete===true?
<i className="font-14 iconfont icon-guanbi "
id={item.id}
onClick={()=>this.onAttachmentRemove(item.id)}
onClick={()=>this.onAttachmentRemoves(item.id)}
aria-hidden="true">
</i>:""}
</div>

@ -125,7 +125,7 @@ class GraduationTasksSubmitnew extends Component{
this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
}
if (info.file.status === 'done') {
if (info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
}
@ -146,7 +146,7 @@ class GraduationTasksSubmitnew extends Component{
// },
// });
// return false;
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
@ -161,43 +161,46 @@ class GraduationTasksSubmitnew extends Component{
cancelAttachment=()=>{
this.setState({
Modalstype:false,
Modalstopval:'确定要删除这个附件吗?',
Modalstopval:'',
ModalSave:"",
ModalCancel:""
})
}
deleteAttachment = (file) => {
const url = `/attachments/${file}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
// const { status } = response.data;
if (response.data.status === 0) {
console.log('--- success')
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
ModalSave:this.cancelAttachment,
Loadtype:true,
})
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
if(!file.percent || file.percent == 100){
let id = file.response == undefined ? file.id : file.response.id;
const url = `/attachments/${id}.json`
axios.delete(url, {})
.then((response) => {
if (response.data) {
// const { status } = response.data;
if (response.data.status === 0) {
console.log('--- success')
// this.setState({
// Modalstype: true,
// Modalstopval: response.data.message,
// ModalSave: this.cancelAttachment,
// Loadtype: true,
// })
this.cancelAttachment();
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
}
inputSearchValue=(e)=>{
@ -549,7 +552,7 @@ render(){
},
};
// console.log(this.props)
console.log(this.props)
@ -598,7 +601,7 @@ render(){
{/*<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/}
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/}
<span>{this.props.user&&this.props.user.username} 提交作品</span>
<span>{this.props.current_user&&this.props.current_user.real_name} 提交作品</span>
</p>
<div style={{ width:'100%',height:'75px'}} >

@ -84,11 +84,13 @@ class GraduationTasksappraiseMainEditor extends Component{
componentDidMount(){
}
handleUploadChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList });
}
}
onAttachmentRemove = (file, stateName) => {
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
this.props.confirm({
content: '确定要删除这个附件吗?',
okText: '确定',

@ -103,7 +103,7 @@ class GraduationTasksedit extends Component{
}
// 附件相关 START
handleChange = (info) => {
if(info.file.status == "done" || info.file.status == "uploading"){
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
// console.log(fileList)
// for(var list of fileList ){
@ -150,7 +150,7 @@ class GraduationTasksedit extends Component{
}
onAttachmentRemove = (file) => {
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
// debugger
this.cancelAttachment();
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`

@ -2,11 +2,12 @@ import React, {Component} from "React";
import {Form, Select, Input, Button, Checkbox, Upload, Icon, message, Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll , getUploadActionUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
const {Option} = Select;
const CheckboxGroup = Checkbox.Group;
const confirm = Modal.confirm;
@ -127,7 +128,7 @@ class GraduationTasksnew extends Component {
}
// 附件相关 START
handleChange = (info) => {
if(info.file.status == "done" || info.file.status == "uploading"){
if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){
let fileList = info.fileList;
// for(var list of fileList ){
@ -173,8 +174,27 @@ class GraduationTasksnew extends Component {
}
onAttachmentRemove = (file) => {
if(file.response!=undefined){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
if(!file.percent || file.percent == 100){
this.props.confirm({
content: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
onOk: () => {
this.deleteAttachment(file)
},
onCancel() {
console.log('Cancel');
},
});
return false;
}
}
deleteAttachment = (file) =>{
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
// const url = `/attachments/${file}.json`
axios.delete(url, {})
.then((response) => {
@ -198,8 +218,6 @@ class GraduationTasksnew extends Component {
.catch(function (error) {
console.log(error);
});
}
}
//滚动
@ -267,7 +285,7 @@ class GraduationTasksnew extends Component {
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -11,7 +11,7 @@ import {getUrl} from 'educoder';
import "../../common/formCommon.css"
import '../style.css'
import '../../css/Courses.css'
import { WordsBtn, City } from 'educoder'
import { WordsBtn, City , getUploadActionUrl } from 'educoder'
import {Link} from 'react-router-dom'
// import City from './City'
@ -211,14 +211,16 @@ class GraduateTopicNew extends Component{
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList });
}
}
onAttachmentRemove = (file) => {
if(file.response!=undefined){
confirm({
title: '确定要删除这个附件吗?',
if(!file.percent || file.percent == 100){
this.props.confirm({
content: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
@ -307,7 +309,7 @@ class GraduateTopicNew extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -159,11 +159,13 @@ class GraduateTopicPostWorksNew extends Component{
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList });
}
}
onAttachmentRemove = (file) => {
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
confirm({
title: '确定要删除这个附件吗?',
okText: '确定',

@ -58,7 +58,7 @@ class Boards extends Component{
let {pageSize}=this.state;
const cid = this.props.match.params.coursesId
let url = `/courses/${cid}/graduation_topics.json?limit=`+pageSize
let url = `/courses/${cid}/graduation_topics.json?limit=${pageSize}`
if(searchValue!=""){
url+="&search="+searchValue
}
@ -68,7 +68,17 @@ class Boards extends Component{
if(status!="" && status != "all"){
url+="&status="+status;
}
axios.get(url).then((response) => {
url=encodeURI(url);//IE11传参为乱码search
axios.get(url
// ,{
// params:{
// search:encodeURI(searchValue),
// page:page,
// status:status,
// limit:pageSize
// }
// }
).then((response) => {
if (response.status == 200 && response.status) {
this.setState({
data:response.data,

@ -29,7 +29,7 @@ class AddStudentModal extends Component{
const { name, school_name } = this.state
let url = `/courses/${courseId}/search_users.json?page=${page}&limit=${pageCount}&school_name=${school_name || ''}&name=${name || ''}`
this.setState({ loading: true })
axios.get(url)
axios.get(encodeURI(url))
.then((response) => {
if (!response.data.users || response.data.users.length == 0) {
this.setState({
@ -80,8 +80,9 @@ class AddStudentModal extends Component{
}
setVisible = (visible) => {
if (visible) {
this.setState({school_name: this.props.user.user_school})
this.fetchMemberList()
this.setState({school_name: this.props.user.user_school},()=>{
this.fetchMemberList();
})
this.fetchOptions()
}
this.refs.modalWrapper.setVisible(visible)

@ -73,7 +73,7 @@ class CreateGroupByImportModal extends Component{
}
onAttachmentRemove = (file) => {
if(file.response!=undefined){
if(!file.percent || file.percent == 100){
this.props.confirm({
content: '是否确认删除?',

@ -324,7 +324,7 @@ class studentsList extends Component{
if(!!searchValue){
url+='&search='+searchValue;
}
axios.get((url)).then((result)=>{
axios.get(encodeURI(url)).then((result)=>{
if (result.data.students) {
this.setState({
students: result.data.students,
@ -497,6 +497,7 @@ class studentsList extends Component{
render(){
const isAdmin = this.props.isAdmin()
const isSuperAdmin = this.props.isSuperAdmin()
const isCourseEnd = this.props.isCourseEnd()
let {
page,
@ -591,7 +592,7 @@ class studentsList extends Component{
></CreateGroupByImportModal>
<WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn>
</React.Fragment> }
{ isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> }
{ !isCourseEnd && isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
<style>{`
@ -674,7 +675,7 @@ class studentsList extends Component{
)
}) }
{ course_groups && course_groups.length > 0 && <Divider className="dividerStyle"></Divider> }
{ isAdmin &&
{ isAdmin && !isCourseEnd &&
<p className="drop_down_btn">
<a href="javascript:void(0)" className="color-grey-6"

@ -377,7 +377,7 @@ class studentsList extends Component{
if(searchValue!=""){
url+='&search='+searchValue;
}
const result = await axios.get(url)
const result = await axios.get(encodeURI(url))
// axios.get((url)).then((result)=>{
if (result.data.teacher_list) {
this.setState({

@ -574,7 +574,7 @@ class CoursesNew extends Component {
{this.props.match.params.coursesId === undefined ?"翻转课堂":dataname}
</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn className="fl cdefault">{this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"}</WordsBtn>
<span className="fl cdefault">{this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"}</span>
</p>

@ -696,7 +696,7 @@ class Goldsubject extends Component {
<a className="btn colorgrey fl hovercolorblue " href={Whethertocreateanewclassroom===true?"/courses":this.props.current_user&&this.props.current_user.first_category_url}
>{Whethertocreateanewclassroom===true?"翻转课堂":name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn className="fl cdefault">{Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"}</WordsBtn>
<span className="fl cdefault">{Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"}</span>
</p>
<div style={{width: '100%', height: '50px'}}>

@ -0,0 +1,109 @@
.color4CACFF{
color: #4CACFF !important;
}
.orderingbox{
width:1200px;
height:80px;
background:rgba(255,255,255,1);
box-shadow:3px 3px 3px rgba(237,237,237,1);
opacity:1;
border-radius:2px 2px 0px 0px;
padding: 24px;
box-sizing: border-box;
line-height: 34px;
}
.orderingbtnright{
width: 90px;
height: 38px;
background: rgba(255,255,255,1);
border: 1px solid rgba(228,228,228,1);
box-shadow: 0px 1px 1px rgba(0,0,0,0.16);
opacity: 1;
border-radius: 4px;
}
.orderingbtnleft{
width: 90px;
height: 38px;
background: rgba(76,172,255,1);
box-shadow: 0px 1px 1px rgba(0,0,0,0.16);
opacity: 1;
border-radius: 4px;
}
.pd1323s{
padding: 10px 6px 25px 40px;
cursor: pointer;
}
.orderSection{
height: 80px;
padding-top: 16px;
}
.ordermidbox{
width: 960px;
height: 120px;
background: rgba(255,255,255,1);
/* border: 1px solid rgba(205,205,205,1); */
opacity: 1;
margin-left:120px;
}
.orderfonttop{
font-size: 16px !important;
font-family: Microsoft YaHei;
font-weight: bold;
line-height: 28px;
color: rgba(5,16,26,1);
opacity: 1;
}
.orderfontbom{
font-size:14px;
font-family:Microsoft YaHei;
font-weight:400;
line-height:25px;
color:rgba(153,153,153,1);
opacity:1;
}
.ordermidbox:hover {
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
}
.mb200{
margin-bottom: 200px;
}
.maxwidth865s{
max-width: 865px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.maxwidth795 {
max-width:795px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
}
.ordermidbox:active{
background:rgba(248,247,255,1);
border:1px solid rgba(76,172,255,1);
}
.ordermidbox:focus{
background:rgba(248,247,255,1);
border:1px solid rgba(76,172,255,1);
}
.ordermiddiv{
min-height: 500px;
}

@ -0,0 +1,297 @@
import React,{ Component } from "react";
import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Breadcrumb,Button } from "antd";
import { WordsBtn,on, off, trigger } from 'educoder';
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
import axios from'axios';
import Modals from '../../modals/Modals';
import '../css/members.css';
import '../css/busyWork.css';
import './Ordering.css';
import NoneData from "../coursesPublic/NoneData";
const reorder = (list, startIndex, endIndex) => {
const result = Array.from(list);
const [removed] = result.splice(startIndex, 1);
result.splice(endIndex, 0, removed);
return result;
};
class Ordering extends Component{
constructor(props){
super(props);
this.state={
isSpin:false,
antIcon:false,
datas:undefined,
windowsscrollTop:false,
newtask_ids:[]
}
}
componentDidMount() {
this.setState({
isSpin:true
})
let coursesId=this.props.match.params.coursesId;
let ordering_type=this.props.match.params.ordering_type;
let url=`/courses/${coursesId}/tasks_list.json`;
axios.get((url),{params:{
container_type:ordering_type
}}).then((result)=>{
if(result){
this.setState({
datas:result.data.tasks,
isSpin:false
})
}
}).catch((error)=>{
console.log(error);
this.setState({
isSpin:false
})
})
window.addEventListener('scroll', this.handleScroll.bind(this)) //监听滚动
// window.addEventListener('resize', this.handleResize.bind(this)) //监听窗口大小改变
}
// componentWillUnmount() { //一定要最后移除监听器以防多个组件之间导致this的指向紊乱
// window.removeEventListener('scroll', this.handleScroll.bind(this))
// window.removeEventListener('resize', this.handleResize.bind(this))
// }
handleScroll=(e)=>{
// console.log(
// '浏览器滚动事件',
// e.srcElement.scrollingElement.scrollTop,
// e.srcElement.scrollingElement.scrollHeight
// )
//e.srcElement.scrollingElement.scrollTop为距离滚动条顶部高度
// e.srcElement.scrollingElement.scrollHeight为整个文档高度
if(e.srcElement.scrollingElement.scrollTop>60){
this.setState({
windowsscrollTop:true,
})
}
if(e.srcElement.scrollingElement.scrollTop===0){
this.setState({
windowsscrollTop:false
})
}
}
//
// handleResize = e => {
// console.log('浏览器窗口大小改变事件', e.target.innerWidth)
// }
onDragEnd=(result)=>{
if(result.destination!=null&&result.destination!=undefined){
let {datas}=this.state;
if (!result.destination) {
console.log('dropped outside the list')
return;
}
if (result.destination.index === result.source.index) {
console.log('the same')
return;
}
const shixuns_list = reorder(
datas,
result.source.index,
result.destination.index
);
let newtask_ids=[]
shixuns_list.map((item,key)=>{
newtask_ids.push(item.task_id)
})
this.setState({
datas:shixuns_list,
newtask_ids:newtask_ids
})
}
}
updatalist=()=>{
let {datas,newtask_ids,isSpin}=this.state;
if(newtask_ids.length===0){
this.props.showNotification("请先移动需要排序的实训作业任务");
return
}
if(isSpin===true){
return
}
this.setState({
isSpin:true
})
let coursesId=this.props.match.params.coursesId;
let ordering_type=this.props.match.params.ordering_type;
let url=`/courses/${coursesId}/update_task_position.json`;
axios.post(url,{
container_type:ordering_type,
task_ids:newtask_ids
}).then((result)=>{
if(result.data.status===0){
this.props.showNotification(result.data.message);
this.setState({
isSpin:false,
datas:datas,
newtask_ids:[]
});
this.goback()
}else{
this.setState({
isSpin:false,
});
}
}).catch((error)=>{
this.setState({
isSpin:false,
});
})
}
goback=()=>{
window.location.href=`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.props.match.params.main_id}`
}
render(){
let {
datas,
Modalstype,
windowsscrollTop,
}=this.state;
let main_id=this.props.match.params.main_id;
let category_id=this.props.match.params.category_id;
console.log(this.props)
console.log(window)
let positiontype=null;
if(windowsscrollTop===true){
positiontype={position:'fixed',zIndex:'1000',top: '0px'}
}else{
positiontype={}
}
return(
<div className={"mb200"}>
{/*提示*/}
{Modalstype&&Modalstype===true?<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
modalsBottomval={this.state.ModalsBottomval}
loadtype={this.state.Loadtype}
antIcon={this.state.antIcon}
/>:""}
<div className="educontent clearfix">
{windowsscrollTop===false?<div className={"mt20 mb20"}>
<Breadcrumb separator=">">
<Breadcrumb.Item href={this.props.current_user&&this.props.current_user.first_category_url}>{this.props.current_user&&this.props.current_user.course_name}</Breadcrumb.Item>
<Breadcrumb.Item href={`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.props.match.params.main_id}`}>实训作业</Breadcrumb.Item>
<Breadcrumb.Item>调整排序</Breadcrumb.Item>
</Breadcrumb>
</div>:""}
<p className="clearfix bor-bottom-greyE edu-back-white orderingbox"
style={positiontype}
>
<span>温馨提示请在列表中长按鼠标左键进行拖放排序完成排序后请点击保存</span>
<Button className="fr orderingbtnleft" type="primary" onClick={()=>this.updatalist()}>保存</Button>
<Button className="fr mr30 orderingbtnright" onClick={()=>this.goback()}>取消</Button>
</p>
</div>
<Spin size="large" spinning={this.state.isSpin} >
<DragDropContext onDragEnd={this.onDragEnd} >
<Droppable droppableId={this.props.match.params.ordering_type}>
{(provided, snapshot) => (
<div
ref={provided.innerRef}
{...provided.droppableProps}
className={"educontent mb50 mt40 droppableul ordermiddiv"}
onScroll={this.contentViewScrolledit}
>
{datas===undefined?"":
datas.map((item, index) => {
return (
<Draggable
key={item.task_id}
draggableId={item.task_id}
index={index}
className={"TabsWarps"}
>
{(provided, snapshot) => (
<div className={"mt30 edu-back-white pd1323s relativef ordermidbox"}
key={index}
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
>
<div className={"clearfix"}>
<div className={"item-body"}>
<div className={"clearfix ds pr orderSection"}>
<p title={item.task_name} className="font-16 color-dark maxwidth865s orderfonttop"
href={`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${item.task_id}/list?tab=0`}>{item.task_name}</p>
<p className={"color-grey panel-lightgrey mt16 "}>
<span className="topicswidth400">
<span className="topsics100 color-grey9 orderfontbom mr20 maxwidth795">{item.user_name}</span>
<span className="mr50 color-grey9 orderfontbom maxwidth795">{item.category}</span>
</span>
</p>
</div>
</div>
</div>
</div>
)}
</Draggable>
)
})
}
</div>
)}
</Droppable>
</DragDropContext>
{
datas===undefined?"":datas.length===0? <NoneData></NoneData>:""
}
</Spin>
</div>
)
}
}
export default Ordering;

@ -116,6 +116,7 @@ class Poll extends Component{
if(search!=""&&search!=undefined){
url+="&search="+search
}
url=encodeURI(url);//IE11传参为乱码search
axios.get(url).then((result)=>{
if(result){
this.setState({

@ -831,20 +831,7 @@ class PollNew extends Component {
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
Deleteadddomtwo = (indexo, object,bool) => {
var thiss = this;
if(bool === true){
this.setState({
q_countst: 1,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else {
this.setState({
q_countst: 1,
Newdisplay:false,
newoption: false,
})
}
var poll_questionslength = this.state.poll_questions.length;
// console.log("deleteadddomtwo|||||||||||||||||||||||||||||||||||||||||\\");
@ -988,78 +975,95 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于选项数")
// this.props.showNotification(`选择题的最大可选项不能大于选项数`);
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification(`选择题的最大可选项不能小于2项目`);
//
// return;
//
// }
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1191,79 +1195,99 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
}
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification('可选的最大限制不能小于最小限制!');
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于答案数")
// this.props.showNotification('选择题的最大可选项不能大于选项数!');
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification('选择题的最大可选项不能小于2项目');
//
// return;
//
// }
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1328,6 +1352,20 @@ class PollNew extends Component {
this.state.mymainsint = this.state.mymainsint + 1;
}
if(bool === true){
this.setState({
q_countst: 1,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else {
this.setState({
q_countst: 1,
Newdisplay:false,
newoption: false,
})
}
this.setState({
// poll_questions: newarrpoll,
adddom: newarr,
@ -1346,11 +1384,6 @@ class PollNew extends Component {
// indexo 第几个数组
//object 单个数组数据
Deleteadddomthree = (indexo, object,bool) => {
if(bool === true) {
this.setState({
bindingid:undefined,
})
}
this.setState({
Newdisplay:false,
newoption: false,
@ -1482,66 +1515,99 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
newarrpoll.splice(thiss.state.Insertposition, 0, question);
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1660,65 +1726,91 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
// console.log(newarrpoll)
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
} else if (object.question.question_type === 3) {
//插入主观题
@ -1790,6 +1882,11 @@ class PollNew extends Component {
q_countst: 0,
})
}
if(bool === true) {
this.setState({
bindingid:undefined,
})
}
this.Deleteadddom(indexo);
// console.log(indexo)
}
@ -1971,6 +2068,7 @@ class PollNew extends Component {
thiss.thisinitializationdatanew();
}
})
}
//上下移到服务器中
@ -2240,34 +2338,34 @@ class PollNew extends Component {
var minbool = false;
var maxbool = false;
let arr = this.state.adddom;
if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
minbool = true;
}
if (max === 0 || max === "0" || max === null || max === undefined) {
maxbool = true;
}
if (minbool === true && maxbool === true) {
for (var i = 0; i < arr.length; i++) {
if (index === i) {
arr[i].question.min_choices = parseInt(value);
}
}
this.setState({
adddom: arr
})
} else {
// if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
// minbool = true;
// }
// if (max === 0 || max === "0" || max === null || max === undefined) {
// maxbool = true;
// }
//
// if (minbool === true && maxbool === true) {
// for (var i = 0; i < arr.length; i++) {
// if (index === i) {
// arr[i].question.min_choices = parseInt(value);
// }
// }
// this.setState({
// adddom: arr
// })
// } else {
for (var i = 0; i < arr.length; i++) {
if (index === i) {
arr[i].question.min_choices = parseInt(value);
arr[i].question.max_choices = length;
// arr[i].question.max_choices = length;
break;
}
}
this.setState({
adddom: arr
})
}
// }
}
@ -2284,21 +2382,21 @@ class PollNew extends Component {
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 {
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
// 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 {
// arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
}
// }
}
}
// console.log(2119);
@ -2767,7 +2865,7 @@ class PollNew extends Component {
console.log(this.state.poll_questions);
console.log(this.state.adddom);
let resultDom;
resultDom = <div>
resultDom = <div >
<p className="clearfix font-16">
<span className="color-grey-6 fl">{index + 1}</span>
<span
@ -2777,7 +2875,7 @@ class PollNew extends Component {
{
item.question.question_type === 2?
<span style={{color: "#4B4B4B"}}
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "" : item.question.min_choices === null && item.question.max_choices === null ? "" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
: ""
}
@ -2863,7 +2961,7 @@ class PollNew extends Component {
resultDomtwo =
<div >
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms3"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -2931,7 +3029,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -2966,7 +3064,7 @@ class PollNew extends Component {
<div style={{minWidth: "1100px"}}>
<div>
<span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
className="color-grey-6 mr20 ml10 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 ">
{/*可选最小1*/}
<style>
@ -3025,11 +3123,11 @@ class PollNew extends Component {
}
</div>
<div>
<div >
{itemo.question.question_type === 2 ?
(
this.state.polls_status === undefined || this.state.polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
@ -3105,7 +3203,7 @@ class PollNew extends Component {
resultDomtwo =
<div >
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms2"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3173,7 +3271,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3271,7 +3369,7 @@ class PollNew extends Component {
{itemo.question.question_type === 2 ?
(
this.state.polls_status === undefined || this.state.polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
@ -3356,7 +3454,7 @@ class PollNew extends Component {
resultDomtwo =
<div className="problemShow">
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3424,7 +3522,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{polls_status === undefined || polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3522,7 +3620,7 @@ class PollNew extends Component {
{itemo.question.question_type === 2 ?
(
polls_status === undefined || polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save