From 0aec565f5eaec2396529d327ffc8f3dd0cdb5cfd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 10 Apr 2017 16:33:34 +0800 Subject: [PATCH 01/13] =?UTF-8?q?editorMD=E4=B8=8A=E4=BC=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index d06791a90..ec025c3f7 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -21,7 +21,18 @@ //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 saveHTMLToTextarea : true, // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - placeholder: "请输入完成当前任务依赖的知识点或者其它相关信息" + placeholder: "请输入完成当前任务依赖的知识点或者其它相关信息", + imageUpload : true, + imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"], + imageUploadURL : "" //url + /* + 上传的后台只需要返回一个 JSON 数据,结构如下: + { + success : 0 | 1, // 0 表示上传失败,1 表示上传成功 + message : "提示的信息,上传成功或上传失败及错误信息等。", + url : "图片地址" // 上传成功时才返回 + } + */ }); }); From fa21ceb07b86624c30fce9309b815ceeeebbbb92 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 10 Apr 2017 16:58:24 +0800 Subject: [PATCH 02/13] =?UTF-8?q?Codemirror=E6=A0=B7=E5=BC=8F=E5=BD=B1?= =?UTF-8?q?=E5=93=8DeditorMD=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index ec025c3f7..26004ac79 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -4,7 +4,17 @@ <%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min' %> <%= javascript_include_tag '/editormd/editormd.min.js','/editormd/examples/js/jquery.min.js' %> - + <% end %> From 7a59b013a007e391da1547f5d9ca38fc831480b6 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 11 Apr 2017 11:09:06 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 9 +++++++-- app/helpers/application_helper.rb | 2 +- app/views/repositories/_shixun_dir_list_content.html.erb | 1 - app/views/shixuns/_shixun_top.html.erb | 5 ++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index bd92c6b9e..0511f8375 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -22,11 +22,16 @@ class ShixunsController < ApplicationController # copy_shixun:复制一个新的实训模块包括版本库 # copy_myshixun自动创建系列game,game中只包含状态等信息,公共信息从Challeges中读取 - # + # 开启过实训的则直接跳入my实训页面 def shixun_exec - if has_exec_cur_shixun(@shixun) || User.current.id == @shixun.user_id + unless allow_shixun_exec(@shixun) render_403 end + myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => @shixun.id).first + unless myshixun.blank? + redirect_to myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun.id) + return + end repository = @shixun.repository ActiveRecord::Base.transaction do begin diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e9de11325..1799122c7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -276,7 +276,7 @@ module ApplicationHelper end def allow_shixun_exec shixun - (User.current.logged? && User.current.id != shixun.user_id && shixun.status == 1) + (User.current.logged? && User.current.id != shixun.user_id && shixun.challenges.count > 0 && !shixun.repository.blank?) end # 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换 diff --git a/app/views/repositories/_shixun_dir_list_content.html.erb b/app/views/repositories/_shixun_dir_list_content.html.erb index 79a9d1512..ab6493cfa 100644 --- a/app/views/repositories/_shixun_dir_list_content.html.erb +++ b/app/views/repositories/_shixun_dir_list_content.html.erb @@ -16,7 +16,6 @@ :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev, - :depth => (depth + 1), :parent_id => tr_id)) %>');">  <% end %> diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index c61030f1e..7f95a51b6 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -6,10 +6,9 @@ /

<%= @shixun.name %>

