diff --git a/Gemfile.lock b/Gemfile.lock index 8aa2daa6a..6a4a7e08f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -378,7 +378,6 @@ DEPENDENCIES kaminari (~> 1.1, >= 1.1.1) listen (>= 3.0.5, < 3.2) mysql2 (>= 0.4.4, < 0.6.0) - newrelic_rpm oauth2 pdfkit puma (~> 3.11) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 46b3964c2..ef30dac83 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -127,21 +127,21 @@ class AccountsController < ApplicationController # UserDayCertification.create(user_id: user.id, status: 1) end - def set_autologin_cookie(user) - token = Token.get_or_create_permanent_login_token(user, "autologin") - cookie_options = { - :value => token.value, - :expires => 1.month.from_now, - :path => '/', - :secure => false, - :httponly => true - } - if edu_setting('cookie_domain').present? - cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain')) - end - cookies[autologin_cookie_name] = cookie_options - logger.info("cookies is #{cookies}") - end + # def set_autologin_cookie(user) + # token = Token.get_or_create_permanent_login_token(user, "autologin") + # cookie_options = { + # :value => token.value, + # :expires => 1.month.from_now, + # :path => '/', + # :secure => false, + # :httponly => true + # } + # if edu_setting('cookie_domain').present? + # cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain')) + # end + # cookies[autologin_cookie_name] = cookie_options + # logger.info("cookies is #{cookies}") + # end def logout UserAction.create(action_id: User.current.id, action_type: "Logout", user_id: User.current.id, :ip => request.remote_ip) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 508d005a4..459ba5384 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -253,7 +253,10 @@ class ApplicationController < ActionController::Base if Digest::MD5.hexdigest(content) == params[:chinaoocKey] user = open_class_user - start_user_session(user) if user + if user + start_user_session(user) + set_autologin_cookie(user) + end User.current = user end end @@ -617,6 +620,22 @@ class ApplicationController < ActionController::Base cookies[:fileDownload] = true end + def set_autologin_cookie(user) + token = Token.get_or_create_permanent_login_token(user, "autologin") + cookie_options = { + :value => token.value, + :expires => 1.month.from_now, + :path => '/', + :secure => false, + :httponly => true + } + if edu_setting('cookie_domain').present? + cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain')) + end + cookies[autologin_cookie_name] = cookie_options + logger.info("cookies is #{cookies}") + end + # 149课程的评审用户数据创建(包含创建课堂学生) def open_class_user user = User.find_by(login: "OpenClassUser") diff --git a/app/controllers/commons_controller.rb b/app/controllers/commons_controller.rb index 43ea31c97..bcb0fa45a 100644 --- a/app/controllers/commons_controller.rb +++ b/app/controllers/commons_controller.rb @@ -51,7 +51,7 @@ class CommonsController < ApplicationController 200 end when 'journals_for_message' - course = @object.jour&.course || @object.jour&.student_work&.homework_common&.course + course = @object&.jour_type.to_s == "StudentWorksScore" ? @object.jour&.student_work&.homework_common&.course : @object.jour&.course if current_user.course_identity(course) >= Course::STUDENT && @object.user != current_user 403 else diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0dc8829da..d2c9f88d2 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -128,8 +128,8 @@ class CoursesController < ApplicationController # POST /courses # POST /courses.json def create - ActiveRecord::Base.transaction do - begin + begin + ActiveRecord::Base.transaction do @course = Course.new(name: params[:name], class_period: params[:class_period], credit: params[:credit], end_date: params[:end_date], is_public: params[:is_public], school_id: @school.id, authentication: params[:authentication], professional_certification: params[:professional_certification]) @@ -174,11 +174,12 @@ class CoursesController < ApplicationController course_module_types = params[:course_module_types] @course.create_course_modules(course_module_types) end - rescue => e - uid_logger_error(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback end + CreateSubjectCourseStudentJob.perform_later(@course.id) if @course.subject && @course.subject.subject_appointments.count > 0 + rescue => e + uid_logger_error(e.message) + tip_exception(e.message) + raise ActiveRecord::Rollback end end diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 4a087ae7a..be8173b2f 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -476,10 +476,13 @@ class GamesController < ApplicationController if @myshixun.shixun.try(:status) < 2 tip_exception("代码获取异常,请检查实训模板的评测设置是否正确") else - # 报错继续retry tip_exception(-3, "#{e.message}") end end + # 如果报错了,并且retry 为1的时候,则fork一个新的仓库 + if params[:retry].to_i == 1 + project_fork(@myshixun, @shixun.repo_path, current_user.login) + end tip_exception(0, e.message) end end diff --git a/app/controllers/gits_controller.rb b/app/controllers/gits_controller.rb index 910864812..b52e75353 100644 --- a/app/controllers/gits_controller.rb +++ b/app/controllers/gits_controller.rb @@ -19,43 +19,48 @@ class GitsController < ApplicationController result = false if request.env["HTTP_AUTHORIZATION"] && request.env["HTTP_AUTHORIZATION"].split(" ").length == 2 username_password = Base64.decode64(request.env["HTTP_AUTHORIZATION"].split(" ")[1]) - input_username = username_password.split(":")[0].strip() - input_password = username_password.split(":")[1].strip() - uid_logger("git start auth: input_username is #{input_username}") - - # Git 超级权限用户 - if input_username.strip == gituser.strip && input_password.strip == gitpassword.strip - result = true + if username_password.split(":")[0].nil? || username_password.split(":")[1].nil? + result = false else - # 用户是否对对象拥有权限 - system_user = User.find_by_login(input_username) || User.find_by_mail(input_username) || User.find_by_phone(input_username) + input_username = username_password.split(":")[0].strip() + input_password = username_password.split(":")[1].strip() + uid_logger("git start auth: input_username is #{input_username}") + - # 如果用户名密码错误 - if system_user && !system_user.check_password?(input_password) - uid_logger_error("git start: password is wrong") - result = false + # Git 超级权限用户 + if input_username.strip == gituser.strip && input_password.strip == gitpassword.strip + result = true else - git_url = params["url"] - username = git_url.split("/")[0] - shixunname = git_url.split("/")[1].split(".")[0] - repo_name = username + "/" + shixunname - uid_logger("git start: repo_name is #{repo_name}") - shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name).first - uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}") - uid_logger("git start auth: systemuser is #{system_user.try(:login)}") + # 用户是否对对象拥有权限 + system_user = User.find_by_login(input_username) || User.find_by_mail(input_username) || User.find_by_phone(input_username) - if shixun.present? - if system_user.present? && system_user.manager_of_shixun?(shixun) - result = true + # 如果用户名密码错误 + if system_user && !system_user.check_password?(input_password) + uid_logger_error("git start: password is wrong") + result = false + else + git_url = params["url"] + username = git_url.split("/")[0] + shixunname = git_url.split("/")[1].split(".")[0] + repo_name = username + "/" + shixunname + uid_logger("git start: repo_name is #{repo_name}") + shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name).first + uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}") + uid_logger("git start auth: systemuser is #{system_user.try(:login)}") + + if shixun.present? + if system_user.present? && system_user.manager_of_shixun?(shixun) + result = true + else + uid_logger_error("gituser is not shixun manager") + result = false + end else - uid_logger_error("gituser is not shixun manager") - result = false + uid_logger_error("shixun is not exist") + # result = false + result = true # 为了测试跳出 end - else - uid_logger_error("shixun is not exist") - # result = false - result = true # 为了测试跳出 end end end diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 7cb7ee800..6ffe277a3 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -692,7 +692,7 @@ class PollsController < ApplicationController else unified_setting = @poll.unified_setting end - show_result = params[:show_result] ? 1 : 0 + show_result = params[:show_result].to_i un_anonymous = params[:un_anonymous] ? true : false # 统一设置或者分班为0,则更新问卷,并删除问卷分组 if unified_setting || (course_group_ids.size == 0) diff --git a/app/jobs/create_subject_course_student_job.rb b/app/jobs/create_subject_course_student_job.rb new file mode 100644 index 000000000..a7b8cb8af --- /dev/null +++ b/app/jobs/create_subject_course_student_job.rb @@ -0,0 +1,22 @@ +class CreateSubjectCourseStudentJob < ApplicationJob + queue_as :default + + def perform(course_id) + course = Course.find_by(id: course_id) + return if course.blank? || course.subject.blank? + + attrs = %i[course_id user_id role created_at updated_at] + same_attrs = {course_id: course.id, role: 4} + + Rails.logger.info("1:course.students.count:##{course.students.count}") + CourseMember.bulk_insert(*attrs) do |worker| + course.subject.subject_appointments.each do |app| + Rails.logger.info("##{course.students.where(user_id: app.user_id)}") + next if course.students.where(user_id: app.user_id).any? + worker.add same_attrs.merge(user_id: app.user_id) + end + end + Rails.logger.info("2:course.students.count:##{course.students.count}") + course.subject.subject_appointments.destroy_all + end +end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 4c8f94a42..40de5a87c 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -134,6 +134,11 @@ class HomeworkCommon < ApplicationRecord self.homework_type == 'practice' && self.publish_time.present? && self.publish_time < Time.now && self.homework_group_reviews.count == 0 end + # 作业查看最新成绩 + def update_score identity + identity < Course::NORMAL && publish_time.present? && publish_time < Time.now && !course.is_end + end + # 作业能否立即发布 def publish_immediately user homework_detail_manual.try(:comment_status) == 0 || homework_group_settings.where(course_group_id: course.charge_group_ids(user)). diff --git a/app/models/poll.rb b/app/models/poll.rb index 7f0d2fd94..9cb860f61 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -104,7 +104,7 @@ class Poll < ApplicationRecord status = 4 else if user.present? && user.student_of_course?(course) - ex_time = get_poll_times(user_id,false) + ex_time = get_poll_times(user.id,false) pb_time = ex_time[:publish_time] ed_time = ex_time[:end_time] if pb_time.present? && ed_time.present? && pb_time <= Time.now && ed_time > Time.now diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index 08c269670..e567ea79a 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -4,6 +4,7 @@ json.partial! "homework_btn_check", locals: {identity: @user_course_identity, ho json.partial! "student_btn_check", locals: {identity: @user_course_identity, homework: @homework, work: @work} +json.update_score @homework.update_score(@user_course_identity) if @homework.homework_type == "practice" json.work_count @work_count json.all_member_count @all_member_count json.course_group_count @course.course_groups_count diff --git a/app/views/searchs/index.json.jbuilder b/app/views/searchs/index.json.jbuilder index 164e90b53..65c4d248c 100644 --- a/app/views/searchs/index.json.jbuilder +++ b/app/views/searchs/index.json.jbuilder @@ -10,9 +10,11 @@ json.results do # 去除开头标点符号 reg = /^[,。?:;‘’!“”—……、]/ # 附件的替换 - atta_reg = /!\[\]\(\/api\/attachments\/\d+\)/ - highlights[:description]&.first&.sub!(reg, '').sub!(atta_reg, '') - highlights[:content]&.first&.sub!(reg, '').sub!(atta_reg, '') + atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ + highlights[:description]&.first&.sub!(reg, '') + highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:content]&.first&.sub!(reg, '') + highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} json.content highlights end diff --git a/app/views/shixun_lists/index.json.jbuilder b/app/views/shixun_lists/index.json.jbuilder index c925d6876..79ce4b09c 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -8,9 +8,12 @@ json.shixun_list do # 去除开头标点符号 reg = /^[,。?:;‘’!“”—……、]/ # 附件的替换 - atta_reg = /!\[\]\(\/api\/attachments\/\d+\)/ - highlights[:description]&.first&.sub!(reg, '')&.sub!(atta_reg, '') - highlights[:content]&.first&.sub!(reg, '')&.sub!(atta_reg, '') + atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ + + highlights[:description]&.first&.sub!(reg, '') + highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:content]&.first&.sub!(reg, '') + highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} json.title highlights.delete(:name)&.join('...') || obj.searchable_title json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.sub!(atta_reg, '') diff --git a/app/views/users/courses/shared/_course.json.jbuilder b/app/views/users/courses/shared/_course.json.jbuilder index e917033da..8da80f372 100644 --- a/app/views/users/courses/shared/_course.json.jbuilder +++ b/app/views/users/courses/shared/_course.json.jbuilder @@ -5,6 +5,7 @@ json.members_count course.course_members_count # json.homework_commons_count course.homework_commons_count json.homework_commons_count get_tasks_count course json.attachments_count course.attachments.count +json.visits course.visits json.first_category_url module_url(course.course_modules.where(hidden: 0).order(position: :desc).first, course) diff --git a/public/editormd/lib/marked.min.js b/public/editormd/lib/marked.min.js index 1cd7c2bae..bfcb191af 100644 --- a/public/editormd/lib/marked.min.js +++ b/public/editormd/lib/marked.min.js @@ -13,6 +13,9 @@ // 0.4.0 /^ *(#{1,6}) ——》/^ *(#{1,6}) 去掉了一个空格 TODO 行内公式带_ /*if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");*/ // b(i[1].replace(/^ *| *\| *$/g,"")) --> i[1].replace(/^ *| *\| *$/g, "").split(/ *\| */) table没识别的问题 -// header.length===a.align.length --> header.length table没识别的问题 a.header.length -> a.cells[p].split('|').length - 2 -!function(e){"use strict";var t={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:d,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6})*([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:d,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(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)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:d,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function n(e){this.tokens=[],this.tokens.links={},this.options=e||m.defaults,this.rules=t.normal,this.options.pedantic?this.rules=t.pedantic:this.options.gfm&&(this.options.tables?this.rules=t.tables:this.rules=t.gfm)}t._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,t._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,t.def=p(t.def).replace("label",t._label).replace("title",t._title).getRegex(),t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=p(t.item,"gm").replace(/bull/g,t.bullet).getRegex(),t.list=p(t.list).replace(/bull/g,t.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+t.def.source+")").getRegex(),t._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",t._comment=//,t.html=p(t.html,"i").replace("comment",t._comment).replace("tag",t._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),t.paragraph=p(t.paragraph).replace("hr",t.hr).replace("heading",t.heading).replace("lheading",t.lheading).replace("tag",t._tag).getRegex(),t.blockquote=p(t.blockquote).replace("paragraph",t.paragraph).getRegex(),t.normal=f({},t),t.gfm=f({},t.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6})+([^\n]+?) *#* *(?:\n+|$)/}),t.gfm.paragraph=p(t.paragraph).replace("(?!","(?!"+t.gfm.fences.source.replace("\\1","\\2")+"|"+t.list.source.replace("\\1","\\3")+"|").getRegex(),t.tables=f({},t.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),t.pedantic=f({},t.normal,{html:p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",t._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+|$)/}),n.rules=t,n.lex=function(e,t){return new n(t).lex(e)},n.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)},n.prototype.token=function(e,n){var r,s,i,l,o,a,h,p,u,c,g,d,f;for(e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(n&&(i=this.rules.nptable.exec(e))&&(a={type:"table",header:i[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/\n$/,"").split("\n"):[]}).header.length){for(e=e.substring(i[0].length),p=0;p ?/gm,""),this.token(i,n),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),g=(l=i[2]).length>1,this.tokens.push({type:"list_start",ordered:g,start:g?+l:""}),r=!1,c=(i=i[0].match(this.rules.item)).length,p=0;p1&&o.length>1||(e=i.slice(p+1).join("\n")+e,p=c-1)),s=r||/\n\n(?!\s*$)/.test(a),p!==c-1&&(r="\n"===a.charAt(a.length-1),s||(s=r)),f=void 0,(d=/^\[[ xX]\] /.test(a))&&(f=" "!==a[1],a=a.replace(/^\[[ xX]\] +/,"")),this.tokens.push({type:s?"loose_item_start":"list_item_start",task:d,checked:f}),this.token(a,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(n&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),i[3]&&(i[3]=i[3].substring(1,i[3].length-1)),u=i[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[u]||(this.tokens.links[u]={href:i[2],title:i[3]});else if(n&&(i=this.rules.table.exec(e))&&(a={type:"table",header:i[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/(?: *\| *)?\n$/,"").split("\n"):[]}).header.length){for(e=e.substring(i[0].length),p=0;p?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:d,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(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\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:d,text:/^[\s\S]+?(?=[\\/g,">").replace(/"/g,""").replace(/'/g,"'")}function h(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function p(e,t){return e=e.source||e,t=t||"",{replace:function(t,n){return n=(n=n.source||n).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(t,n),this},getRegex:function(){return new RegExp(e,t)}}}function u(e,t){return c[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?c[" "+e]=e+"/":c[" "+e]=e.replace(/[^/]*$/,"")),e=c[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}r._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,r._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,r._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])?)+(?![-_])/,r.autolink=p(r.autolink).replace("scheme",r._scheme).replace("email",r._email).getRegex(),r._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,r.tag=p(r.tag).replace("comment",t._comment).replace("attribute",r._attribute).getRegex(),r._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,r._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f()\\]*\)|[^\s\x00-\x1f()\\])*?)/,r._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,r.link=p(r.link).replace("label",r._label).replace("href",r._href).replace("title",r._title).getRegex(),r.reflink=p(r.reflink).replace("label",r._label).getRegex(),r.normal=f({},r),r.pedantic=f({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",r._label).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",r._label).getRegex()}),r.gfm=f({},r.normal,{escape:p(r.escape).replace("])","~|])").getRegex(),url:p(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("email",r._email).getRegex(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:p(r.text).replace("]|","~]|").replace("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|").getRegex()}),r.breaks=f({},r.gfm,{br:p(r.br).replace("{2,}","*").getRegex(),text:p(r.gfm.text).replace("{2,}","*").getRegex()}),s.rules=r,s.output=function(e,t,n){return new s(t,n).output(e)},s.prototype.output=function(e){for(var t,n,r,i,l,o="";e;)if(l=this.rules.escape.exec(e))e=e.substring(l[0].length),o+=l[1];else if(l=this.rules.autolink.exec(e))e=e.substring(l[0].length),r="@"===l[2]?"mailto:"+(n=a(this.mangle(l[1]))):n=a(l[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(l=this.rules.url.exec(e))){if(l=this.rules.tag.exec(e))!this.inLink&&/^/i.test(l[0])&&(this.inLink=!1),e=e.substring(l[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):a(l[0]):l[0];else if(l=this.rules.link.exec(e))e=e.substring(l[0].length),this.inLink=!0,r=l[2],this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r))?(r=t[1],i=t[3]):i="":i=l[3]?l[3].slice(1,-1):"",r=r.trim().replace(/^<([\s\S]*)>$/,"$1"),o+=this.outputLink(l,{href:s.escapes(r),title:s.escapes(i)}),this.inLink=!1;else if((l=this.rules.reflink.exec(e))||(l=this.rules.nolink.exec(e))){if(e=e.substring(l[0].length),t=(l[2]||l[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=l[0].charAt(0),e=l[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(l,t),this.inLink=!1}else if(l=this.rules.strong.exec(e))e=e.substring(l[0].length),o+=this.renderer.strong(this.output(l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.em.exec(e))e=e.substring(l[0].length),o+=this.renderer.em(this.output(l[6]||l[5]||l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.code.exec(e))e=e.substring(l[0].length),o+=this.renderer.codespan(a(l[2].trim(),!0));else if(l=this.rules.br.exec(e))e=e.substring(l[0].length),o+=this.renderer.br();else if(l=this.rules.del.exec(e))e=e.substring(l[0].length),o+=this.renderer.del(this.output(l[1]));else if(l=this.rules.text.exec(e))e=e.substring(l[0].length),o+=this.renderer.text(a(this.smartypants(l[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else l[0]=this.rules._backpedal.exec(l[0])[0],e=e.substring(l[0].length),"@"===l[2]?r="mailto:"+(n=a(l[0])):(n=a(l[0]),r="www."===l[1]?"http://"+n:n),o+=this.renderer.link(r,null,n);return o},s.escapes=function(e){return e?e.replace(s.rules._escapes,"$1"):e},s.prototype.outputLink=function(e,t){var n=t.href,r=t.title?a(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,a(e[1]))},s.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},s.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},i.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
'+(n?e:a(e,!0))+"
\n":"
"+(n?e:a(e,!0))+"
"},i.prototype.blockquote=function(e){return"
\n"+e+"
\n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,n){return this.options.headerIds?"'+e+"\n":""+e+"\n"},i.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"},i.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},i.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},i.prototype.checkbox=function(e){return" "},i.prototype.paragraph=function(e){return"

    "+e+"

    \n"},i.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},i.prototype.tablerow=function(e){return"\n"+e+"\n"},i.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},i.prototype.strong=function(e){return""+e+""},i.prototype.em=function(e){return""+e+""},i.prototype.codespan=function(e){return""+e+""},i.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},i.prototype.del=function(e){return""+e+""},i.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(h(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return n}var s='
    "},i.prototype.image=function(e,t,n){this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));var r=''+n+'":">"},i.prototype.text=function(e){return e},l.prototype.strong=l.prototype.em=l.prototype.codespan=l.prototype.del=l.prototype.text=function(e){return e},l.prototype.link=l.prototype.image=function(e,t,n){return""+n},l.prototype.br=function(){return""},o.parse=function(e,t){return new o(t).parse(e)},o.prototype.parse=function(e){this.inline=new s(e.links,this.options),this.inlineText=new s(e.links,f({},this.options,{renderer:new l})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.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,h(this.inlineText.output(this.token.text)));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;et)n.splice(t);else for(;n.lengthAn error occurred:

    "+a(e.message+"",!0)+"
    ";throw e}}d.exec=d,m.options=m.setOptions=function(e){return f(m.defaults,e),m},m.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new i,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},m.defaults=m.getDefaults(),m.Parser=o,m.parser=o.parse,m.Renderer=i,m.TextRenderer=l,m.Lexer=n,m.lexer=n.lex,m.InlineLexer=s,m.inlineLexer=s.output,m.parse=m,"undefined"!=typeof module&&"object"==typeof exports?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):e.marked=m}(this||("undefined"!=typeof window?window:global)); +// header.length===a.align.length --> header.length table没识别的问题 +// 2个table: b(a.cells[p],a.header.length) -> a.cells[p].replace(/^ *\| *| *\| *$/g, "").split(/ *\| */) +// .replace(/(?: *\| *)?\n$/,"") --> .replace(/\n$/, "") +// /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ --> /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ +!function(e){"use strict";var t={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:d,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6})*([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:d,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(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)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:d,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function n(e){this.tokens=[],this.tokens.links={},this.options=e||m.defaults,this.rules=t.normal,this.options.pedantic?this.rules=t.pedantic:this.options.gfm&&(this.options.tables?this.rules=t.tables:this.rules=t.gfm)}t._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,t._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,t.def=p(t.def).replace("label",t._label).replace("title",t._title).getRegex(),t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=p(t.item,"gm").replace(/bull/g,t.bullet).getRegex(),t.list=p(t.list).replace(/bull/g,t.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+t.def.source+")").getRegex(),t._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",t._comment=//,t.html=p(t.html,"i").replace("comment",t._comment).replace("tag",t._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),t.paragraph=p(t.paragraph).replace("hr",t.hr).replace("heading",t.heading).replace("lheading",t.lheading).replace("tag",t._tag).getRegex(),t.blockquote=p(t.blockquote).replace("paragraph",t.paragraph).getRegex(),t.normal=f({},t),t.gfm=f({},t.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6})+([^\n]+?) *#* *(?:\n+|$)/}),t.gfm.paragraph=p(t.paragraph).replace("(?!","(?!"+t.gfm.fences.source.replace("\\1","\\2")+"|"+t.list.source.replace("\\1","\\3")+"|").getRegex(),t.tables=f({},t.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.pedantic=f({},t.normal,{html:p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",t._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+|$)/}),n.rules=t,n.lex=function(e,t){return new n(t).lex(e)},n.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)},n.prototype.token=function(e,n){var r,s,i,l,o,a,h,p,u,c,g,d,f;for(e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(n&&(i=this.rules.nptable.exec(e))&&(a={type:"table",header:i[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/\n$/,"").split("\n"):[]}).header.length){for(e=e.substring(i[0].length),p=0;p ?/gm,""),this.token(i,n),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),g=(l=i[2]).length>1,this.tokens.push({type:"list_start",ordered:g,start:g?+l:""}),r=!1,c=(i=i[0].match(this.rules.item)).length,p=0;p1&&o.length>1||(e=i.slice(p+1).join("\n")+e,p=c-1)),s=r||/\n\n(?!\s*$)/.test(a),p!==c-1&&(r="\n"===a.charAt(a.length-1),s||(s=r)),f=void 0,(d=/^\[[ xX]\] /.test(a))&&(f=" "!==a[1],a=a.replace(/^\[[ xX]\] +/,"")),this.tokens.push({type:s?"loose_item_start":"list_item_start",task:d,checked:f}),this.token(a,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(n&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),i[3]&&(i[3]=i[3].substring(1,i[3].length-1)),u=i[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[u]||(this.tokens.links[u]={href:i[2],title:i[3]});else if(n&&(i=this.rules.table.exec(e))&&(a={type:"table",header:i[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/\n$/, "").split("\n"):[]}).header.length){for(e=e.substring(i[0].length),p=0;p?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:d,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(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\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:d,text:/^[\s\S]+?(?=[\\/g,">").replace(/"/g,""").replace(/'/g,"'")}function h(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function p(e,t){return e=e.source||e,t=t||"",{replace:function(t,n){return n=(n=n.source||n).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(t,n),this},getRegex:function(){return new RegExp(e,t)}}}function u(e,t){return c[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?c[" "+e]=e+"/":c[" "+e]=e.replace(/[^/]*$/,"")),e=c[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}r._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,r._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,r._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])?)+(?![-_])/,r.autolink=p(r.autolink).replace("scheme",r._scheme).replace("email",r._email).getRegex(),r._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,r.tag=p(r.tag).replace("comment",t._comment).replace("attribute",r._attribute).getRegex(),r._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,r._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f()\\]*\)|[^\s\x00-\x1f()\\])*?)/,r._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,r.link=p(r.link).replace("label",r._label).replace("href",r._href).replace("title",r._title).getRegex(),r.reflink=p(r.reflink).replace("label",r._label).getRegex(),r.normal=f({},r),r.pedantic=f({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",r._label).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",r._label).getRegex()}),r.gfm=f({},r.normal,{escape:p(r.escape).replace("])","~|])").getRegex(),url:p(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("email",r._email).getRegex(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:p(r.text).replace("]|","~]|").replace("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|").getRegex()}),r.breaks=f({},r.gfm,{br:p(r.br).replace("{2,}","*").getRegex(),text:p(r.gfm.text).replace("{2,}","*").getRegex()}),s.rules=r,s.output=function(e,t,n){return new s(t,n).output(e)},s.prototype.output=function(e){for(var t,n,r,i,l,o="";e;)if(l=this.rules.escape.exec(e))e=e.substring(l[0].length),o+=l[1];else if(l=this.rules.autolink.exec(e))e=e.substring(l[0].length),r="@"===l[2]?"mailto:"+(n=a(this.mangle(l[1]))):n=a(l[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(l=this.rules.url.exec(e))){if(l=this.rules.tag.exec(e))!this.inLink&&/^
    /i.test(l[0])&&(this.inLink=!1),e=e.substring(l[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):a(l[0]):l[0];else if(l=this.rules.link.exec(e))e=e.substring(l[0].length),this.inLink=!0,r=l[2],this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r))?(r=t[1],i=t[3]):i="":i=l[3]?l[3].slice(1,-1):"",r=r.trim().replace(/^<([\s\S]*)>$/,"$1"),o+=this.outputLink(l,{href:s.escapes(r),title:s.escapes(i)}),this.inLink=!1;else if((l=this.rules.reflink.exec(e))||(l=this.rules.nolink.exec(e))){if(e=e.substring(l[0].length),t=(l[2]||l[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=l[0].charAt(0),e=l[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(l,t),this.inLink=!1}else if(l=this.rules.strong.exec(e))e=e.substring(l[0].length),o+=this.renderer.strong(this.output(l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.em.exec(e))e=e.substring(l[0].length),o+=this.renderer.em(this.output(l[6]||l[5]||l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.code.exec(e))e=e.substring(l[0].length),o+=this.renderer.codespan(a(l[2].trim(),!0));else if(l=this.rules.br.exec(e))e=e.substring(l[0].length),o+=this.renderer.br();else if(l=this.rules.del.exec(e))e=e.substring(l[0].length),o+=this.renderer.del(this.output(l[1]));else if(l=this.rules.text.exec(e))e=e.substring(l[0].length),o+=this.renderer.text(a(this.smartypants(l[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else l[0]=this.rules._backpedal.exec(l[0])[0],e=e.substring(l[0].length),"@"===l[2]?r="mailto:"+(n=a(l[0])):(n=a(l[0]),r="www."===l[1]?"http://"+n:n),o+=this.renderer.link(r,null,n);return o},s.escapes=function(e){return e?e.replace(s.rules._escapes,"$1"):e},s.prototype.outputLink=function(e,t){var n=t.href,r=t.title?a(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,a(e[1]))},s.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},s.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},i.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
    '+(n?e:a(e,!0))+"
    \n":"
    "+(n?e:a(e,!0))+"
    "},i.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,n){return this.options.headerIds?"'+e+"\n":""+e+"\n"},i.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},i.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},i.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},i.prototype.checkbox=function(e){return" "},i.prototype.paragraph=function(e){return"

    "+e+"

    \n"},i.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},i.prototype.tablerow=function(e){return"\n"+e+"\n"},i.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},i.prototype.strong=function(e){return""+e+""},i.prototype.em=function(e){return""+e+""},i.prototype.codespan=function(e){return""+e+""},i.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},i.prototype.del=function(e){return""+e+""},i.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(h(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return n}var s='
    "},i.prototype.image=function(e,t,n){this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));var r=''+n+'":">"},i.prototype.text=function(e){return e},l.prototype.strong=l.prototype.em=l.prototype.codespan=l.prototype.del=l.prototype.text=function(e){return e},l.prototype.link=l.prototype.image=function(e,t,n){return""+n},l.prototype.br=function(){return""},o.parse=function(e,t){return new o(t).parse(e)},o.prototype.parse=function(e){this.inline=new s(e.links,this.options),this.inlineText=new s(e.links,f({},this.options,{renderer:new l})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.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,h(this.inlineText.output(this.token.text)));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;et)n.splice(t);else for(;n.lengthAn error occurred:

    "+a(e.message+"",!0)+"
    ";throw e}}d.exec=d,m.options=m.setOptions=function(e){return f(m.defaults,e),m},m.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new i,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},m.defaults=m.getDefaults(),m.Parser=o,m.parser=o.parse,m.Renderer=i,m.TextRenderer=l,m.Lexer=n,m.lexer=n.lex,m.InlineLexer=s,m.inlineLexer=s.output,m.parse=m,"undefined"!=typeof module&&"object"==typeof exports?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):e.marked=m}(this||("undefined"!=typeof window?window:global)); diff --git a/public/javascripts/educoder/edu_application.js b/public/javascripts/educoder/edu_application.js index 7f8f8ac4d..d11511c63 100644 --- a/public/javascripts/educoder/edu_application.js +++ b/public/javascripts/educoder/edu_application.js @@ -1,4 +1,4 @@ -document.write(""); +document.write(""); /*! * JavaScript Cookie v2.2.0 diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index a04ec614c..aabcd8fb7 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -32,7 +32,7 @@ module.exports = { // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", // 开启调试 - // devtool: "eval", // 开启调试 + // devtool: "eval-source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index 27413ba04..e97822df8 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -70,10 +70,23 @@ class NewWorkForm extends Component{ contentFileList, answerFileList, }, () => { - setTimeout(() => { - this.contentMdRef.current.setValue(data.description || '') - this.answerMdRef.current.setValue(data.reference_answer || '') - }, 2000) + // setTimeout(() => { + // this._scrollToTop() + // 阻止setValue的滚动 + // $(window).scroll( function() { + // $("html").scrollTop(0) + // $(window).unbind("scroll"); + // }); + /** + setValue会调用到 codemirror的 o.scrollIntoView(i), 会导致滚动条跳动 + */ + // $('.editormd').parent().css('position', 'fixed').css('left', '-1000px') + // this.contentMdRef.current.setValue(data.description || '') + // this.answerMdRef.current.setValue(data.reference_answer || '') + // setTimeout(() => { + // $('.editormd').parent().css('position', '').css('left', 'auto') + // }, 100); + // }, 500) this.props.form.setFieldsValue({ title: data.name, @@ -85,12 +98,13 @@ class NewWorkForm extends Component{ } else { // new } - this._scrollToTop() + // this._scrollToTop() } _scrollToTop = () => { - setTimeout(() => { - $("html").animate({ scrollTop: 0 }) - }, 1500) + // setTimeout(() => { + $("html").scrollTop(0) + // $("html").animate({ scrollTop: 0 }) + // }, 1000) } // 输入title @@ -292,6 +306,8 @@ class NewWorkForm extends Component{ this.setState({ base_on_project: !this.state.base_on_project }) } componentDidMount() { + this.isEdit = this.props.match.url.indexOf('/edit') + window.$('.groupSetting .ant-form-item-label > label').addClass('ant-form-item-required') this._scrollToTop() } @@ -303,15 +319,13 @@ class NewWorkForm extends Component{ 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 + title_num, course_name, category, has_commit, has_project }=this.state const { current_user } = this.props const courseId = this.state.course_id || this.props.match.params.coursesId ; - if ((isEdit) && !this.state.workLoaded) { + if ((this.isEdit) && !this.state.description) { return '' } const uploadProps = { @@ -439,7 +453,8 @@ class NewWorkForm extends Component{ }], })( + initValue={this.state.description} noSetValue={true} + className="courseMessageMD" > )} } @@ -479,7 +494,7 @@ class NewWorkForm extends Component{ - +

    @@ -488,7 +503,7 @@ class NewWorkForm extends Component{ >基于项目实施 - +

    )} @@ -507,7 +522,8 @@ class NewWorkForm extends Component{ }], })( + initValue={this.state.reference_answer || ''} noSetValue={true} + className="courseMessageMD" refreshTimeout={1500} > )} diff --git a/public/react/src/modules/courses/coursesPublic/CoursesListType.js b/public/react/src/modules/courses/coursesPublic/CoursesListType.js index d5805c0d5..039f96914 100644 --- a/public/react/src/modules/courses/coursesPublic/CoursesListType.js +++ b/public/react/src/modules/courses/coursesPublic/CoursesListType.js @@ -30,7 +30,7 @@ class CoursesListType extends Component { return( { - typelist===undefined?"":typelist.map((item,key)=>{ + typelist===undefined || typelist=== 403 || typelist === 401 || typelist=== 407 || typelist=== 408|| typelist=== 409 || typelist === 500?"":typelist.map((item,key)=>{ return( document.querySelector('.TabsWarp')} key={key}> diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index 496423f73..db4f89bfc 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -233,7 +233,7 @@ class Bullsubdirectory extends Component{ { whethertoeditysl === false?
    -
    +
    {myname} diff --git a/public/react/src/modules/courses/gradinforms/myysleduinforms.css b/public/react/src/modules/courses/gradinforms/myysleduinforms.css index 8376c63c8..a05dc9a63 100644 --- a/public/react/src/modules/courses/gradinforms/myysleduinforms.css +++ b/public/react/src/modules/courses/gradinforms/myysleduinforms.css @@ -70,6 +70,10 @@ .fudonyingxiangysl{ width: 100%; } +.fudonyingxiangysls{ + display: flex; + flex-direction:column; +} .yslbianji{ padding-top: 31px; diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index 41768333a..7c697e31b 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -285,7 +285,7 @@ class GraduationTasksSubmitedit extends Component{ let{ search,page,limit,workslist}=this.state; - let newpage=page+2 + let newpage=page+1 this.searchList(search,newpage,limit,workslist.task_id,1) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index be29d45a4..7438b36a4 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -271,20 +271,27 @@ class GraduationTasksSubmitnew extends Component{ contentViewScroll=(e)=>{ - //滑动到底判断 + + + //滑动到底判断 + const {memberslist} = this.state; let newscrollTop=parseInt(e.currentTarget.scrollTop); let allclientHeight=e.currentTarget.clientHeight+newscrollTop; - if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){ - // console.log("到达底部"); - let{ search,page,limit }=this.state; + if(memberslist.length===0){ + return; + }else{ + let{ search,page,limit }=this.state; - let newpage=page+2 + let newpage=page+1 + + this.searchList(search,newpage,limit,1) + + } + } - this.searchList(search,newpage,limit,1) - } } diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js index 55dfd9855..f0bead58f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js @@ -32,8 +32,10 @@ class GraduationTasksappraise extends Component{ axios.get(zrl).then((result)=>{ if(result.status===200){ + let status=result.data.status; + if(status===undefined || status=== 403 || status === 401 || status=== 407 || status=== 408|| status=== 409 || status === 500||status===-1){ - if(result.data.status!=-1){ + }else{ this.setState({ firelistdata:result.data, }) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index 874a69ca5..a7f886d78 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -80,6 +80,8 @@ class GraduationTaskssettingapp extends Component{ starttime:undefined, DownloadType:false, DownloadMessageval:undefined, + commentstatustype:undefined, + commenttimeone:undefined } } @@ -102,10 +104,10 @@ class GraduationTaskssettingapp extends Component{ } let starttype=false; let endtype=false; - if(moment(result.data.publish_time){ - let {latetime,end_time,allowlate}=this.state; + let {latetime,end_time,allowlate,commenttime,commenttimeone}=this.state; + let commenttimetype=commenttime===null||commenttime===""; + let newlatetimea=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm"); let newcommenttimea=moment(new Date()).format("YYYY-MM-DD HH:mm"); @@ -377,26 +385,33 @@ class GraduationTaskssettingapp extends Component{ let newend_timed=moment(end_time).add(7, 'days').format("YYYY-MM-DD HH:mm"); let newcommenttimed=moment(end_time).add(8, 'days').format("YYYY-MM-DD HH:mm"); - let newtime; if(e.target.checked===true){ - - if(allowlate===1||allowlate===true){ - if(latetime===null||latetime===""){ - this.updatesfuncrosscomment(1,newlatetimea,newcommenttimea) - }else{ - this.updatesfuncrosscomment(1,newlatetimes,newcommenttimes) - } - }else{ - if(end_time===null||end_time===""){ - this.updatesfuncrosscomment(2,newend_timeb,newcommenttimeb) + if(commenttimetype===true){ + + if(allowlate===1||allowlate===true){ + if(latetime===null||latetime===""){ + this.updatesfuncrosscomment(1,newlatetimea,newcommenttimea) + }else{ + this.updatesfuncrosscomment(1,newlatetimes,newcommenttimes) + } + }else{ + if(end_time===null||end_time===""){ + this.updatesfuncrosscomment(2,newend_timeb,newcommenttimeb) + }else{ + this.updatesfuncrosscomment(2,newend_timed,newcommenttimed) + } + } }else{ - this.updatesfuncrosscomment(2,newend_timed,newcommenttimed) - } - } + this.setState({ + crosscomment:e.target.checked, + commenttime:commenttimeone, + }) + } + }else{ this.setState({ crosscomment:e.target.checked, - commenttime:undefined + commenttime:undefined }) } } @@ -519,10 +534,10 @@ class GraduationTaskssettingapp extends Component{ } - if(moment(end_time) -
    分组设置 (提交作品时需要关联同组成员,组内成员作品共享)
    +
    分组设置
    ~ @@ -1154,7 +1170,7 @@ class GraduationTaskssettingapp extends Component{
    评分设置
    最终成绩组成 (取各教师最终评分的平均分)
    启用交叉评阅 (给老师分配其他指导老师的学生作品) + disabled={this.props.isAdmin()===true?flagPageEdit===true?commentstatustype===3?true:false:true:true} >启用交叉评阅 (给老师分配其他指导老师的学生作品) {crosscomment===true?
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 20a34ab89..0469d5d9c 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -850,47 +850,47 @@ class GraduationTaskssettinglist extends Component{ ), }, { - title: '操作', - key: 'operation', - width:'100px', - dataIndex: 'operation', - className:'edu-txt-center', - render: operation => ( - + title: '操作', + key: 'operation', + width:'100px', + dataIndex: 'operation', + className:'edu-txt-center', + render: operation => ( +
    + {this.props.isAdmin()?operation.map((tag,key) => { + return( + + { + tag.name && + 调整学生最终成绩
    其它历史评分将全部失效:""}> + {tag.name==="评阅"? + {tag.name} + + : + this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""}> + {tag.name} + + } +
    + } +
    + ) + }):""} + { + this.props.isStudent()? + operation.map((tag,key) => { + return( +
    + {tag.view_work===false?"--":查看} +
    + )} + ):"" + } +
    - ), - }]; + ), + }]; let courseId=this.props.match.params.coursesId; let position=this.props.match.params.position; @@ -972,7 +972,7 @@ class GraduationTaskssettinglist extends Component{ text-overflow: ellipsis; white-space: nowrap; } - .ant-table-tbody>tr>td, .ant-table-thead>tr>th{ + .ant-table-tbody>tr>td, .ant-table-thead>tr>th{ padding: 16px 10px } diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index ed52d5cbc..ae764cc95 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -88,7 +88,7 @@ class GraduationTasks extends Component{ savedelete=()=>{ this.setState({ - Modalstype:false, + Modalstype:false, }) let {checkAllValue,checkBoxValues,search,page,order} = this.state; // let all_check; @@ -107,9 +107,10 @@ class GraduationTasks extends Component{ if (response.data.status == 0) { // {"status":1,"message":"删除成功"} this.fetchAll(search,page,order) + this.props.showNotification(response.data.message); this.setState({ - Modalstype:true, - Modalstopval:response.data.message, + // Modalstype:true, + // Modalstopval:response.data.message, ModalsBottomval:"", ModalSave:this.cancelmodel, Loadtype:true, diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js index b53e4528b..38e68ad32 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js @@ -382,7 +382,7 @@ class GraduateTopicPostWorksNew extends Component{ )} - (项目管理员角色的成员都可以提交作品,提交作品时需要关联同组成员,组内成员作品共享) + (学生提交作品时需要关联同组成员,组内成员作品共享) 基于项目实施 )} - (勾选后各小组必须在educoder平台创建项目,教师可随时观察平台对各小组最小进展的实时统计) + (选中,则必须在本平台创建项目,项目管理员可以提交作品;不选中,无需在平台创建项目,任意小组成员均可以提交作品)
    diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 9d34b7036..5aa7f8f72 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2863,7 +2863,7 @@ class PollNew extends Component { } 问卷须知
    */} - {/* cm monaco 切换 */} - {/* */} - + {this.props.readRepoTimeout === true ? : + +
    + {/**/} + {/* cm monaco 切换 */} + {/* */} + +
    + }
    diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index 2a0ad15ea..d77b35888 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -336,7 +336,7 @@ class DetailCards extends Component{ showparagraphindex }=this.state; const antIcon = ; - + // console.log("zzz"+this.props.MenuItemsindextype) return(
    {AccountProfiletype===true?{ - if(listtype===false){ - keys=key+1 - if(item.course_status.status===0) { - listtype=true - return ( - courseslist.push(item) - ) - } - } - }) + let type=undefined; + this.props.courses.map((item,key)=>{ - if(listtype===false){ + let arr=[] keys=key+1 if(item.course_status.status===2) { + type=key+1 + arr.push(item) + } + courseslist=arr; + }) + + this.props.courses.map((item,key)=>{ + let arr=[] + if(listtype===false){ + keys=key+1 + if(item.course_status.status===0) { listtype=true - return ( - courseslist.push(item) - ) + // courseslist.push(item) + arr.push(item) + courseslist=arr } } }) + console.log(courseslist) + + + } + if(courseslist.length!=0){ + this.props.getMenuItemsindex(keys,courseslist[0].course_status.status) } - this.props.getMenuItemsindex(keys,courseslist[0].course_status.status) + } this.setState({ @@ -254,6 +264,18 @@ class DetailTop extends Component{ } putappointment=()=>{ + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + + if(this.props.current_user&&this.props.current_user.profile_completed===false){ + this.setState({ + AccountProfiletype:true + }) + return + } + this.setState({ Modalstype:true, Modalstopval:"是否确认立即预约?", @@ -313,9 +335,15 @@ class DetailTop extends Component{ this.cardsModalcancel() }) } + + hideAccountProfile=()=>{ + this.setState({ + AccountProfiletype:false + }) + } render(){ let{detailInfoList}=this.props; - let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype}=this.state; + let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,AccountProfiletype}=this.state; const radioStyle = { display: 'block', height: '30px', @@ -339,11 +367,18 @@ class DetailTop extends Component{ let applypath=this.props.detailInfoList&&this.props.detailInfoList.participant_count!=undefined&&this.props.detailInfoList&&this.props.detailInfoList.allow_statistics===false; + let coursestypes=this.props.courses!=undefined&&this.props.courses.length===0; + let isadminallow_statistics=this.props.courses&&this.props.courses.length===0&&this.props.detailInfoList&&this.props.detailInfoList.allow_statistics===true; - // console.log(this.props.courses) return( -
    +
    40?"subhead mb100":"subhead mb70":this.state.MenuItemskey===this.props.courses.length?"subhead mb120":detailInfoList.name.length>40?"subhead mb100":"subhead mb80"}> + {AccountProfiletype===true?this.hideAccountProfile()} + {...this.props} + {...this.state} + />:""} + {this.state.yslJointhe===true?this.ysljoinmodalCancel()} ysljoinmodalCanceltwo={()=>this.ysljoinmodalCanceltwo(this.state.MenuItemskey)}>:""} {this.state.OpenCourseTypes===true?this.OpenCourseCancel()}/>:""} + { detailInfoList && -
    +
    {/*27?detailInfoList.name:""}>*/} @@ -477,12 +526,10 @@ class DetailTop extends Component{
    - {this.props.courses===undefined||this.props.courses.length===0?"":
    - -
  • - - + } + + {this.props.courses===undefined||this.props.courses.length===0?"":
  • - {this.props.courses===undefined?"":this.state.courseslist.map((item,key)=>{ + {this.state.courseslist.map((item,key)=>{ if(item.course_identity<4){ return( @@ -524,7 +571,7 @@ class DetailTop extends Component{ 第 {this.state.MenuItemskey} 次开课 -
  • + } -
  • + {this.props.courses===undefined||this.props.courses.length===0?"":
  • {this.state.courseslist.map((item,key)=>{ return(
    @@ -588,12 +635,10 @@ class DetailTop extends Component{ }) } -
  • - -
  • - + ` + } + + {this.props.courses===undefined||this.props.courses.length===0?"":
  • + {/* height: 158px; @@ -652,42 +708,60 @@ class DetailTop extends Component{ return(
    - {/*{item.course_status.status===0?
    即将开课
    :""}*/} - {item.course_status.status===1?
    {item.course_status.time}
    :""} - {item.course_status.status===2&&item.course_identity<6?
    已结束
    :""} + {applypath===false?"":this.state.MenuItemskey===this.props.courses.length||coursestypes===true? + this.props.detailInfoList&&this.props.detailInfoList.has_participate===false? + getappointmenttype===true?预约报名成功:this.putappointment()}>期待开课并预约报名: + 预约报名成功:""} + {/*{item.course_status.status===0?
    即将开课
    :""}*/} + {item.course_status.status===1?
    {item.course_status.time}
    :""} + {item.course_status.status===2&&item.course_identity<6?
    已结束
    :""} + {/*
    已结束
    */} {item.course_status.status===0? - item.course_identity<5? + item.course_identity<5? 进入课堂 - :item.course_identity<6?
    报名成功
    - :this.JoinnowCourse(item.course_id)}>立即报名:""} + :item.course_identity<6?
    报名成功
    + :this.JoinnowCourse(item.course_id)}>立即报名:""} {item.course_status.status===1? - item.course_identity<5? + item.course_identity<5? 进入课堂 - :item.course_identity<6? + :item.course_identity<6? 立即学习 - :this.JoinnowCourse(item.course_id,item.course_status.status)}>立即加入:""} + :this.JoinnowCourse(item.course_id,item.course_status.status)}>立即加入:""} {item.course_status.status===2? - item.course_identity<6? + item.course_identity<6? 进入课堂 - :
    已结束
    :""} + :
    已结束
    :""}
    )})} -
  • + } + + {applypath===false?"":this.state.MenuItemskey===this.props.courses.length?
    :""} - {applypath===false?"":this.state.MenuItemskey===this.props.courses.length? - 当前预约报名人数:{getappointmenttype===true?this.props.detailInfoList&&this.props.detailInfoList.participant_count+1:this.props.detailInfoList&&this.props.detailInfoList.participant_count} - 当预约报名人数达到 {this.props.detailInfoList&&this.props.detailInfoList.student_count} 人时即将开课 + + {applypath===false?"":this.props.courses.length===0?"":this.state.MenuItemskey===this.props.courses.length||coursestypes===true? + 当前预约报名人数:{getappointmenttype===true?this.props.detailInfoList&&this.props.detailInfoList.participant_count+1:this.props.detailInfoList&&this.props.detailInfoList.participant_count} + 当预约报名人数达到 {this.props.detailInfoList&&this.props.detailInfoList.student_count} 人时即将开课 + {/*{this.props.detailInfoList&&this.props.detailInfoList.has_participate===false?*/} + {/*getappointmenttype===true?预约报名成功:this.putappointment()}>期待开课并预约报名:*/} + {/*预约报名成功}*/} + + :""} + + {applypath===true&&this.props.courses.length===0?this.state.MenuItemskey===this.props.courses.length||coursestypes===true? + 当前预约报名人数:{getappointmenttype===true?this.props.detailInfoList&&this.props.detailInfoList.participant_count+1:this.props.detailInfoList&&this.props.detailInfoList.participant_count} + 当预约报名人数达到 {this.props.detailInfoList&&this.props.detailInfoList.student_count} 人时即将开课 {this.props.detailInfoList&&this.props.detailInfoList.has_participate===false? - getappointmenttype===true?预约报名成功:this.putappointment()}>期待开课并预约报名: - 预约报名成功} - :""} + getappointmenttype===true?预约报名成功:this.putappointment()}>期待开课并预约报名: + 预约报名成功} + :"":""} +
    } diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 7129b820f..b0f64abde 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -86,7 +86,7 @@ class PathDetailIndex extends Component{ pathtopskey:1, dataquerys:{}, MenuItemsindex:1, - MenuItemsindextype:2 + MenuItemsindextype:0 } this.onDragEnd = this.onDragEnd.bind(this); @@ -621,7 +621,10 @@ class PathDetailIndex extends Component{ {/*}*/}

    -

    {item.school}{item.identity}

    +

    + {item.school} + {/*{item.identity}*/} +

    @@ -645,7 +648,9 @@ class PathDetailIndex extends Component{ }

    -

    {item.school}{item.identity}

    +

    {item.school} + {/*{item.identity}*/} +

    { detailInfoList===undefined?"":detailInfoList.allow_add_member===true?
    @@ -674,7 +679,9 @@ class PathDetailIndex extends Component{ {/*}*/}

    -

    {item.school}{item.identity}

    +

    {item.school} + {/*{item.identity}*/} +

    diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 064a482c9..992c77fac 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -865,7 +865,7 @@ submittojoinclass=(value)=>{
  • 我的实训项目
  • 我的实践课程
  • 我的开发项目
  • -
  • 我的众包
  • + {/*
  • 我的众包
  • */}
  • 客户管理
  • diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js index 91cb34954..1d2d12ea6 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js +++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js @@ -236,19 +236,24 @@ export default class TPMMDEditor extends Component { setTimeout(() => { if (that.props.needRecreate == true) { - __editorName.recreate() + __editorName.recreate() // 注意 必须在setValue之前触发,不然会清空 } else { __editorName.resize() } console.log('timeout', __editorName.id) __editorName.cm && __editorName.cm.refresh() }, that.props.refreshTimeout || 500) - if (that.props.initValue != undefined && that.props.initValue != '') { - __editorName.setValue(that.props.initValue) - } - if (that.state.initValue) { - __editorName.setValue(that.state.initValue) + if (this.props.noSetValue) { + + } else { + if (that.props.initValue != undefined && that.props.initValue != '') { + __editorName.setValue(that.props.initValue) + } + if (that.state.initValue) { + __editorName.setValue(that.state.initValue) + } } + __editorName.cm.on("change", (_cm, changeObj) => { that.contentChanged = true; if (that.state.showError) { diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index 5e79a9b2b..a3b834493 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -39,21 +39,21 @@ class InfosBanner extends Component{
    -

    头像

    +

    头像

    {data && data.name} - { - data && is_current == false && data.identity =="学生" ? "" : - - } + {/*{*/} + {/*data && is_current == false && data.identity =="学生" ? "" : */} + {/**/} + {/*}*/}

    - + - +

    @@ -111,11 +111,11 @@ class InfosBanner extends Component{ onClick={() => this.setState({moduleName: 'projects'})} to={`/users/${username}/projects`}>开发项目 -
  • - this.setState({moduleName: 'package'})} - to={`/users/${username}/package`}>众包 -
  • + {/*
  • */} + {/* this.setState({moduleName: 'package'})}*/} + {/* to={`/users/${username}/package`}>众包*/} + {/*
  • */} {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) &&