diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 59b0d7e41..fb68f23bf 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -890,7 +890,7 @@ class CoursesController < ApplicationController name = worksheet.cell(row, 1).to_s if @course.course_groups.where(:name => name).blank? - @course.course_groups << CourseGroup.new(:name => name) + @course.course_groups << CourseGroup.new(:name => name, :position => @course.course_groups_count + 1) group_count += 1 end end diff --git a/app/controllers/exercise_bank_questions_controller.rb b/app/controllers/exercise_bank_questions_controller.rb index 416358af6..b64e71b59 100644 --- a/app/controllers/exercise_bank_questions_controller.rb +++ b/app/controllers/exercise_bank_questions_controller.rb @@ -124,6 +124,7 @@ class ExerciseBankQuestionsController < ApplicationController @exercise_question.update_attributes(:question_score => question_score, :shixun_name=> shixun_name) end end + normal_status("创建成功") rescue Exception => e uid_logger_error(e.message) tip_exception("试卷问题创建失败!") @@ -185,7 +186,6 @@ class ExerciseBankQuestionsController < ApplicationController if @exercise_question.question_type <= Exercise::JUDGMENT #选择题/判断题,标准答案为一个或多个 exercise_standard_choices = @exercise_answers_array.pluck(:exercise_bank_choice_id) #问题以前的全部标准答案选项位置 if exercise_standard_choices.sort != standard_answer.sort #表示答案有更改的 - standard_answer_change = true common_standard_choices = standard_answer & exercise_standard_choices # 传入的标准答案的选项位置和以前的并集,即表示不用做更改的 old_left_standard_choices = exercise_standard_choices - common_standard_choices # 以前的差集共同的,剩余的表示需要删掉 new_left_standard_choices = standard_answer - common_standard_choices # 传入的标准答案差集共同的,剩余的表示需要新建 @@ -216,7 +216,6 @@ class ExerciseBankQuestionsController < ApplicationController if old_ex_answer_choice_texts != new_ex_answer_choice_texts #填空题标准答案有更改时,才会更新标准答案 new_ex_answer_choice_ids = standard_answer.map {|a| a[:choice_id]}.uniq #新传入的答案数组序号 old_ex_answer_choice_ids = old_ex_answer.pluck(:exercise_bank_choice_id).uniq #全部的答案数组序号 - standard_answer_change = true #删除多余的选项 if old_ex_answer_choice_ids.count > new_ex_answer_choice_ids.count #有减少的填空 delete_ex_answer_choice_ids = old_ex_answer_choice_ids - new_ex_answer_choice_ids @@ -300,7 +299,7 @@ class ExerciseBankQuestionsController < ApplicationController elsif @exercise_question.question_type == Exercise::PRACTICAL question_score = 0 shixun_name = params[:shixun_name] || @exercise_question.shixun_name - @exercise_question.exercise_shixun_challenges.each_with_index do |challenge, index| + @exercise_question.exercise_bank_shixun_challenges.each_with_index do |challenge, index| challenge.question_score = params[:question_scores][index].to_f.round(1) challenge.save question_score += params[:question_scores][index].to_f.round(1) @@ -309,32 +308,63 @@ class ExerciseBankQuestionsController < ApplicationController @exercise_question.shixun_name = shixun_name @exercise_question.save end + normal_status(0,"试卷更新成功") + rescue Exception => e + uid_logger_error(e.message) + tip_exception("页面调用失败!") + raise ActiveRecord::Rollback + end + end + end - #当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数. - - if standard_answer_change && @exercise.exercise_status >= Exercise::PUBLISHED - # ex_users_committed = @exercise.exercise_users.exercise_user_committed - # if ex_users_committed.size > 0 - # ex_users_committed.each do |ex_user| - # update_objective_score = update_single_score(@exercise_question,ex_user.user_id,standard_answer) - # if update_objective_score != 0 - # objective_score = ex_user.objective_score - # new_objective_score = objective_score + update_objective_score - # total_score = ex_user.score + update_objective_score - # total_score = total_score < 0.0 ? 0.0 : total_score - # ex_user.update_attributes(objective_score:new_objective_score,score:total_score) - # end - # end - # end - normal_status(3,"修改了标准答案\n是否重新计算学生答题的成绩?") + def up_down + ActiveRecord::Base.transaction do + begin + opr = params[:opr] + current_q_p = @exercise_question.question_number.to_i #问题的当前位置 + if opr.present? + if opr.to_s == "up" + last_q_p = @exercise.exercise_bank_questions.find_by(question_number: (current_q_p - 1)) # 当前问题的前一个问题 + if last_q_p.present? + @exercise_question.update_attribute('question_number', (current_q_p - 1)) + last_q_p.update_attribute('question_number', current_q_p) # 重新获取当前问题的位置 + normal_status(0, "问题上移成功!") + else + normal_status(-1, "移动失败,已经是第一个问题了!") + end + elsif opr.to_s == "down" + next_q_p = @exercise.exercise_bank_questions.find_by(question_number: (current_q_p + 1)) # 当前问题的前一个问题 + if next_q_p.present? + @exercise_question.update_attribute('question_number', (current_q_p + 1)) + next_q_p.update_attribute('question_number', current_q_p) + normal_status(0, "问题下移成功!") + else + normal_status(-1, "移动失败,已经是最后一个问题了!") + end + end else - normal_status(0,"试卷更新成功!") + normal_status(-1, "移动失败,请输入参数") end + rescue Exception => e + uid_logger_error(e.message) + tip_exception("问题移动失败!") + end + end + end + #试卷问题的删除 + def destroy + ActiveRecord::Base.transaction do + begin + question_d_id = @exercise_question.question_number.to_i #问题的当前位置 + exercise_questions = @exercise.exercise_bank_questions + left_questions = exercise_questions.where("question_number > ?", question_d_id) + left_questions.update_all("question_number = question_number - 1") if left_questions + @exercise_question.destroy + normal_status(0, "删除成功") rescue Exception => e uid_logger_error(e.message) - tip_exception("页面调用失败!") - raise ActiveRecord::Rollback + tip_exception("删除失败") end end end diff --git a/app/controllers/exercise_banks_controller.rb b/app/controllers/exercise_banks_controller.rb index 29af3c42b..cc7a1003e 100644 --- a/app/controllers/exercise_banks_controller.rb +++ b/app/controllers/exercise_banks_controller.rb @@ -1,8 +1,9 @@ #encoding: UTF-8 class ExerciseBanksController < ApplicationController before_action :require_login - before_action :find_bank + before_action :find_bank, except: [:choose_shixun] before_action :bank_admin, only: [:update] + before_action :commit_shixun_present, only: [:commit_shixun] def show @exercise_questions = @bank.exercise_bank_questions&.includes(:exercise_bank_choices, :exercise_bank_shixun_challenges, @@ -47,6 +48,38 @@ class ExerciseBanksController < ApplicationController normal_status(0,"试卷更新成功!") end + def choose_shixun + search = params[:search] + if !current_user.admin? #当不为管理员的时候 + user_school_id = current_user.school_id #当前用户的学校id + if user_school_id.present? + none_shixun_ids = ShixunSchool.where("school_id != #{user_school_id}").pluck(:shixun_id) + @publish_shixuns = Shixun.where.not(id: none_shixun_ids).unhidden + end + else + @publish_shixuns = Shixun.unhidden + end + if search.present? + @publish_shixuns = @publish_shixuns.search_by_name(search) + end + + @shixuns = @publish_shixuns.joins(:challenges).where("challenges.st != 0").distinct + # 全部页面,需返回 + @shixuns_count = @shixuns.count + + # 分页 + @page = params[:page] || 1 + @limit = params[:limit] || 8 + + @shixuns = @shixuns.page(@page).per(@limit) + end + + #确认实训的选择 + def commit_shixun + @shixun_challenges = @shixun.challenges + @shixun_challenges_count = @shixun_challenges.size + end + private def find_bank @@ -57,4 +90,17 @@ class ExerciseBanksController < ApplicationController def bank_admin tip_exception(403, "无权限") unless (current_user.certification_teacher? && @bank.user_id == current_user.id) || current_user.admin? end + + #判断实训是否已选择 + def commit_shixun_present + question_shixun_ids = @exercise.exercise_bank_questions.pluck(:shixun_id).reject(&:blank?) + shixun_id = params[:shixun_id] + @shixun = Shixun.find_by(id: shixun_id) + if shixun_id.present? && question_shixun_ids.include?(shixun_id) + normal_status(-1,"该实训已选择!") + elsif @shixun.blank? + normal_status(-1,"该实训不存在!") + end + end + end diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 0f301dd4f..bc549cf1d 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -901,9 +901,9 @@ class PollsController < ApplicationController error_question = [] @poll_multi_questions.each do |q| poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size - if q.max_choices.present? && (poll_user_votes > q.max_choices) + if q.max_choices.present? && (q.max_choices > 0) && (poll_user_votes > q.max_choices) error_messages = "第#{q.question_number}题:超过最大选项限制" - elsif q.min_choices.present? && (poll_user_votes < q.min_choices) + elsif q.min_choices.present? && (q.min_choices > 0)&& (poll_user_votes < q.min_choices) error_messages = "第#{q.question_number}题:不得少于最小选项限制" else error_messages = nil @@ -936,7 +936,7 @@ class PollsController < ApplicationController def commit_result ActiveRecord::Base.transaction do begin - @poll_users = @poll.all_poll_users(current_user.id) + @poll_users = @poll.all_poll_users(current_user.id).where(commit_status:1) # 问卷已提交的用户 @poll_commit_ids = @poll_users.commit_by_status(1).pluck(:user_id) #问卷提交用户的id @page = params[:page] || 1 @limit = params[:limit] || 10 diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 96fcbeace..00fea5f3e 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -1,6 +1,7 @@ class QuestionBanksController < ApplicationController before_action :require_login, :check_auth before_action :params_filter, except: [:my_courses] + before_action :teacher_or_admin, except: [:bank_list] # 题库选用列表 # object_type: # normal 普通作业题库; group 分组作业题库; poll问卷题库; exercise试卷题库; gtask 毕设选题题库;gtopic 毕设任务 @@ -81,24 +82,29 @@ class QuestionBanksController < ApplicationController def my_courses @courses = current_user.manage_courses.where(is_delete: 0, is_end: 0) + unless params[:search].blank? + @courses = @courses.where("name like ?", "%#{params[:search].strip}%") + end end def send_to_course - bank = current_bank - course = current_user.manage_courses.find_by(id: params[:course_id]) - case @object_type - when 'HomeworkBank' # 作业 - quote_homework_bank bank, course - when 'ExerciseBank' - if bank.container_type == 'Exercise' # 试卷 - quote_exercise_bank bank, course - else # 问卷 - quote_poll_bank bank, course + banks = object_banks + course = current_user.manage_courses.find_by!(id: params[:course_id]) + banks.each do |bank| + case @object_type + when 'HomeworkBank' # 作业 + quote_homework_bank bank, course + when 'ExerciseBank' + if bank.container_type == 'Exercise' # 试卷 + quote_exercise_bank bank, course + else # 问卷 + quote_poll_bank bank, course + end + when 'GtaskBank' + quote_gtask_bank bank, course + when 'GtopicBank' + quote_gtopic_bank bank, course end - when 'GtaskBank' - quote_gtask_bank bank, course - when 'GtopicBank' - quote_gtopic_bank bank, course end normal_status("发送成功") end @@ -106,7 +112,7 @@ class QuestionBanksController < ApplicationController def destroy bank = current_bank - unless user.admin? || bank.user_id == user.id + unless current_user.admin? || bank.user_id == current_user.id render_forbidden return end @@ -121,11 +127,32 @@ class QuestionBanksController < ApplicationController render_ok end + def multi_delete + @objects = object_banks + @objects.destroy_all + normal_status("删除成功") + end + + def multi_public + @objects = object_banks + @objects.update_all(is_public: true) + normal_status("更新成功") + end + private + def object_banks + banks ||= @object_type.classify.constantize.where(@object_filter).where(id: params[:object_id]) + unless current_user.admin? + banks = banks.where(user_id: current_user.id) + end + banks + end + def current_bank @_current_bank ||= @object_type.classify.constantize.where(@object_filter).find(params[:id]) end + def params_filter type = ["normal", "group", "poll", "exercise", "gtask", "gtopic"] tip_exception("object_type类型不正确") unless type.include?(params[:object_type]) @@ -152,6 +179,10 @@ class QuestionBanksController < ApplicationController end end + def teacher_or_admin + tip_exception(403, "无权限操作") unless current_user.is_certification_teacher || current_user.admin? + end + def quote_homework_bank homework, course ActiveRecord::Base.transaction do # 复制作业的基本信息 diff --git a/app/controllers/users/question_banks_controller.rb b/app/controllers/users/question_banks_controller.rb index d0a331291..1f51b701c 100644 --- a/app/controllers/users/question_banks_controller.rb +++ b/app/controllers/users/question_banks_controller.rb @@ -8,7 +8,7 @@ class Users::QuestionBanksController < Users::BaseController @count = question_banks.count @course_lists = service.course_lists - @question_banks = paginate(question_banks.includes(:user, :course_list), special: true) + @question_banks = paginate(question_banks.includes(:user, :course_list)) load_question_banks_solve_count # for solve n + 1 end @@ -18,8 +18,8 @@ class Users::QuestionBanksController < Users::BaseController def load_question_banks_solve_count question_bank_ids = @question_banks.map(&:id) @solve_count_map = - case params[:category] - when 'common', 'group' then + case params[:object_type] + when 'normal', 'group' then StudentWork.where(is_delete: false, work_status: [1, 2, 3]).joins(:homework_common) .where(homework_commons: { homework_bank_id: question_bank_ids }) .group('homework_commons.homework_bank_id').count @@ -42,14 +42,14 @@ class Users::QuestionBanksController < Users::BaseController end def query_params - params.permit(:type, :category, :course_list_id, :sort_by, :sort_direction) + params.permit(:type, :object_type, :course_list_id, :sort_by, :sort_direction) end def check_query_params! params[:type] = 'personal' if params[:type].blank? || !%w(personal publicly).include?(params[:type]) - if params[:category].blank? || !%w(common group exercise poll gtask gtopic).include?(params[:category]) - params[:category] = 'common' + if params[:object_type].blank? || !%w(normal group exercise poll gtask gtopic).include?(params[:object_type]) + params[:object_type] = 'normal' end if params[:sort_by].blank? || !%w(updated_at name contributor).include?(params[:sort_by]) diff --git a/app/services/users/question_bank_service.rb b/app/services/users/question_bank_service.rb index b17073a4f..7e640c6a5 100644 --- a/app/services/users/question_bank_service.rb +++ b/app/services/users/question_bank_service.rb @@ -22,8 +22,8 @@ class Users::QuestionBankService course_lists = CourseList.joins(relation_name).where.not(relation_name => { id: nil }) category_condition = - case params[:category] - when 'common' then { homework_type: 1 } + case params[:object_type] + when 'normal' then { homework_type: 1 } when 'group' then { homework_type: 3 } when 'exercise' then { container_type: 'Exercise' } when 'poll' then { container_type: 'Poll' } @@ -47,8 +47,8 @@ class Users::QuestionBankService def class_name @_class_name ||= begin - case params[:category] - when 'common', 'group' then 'HomeworkBank' + case params[:object_type] + when 'normal', 'group' then 'HomeworkBank' when 'exercise', 'poll' then 'ExerciseBank' when 'gtask' then 'GtaskBank' when 'gtopic' then 'GtopicBank' @@ -58,8 +58,8 @@ class Users::QuestionBankService end def category_filter(relations) - case params[:category] - when 'common' then + case params[:object_type] + when 'normal' then relations.where(homework_type: 1) when 'group' then relations.where(homework_type: 3) diff --git a/app/views/admins/shixun_settings/shared/_td.html.erb b/app/views/admins/shixun_settings/shared/_td.html.erb index 8523b682b..931ad11ac 100644 --- a/app/views/admins/shixun_settings/shared/_td.html.erb +++ b/app/views/admins/shixun_settings/shared/_td.html.erb @@ -17,15 +17,16 @@ + -- - - <%= File.exist?(disk_filename("Shixun",shixun.id)) ? "重新上传" : "上传图片" %> - - <% if File.exist?(disk_filename("Shixun",shixun.id)) %> - <%= image_tag(url_to_avatar(shixun), :class => "w80 h80 fl ml5 shixun_image_show", :id => "shixun_image_show_#{shixun.id}") %> - <% else %> - - <% end %> + + <%#= File.exist?(disk_filename("Shixun",shixun.id)) ? "重新上传" : "上传图片" %> + + <%# if File.exist?(disk_filename("Shixun",shixun.id)) %> + <%#= image_tag(url_to_avatar(shixun), :class => "w80 h80 fl ml5 shixun_image_show", :id => "shixun_image_show_#{shixun.id}") %> + <%# else %> + + <%# end %> <%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.login}",target:'_blank' %> diff --git a/app/views/exercise_banks/choose_shixun.json.jbuilder b/app/views/exercise_banks/choose_shixun.json.jbuilder new file mode 100644 index 000000000..96a9a2b61 --- /dev/null +++ b/app/views/exercise_banks/choose_shixun.json.jbuilder @@ -0,0 +1,10 @@ +json.shixun_counts @shixuns_count + +json.shixuns do + json.array! @shixuns do |s| + json.shixun_id s.id + json.shixun_name s.name + json.shixun_user s.user.real_name + json.shixun_user_count s.myshixuns_count + end +end \ No newline at end of file diff --git a/app/views/exercise_banks/commit_shixun.json.jbuilder b/app/views/exercise_banks/commit_shixun.json.jbuilder new file mode 100644 index 000000000..d140e3c5d --- /dev/null +++ b/app/views/exercise_banks/commit_shixun.json.jbuilder @@ -0,0 +1,10 @@ +json.shixun_id @shixun.id +json.shixun_name @shixun.name + +json.challenges do + json.array! @shixun_challenges do |s| + json.challenge_name s.subject + end +end + +json.challenge_counts @shixun_challenges_count \ No newline at end of file diff --git a/app/views/exercises/start_answer.json.jbuilder b/app/views/exercises/start_answer.json.jbuilder index 53336bf6f..01b730c76 100644 --- a/app/views/exercises/start_answer.json.jbuilder +++ b/app/views/exercises/start_answer.json.jbuilder @@ -31,6 +31,11 @@ else json.question_status @question_status end +exercise_type = 3 +if @t_user_exercise_status == 3 && @exercise.answer_open + exercise_type = 4 +end + json.partial! "exercises/exercise_scores" json.exercise_questions do @@ -57,7 +62,7 @@ json.exercise_questions do shixun_challenges: question.exercise_shixun_challenges, user_answer: question_info[:answered_content], choices:question.exercise_choices, - exercise_type:3, + exercise_type:exercise_type, shixun_type:question_info[:shixun_type], ques_position: q[:ques_number], edit_type:nil diff --git a/app/views/polls/commit_result.json.jbuilder b/app/views/polls/commit_result.json.jbuilder index 51f70afa2..795d609a7 100644 --- a/app/views/polls/commit_result.json.jbuilder +++ b/app/views/polls/commit_result.json.jbuilder @@ -14,7 +14,7 @@ if @poll_questions_count > 0 json.array! @poll_questions do |question| json.partial! "polls/commit_answers_result", question: question, answers:question.poll_answers, - question_votes:question.poll_votes #问题的全部答案 + question_votes:question.poll_votes.where(user_id:@poll_commit_ids) #问题的全部答案 end end else diff --git a/config/routes.rb b/config/routes.rb index 01c981352..a0aaa65cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -632,6 +632,8 @@ Rails.application.routes.draw do post :save_banks get :my_courses post :send_to_course + delete :multi_delete + post :multi_public end end @@ -643,7 +645,23 @@ Rails.application.routes.draw do resources :gtopic_banks resources :task_banks - resources :exercise_banks + + resources :exercise_banks do + collection do + get :choose_shixun + end + + member do + get :commit_shixun + end + end + + resources :exercise_bank_questions do + member do + post :up_down + get :choose_shixun + end + end resources :attachments diff --git a/db/migrate/20190829025855_migrate_gtopic_bank_is_public.rb b/db/migrate/20190829025855_migrate_gtopic_bank_is_public.rb new file mode 100644 index 000000000..c267284a0 --- /dev/null +++ b/db/migrate/20190829025855_migrate_gtopic_bank_is_public.rb @@ -0,0 +1,5 @@ +class MigrateGtopicBankIsPublic < ActiveRecord::Migration[5.2] + def change + change_column :gtopic_banks, :is_public, :boolean, default: 0 + end +end diff --git a/db/migrate/20190829084147_migrate_course_group_position.rb b/db/migrate/20190829084147_migrate_course_group_position.rb new file mode 100644 index 000000000..3a71baae4 --- /dev/null +++ b/db/migrate/20190829084147_migrate_course_group_position.rb @@ -0,0 +1,11 @@ +class MigrateCourseGroupPosition < ActiveRecord::Migration[5.2] + def change + Course.all.each do |course| + if course.course_groups.exists?(position: 0) + course.course_groups.each_with_index do |group, index| + group.update_attributes(position: index+1) + end + end + end + end +end diff --git a/public/assets/.sprockets-manifest-1c370772f16743f825981ab0e5c94237.json b/public/assets/.sprockets-manifest-1c370772f16743f825981ab0e5c94237.json index 1da7534f9..ef941726e 100644 --- a/public/assets/.sprockets-manifest-1c370772f16743f825981ab0e5c94237.json +++ b/public/assets/.sprockets-manifest-1c370772f16743f825981ab0e5c94237.json @@ -1 +1 @@ -{"files":{"admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js":{"logical_path":"admin.js","mtime":"2019-08-29T10:56:46+08:00","size":1325003,"digest":"9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d","integrity":"sha256-m8AdkpYRCK2wZzmuQ9UpKMv0HTg78npK4hJa0jLy8W0="},"admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css":{"logical_path":"admin.css","mtime":"2019-08-29T10:56:46+08:00","size":640292,"digest":"96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b","integrity":"sha256-lq8GMDfgur8lsVedHJ0eGQGWHRCljvPUH+ueaP7/NIs="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-23T09:13:14+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-23T09:13:14+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-23T09:13:14+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-23T09:13:14+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-23T09:13:14+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2019-08-23T10:44:25+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js":{"logical_path":"application.js","mtime":"2019-08-29T10:56:46+08:00","size":1459545,"digest":"761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13","integrity":"sha256-dh0Ls1TWAI6FP9C2hmP1MGxQNdzA9QDWhxAlvK7+CxM="},"application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css":{"logical_path":"application.css","mtime":"2019-08-29T10:56:46+08:00","size":1146039,"digest":"7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe","integrity":"sha256-fkxPXnRqLWpv73Fdb8cQBbPYq4l+e4+3ywZBk1e9YP4="}},"assets":{"admin.js":"admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js","admin.css":"admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js","application.css":"application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css"}} \ No newline at end of file +{"files":{"admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js":{"logical_path":"admin.js","mtime":"2019-08-29T10:56:46+08:00","size":1325003,"digest":"9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d","integrity":"sha256-m8AdkpYRCK2wZzmuQ9UpKMv0HTg78npK4hJa0jLy8W0="},"admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css":{"logical_path":"admin.css","mtime":"2019-08-29T10:56:46+08:00","size":640292,"digest":"96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b","integrity":"sha256-lq8GMDfgur8lsVedHJ0eGQGWHRCljvPUH+ueaP7/NIs="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-23T09:13:14+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-23T09:13:14+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-23T09:13:14+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-23T09:13:14+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-23T09:13:14+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2019-08-23T10:44:25+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js":{"logical_path":"application.js","mtime":"2019-08-29T10:56:46+08:00","size":1459545,"digest":"761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13","integrity":"sha256-dh0Ls1TWAI6FP9C2hmP1MGxQNdzA9QDWhxAlvK7+CxM="},"application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css":{"logical_path":"application.css","mtime":"2019-08-29T10:56:46+08:00","size":1146039,"digest":"7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe","integrity":"sha256-fkxPXnRqLWpv73Fdb8cQBbPYq4l+e4+3ywZBk1e9YP4="},"admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js":{"logical_path":"admin.js","mtime":"2019-08-29T13:45:30+08:00","size":1324968,"digest":"692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53","integrity":"sha256-aSw5JSjFYJDYj+yS5v87ajRCxqaR2UZ8O1HoJiVBfFM="},"admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css":{"logical_path":"admin.css","mtime":"2019-08-29T13:45:30+08:00","size":640433,"digest":"94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051","integrity":"sha256-lPa6CwwXINYbTb9g18k5+AI/Fw42CZWXzAAvVG+QoFE="},"application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js":{"logical_path":"application.js","mtime":"2019-08-29T13:45:30+08:00","size":1459510,"digest":"8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957","integrity":"sha256-i6a85ZVbdgzVu5Ip0kQNPvU/y8SwcdnQ6SBhdqAzeVc="},"application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css":{"logical_path":"application.css","mtime":"2019-08-29T13:45:30+08:00","size":1146321,"digest":"d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb","integrity":"sha256-2FwKsrPsLO9MvIxO/ObVv6d8hWigy/1Kx04Msga28+s="}},"assets":{"admin.js":"admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js","admin.css":"admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js","application.css":"application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css"}} \ No newline at end of file diff --git a/public/assets/admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js b/public/assets/admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js similarity index 99% rename from public/assets/admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js rename to public/assets/admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js index 6cf15aa3a..54423bac3 100644 --- a/public/assets/admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js +++ b/public/assets/admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js @@ -38362,46 +38362,37 @@ $(document).on('turbolinks:load', function() { ; $(document).on('turbolinks:load', function() { if ($('body.admins-shixun-settings-index-page').length > 0) { + $(".shixun-settings-select").on("change", function () { + var s_value = $(this).val(); + var s_name = $(this).attr("name"); + var json = {}; + json[s_name] = s_value; + $.ajax({ + url: "/admins/shixun_settings", + type: "GET", + dataType:'script', + data: json + }) + }); + $(".shixun-setting-form").on("change",function () { + var s_id = $(this).attr("data-id"); + var s_value = $(this).val(); + var s_name = $(this).attr("name"); + var json = {}; + var s_index = $(this).parent("td").siblings(".shixun-line-no").text(); + json[s_name] = s_value; + json["page_no"] = s_index; + $.ajax({ + url: "/admins/shixun_settings/" + s_id, + type: "PUT", + dataType:'script', + data: json + }) + }) } }); -function update_change(target) { - var s_id = $(target).attr("data-id"); - var s_value = $(target).val(); - var s_name = $(target).attr("name"); - var json = {}; - var s_index = $(target).parent("td").siblings(".shixun-line-no").text(); - json[s_name] = s_value; - json["page_no"] = s_index; - $.ajax({ - url: "/admins/shixun_settings/" + s_id, - type: "PUT", - dataType:'script', - data: json, - success: function (data) { - - } - }) -} - - -function select_change(target) { - var s_value = $(target).val(); - var s_name = $(target).attr("name"); - var json = {}; - json[s_name] = s_value; - $.ajax({ - url: "/admins/shixun_settings/", - type: "GET", - dataType:'script', - data: json, - success: function (data) { - - } - }) -} -; $(document).on('turbolinks:load', function() { $('select#tag-choosed').select2({ placeholder: "请选择分类", diff --git a/public/assets/admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js.gz b/public/assets/admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js.gz similarity index 97% rename from public/assets/admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js.gz rename to public/assets/admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js.gz index 0302686cf..03c214092 100644 Binary files a/public/assets/admin-9bc01d92961108adb06739ae43d52928cbf41d383bf27a4ae2125ad232f2f16d.js.gz and b/public/assets/admin-692c392528c56090d88fec92e6ff3b6a3442c6a691d9467c3b51e82625417c53.js.gz differ diff --git a/public/assets/admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css b/public/assets/admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css similarity index 99% rename from public/assets/admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css rename to public/assets/admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css index 0acd5f130..ea95aa0e2 100644 --- a/public/assets/admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css +++ b/public/assets/admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css @@ -18726,6 +18726,13 @@ input[type="checkbox"] { border: 1px solid #eee !important; } +/* line 10, app/assets/stylesheets/admins/shixun_settings.scss */ +.setting-chosen { + font-weight: 400; + font-size: 10px; + color: #333; +} + /* line 1, app/assets/stylesheets/admins/sidebar.scss */ #sidebar { min-width: 200px; diff --git a/public/assets/admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css.gz b/public/assets/admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css.gz similarity index 97% rename from public/assets/admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css.gz rename to public/assets/admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css.gz index b48eb3027..64b11d882 100644 Binary files a/public/assets/admin-96af063037e0babf25b1579d1c9d1e1901961d10a58ef3d41feb9e68feff348b.css.gz and b/public/assets/admin-94f6ba0b0c1720d61b4dbf60d7c939f8023f170e36099597cc002f546f90a051.css.gz differ diff --git a/public/assets/application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js b/public/assets/application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js similarity index 99% rename from public/assets/application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js rename to public/assets/application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js index 31929c033..62b797984 100644 --- a/public/assets/application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js +++ b/public/assets/application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js @@ -38362,46 +38362,37 @@ $(document).on('turbolinks:load', function() { ; $(document).on('turbolinks:load', function() { if ($('body.admins-shixun-settings-index-page').length > 0) { + $(".shixun-settings-select").on("change", function () { + var s_value = $(this).val(); + var s_name = $(this).attr("name"); + var json = {}; + json[s_name] = s_value; + $.ajax({ + url: "/admins/shixun_settings", + type: "GET", + dataType:'script', + data: json + }) + }); + $(".shixun-setting-form").on("change",function () { + var s_id = $(this).attr("data-id"); + var s_value = $(this).val(); + var s_name = $(this).attr("name"); + var json = {}; + var s_index = $(this).parent("td").siblings(".shixun-line-no").text(); + json[s_name] = s_value; + json["page_no"] = s_index; + $.ajax({ + url: "/admins/shixun_settings/" + s_id, + type: "PUT", + dataType:'script', + data: json + }) + }) } }); -function update_change(target) { - var s_id = $(target).attr("data-id"); - var s_value = $(target).val(); - var s_name = $(target).attr("name"); - var json = {}; - var s_index = $(target).parent("td").siblings(".shixun-line-no").text(); - json[s_name] = s_value; - json["page_no"] = s_index; - $.ajax({ - url: "/admins/shixun_settings/" + s_id, - type: "PUT", - dataType:'script', - data: json, - success: function (data) { - - } - }) -} - - -function select_change(target) { - var s_value = $(target).val(); - var s_name = $(target).attr("name"); - var json = {}; - json[s_name] = s_value; - $.ajax({ - url: "/admins/shixun_settings/", - type: "GET", - dataType:'script', - data: json, - success: function (data) { - - } - }) -} -; $(document).on('turbolinks:load', function() { $('select#tag-choosed').select2({ placeholder: "请选择分类", diff --git a/public/assets/application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js.gz b/public/assets/application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js.gz similarity index 81% rename from public/assets/application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js.gz rename to public/assets/application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js.gz index 29e2dd916..36faaa5a0 100644 Binary files a/public/assets/application-761d0bb354d6008e853fd0b68663f5306c5035dcc0f500d6871025bcaefe0b13.js.gz and b/public/assets/application-8ba6bce5955b760cd5bb9229d2440d3ef53fcbc4b071d9d0e9206176a0337957.js.gz differ diff --git a/public/assets/application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css b/public/assets/application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css similarity index 99% rename from public/assets/application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css rename to public/assets/application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css index 2b89b1fad..b819aa43c 100644 --- a/public/assets/application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css +++ b/public/assets/application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css @@ -18726,6 +18726,13 @@ input[type="checkbox"] { border: 1px solid #eee !important; } +/* line 10, app/assets/stylesheets/admins/shixun_settings.scss */ +.setting-chosen { + font-weight: 400; + font-size: 10px; + color: #333; +} + /* line 1, app/assets/stylesheets/admins/sidebar.scss */ #sidebar { min-width: 200px; @@ -19421,6 +19428,13 @@ input[type="checkbox"] { .select2 .select2-selection__choice { border: 1px solid #eee !important; } + +/* line 10, app/assets/stylesheets/admins/shixun_settings.scss */ +.setting-chosen { + font-weight: 400; + font-size: 10px; + color: #333; +} /* line 1, app/assets/stylesheets/admins/sidebar.scss */ #sidebar { min-width: 200px; diff --git a/public/assets/application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css.gz b/public/assets/application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css.gz similarity index 60% rename from public/assets/application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css.gz rename to public/assets/application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css.gz index 6b2204c06..c44bb3a3b 100644 Binary files a/public/assets/application-7e4c4f5e746a2d6a6fef715d6fc71005b3d8ab897e7b8fb7cb06419357bd60fe.css.gz and b/public/assets/application-d85c0ab2b3ec2cef4cbc8c4efce6d5bfa77c8568a0cbfd4ac74e0cb206b6f3eb.css.gz differ diff --git a/public/editormd/lib/marked.min.backup.js b/public/editormd/lib/marked.min.backup.js new file mode 100644 index 000000000..28e20ebec --- /dev/null +++ b/public/editormd/lib/marked.min.backup.js @@ -0,0 +1,18 @@ +/** + 备注,这个改动没启用,只是做个记录: + br不转成br + 加了个 if (cap[0] != '
' && cap[0] != '
') { out+=this.options.sanitize?escape(cap[0]):cap[0]; } + */ +/** + * marked - a markdown parser + * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + 2019 08 29 + + case"html":return this.renderer.html((this.token.text)); + --> + case"html":return this.renderer.paragraph(this.inline.output(this.token.text)); + + add: && !(e instanceof String) + */ +!function(e){"use strict";var x={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:g,table:g,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||k.defaults,this.rules=x.normal,this.options.pedantic?this.rules=x.pedantic:this.options.gfm&&(this.rules=x.gfm)}x._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,x._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,x.def=i(x.def).replace("label",x._label).replace("title",x._title).getRegex(),x.bullet=/(?:[*+-]|\d{1,9}\.)/,x.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,x.item=i(x.item,"gm").replace(/bull/g,x.bullet).getRegex(),x.list=i(x.list).replace(/bull/g,x.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+x.def.source+")").getRegex(),x._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",x._comment=//,x.html=i(x.html,"i").replace("comment",x._comment).replace("tag",x._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x.paragraph=i(x._paragraph).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} +").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",x._tag).getRegex(),x.blockquote=i(x.blockquote).replace("paragraph",x.paragraph).getRegex(),x.normal=f({},x),x.gfm=f({},x.normal,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),x.pedantic=f({},x.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",x._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:g,paragraph:i(x.normal._paragraph).replace("hr",x.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",x.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),a.rules=x,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,k;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1 ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\*])\*(?!\*|[^\spunctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:g,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~",n.em=i(n.em).replace(/punctuation/g,n._punctuation).getRegex(),n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=i(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=i(n.tag).replace("comment",x._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,n._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=i(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=i(n.reflink).replace("label",n._label).getRegex(),n.normal=f({},n),n.pedantic=f({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=f({},n.normal,{escape:i(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):_(i[0]):i[0];else if(i=this.rules.link.exec(e)){var a=d(i[2],"()");if(-1$/,"$1"),o+=this.outputLink(i,{href:p.escapes(r),title:p.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(_(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=_(this.mangle(i[1]))):n=_(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):_(i[0]):i[0]):o+=this.renderer.text(_(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=_(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=_(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},p.escapes=function(e){return e?e.replace(p.rules._escapes,"$1"):e},p.prototype.outputLink=function(e,t){var n=t.href,r=t.title?_(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,_(e[1]))},p.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},p.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s'+(n?e:_(e,!0))+"\n":"
"+(n?e:_(e,!0))+"
"},r.prototype.blockquote=function(e){return"
\n"+e+"
\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.checkbox=function(e){return" "},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r=''+n+'":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},h.parse=function(e,t){return new h(t).parse(e)},h.prototype.parse=function(e){this.inline=new p(e.links,this.options),this.inlineText=new p(e.links,f({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},h.prototype.next=function(){return this.token=this.tokens.pop(),this.token},h.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},h.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},h.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},_.escapeTest=/[&<>"']/,_.escapeReplace=/[&<>"']/g,_.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},_.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,_.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var o={},u=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(){}function f(e){for(var t,n,r=1;rt)n.splice(t);else for(;n.lengthAn error occurred:

    "+_(e.message+"",!0)+"
    ";throw e}}g.exec=g,k.options=k.setOptions=function(e){return f(k.defaults,e),k},k.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}},k.defaults=k.getDefaults(),k.Parser=h,k.parser=h.parse,k.Renderer=r,k.TextRenderer=s,k.Lexer=a,k.lexer=a.lex,k.InlineLexer=p,k.inlineLexer=p.output,k.Slugger=t,k.parse=k,"undefined"!=typeof module&&"object"==typeof exports?module.exports=k:"function"==typeof define&&define.amd?define(function(){return k}):e.marked=k}(this||("undefined"!=typeof window?window:global)); \ No newline at end of file diff --git a/public/editormd/lib/marked.min.js b/public/editormd/lib/marked.min.js index 1ba27d2f4..519296797 100644 --- a/public/editormd/lib/marked.min.js +++ b/public/editormd/lib/marked.min.js @@ -1,18 +1,13 @@ -/** +/** + * marked v0.3.3 - a markdown parser + * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + 备注,这个改动没启用,只是做个记录: br不转成br 加了个 if (cap[0] != '
    ' && cap[0] != '
    ') { out+=this.options.sanitize?escape(cap[0]):cap[0]; } */ -/** - * marked - a markdown parser - * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed) - * https://github.com/markedjs/marked - 2019 08 29 - - case"html":return this.renderer.html((this.token.text)); - --> - case"html":return this.renderer.paragraph(this.inline.output(this.token.text)); - - add: && !(e instanceof String) - */ -!function(e){"use strict";var x={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:g,table:g,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||k.defaults,this.rules=x.normal,this.options.pedantic?this.rules=x.pedantic:this.options.gfm&&(this.rules=x.gfm)}x._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,x._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,x.def=i(x.def).replace("label",x._label).replace("title",x._title).getRegex(),x.bullet=/(?:[*+-]|\d{1,9}\.)/,x.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,x.item=i(x.item,"gm").replace(/bull/g,x.bullet).getRegex(),x.list=i(x.list).replace(/bull/g,x.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+x.def.source+")").getRegex(),x._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",x._comment=//,x.html=i(x.html,"i").replace("comment",x._comment).replace("tag",x._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x.paragraph=i(x._paragraph).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} +").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",x._tag).getRegex(),x.blockquote=i(x.blockquote).replace("paragraph",x.paragraph).getRegex(),x.normal=f({},x),x.gfm=f({},x.normal,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),x.pedantic=f({},x.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",x._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:g,paragraph:i(x.normal._paragraph).replace("hr",x.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",x.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),a.rules=x,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,k;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1 ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\*])\*(?!\*|[^\spunctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:g,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~",n.em=i(n.em).replace(/punctuation/g,n._punctuation).getRegex(),n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=i(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=i(n.tag).replace("comment",x._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,n._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=i(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=i(n.reflink).replace("label",n._label).getRegex(),n.normal=f({},n),n.pedantic=f({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=f({},n.normal,{escape:i(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):_(i[0]):i[0];else if(i=this.rules.link.exec(e)){var a=d(i[2],"()");if(-1$/,"$1"),o+=this.outputLink(i,{href:p.escapes(r),title:p.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(_(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=_(this.mangle(i[1]))):n=_(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):_(i[0]):i[0]):o+=this.renderer.text(_(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=_(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=_(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},p.escapes=function(e){return e?e.replace(p.rules._escapes,"$1"):e},p.prototype.outputLink=function(e,t){var n=t.href,r=t.title?_(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,_(e[1]))},p.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},p.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s'+(n?e:_(e,!0))+"\n":"
    "+(n?e:_(e,!0))+"
    "},r.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.checkbox=function(e){return" "},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='
    "},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r=''+n+'":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},h.parse=function(e,t){return new h(t).parse(e)},h.prototype.parse=function(e){this.inline=new p(e.links,this.options),this.inlineText=new p(e.links,f({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},h.prototype.next=function(){return this.token=this.tokens.pop(),this.token},h.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},h.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},h.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},_.escapeTest=/[&<>"']/,_.escapeReplace=/[&<>"']/g,_.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},_.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,_.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var o={},u=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(){}function f(e){for(var t,n,r=1;rt)n.splice(t);else for(;n.lengthAn error occurred:

    "+_(e.message+"",!0)+"
    ";throw e}}g.exec=g,k.options=k.setOptions=function(e){return f(k.defaults,e),k},k.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}},k.defaults=k.getDefaults(),k.Parser=h,k.parser=h.parse,k.Renderer=r,k.TextRenderer=s,k.Lexer=a,k.lexer=a.lex,k.InlineLexer=p,k.inlineLexer=p.output,k.Slugger=t,k.parse=k,"undefined"!=typeof module&&"object"==typeof exports?module.exports=k:"function"==typeof define&&define.amd?define(function(){return k}):e.marked=k}(this||("undefined"!=typeof window?window:global)); \ No newline at end of file +(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose){loose=next}}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq); +this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if((!bq&&top)&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else{if(this.options.pedantic){this.rules=inline.pedantic}}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^
    /i.test(cap[0])){this.inLink=false}}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue +}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants){return text}return text.replace(/--/g,"\u2014").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201c").replace(/"/g,"\u201d").replace(/\.{3}/g,"\u2026")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i0.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
    "+(escaped?code:escape(code,true))+"\n
    "}return'
    '+(escaped?code:escape(code,true))+"\n
    \n"};Renderer.prototype.blockquote=function(quote){return"
    \n"+quote+"
    \n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon"){return":"}if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name){return new RegExp(regex,opt)}val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else{if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file diff --git a/public/react/src/App.css b/public/react/src/App.css index 2b3d8d08c..42e40f8c8 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -55,6 +55,9 @@ html, body { .markdown-body p { white-space: pre-wrap; } +.markdown-body > p { + line-height: 25px; +} /* https://www.educoder.net/courses/2346/group_homeworks/34405/question */ .renderAsHtml.markdown-body p { white-space: inherit; diff --git a/public/react/src/App.js b/public/react/src/App.js index b40af3e0b..0db6c5b1a 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -222,6 +222,12 @@ const InfosIndex = Loadable({ loader: () => import('./modules/user/usersInfo/InfosIndex'), loading: Loading, }) +// 题库 +const BanksIndex = Loadable({ + loader: () => import('./modules/user/usersInfo/banks/BanksIndex'), + loading: Loading, +}) + // 教学案例 const MoopCases = Loadable({ @@ -365,6 +371,13 @@ class App extends Component { } }> + { + return () + } + }> + diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 1565f5abb..8d9d3aa44 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -493,7 +493,8 @@ class Fileslists extends Component{ let selectpagetype=selectpage===page?true:false this.setState({ page:page, - checkAllValue:selectpagetype + checkAllValue:selectpagetype, + checkBoxValues:[] }) let{pagesize,tagname,searchValue,sort,sorttype,coursesecondcategoryid}=this.state; @@ -801,7 +802,7 @@ class Fileslists extends Component{ {this.props.isAdmin()? files===undefined?'' :files.length===0? "":
    - {this.props.isAdmin()? 已选 {checkBoxValues.length} 个:""} + {this.props.isAdmin()? 已选 {checkBoxValues.length} 个 (不支持跨页勾选):""}
    {this.props.isAdmin()?
  • 删除
  • :""} {this.props.isAdmin()?
  • 发送
  • :""} diff --git a/public/react/src/modules/courses/boards/index.js b/public/react/src/modules/courses/boards/index.js index 60d327799..dbb6dea1c 100644 --- a/public/react/src/modules/courses/boards/index.js +++ b/public/react/src/modules/courses/boards/index.js @@ -283,6 +283,9 @@ class Boards extends Component{ console.log('checked = ', checkedValues); } onPageChange = (pageNumber) => { + this.setState({ + checkBoxValues:[] + }) this.fetchAll(null, pageNumber) } @@ -365,7 +368,7 @@ class Boards extends Component{ {messages&&messages.length == 0?"": isAdmin &&
    - {isAdmin&&已选 {checkBoxValues.length} 个} + {isAdmin&&已选 {checkBoxValues.length} 个 (不支持跨页勾选)}
    { !!isAdmin && diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 525e13922..09b029044 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -3,11 +3,11 @@ 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 TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; +import { WordsBtn, getUrl, ConditionToolTip } from 'educoder' + import CBreadcrumb from '../common/CBreadcrumb' +import NewWorkForm from './NewWorkForm' -const confirm = Modal.confirm; const $ = window.$ const MAX_TITLE_LENGTH = 60; class NewWork extends Component{ @@ -17,15 +17,6 @@ class NewWork extends Component{ this.answerMdRef = React.createRef(); this.state={ - title_value:"", - title_num: 0, - contentFileList: [], - answerFileList: [], - workLoaded: false, - base_on_project: true, - category: {}, - min_num: 2, - max_num: 10, } } componentDidMount () { @@ -50,7 +41,6 @@ class NewWork extends Component{ course_id: data.course_id, course_name: data.course_name, category: data.category, - }) } }) @@ -65,129 +55,26 @@ class NewWork extends Component{ .then((response) => { if (response.data.name) { const data = response.data; - - const contentFileList = data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - status: 'done' - } - }) - const answerFileList = data.ref_attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - status: 'done' - } - }) - - this.setState({ - ...data, - // course_id: data.course_id, - // course_name: data.course_name, - // category: data.category, - title_num: parseInt(data.name.length), - workLoaded: true, - init_min_num: data.min_num, - init_max_num: data.max_num, - // description: data.description, - reference_answer: data.reference_answer, - contentFileList, - answerFileList, - }, () => { - setTimeout(() => { - this.contentMdRef.current.setValue(data.description || '') - this.answerMdRef.current.setValue(data.reference_answer || '') - - }, 2000) - - this.props.form.setFieldsValue({ - title: data.name, - description: data.description || '', - reference_answer: data.reference_answer || '', - }); - + data.isEdit = true; + this.setState({ + category: data.category, + course_id: data.course_id, + course_name: data.course_name, }) - + this.newWorkFormRef.initValue(data); } }) .catch(function (error) { console.log(error); }); } - - // 输入title - changeTitle=(e)=>{ - console.log(e.target.value.length); - this.setState({ - title_num: parseInt(e.target.value.length) - }) - } - handleSubmit = () => { - const courseId = this.state.course_id || this.props.match.params.coursesId ; - - this.props.form.validateFieldsAndScroll((err, values) => { - console.log(values) - const mdContnet = this.contentMdRef.current.getValue().trim(); - console.log(mdContnet) - values.description = mdContnet; - // return; - - {/* max={has_commit ? init_min_num : null } */} - {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} - // 已有提交作品,人数范围只能扩大 - const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state; - if (has_commit) { - if (max_num < init_max_num || min_num > init_min_num) { - this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) - return; - } - } - - // const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet - if (!err) { - if (this.isEdit) { - this.doEdit(courseId, values) - } else { - this.doNew(courseId, values) - } - - } else { - $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) - } - }) - } - doEdit = (courseId, values) => { + + doEdit = (params) => { const workId = this.props.match.params.workId const newUrl = `/homework_commons/${workId}.json` - let attachment_ids = this.state.contentFileList.map(item => { - return item.response ? item.response.id : item.id - }) - let reference_attachment_ids = this.state.answerFileList.map(item => { - return item.response ? item.response.id : item.id - }) - - const { min_num, max_num, base_on_project, category } = this.state const isGroup = this.props.isGroup() - axios.put(newUrl, { - type: isGroup ? 3 : 1, - name: values.title, - description: values.description, - reference_answer: values.reference_answer, - attachment_ids, - reference_attachment_ids, - - min_num, - max_num, - base_on_project - }) + axios.put(newUrl, params) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -198,30 +85,11 @@ class NewWork extends Component{ console.log(error); }); } - doNew = (courseId, values) => { + doNew = (params) => { + const courseId = this.props.match.params.coursesId ; const newUrl = `/courses/${courseId}/homework_commons.json` - let attachment_ids = this.state.contentFileList.map(item => { - return item.response ? item.response.id : item.id - }) - let reference_attachment_ids = this.state.answerFileList.map(item => { - return item.response ? item.response.id : item.id - }) - const isGroup = this.props.isGroup() - const { min_num, max_num, base_on_project, category } = this.state - - axios.post(newUrl, { - type: isGroup ? 3 : 1, - name: values.title, - description: values.description, - reference_answer: values.reference_answer, - attachment_ids, - reference_attachment_ids, - - min_num, - max_num, - base_on_project - }) + axios.post(newUrl, params) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -232,144 +100,26 @@ class NewWork extends Component{ console.log(error); }); } - - handleContentUploadChange = (info) => { - let contentFileList = info.fileList; - this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) }); - } - handleAnswerUploadChange = (info) => { - let answerFileList = info.fileList; - this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) }); - } - onAttachmentRemove = (file, stateName) => { - this.props.confirm({ - content: '是否确认删除?', - - onOk: () => { - this.deleteAttachment(file, stateName) - }, - onCancel() { - console.log('Cancel'); - }, - }); - - - return false; - } - deleteAttachment = (file, stateName) => { - // 初次上传不能直接取uid - const url = `/attachments/${file.response ? file.response.id : file.uid}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state[stateName].indexOf(file); - const newFileList = state[stateName].slice(); - newFileList.splice(index, 1); - return { - [stateName]: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - max_num_change = (val) => { - if (val < 2) { - this.setState({ - max_num: 2, - }) - return; - } - const { min_num } = this.state; - this.setState({ - max_num: val, - min_num: val <= min_num ? val - 1 : min_num - }) - } - min_num_change = (val) => { - this.setState({ min_num: val }) - } - base_on_project_change = () => { - this.setState({ base_on_project: !this.state.base_on_project }) - } render(){ let {typeId,coursesId,pageType}=this.props.match.params; - const { getFieldDecorator } = this.props.form; + const isGroup = this.props.isGroup() const moduleName = !isGroup? "普通作业":"分组作业"; const moduleEngName = this.props.getModuleName() let{ - title_value, contentFileList, answerFileList, max_num, min_num, base_on_project, - init_max_num, init_min_num, - title_num, course_name, category, has_commit, has_project + category }=this.state const { current_user } = this.props - const courseId = this.state.course_id || this.props.match.params.coursesId ; + const courseId = this.props.match.params.coursesId ; const isEdit = this.isEdit; - if ((isEdit == undefined || isEdit) && !this.state.workLoaded) { - return '' - } - const uploadProps = { - width: 600, - fileList: contentFileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, - onChange: this.handleContentUploadChange, - onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - message.error('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - const answerUploadProps = { - width: 600, - fileList: answerFileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, - onChange: this.handleAnswerUploadChange, - onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'), - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - message.error('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - + return(
    - {/*

    - {course_name} - > - {typeId==1 ?"普通作业":"分组作业"} - > - {pageType==="new"?"新建":"编辑"} -

    */} +

    - {/* onSubmit={this.handleSubmit} */} - -
    - - {getFieldDecorator('title', { - rules: [{ - required: true, message: '请输入标题' - }], - })( - - )} - - - - - { - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入作业内容和要求' - }], - })( - - )} - } - - - (单个文件150M以内) - - - - { isGroup && - - {getFieldDecorator('personNum', { - rules: [{ - required: false - // required: true, message: '请输入最小人数和最大人数' - }], - })( -
    -

    - - {/* max={has_commit ? init_min_num : null } */} - - - - ~ - {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} - - - - -

    -

    - - 基于项目实施 - - - -

    -
    - )} -
    - } - - {getFieldDecorator('reference_answer', { - rules: [{ - required: false - }], - })( - - )} - - - (单个文件150M以内) - - - - - - + {this.newWorkFormRef = ref}} + {...this.props} + onSave={this.onSave} + doNew={this.doNew} + doEdit={this.doEdit} + >
    ) } } -const WrappedBoardsNew = Form.create({ name: 'NewWork' })(NewWork); -export default WrappedBoardsNew; \ No newline at end of file +export default NewWork; \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js new file mode 100644 index 000000000..c4f6c4eed --- /dev/null +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -0,0 +1,466 @@ +import React,{ Component } from "react"; +import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Modal } from "antd"; +import axios from 'axios' +import '../css/busyWork.css' +import '../css/Courses.css' +import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder' +import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; +import CBreadcrumb from '../common/CBreadcrumb' + +const confirm = Modal.confirm; +const $ = window.$ +const MAX_TITLE_LENGTH = 60; +class NewWorkForm extends Component{ + constructor(props){ + super(props); + this.contentMdRef = React.createRef(); + this.answerMdRef = React.createRef(); + + this.state={ + title_value:"", + title_num: 0, + contentFileList: [], + answerFileList: [], + workLoaded: false, + base_on_project: true, + category: {}, + min_num: 2, + max_num: 10, + } + } + initValue = (data) => { + if (data.isEdit) { + const contentFileList = data.attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done' + } + }) + const answerFileList = data.ref_attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done' + } + }) + + this.setState({ + ...data, + // course_id: data.course_id, + // course_name: data.course_name, + // category: data.category, + title_num: parseInt(data.name.length), + workLoaded: true, + init_min_num: data.min_num, + init_max_num: data.max_num, + // description: data.description, + reference_answer: data.reference_answer, + contentFileList, + answerFileList, + }, () => { + setTimeout(() => { + this.contentMdRef.current.setValue(data.description || '') + this.answerMdRef.current.setValue(data.reference_answer || '') + + }, 2000) + + this.props.form.setFieldsValue({ + title: data.name, + description: data.description || '', + reference_answer: data.reference_answer || '', + }); + + }) + } else { // new + + } + } + + + // 输入title + changeTitle=(e)=>{ + console.log(e.target.value.length); + this.setState({ + title_num: parseInt(e.target.value.length) + }) + } + handleSubmit = () => { + const courseId = this.state.course_id || this.props.match.params.coursesId ; + + this.props.form.validateFieldsAndScroll((err, values) => { + console.log(values) + const mdContnet = this.contentMdRef.current.getValue().trim(); + console.log(mdContnet) + values.description = mdContnet; + // return; + + {/* max={has_commit ? init_min_num : null } */} + {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} + // 已有提交作品,人数范围只能扩大 + const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state; + if (has_commit) { + if (max_num < init_max_num || min_num > init_min_num) { + this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) + return; + } + } + + // const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet + if (!err) { + if (this.state.isEdit) { + this.doEdit(courseId, values) + } else { + this.doNew(courseId, values) + } + + } else { + $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) + } + }) + } + doEdit = (courseId, values) => { + let attachment_ids = this.state.contentFileList.map(item => { + return item.response ? item.response.id : item.id + }) + let reference_attachment_ids = this.state.answerFileList.map(item => { + return item.response ? item.response.id : item.id + }) + + const { min_num, max_num, base_on_project, category } = this.state + const isGroup = this.props.isGroup() + + const params = { + type: isGroup ? 3 : 1, + name: values.title, + description: values.description, + reference_answer: values.reference_answer, + attachment_ids, + reference_attachment_ids, + + min_num, + max_num, + base_on_project + } + this.props.doEdit && this.props.doEdit(params) + } + doNew = (courseId, values) => { + let attachment_ids = this.state.contentFileList.map(item => { + return item.response ? item.response.id : item.id + }) + let reference_attachment_ids = this.state.answerFileList.map(item => { + return item.response ? item.response.id : item.id + }) + const isGroup = this.props.isGroup() + const { min_num, max_num, base_on_project, category } = this.state + + const params = { + type: isGroup ? 3 : 1, + name: values.title, + description: values.description, + reference_answer: values.reference_answer, + attachment_ids, + reference_attachment_ids, + + min_num, + max_num, + base_on_project + } + this.props.doNew && this.props.doNew(params) + + } + + handleContentUploadChange = (info) => { + let contentFileList = info.fileList; + this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) }); + } + handleAnswerUploadChange = (info) => { + let answerFileList = info.fileList; + this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) }); + } + + onAttachmentRemove = (file, stateName) => { + this.props.confirm({ + content: '是否确认删除?', + + onOk: () => { + this.deleteAttachment(file, stateName) + }, + onCancel() { + console.log('Cancel'); + }, + }); + + + return false; + } + deleteAttachment = (file, stateName) => { + // 初次上传不能直接取uid + const url = `/attachments/${file.response ? file.response.id : file.uid}.json` + axios.delete(url, { + }) + .then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { + console.log('--- success') + + this.setState((state) => { + const index = state[stateName].indexOf(file); + const newFileList = state[stateName].slice(); + newFileList.splice(index, 1); + return { + [stateName]: newFileList, + }; + }); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + max_num_change = (val) => { + if (val < 2) { + this.setState({ + max_num: 2, + }) + return; + } + const { min_num } = this.state; + this.setState({ + max_num: val, + min_num: val <= min_num ? val - 1 : min_num + }) + } + min_num_change = (val) => { + this.setState({ min_num: val }) + } + base_on_project_change = () => { + this.setState({ base_on_project: !this.state.base_on_project }) + } + + render(){ + let {typeId,coursesId,pageType}=this.props.match.params; + const { getFieldDecorator } = this.props.form; + const isGroup = this.props.isGroup() + const moduleName = !isGroup? "普通作业":"分组作业"; + const moduleEngName = this.props.getModuleName() + let{ + title_value, contentFileList, answerFileList, max_num, min_num, base_on_project, + init_max_num, init_min_num, + title_num, course_name, category, has_commit, has_project, + + isEdit + }=this.state + const { current_user } = this.props + + const courseId = this.state.course_id || this.props.match.params.coursesId ; + + if ((isEdit) && !this.state.workLoaded) { + return '' + } + const uploadProps = { + width: 600, + fileList: contentFileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + onChange: this.handleContentUploadChange, + onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), + beforeUpload: (file) => { + console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; + if (!isLt150M) { + message.error('文件大小必须小于150MB!'); + } + return isLt150M; + }, + }; + const answerUploadProps = { + width: 600, + fileList: answerFileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + onChange: this.handleAnswerUploadChange, + onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'), + beforeUpload: (file) => { + console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; + if (!isLt150M) { + message.error('文件大小必须小于150MB!'); + } + return isLt150M; + }, + }; + + return( + + + +
    + + {getFieldDecorator('title', { + rules: [{ + required: true, message: '请输入标题' + }], + })( + + )} + + + + + { + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请输入作业内容和要求' + }], + })( + + )} + } + + + (单个文件150M以内) + + + + { isGroup && + + {getFieldDecorator('personNum', { + rules: [{ + required: false + // required: true, message: '请输入最小人数和最大人数' + }], + })( +
    +

    + + {/* max={has_commit ? init_min_num : null } */} + + + + ~ + {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} + + + + +

    +

    + + 基于项目实施 + + + +

    +
    + )} +
    + } + + {getFieldDecorator('reference_answer', { + rules: [{ + required: false + }], + })( + + )} + + + (单个文件150M以内) + + + +
    + + + +
    + ) + } +} +const WrappedWorkForm = Form.create({ name: 'NewWorkForm' })(NewWorkForm); +export default WrappedWorkForm; \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index d5ac0be68..9f98b9294 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -153,7 +153,8 @@ class commonWork extends Component{ onPageChange=(pageNumber)=>{ this.setState({ - page:pageNumber + page:pageNumber, + checkBoxValues:[] }) let {search,order}=this.state; this.getList(pageNumber,search,order); @@ -430,7 +431,7 @@ class commonWork extends Component{ mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
    - 已选 {checkBoxValues.length} 个 + 已选 {checkBoxValues.length} 个 (不支持跨页勾选)
  • -

    本实训的开启时间:{shixunsmessage}
    开启时间之前不能挑战 -

    +

    目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!

    {/*取消*/} diff --git a/public/react/src/modules/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index 57f567c9e..4f37ac816 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -1566,7 +1566,7 @@ samp { padding-left: 5px; } .padding10200{ - padding: 10px 20px 0px; + padding: 10px 20px; } .padding1020{ padding: 10px 20px 10px; diff --git a/public/react/src/modules/courses/elearning/Elearning.js b/public/react/src/modules/courses/elearning/Elearning.js index e4ae3fe94..21d430a2f 100644 --- a/public/react/src/modules/courses/elearning/Elearning.js +++ b/public/react/src/modules/courses/elearning/Elearning.js @@ -293,7 +293,7 @@ class Elearning extends Component{ footer={null} >
    -

    本实训的开启时间:{this.state.shixunsmessages}
    开启时间之前不能挑战

    +

    目前该实训项目尚在内测中,将于{this.state.shixunsmessages}之后开放,谢谢!

    {/*取消*/} diff --git a/public/react/src/modules/courses/elearning/YslDetailCards.js b/public/react/src/modules/courses/elearning/YslDetailCards.js index a1ad44e67..eef44346e 100644 --- a/public/react/src/modules/courses/elearning/YslDetailCards.js +++ b/public/react/src/modules/courses/elearning/YslDetailCards.js @@ -141,7 +141,7 @@ class YslDetailCards extends Component{ footer={null} >
    -

    本实训的开启时间:{this.state.shixunsmessage}
    开启时间之前不能挑战

    +

    目前该实训项目尚在内测中,将于{this.state.shixunsmessage}之后开放,谢谢!

    {/*取消*/} diff --git a/public/react/src/modules/courses/exercise/Exercise.js b/public/react/src/modules/courses/exercise/Exercise.js index 83227fb5a..2bc646fb3 100644 --- a/public/react/src/modules/courses/exercise/Exercise.js +++ b/public/react/src/modules/courses/exercise/Exercise.js @@ -130,7 +130,8 @@ class Exercise extends Component{ //切换分页 changePage=(pageNumber)=>{ this.setState({ - page:pageNumber + page:pageNumber, + checkBoxValues:[] }) let{type,StudentList_value,limit}=this.state this.InitList(type,StudentList_value,pageNumber,limit); @@ -522,7 +523,7 @@ class Exercise extends Component{ {this.props.isAdmin()?exercises && exercises.length ===0?"":
    - 已选 {checkBoxValues.length} 个 + 已选 {checkBoxValues.length} 个 (不支持跨页勾选)
  • this.ActionPoll("delete")}>删除
  • diff --git a/public/react/src/modules/courses/exercise/question/fillEmpty.js b/public/react/src/modules/courses/exercise/question/fillEmpty.js index 24ff7b641..737fef682 100644 --- a/public/react/src/modules/courses/exercise/question/fillEmpty.js +++ b/public/react/src/modules/courses/exercise/question/fillEmpty.js @@ -129,7 +129,7 @@ class fillEmpty extends Component{ } { // 答案公开,且试卷已经截止 - isAdmin && + questionType.standard_answer &&

    参考答案:

    { questionType.standard_answer && questionType.standard_answer.map((item,k)=>{ diff --git a/public/react/src/modules/courses/exercise/question/simpleAnswer.js b/public/react/src/modules/courses/exercise/question/simpleAnswer.js index 527044968..1dfcbdb2a 100644 --- a/public/react/src/modules/courses/exercise/question/simpleAnswer.js +++ b/public/react/src/modules/courses/exercise/question/simpleAnswer.js @@ -85,9 +85,9 @@ class simpleAnswer extends Component{
    } { - isStudent && exercise.answer_open==true && exercise.exercise_status == 3 ? + isStudent && questionType.standard_answer ?
    -

    参考答案:

    +

    参考答案:

    {/*
  • */}
    - 已选 {checkBoxValues.length} 个 + 已选 {checkBoxValues.length} 个 (不支持跨页勾选)
  • 删除
  • diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js index 329cd169b..02fc5018e 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js @@ -1,28 +1,19 @@ import React,{ Component } from "react"; -import { - Form, Input, InputNumber, Switch, Radio, - Slider, Button, Upload, Icon, Rate, Checkbox, message, - Row, Col, Select, Modal,Cascader -} from 'antd'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; +import { Select, Modal } from 'antd'; + import axios from 'axios' -import {getUrl} from 'educoder'; + import "../../common/formCommon.css" import '../style.css' import '../../css/Courses.css' -import { WordsBtn, City } from 'educoder' +import { WordsBtn } from 'educoder' import {Link} from 'react-router-dom' -// import City from './City' -// import './board.css' -// import { RouteHOC } from './common.js' +import GraduateTopicNewFrom from './GraduateTopicNewFrom' -const confirm = Modal.confirm; const $ = window.$ -const { Option } = Select; -const NAME_COUNT=60; // 新建毕设选题 // https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c class GraduateTopicNew extends Component{ @@ -33,14 +24,12 @@ class GraduateTopicNew extends Component{ this.state = { fileList: [], - boards: [], teacherList:[], topic_property_first:[], topic_property_second:[], topic_repeat:[], topic_source:[], topic_type:[], - attachments:undefined, addonAfter:0, left_banner_id:undefined, course_name:undefined @@ -53,21 +42,11 @@ class GraduateTopicNew extends Component{ axios.get((url)).then((result)=>{ if(result.status==200){ this.setState({ - teacherList:result.data.teacher_list, left_banner_id:result.data.left_banner_id, course_name:result.data.course_name, - left_banner_name:result.data.left_banner_name, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type - }) - console.log("sdfds"); - console.log(this.props.current_user && this.props.current_user.user_id); - this.props.form.setFieldsValue({ - tea_id:this.props.current_user && this.props.current_user.user_id + left_banner_name:result.data.left_banner_name }) + this.GraduateTopicNewFromRef.initNewInfo(result); } }).catch((error)=>{ console.log(error); @@ -87,236 +66,91 @@ class GraduateTopicNew extends Component{ //编辑,信息显示 getEditInfo=()=>{ const cid = this.props.match.params.coursesId - let topicId=this.props.match.params.topicId - let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`; - axios.get((url)).then((result)=>{ - if(result){ - this.setState({ - left_banner_id:result.data.left_banner_id, - course_name:result.data.course_name, - left_banner_name:result.data.left_banner_name, - teacherList:result.data.teacher_list, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type, - attachments:result.data.attachments, - addonAfter:parseInt(result.data.selected_data.name.length) - }) - this.props.form.setFieldsValue({ - tea_id:result.data.selected_data.tea_id, - name:result.data.selected_data.name, - city: [result.data.selected_data.province,result.data.selected_data.city], - topic_type:result.data.selected_data.topic_type || undefined, - topic_source:result.data.selected_data.topic_source || undefined, - topic_property_first:result.data.selected_data.topic_property_first || undefined, - topic_property_second:result.data.selected_data.topic_property_second || undefined, - source_unit:result.data.selected_data.source_unit, - topic_repeat:result.data.selected_data.topic_repeat || undefined - }); - this.mdRef.current.setValue(result.data.selected_data.description) - const _fileList = result.data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: item.title, - url: item.url, - status: 'done' - } - }) - this.setState({ fileList: _fileList, cityDefaultValue: [result.data.selected_data.province,result.data.selected_data.city] }) - } - }).catch((error)=>{ - console.log(error); - }) + let topicId=this.props.match.params.topicId; + if(topicId){ + let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`; + axios.get((url)).then((result)=>{ + if(result){ + this.setState({ + left_banner_id:result.data.left_banner_id, + course_name:result.data.course_name, + left_banner_name:result.data.left_banner_name + }) + this.GraduateTopicNewFromRef.initValue(result); + + } + }).catch((error)=>{ + console.log(error); + }) + } } - handleSubmit = (e) => { - e.preventDefault(); + // 编辑保存 + editSave = (param,attachments,topicId) =>{ const cid = this.props.match.params.coursesId - const topicId = this.props.match.params.topicId - // console.log(this.props); - - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - console.log('Received values of form: ', values); - if (topicId !=undefined) { - const editTopic = this.editTopic - const editUrl = `/courses/${cid}/graduation_topics/${topicId}.json` - - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - } - axios.put(editUrl, { - graduation_topic:{ - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - }, - attachment_ids - }).then((response) => { - if (response.status == 200) { - const { id } = response.data; - if (id) { - this.props.showNotification('保存成功!'); - this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); - } - } - }).catch(function (error) { - console.log(error); - }); - } else { - const url = `/courses/${cid}/graduation_topics.json` - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response.id - }) - } - - axios.post(url, { - graduation_topic:{ - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - }, - attachment_ids, - }).then((response) => { - if (response.data) { - const { id } = response.data; - if (id) { - this.props.showNotification('提交成功!'); - this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); - } - } - }) - .catch(function (error) { - console.log(error); - }); + const editUrl = `/courses/${cid}/graduation_topics/${topicId}.json` + let params = { + graduation_topic:param, + attachment_ids:attachments + } + axios.put(editUrl, params).then((response) => { + if (response.status == 200) { + const { id } = response.data; + if (id) { + this.props.showNotification('保存成功!'); + this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); } - } else { - $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) } + }).catch(function (error) { + console.log(error); }); } - // 选择省市 - ChangeCity=(value, selectedOptions)=>{ - console.log(selectedOptions); - } - - // 附件相关 START - handleChange = (info) => { - let fileList = info.fileList; - this.setState({ fileList }); - } - onAttachmentRemove = (file) => { - confirm({ - title: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, + // 新建提交 + newSubmit = (param,attachments,topicId) =>{ + const cid = this.props.match.params.coursesId + const url = `/courses/${cid}/graduation_topics.json` + let params = { + graduation_topic:param, + attachment_ids:attachments + } + axios.post(url, params).then((response) => { + if (response.data) { + const { id } = response.data; + if (id) { + this.props.showNotification('提交成功!'); + this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); + } + } + }).catch(function (error) { + console.log(error); }); - return false; } - deleteAttachment = (file) => { - console.log(file); - 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 (status == 0) { - console.log('--- success') - - 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); - }); + // 取消编辑或者新建 + editCancel = () =>{ + const cid = this.props.match.params.coursesId; + let topicId=this.props.match.params.topicId; + if(topicId){ + this.props.history.push(`/courses/${cid}/graduation_topics/${topicId}/detail`); + }else{ + this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); + } } - // 附件相关 ------------ END - - changeTopicName=(e)=>{ - // let num= 60 - parseInt(e.target.value.length); - this.setState({ - addonAfter:e.target.value.length - }) - } + render() { let { - fileList, - teacherList, - topic_property_first, - topic_property_second, - topic_repeat, - topic_source, - topic_type, - addonAfter, left_banner_id, course_name, left_banner_name } = this.state; const { current_user } = this.props - const { getFieldDecorator } = this.props.form; let{ topicId,coursesId }=this.props.match.params - // console.log(this.props); - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - // sm: { span: 8 }, - sm: { span: 24 }, - }, - wrapperCol: { - xs: { span: 24 }, - // sm: { span: 16 }, - sm: { span: 24 }, - }, - }; - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - message.error('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - // console.log("dfsf"); - // console.log(this.props); + const common={ + editSave:this.editSave, + newSubmit:this.newSubmit, + editCancel:this.editCancel + } return(
    - - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '最大限制为60个字符', - }], - })( - - )} - -
    - - - -
    - - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入选题简介', - }, { - max: 10000, message: '最大限制为10000个字符', - }], - })( - - )} - - - { - getFieldDecorator('file',{ - rules:[{ - required:false - }] - })( - - - (单个文件150M以内) - - ) - } - -
    - - {getFieldDecorator('topic_type', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_source', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_first', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_second', { - rules: [{ - required: false, message: '', - }], - })( - - )} - -
    -
    - - - - - -
    - - {getFieldDecorator('source_unit', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_repeat', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('city', { - rules: [{ - initialValue: this.state.cityDefaultValue, - type: 'array', - required: false, message: '', - }], - })( - - )} - -
    - - -
    - - this.props.history.goBack()}>取消 -
    -
    - + this.GraduateTopicNewFromRef = ref} + topicId={topicId} + teacherName={true} + > +
    ) } } -const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew); +// const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew); // RouteHOC() -export default (WrappedGraduateTopicNew); \ No newline at end of file +export default GraduateTopicNew; \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js new file mode 100644 index 000000000..24336c356 --- /dev/null +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js @@ -0,0 +1,519 @@ +import React,{ Component } from "react"; + +import { + Form, Input, Button, Upload, Icon , message, Select +} from 'antd'; +import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; +import axios from 'axios' +import { City , getUploadActionUrl , appendFileSizeToUploadFileAll } from 'educoder'; + +const NAME_COUNT=60; +class GraduateTopicNewForm extends Component{ + constructor(props){ + super(props); + + this.mdRef = React.createRef(); + + this.state = { + fileList: [], + teacherList:[], + topic_property_first:[], + topic_property_second:[], + topic_repeat:[], + topic_source:[], + topic_type:[], + addonAfter:0, + cityDefaultValue:undefined + } + } + // init编辑信息 + initValue=(result)=>{ + this.setState({ + teacherList:result.data.teacher_list, + topic_property_first:result.data.topic_property_first, + topic_property_second:result.data.topic_property_second, + topic_repeat:result.data.topic_repeat, + topic_source:result.data.topic_source, + topic_type:result.data.topic_type, + addonAfter:parseInt(result.data.selected_data.name.length) + }) + this.props.form.setFieldsValue({ + tea_id:result.data.selected_data.tea_id, + name:result.data.selected_data.name, + city: [result.data.selected_data.province,result.data.selected_data.city], + topic_type:result.data.selected_data.topic_type || undefined, + topic_source:result.data.selected_data.topic_source || undefined, + topic_property_first:result.data.selected_data.topic_property_first || undefined, + topic_property_second:result.data.selected_data.topic_property_second || undefined, + source_unit:result.data.selected_data.source_unit, + topic_repeat:result.data.selected_data.topic_repeat || undefined + }); + this.mdRef.current.setValue(result.data.selected_data.description) + const _fileList = result.data.attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: item.title, + url: item.url, + status: 'done' + } + }) + this.setState({ fileList: _fileList, cityDefaultValue: [result.data.selected_data.province,result.data.selected_data.city] }) + } + //init新建信息 + initNewInfo=(result)=>{ + this.setState({ + teacherList:result.data.teacher_list, + topic_property_first:result.data.topic_property_first, + topic_property_second:result.data.topic_property_second, + topic_repeat:result.data.topic_repeat, + topic_source:result.data.topic_source, + topic_type:result.data.topic_type + }) + + this.props.form.setFieldsValue({ + tea_id:this.props.current_user && this.props.current_user.user_id + }) + } + + // 附件相关 START + handleChange = (info) => { + if (info.file.status === 'done' || info.file.status === 'uploading') { + let contentFileList = info.fileList; + // this.setState({ fileList: appendFileSizeToUploadFileAll(contentFileList)}); + // let list = appendFileSizeToUploadFileAll(contentFileList); + // let arr = list.map(item=>{ + // return ( item.response && item.response.id ) + // }) + this.setState({ + fileList:contentFileList + }); + } + } + onAttachmentRemove = (file) => { + this.props.confirm({ + content: '确定要删除这个附件吗?', + onOk: () => { + this.deleteAttachment(file) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } + deleteAttachment = (file) => { + console.log(file); + 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 (status == 0) { + console.log('--- success') + + 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); + }); + } + + changeTopicName=(e)=>{ + // let num= 60 - parseInt(e.target.value.length); + this.setState({ + addonAfter:e.target.value.length + }) + } + + + handleSubmit = (e) => { + e.preventDefault(); + const topicId = this.props.topicId + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + if (topicId !=undefined) { + // 编辑 + // const editTopic = this.editTopic + let attachment_ids = undefined + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + const param = { + ...values, + province: values.city==undefined?"":values.city[0], + city: values.city==undefined?"":values.city[1], + } + this.props.editSave && this.props.editSave(param,attachment_ids,topicId); + } else { + // 新建 + let attachment_ids = undefined + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response.id + }) + } + const param ={ + ...values, + province: values.city==undefined?"":values.city[0], + city: values.city==undefined?"":values.city[1], + } + this.props.newSubmit && this.props.newSubmit(param,attachment_ids,topicId); + } + } else { + $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) + } + }); + } + + // 附件相关 ------------ END + render(){ + let{ + fileList, + teacherList, + topic_property_first, + topic_property_second, + topic_repeat, + topic_source, + topic_type, + addonAfter, + cityDefaultValue + }=this.state; + const { getFieldDecorator } = this.props.form; + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + // sm: { span: 8 }, + sm: { span: 24 }, + }, + wrapperCol: { + xs: { span: 24 }, + // sm: { span: 16 }, + sm: { span: 24 }, + }, + }; + const uploadProps = { + width: 600, + fileList, + multiple: true, + action: `${getUploadActionUrl()}`, + onChange: this.handleChange, + onRemove: this.onAttachmentRemove, + beforeUpload: (file) => { + const isLt150M = file.size / 1024 / 1024 < 150; + if (!isLt150M) { + //message.error('文件大小必须小于150MB!'); + this.props.define({ + title:'提示', + content:"该文件无法上传。超过文件大小限制(150MB),建议上传到百度云等其它共享工具里,然后再txt文档里给出链接以及共享密码并上传" + }) + return isLt150M; + } + } + }; + let { topicId , teacherName }=this.props; + return( + +
    +
    + { + teacherName && + + {getFieldDecorator('tea_id', { + rules: [{ + required: true, message: '请选择指导老师' + }], + })( + + )} + + } + + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请输入选题名称', + }, { + max: 60, message: '最大限制为60个字符', + }], + })( + + )} + +
    + + + +
    + + + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请输入选题简介', + }, { + max: 10000, message: '最大限制为10000个字符', + }], + })( + // initValue={this.editTopic ? this.editTopic.content : ''} + + )} + + + { + getFieldDecorator('file',{ + rules:[{ + required:false + }] + })( + + + (单个文件150M以内) + + ) + } + +
    + + {getFieldDecorator('topic_type', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_source', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_property_first', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_property_second', { + rules: [{ + required: false, message: '', + }], + })( + + )} + +
    +
    + + + + + +
    + + {getFieldDecorator('source_unit', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_repeat', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('city', { + rules: [{ + initialValue: cityDefaultValue, + type: 'array', + required: false, message: '', + }], + })( + + )} + +
    + + +
    + + + + ) + } +} + +const WrappedGraduateTopicNewForm = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNewForm); +// RouteHOC() +export default (WrappedGraduateTopicNewForm); \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/topics/index.js b/public/react/src/modules/courses/graduation/topics/index.js index 61a9bea67..b5be57564 100644 --- a/public/react/src/modules/courses/graduation/topics/index.js +++ b/public/react/src/modules/courses/graduation/topics/index.js @@ -153,7 +153,8 @@ class Boards extends Component{ // 分页 onChangePage=(pageNum)=>{ this.setState({ - page:pageNum + page:pageNum, + checkBoxValues:[] }) let {status,searchValue}=this.state; this.fetchAll(searchValue,pageNum,status); @@ -430,7 +431,7 @@ onBoardsNew=()=>{ // 超级管理员、教师、助教 isAdmin ?
    - 已选 {checkBoxValues.length} 个 + 已选 {checkBoxValues.length} 个 (不支持跨页勾选)
  • this.onDelete(1)}>删除
  • { diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 8d8ba7b3f..096d19402 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -152,16 +152,16 @@ class studentsList extends Component{ } }else { this.props.showNotification(`正在下载中`); - // window.open("/api"+url, '_blank'); - downloadFile({ - url: url, - successCallback: (url) => { - console.log('successCallback') - }, - failCallback: (responseHtml, url) => { - console.log('failCallback') - } - }) + window.open("/api"+url, '_blank'); + // downloadFile({ + // url: url, + // successCallback: (url) => { + // console.log('successCallback') + // }, + // failCallback: (responseHtml, url) => { + // console.log('failCallback') + // } + // }) } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 7ff0a9e4c..c3096adeb 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -606,7 +606,7 @@ class CoursesNew extends Component { `} -
    +
    @@ -647,7 +633,7 @@ class CoursesNew extends Component { })( @@ -884,7 +870,7 @@ class CoursesNew extends Component { {optionschool} diff --git a/public/react/src/modules/courses/new/Goldsubject.js b/public/react/src/modules/courses/new/Goldsubject.js index c9642f458..8ef193947 100644 --- a/public/react/src/modules/courses/new/Goldsubject.js +++ b/public/react/src/modules/courses/new/Goldsubject.js @@ -794,18 +794,7 @@ class Goldsubject extends Component { width: 65px !important; background-color: #fafafa!important; } - - .yslzxueshis .ant-select-dropdown{ - width: 655px !important; - height:160px !important; - } - .yslzxueshis .ant-select-dropdown-menu{ - width: 655px !important; - } - .ant-select-dropdown{ - width: 655px !important; - height:160px !important; - } + ` } + +
    +
    + 温馨提示:选择的题将会发送到指定课堂 +
    +
    + +
    +
    + + { + courses && courses.map((item,key)=>{ + return( +
    + + {item.course_name} + +
    + ) + }) + } +
    + +
    + {showcheck===true?
    请先选择课堂
    :""} + +
    +
    +
    + ) + } + +} +export default SendTopics; \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index 780ed4071..eec340249 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -361,7 +361,7 @@ class DetailCards extends Component{ footer={null} >
    -

    本实训的开启时间:{this.state.shixunsmessage}
    开启时间之前不能挑战

    +

    目前该实训项目尚在内测中,将于{this.state.shixunsmessage}之后开放,谢谢!

    {/*取消*/} diff --git a/public/react/src/modules/projectPackages/packageconcnet.css b/public/react/src/modules/projectPackages/packageconcnet.css index f7ee4cc06..22dd4ebc8 100644 --- a/public/react/src/modules/projectPackages/packageconcnet.css +++ b/public/react/src/modules/projectPackages/packageconcnet.css @@ -295,11 +295,11 @@ .topsj{ position: absolute; - top: -6px; + top: -3px; } .bottomsj{ position: absolute; - bottom: -6px; + bottom: -5px; } .touchSelect .ant-spin-dot-spin{ margin-top: 30% !important; diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 948c42c50..fc9c53be1 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -731,8 +731,7 @@ class TPMBanner extends Component { footer={null} >
    -

    本实训的开启时间:{shixunsmessage}
    开启时间之前不能挑战 -

    +

    目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!

    {/*取消*/} diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 66054142a..ef94f7fa4 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -587,7 +587,7 @@ class Challenges extends Component { footer={null} >
    -

    本实训的开启时间:{shixunsmessage}
    开启时间之前不能挑战

    +

    目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!

    {/*取消*/} diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 242e25464..3a2632061 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -43,7 +43,10 @@ const InfosVideo = Loadable({ loader: () => import('./video/InfosVideo'), loading:Loading, }) - +const InfosTopics=Loadable({ + loader: () => import('./InfosTopics'), + loading:Loading, +}) const $ = window.$; class Infos extends Component{ @@ -258,13 +261,10 @@ class Infos extends Component{ {/* --------------------------------------------------------------------- */} - - - {/* 众包 */} - {/* http://localhost:3007/courses/1309/homework/9300/setting */} - () + (props) => () } > @@ -297,7 +297,15 @@ class Infos extends Component{ } > - {/* 项目 */} + {/* 众包 */} + {/* http://localhost:3007/courses/1309/homework/9300/setting */} + () + } + > + + {/* 视频 */} () @@ -305,6 +313,7 @@ class Infos extends Component{ > + () diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index 3aa329ec9..c28bff9db 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -27,6 +27,9 @@ class InfosBanner extends Component{ let {pathname}=this.props.location; moduleName=pathname.split("/")[3]; + let user_id=this.props.current_user&&this.props.current_user.user_id; + let user_type=this.props.current_user&&this.props.current_user.user_identity; + let targetuserid=this.props.data&&this.props.data.id; return(
    @@ -115,6 +118,13 @@ class InfosBanner extends Component{ to={`/users/${username}/videos`}>视频 } + {/*自己的主页且不是学生显示题库按钮*/} + { user_id===targetuserid&&user_type!="学生"?
  • + this.setState({moduleName: 'topics'})} + to={`/users/${username}/topics/personal`}>题库 +
  • :""} +
    diff --git a/public/react/src/modules/user/usersInfo/InfosTopics.js b/public/react/src/modules/user/usersInfo/InfosTopics.js new file mode 100644 index 000000000..cf2c1eaa0 --- /dev/null +++ b/public/react/src/modules/user/usersInfo/InfosTopics.js @@ -0,0 +1,489 @@ +import React, { Component } from 'react'; +import { SnackbarHOC } from 'educoder'; +import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom'; +import {Tooltip,Menu,Pagination,Spin, Dropdown,Checkbox} from 'antd'; +import axios from 'axios'; +import {getImageUrl,WordsBtn} from 'educoder'; +import moment from 'moment'; +import Modals from '../../modals/Modals'; +import SendTopics from '../../modals/SendTopics' +import NoneData from '../../courses/coursesPublic/NoneData'; +import "./usersInfo.css"; +import Withoutpermission from './Withoutpermission.png'; + + + +class InfosTopics extends Component{ + constructor(props){ + super(props); + this.state={ + isSpin:false, + category:"normal", + course_list_id:undefined, + sort_by:"updated_at", + sort_direction:"desc", + page:1, + data:undefined, + checkBoxValues:[], + per_page:15, + isshowprofes:false + } + } + + componentDidMount(){ + let types=this.props.match.params.topicstype; + let professional_certification=this.props.current_user&&this.props.current_user.professional_certification; + + console.log(professional_certification) + if(professional_certification===false&&types==="publicly"){ + this.setState({ + isshowprofes:true + }) + }else{ + this.updataslist() + } + } + updataslist=()=>{ + let types=this.props.match.params.topicstype; + let { category,course_list_id,sort_by,sort_direction,page}=this.state; + this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,page) + } + searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{ + let user_id=this.props.current_user&&this.props.current_user.user_id; + if(user_id!=undefined){ + let {per_page}=this.state; + let url=`/users/${user_id}/question_banks.json`; + axios.get(url,{params:{ + type, + category, + course_list_id, + sort_by, + sort_direction, + page, + per_page + } + }).then((response) => { + this.setState({ + data:response.data + }) + }).catch((error) => { + + }); + } + + } + + searchCategory=(type)=>{ + this.setState({ + category:type + }) + + let types=this.props.match.params.topicstype; + let { category,course_list_id,sort_by,sort_direction,page}=this.state; + this.searchAlldata(types,type,course_list_id,sort_by,sort_direction,page) + } + + searchCourselistid=(id)=>{ + this.setState({ + course_list_id:id + }) + + let types=this.props.match.params.topicstype; + let { category,course_list_id,sort_by,sort_direction,page}=this.state; + this.searchAlldata(types,category,id,sort_by,sort_direction,page) + } + + onCheckBoxChange=(checkedValues)=>{ + if(checkedValues.length>15){ + this.props.showNotification("选择条数不能大于15条") + }else{ + this.setState({ + checkBoxValues:checkedValues + }) + } + + } + + updatedlist=(updatedtype)=>{ + let types=this.props.match.params.topicstype; + let { category,course_list_id,sort_by,sort_direction,page}=this.state; + if(updatedtype===sort_by){ + if(sort_direction==="desc"){ + this.setState({ + sort_direction:"asc", + sort_by:updatedtype + }) + this.searchAlldata(types,category,course_list_id,updatedtype,"asc",page) + }else{ + this.setState({ + sort_direction:"desc", + sort_by:updatedtype + }) + this.searchAlldata(types,category,course_list_id,updatedtype,"desc",page) + } + }else{ + this.setState({ + sort_direction:"desc", + sort_by:updatedtype + }) + this.searchAlldata(types,category,course_list_id,updatedtype,"desc",page) + } + } + + + changePage=(pageNumber)=>{ + let types=this.props.match.params.topicstype; + let { category,course_list_id,sort_by,sort_direction,page}=this.state; + this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,pageNumber) + this.setState({ + page:pageNumber, + checkBoxValues:[] + }) + } + + deletecheckBoxValues=()=>{ + let {checkBoxValues}=this.state; + if(checkBoxValues.length===0){ + this.props.showNotification("请选择题库") + } + this.setState({ + Modalstype:true, + Modalstopval:"是否确认删除?", + ModalCancel:this.topicscancelmodel, + ModalSave:this.topicssavedelete, + }) + } + + topicssavedelete=()=>{ + let {checkBoxValues,category}=this.state; + const url = `/question_banks/multi_delete.json`; + axios.delete(url, { data: { + object_id: checkBoxValues, + object_type:category + }}) + .then((response) => { + if(response.data.status===0){ + this.updataslist() + this.props.showNotification(response.data.message) + }else{ + this.props.showNotification(response.data.message) + } + }) + .catch(function (error) { + console.log(error); + }); + + this.topicscancelmodel() + } + + + topicscancelmodel=()=>{ + this.setState({ + Modalstype:false, + Loadtype:false, + visible:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", + checkBoxValues:[], + checkedtype:false + }) + + } + openTopics=(id)=>{ + this.setState({ + Modalstype:true, + Modalstopval:"公开后不能重设为私有", + ModalsBottomval:"是否确认设为公开?", + ModalCancel:this.topicscancelmodel, + ModalSave:()=>this.topicssaveonOpen(id), + }) + } + + topicssaveonOpen=(id)=>{ + + let {category}=this.state; + const url = `/question_banks/multi_public.json`; + axios.post(url,{ + object_id:[id], + object_type:category + }).then((response) => { + if(response.data.status===0){ + this.updataslist() + this.props.showNotification(response.data.message) + }else{ + this.props.showNotification(response.data.message) + } + }).catch(function (error) { + console.log(error); + }); + + this.topicscancelmodel() + } + + + sendTopics=()=>{ + let {checkBoxValues}=this.state; + if(checkBoxValues.length===0){ + this.props.showNotification("请选择题库") + }else{ + this.setState({ + visible:true + }) + } + + } + render(){ + let{ + category, + course_list_id, + isSpin, + data, + page, + sort_direction, + sort_by, + checkBoxValues, + Modalstype, + visible, + isshowprofes + } = this.state; + + let categorylist=[ + {val:"普通作业",type:"normal"}, + {val:"分组作业",type:"group"}, + {val:"毕设选题",type:"gtopic"}, + {val:"毕设任务",type:"gtask"}, + {val:"试卷",type:"exercise"}, + {val:"问卷",type:"poll"}, + ] + + let types=this.props.match.params.topicstype; + + console.log(isshowprofes) + + //types===publicly 公共 + //types===personal 私有 + let user_id=this.props.current_user&&this.props.current_user.user_id; + let user_type=this.props.current_user&&this.props.current_user.user_identity; + let targetuserid=this.props.data&&this.props.data.id; + const menu = ( + + this.updatedlist("updated_at")}> + 最近更新 + + this.updatedlist("name")}> + 题目更新 + + {types==="publicly"?this.updatedlist("contributor")}> + 贡献者 + :""} + + ); + return( +
    + {/*提示*/} + + {Modalstype&&Modalstype===true?:""} + + {/*发送至弹窗*/} + { + visible&&visible===true? + this.updataslist()} + topicscancelmodel={()=>this.topicscancelmodel()} + />:"" + } + + + +
    + {types==="publicly"?:} + + + + {isshowprofes===false? +
    + +
    + {categorylist.map((item,key)=>{ + return( + this.searchCategory(item.type)}>{item.val} + ) + })} + +
    + +
    +
    +
  • this.searchCourselistid(undefined)}>全部
  • + {data===undefined?"":data.course_list===undefined||data.course_list.length===0?"":data.course_list.map((item,key)=>{ + return( +
  • this.searchCourselistid(item.id)}>{item.name}
  • + ) + })} +
    +
    + +
    :
    +

    +

    +
    +
    通过职业认证的教师才能访问公共题库
    + +
    +

    +
    } + + + + +
    + + {isshowprofes===false?
    +

    + {data&&data.count===undefined?0:data&&data.count} + 已选择 {checkBoxValues.length} 个 (不支持跨页勾选) +

    +

    + + + {sort_by==="updated_at"?'最近更新':sort_by==="name"?'题目更新':sort_by==="contributor"?"贡献者":""} + + + + + + + {user_type!="学生"?this.sendTopics()}>发送:""} + {types==="personal"?user_id===targetuserid&&user_type!="学生"?this.deletecheckBoxValues()}>删除:"":""} +

    +
    :""} + + + {isshowprofes===true?"":data===undefined?:data.question_banks===undefined||data.question_banks.length===0?: + + {data.question_banks.map((item,key)=>{ + return( +
    +
    +
    + +
    + {user_type!="学生"?:""} + + {item.name} + + + {item.is_public===true?公开:""} + + {types==="personal"&&item.is_public===false?user_id===targetuserid&&user_type!="学生"?this.openTopics(item.id)}>设为公开:"":""} + +
    + +

    + + {types==="publicly"?{item.creator_name}:""} + {item.quotes_count} 次引用 + {item.solve_count} 次答题 + {moment(item.updated_at).fromNow()} + + {item.course_list_name} +

    + +
    + {types==="personal"?user_id===targetuserid&&user_type!="学生"? + 编辑 + :"":""} +
    +
    +
    + +
    +
    + )})} +
    + } + + { + isshowprofes===true?"":data&&data.count >15 && +
    + +
    + } + +
    +
    + ) + } +} +export default InfosTopics; \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/Withoutpermission.png b/public/react/src/modules/user/usersInfo/Withoutpermission.png new file mode 100755 index 000000000..791a0bc6e Binary files /dev/null and b/public/react/src/modules/user/usersInfo/Withoutpermission.png differ diff --git a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js new file mode 100644 index 000000000..6b474b934 --- /dev/null +++ b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js @@ -0,0 +1,100 @@ +import React, { Component } from 'react'; + +import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; + +import { Breadcrumb } from 'antd'; +import { SnackbarHOC } from 'educoder'; +import { TPMIndexHOC } from '../../../tpm/TPMIndexHOC'; +import { CNotificationHOC } from '../../../courses/common/CNotificationHOC' + + +import "../usersInfo.css" +import "../../../courses/css/members.css" +import "../../../courses/css/Courses.css" + + +import Loadable from 'react-loadable'; +import Loading from '../../../../Loading'; + +// 毕设选题 +const GtopicBanks = Loadable({ + loader: () => import('./GtopicBanks'), + loading: Loading, +}) + +const BanksTabIndex = Loadable({ + loader: () => import('./BanksTabIndex'), + loading: Loading, +}) +const GtopicBanksEdit = Loadable({ + loader: () => import('./GtopicBanksEdit'), + loading: Loading, +}) + +class BanksIndex extends Component{ + constructor(props){ + super(props); + this.state={ + crumbData:undefined + } + } + + initPublic = (crumbData) =>{ + this.setState({ + crumbData + }) + } + + render(){ + let { crumbData }=this.state + const common = { + initPublic:this.initPublic + } + return( +
    +
    + { + crumbData && + + 题库 + { + crumbData.crumbArray && crumbData.crumbArray.map((item,key)=>{ + return( + {item.content} + ) + }) + } + + } + +

    + {crumbData && crumbData.title} + { + crumbData && crumbData.is_public && {crumbData.is_public == true ? '公开':'私有'} + } +

    + + + + { + return () + } + }> + + { + return () + } + }> + + + +
    +
    + ) + } +} +export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(BanksIndex) )); \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/banks/BanksTabIndex.js b/public/react/src/modules/user/usersInfo/banks/BanksTabIndex.js new file mode 100644 index 000000000..874f82f55 --- /dev/null +++ b/public/react/src/modules/user/usersInfo/banks/BanksTabIndex.js @@ -0,0 +1,65 @@ +import React, { Component } from 'react'; + +import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; + + +import Loadable from 'react-loadable'; +import Loading from '../../../../Loading'; + +import BanksMenu from './banksMenu' +// 毕设选题 +const GtopicBanks = Loadable({ + loader: () => import('./GtopicBanks'), + loading: Loading, +}) + +class BanksTabIndex extends Component{ + constructor(props){ + super(props); + this.state={ + banksMenu:undefined + } + } + + initPublic = (crumbData,menuData) =>{ + this.setState({ + banksMenu:menuData + }) + this.props.initPublic(crumbData); + } + + render(){ + let{ + banksMenu + }=this.state + + const common={ + initPublic:this.initPublic, + } + return( + + { + banksMenu && + + } + + + + { + return () + } + }> + + + + ) + } +} +export default (BanksTabIndex); \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/banks/GtopicBanks.js b/public/react/src/modules/user/usersInfo/banks/GtopicBanks.js new file mode 100644 index 000000000..4d7aceb8b --- /dev/null +++ b/public/react/src/modules/user/usersInfo/banks/GtopicBanks.js @@ -0,0 +1,36 @@ +import React, { Component } from 'react'; + + +class GtopicBanks extends Component{ + constructor(props){ + super(props); + } + componentDidMount = () =>{ + let bankId = this.props.match.params.bankId + const crumbData={ + title:'MySQL数据库编程开发实训(基础篇)111', + is_public:true, + crumbArray:[ + {content:'详情'}, + ] + } + const menuData={ + tab:'0',//tab选中的index + menuArray:[//tab以及tab路由 + {to:'/banks/gtopic/1',content:'内容详情'}, + // {to:'/banks/gtopic/1/answer',content:'参考答案'}, + ], + category:'topic',//毕设选题 + id:bankId + } + this.props.initPublic(crumbData,menuData); + } + render(){ + return( +
    + +
    + ) + } +} +export default GtopicBanks; \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/banks/GtopicBanksEdit.js b/public/react/src/modules/user/usersInfo/banks/GtopicBanksEdit.js new file mode 100644 index 000000000..ea7563893 --- /dev/null +++ b/public/react/src/modules/user/usersInfo/banks/GtopicBanksEdit.js @@ -0,0 +1,88 @@ +import React, { Component } from 'react'; +import axios from 'axios' + +import GraduateTopicNewFrom from '../../../courses/graduation/topics/GraduateTopicNewFrom' + +class GtopicBanksEdit extends Component{ + constructor(props){ + super(props); + this.state = { + isPublic:undefined + } + } + componentDidMount = () =>{ + let bankId = this.props.match.params.bankId; + + this.initData(bankId); + } + + initData = (bankId) =>{ + let url = `/gtopic_banks/${bankId}/edit.json`; + axios.get(url).then((result)=>{ + if(result){ + const crumbData={ + title:'编辑', + is_public:result && result.selected_data && result.selected_data.is_public, + crumbArray:[ + {to:`/banks/gtopic/${bankId}/edit`,content:'详情'}, + {content:'编辑'} + ] + } + this.props.initPublic(crumbData); + + this.GraduateTopicNewFromRef.initValue(result); + } + }).catch((error)=>{ + console.log(error) + }) + } + + // 编辑保存 + editSave = (param,attachments,bankId) =>{ + const url = `/gtopic_banks/${bankId}.json`; + let params = { + gtopic_bank:param, + attachment_ids:attachments + } + axios.put(url,params).then((result)=>{ + if(result){ + this.props.showNotification('保存成功!'); + this.props.history.push(`/banks/gtopic/${bankId}`); + } + }).catch((error)=>{ + console.log(error); + }) + } + + // 取消 + editCancel = () =>{ + this.props.history.push(`/banks/gtopic/${this.props.match.params.bankId}`); + } + + render(){ + let { bankId } = this.props.match.params + const common = { + editSave:this.editSave, + editCancel:this.editCancel + } + return( +
    + + this.GraduateTopicNewFromRef = ref} + topicId={bankId} + > +
    + ) + } +} +export default GtopicBanksEdit; \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/banks/banksMenu.js b/public/react/src/modules/user/usersInfo/banks/banksMenu.js new file mode 100644 index 000000000..bcd79406b --- /dev/null +++ b/public/react/src/modules/user/usersInfo/banks/banksMenu.js @@ -0,0 +1,42 @@ +import React, { Component } from 'react'; + +import { Menu } from 'antd' +import { Link } from 'react-router-dom' +import { WordsBtn } from 'educoder' +import "../usersInfo.css" +import "../../../courses/css/Courses.css" +import "../../../courses/css/busyWork.css" + +class BanksMenu extends Component{ + constructor(props){ + super(props); + } + render(){ + let { banksMenu } = this.props; + return( +
    + { + banksMenu && +
    + + { + banksMenu.menuArray && banksMenu.menuArray.map((item,key)=>{ + return( + {item.content} + ) + }) + } + +
    + } + + + 删除 + 编辑 + 发送 + +
    + ) + } +} +export default BanksMenu; \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/usersInfo.css b/public/react/src/modules/user/usersInfo/usersInfo.css index ab5dd6136..1c7b3d325 100644 --- a/public/react/src/modules/user/usersInfo/usersInfo.css +++ b/public/react/src/modules/user/usersInfo/usersInfo.css @@ -226,4 +226,158 @@ content: ''; left:0px; background: #4CACFF; +} + +/* 题库相关 */ +.breadcrumb{ + height: 18px; + line-height: 18px; + margin:10px 0px 0px; +} +.breadcrumb .ant-breadcrumb-separator{ + margin:0px 2px!important; +} +.breadcrumb span.ant-breadcrumb-link{ + cursor: default; +} +.bank_is_public{ + background: #E4F2FE; + float: left; + height: 30px; + line-height: 30px; + padding:0px 20px; + color: #4CACFF; + font-size: 16px; + margin-left: 10px; +} +.topicsbox{ + width: 1200px; + /*min-height: 216px;*/ + background: rgba(255,255,255,1); + padding: 0px 30px 0px 40px; +} + +.topicstopfont{ + width:64px; + height:16px; + font-size:16px; + font-family:PingFangSC; + font-weight:400; + color:rgba(51,51,51,1); + cursor: pointer; +} + +.topcschild{ + width:1128px; + height:55px; + line-height: 54px; + border-bottom:1px solid rgba(235,235,235,1); +} + +.topcsmid{ + width:1128px; + height:55px; + line-height: 55px; +} + +.topcsactive{ + color: #4CACFF !important; +} + +.topicsmidfont{ + max-width: 56px; + height: 55px; + font-size: 14px; + font-family: PingFangSC; + font-weight: 400; + cursor: pointer; + line-height: 55px; +} + +.alltopisc{ + width:230px; + height:20px; + font-size:14px; + font-family:PingFangSC; + font-weight:400; + color:rgba(153,153,153,1); + line-height:20px; +} + +.alltopiscright{ + /* width: 141px; */ + height: 20px; + font-size: 14px; + font-family: PingFangSC; + font-weight: 400; + color: rgba(153,153,153,1); + line-height: 20px; +} + +.topicsbtn{ + padding: 3px 15px; + border-radius: 2px; + color: #4C4C4C; + cursor: pointer; + display: inline-block; + background-color: #4CACFF!important; + color: #fff!important; +} + +.pd1323{ + padding: 10px 6px 25px 40px; + cursor: pointer; +} +.pd1323:hover { + box-shadow: 0px 2px 6px rgba(51,51,51,0.09); + opacity: 1; + border-radius: 2px; +} +.topicswidth400{ + width: 400px; + display: inline-block; +} +.topicswidth300{ + width: 300px; + display: inline-block; +} +.topiscfilterbtn{ + font-size: 14px; + color: #4CACFF !important; + border-radius: 5px; + border: 1px solid #4CACFF !important; + line-height: 23px !important; +} + +.topscisright{ + right: 0px; + top: 50px; + display: block; + position: absolute; +} + +.topsics100{ + width: 100px; + display: inline-block; +} + +.professional_certificationbox{ + height:431px; + background:rgba(255,255,255,1); +} + +.pd115200{ + padding: 55px 200px 0px 200px; +} + +.topicsItemimg{ + width:150px; +} + +.topicsItemfont{ + font-size: 18px; + font-family: PingFang-SC; + font-weight: 400; + color: rgba(51,51,51,1); + line-height: 35px; } \ No newline at end of file