<% if allow_shixun_exec(@shixun) %> - <%= link_to "开始挑战", shixun_monitor_shixun_path(@shixun), + <%= link_to "开始挑战", shixun_exec_shixun_path(@shixun), :class => "fr task-btn task-btn-orange", - :id => "challenge_begin", - :remote => true %> + :id => "challenge_begin" %> <% end %>
From ca2e7a9c6c3e2d481d655f17245f416a661fe2a4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 11 Apr 2017 13:53:01 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=AE=9E=E8=AE=ADTPM=E8=BF=87=E5=85=B3?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=BD=BF=E7=94=A8MD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 46 ++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index 138a93fd2..7c65026c2 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -45,6 +45,34 @@ } */ }); + taskpass_editormd = editormd("challenge_task_pass", { + width : "89.6%", + height : 300, + syncScrolling : "single", + //你的lib目录的路径,我这边用JSP做测试的 + path : "/editormd/lib/", + toolbarIcons : function() { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "h1", "h2", "h3", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "watch", "clear"] + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea : true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity : 0.6, + placeholder: "请输入完成当前任务依赖的知识点或者其它相关信息", + imageUpload : true, + imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"], + imageUploadURL : "" //url + /* + 上传的后台只需要返回一个 JSON 数据,结构如下: + { + success : 0 | 1, // 0 表示上传失败,1 表示上传成功 + message : "提示的信息,上传成功或上传失败及错误信息等。", + url : "图片地址" // 上传成功时才返回 + } + */ + }); }); @@ -92,7 +120,11 @@
  • <%#= f.kindeditor :task_pass, :editor_id => "challenge_task_pass", :width=>'87.5%', :height => 159, :resizeType => 0, :no_label => true %> - <%= f.text_area :task_pass, :class => "panel-form-width-690 panel-box-sizing", :no_label => true %> + <%#= f.text_area :task_pass, :class => "panel-form-width-690 panel-box-sizing", :no_label => true %> +
    + <%#= f.text_area :ready_knowledge, :placeholder => "请输入完成当前任务依赖的知识点或者其它相关信息,指导学员完成任务" %> + +
  • @@ -211,10 +243,10 @@
  • <% if params[:action] == "edit" %> - 保存 + 保存 取消 <% else %> - 保存 + 保存 取消 <% end %> @@ -300,7 +332,7 @@ function challenge_create(){ if($('#challenge_subject').val().trim() == ""){ $("#new_shixun_name").show(); - }else if($("#challenge_task_pass").val().trim() == ""){ + }else if($("#challenge_task_pass textarea").val().trim() == ""){ $("#new_shixun_pass").show(); }else if($("#challenge_score").val().trim()==""){ $("#new_shixun_score").show(); @@ -312,7 +344,7 @@ function challenge_update(){ if($('#challenge_subject').val().trim() == ""){ $("#new_shixun_name").show(); - }else if($("#challenge_task_pass").val().trim() == ""){ + }else if($("#challenge_task_pass textarea").val().trim() == ""){ $("#new_shixun_pass").show(); }else if($("#challenge_score").val().trim()==""){ $("#new_shixun_score").show(); @@ -335,7 +367,7 @@ $('#challenge_answer').val(cMirror.getValue()); }); - challenge_task_pass_editor = KindEditor.create('#challenge_task_pass', + /* challenge_task_pass_editor = KindEditor.create('#challenge_task_pass', {"width":"89.7%", "resizeType":0, "no_label":true, @@ -358,7 +390,7 @@ "fileManagerJson":"/kindeditor/filemanager" }); - +*/ function add_tag(){ var num = $(".task-bd-grey").children('div').length; var val = $(".task-tag-input").val().trim(); From 0be0467cb7c0947a2946ee412496898021665c59 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 11 Apr 2017 14:05:50 +0800 Subject: [PATCH 09/13] =?UTF-8?q?challenge=E6=96=B0=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=90=8E=E6=96=B0=E5=BB=BA=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=9B=B8=E5=BA=94=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/challenges_helper.rb | 12 ++++++++++++ app/views/challenges/_form.html.erb | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/helpers/challenges_helper.rb b/app/helpers/challenges_helper.rb index 86b0183c9..06d71f9bb 100644 --- a/app/helpers/challenges_helper.rb +++ b/app/helpers/challenges_helper.rb @@ -1,2 +1,14 @@ +# encoding: utf-8 module ChallengesHelper + + def difficulty_type difficulty + case difficulty + when 1 + "简单" + when 2 + "中等" + when 3 + "复杂" + end + end end diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index 138a93fd2..b520f705b 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -97,7 +97,7 @@
  • - <%= select_tag :evaluation, options_for_select([["输出输出", 1], ["文件存在", 2]]), :name => 'challenge[evaluation]', :class => "ml5", :style => "height: 28px;" %> + <%= select_tag :evaluation_way, options_for_select([["输出输出", 1], ["文件存在", 2]]), :name => 'challenge[evaluation_way]', :class => "ml5", :style => "height: 28px;" %>
  • @@ -197,9 +197,9 @@
  • - - - + + +
  • From 43d11c538881b15fc4a3de43659626931503eeda Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 11 Apr 2017 16:38:17 +0800 Subject: [PATCH 10/13] =?UTF-8?q?tpi=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_myshixun.html.erb | 348 +++++++- public/images/task/coin.png | Bin 0 -> 26748 bytes public/stylesheets/css/bigdata-common.css | 232 +++--- public/stylesheets/css/bigdata-public.css | 161 +++- public/stylesheets/css/font-awesome.css | 968 +++++++++++----------- public/stylesheets/css/taskstyle.css | 167 ++-- 6 files changed, 1166 insertions(+), 710 deletions(-) create mode 100644 public/images/task/coin.png diff --git a/app/views/layouts/base_myshixun.html.erb b/app/views/layouts/base_myshixun.html.erb index 86be35ea4..532aef9f1 100644 --- a/app/views/layouts/base_myshixun.html.erb +++ b/app/views/layouts/base_myshixun.html.erb @@ -9,7 +9,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/font-awesome','css/taskstyle','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/cssPlus-v.0.2-build' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/font-awesome','css/taskstyle','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/cssPlus-v.0.2-build', 'css/bigdata-common','css/bigdata-public' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -18,38 +18,313 @@
    -
    -
    -
    -
    -
  • -
    全部任务123 +
    全部任务<%= @myshixun.games.count %>
  • -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -

    第一关标题

    -

    - Python3 代码风格建议
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    -

    -
    -
    -
    -
    -
    -
    -
    -
    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -
    -
    -
    -
    -
    -
    -
    -
    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    testrepo / lib / plugins / acts_as_searchable / init.rb

    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -

    0/11 编译错误

    -
    -
    - - 测试集 1 -
    -
    -
      -
    • 输入:param1:1
    • -
    • 实际输出:
    • -
    • 期望输出:3
    • -
    -
    -
    -
    -
    - - 测试集 2 -
    -
    -
    -
    -
    -
    - - 测试集 3 - -
    -
    -
    -
    -
    -
    - - 测试集 4 - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    11/11 全部通过

    -
    -
    -
      -
    • 样例测试:9/9
    • -
    • 隐藏测试:9/9
    • -
    • 经验值:+ 300
    • -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - 耗时:1天5小时10分钟 - 测评 -
    -
    -
    -
    -
    -
    +<%= yield %>