|
|
|
|
@ -1,77 +1,76 @@
|
|
|
|
|
<li class="clearfix pt30 pr30">
|
|
|
|
|
<a href="javascript:void(0);" class="task-btn task-btn-green fr" >编辑</a>
|
|
|
|
|
<a href="javascript:void(0)" class="task-btn fr mr10 deloption-btn" id="skill_cancel">删除</a>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="panel-form">
|
|
|
|
|
<div id="shixun_form">
|
|
|
|
|
<li class="clearfix">
|
|
|
|
|
<label class="panel-form-label fl"><span class="c_red mr5">*</span>题干:</label>
|
|
|
|
|
<div id="challenge_task_pass" class="fl task-bg-grey panel-box-sizing panel-form-width-690 new_li">
|
|
|
|
|
<textarea name="challenge[task_pass]"></textarea>
|
|
|
|
|
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %>
|
|
|
|
|
<%= javascript_include_tag '/editormd/editormd.min.js','/editormd/examples/js/jquery.min.js' %>
|
|
|
|
|
<%= labelled_form_for @challenge, :url => new_or_edit_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun), :html => {:id => "challenge_choose_update", :remote => true } do |f| %>
|
|
|
|
|
<li class="clearfix pt30 pr30">
|
|
|
|
|
<a href="javascript:void(0);" class="task-btn task-btn-green fr" >编辑</a>
|
|
|
|
|
<a href="javascript:void(0)" class="task-btn fr mr10 deloption-btn" id="skill_cancel">删除</a>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="panel-form">
|
|
|
|
|
<div id="shixun_form">
|
|
|
|
|
<li class="clearfix">
|
|
|
|
|
<label class="panel-form-label fl"><span class="c_red mr5">*</span>题干:</label>
|
|
|
|
|
<div id="challenge_choose_subject" class="fl task-bg-grey panel-box-sizing panel-form-width-690 new_li">
|
|
|
|
|
<textarea name="choose[subject]"></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<script id="t:set-option-list" type="text/html">
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @type %>);" name="option_span" title="点击设置答案">A</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
</script>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @type %>);" name="option_span" title="点击设置答案">A</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @type %>);" name="option_span" title="点击设置答案">B</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @type %>);" name="option_span" title="点击设置答案">C</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @type %>);" name="option_span" title="点击设置答案">D</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="clearfix mb10" >
|
|
|
|
|
<label class="panel-form-label fl"><span class="add-option-item fr mr10 color-grey border-dash-orange" name="option_span"><%#= params[:action] == "edit" ? (@challenge.challenge_questions.count + 65).chr : (@type == 1 ? "E" : "C") %></span></label>
|
|
|
|
|
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" class="option_icon_add">新增选项</a></div>
|
|
|
|
|
</li>
|
|
|
|
|
<span style="display: none" class="c_red ml95" id="choice_error_tip"></span>
|
|
|
|
|
<li class="clearfix" ><label class="fl" style="margin-left: 10%">温馨提示:点击选项,可以直接设置答案</label><label class="fr">标准答案:<span id="current-option" class="color-orange"><%#= @challenge.right_answers.blank? ? "请点击正确选项" : @challenge.right_answers %></span></label></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="bor-bottom-greyE"></p>
|
|
|
|
|
<!--参考答案-->
|
|
|
|
|
<li class="clearfix" style="line-height:1.9;">
|
|
|
|
|
<label class=" panel-form-label fl"> 参考答案:</label>
|
|
|
|
|
<div id="challenge_choose_answer" class="new_li">
|
|
|
|
|
<textarea name="challenge[answer]"><%= @challenge.answer %></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
<p id="e_tip_in" style="margin-left: 10%" class="c_grey"></p>
|
|
|
|
|
<p id="e_tips_in" style="margin-left: 10%" class="c_grey"></p>
|
|
|
|
|
</li>
|
|
|
|
|
<script id="t:set-option-list" type="text/html">
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @st %>);" name="option_span" title="点击设置答案">A</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
</script>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @st %>);" name="option_span" title="点击设置答案">A</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @st %>);" name="option_span" title="点击设置答案">B</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @st %>);" name="option_span" title="点击设置答案">C</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix pr">
|
|
|
|
|
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this, <%= @st %>);" name="option_span" title="点击设置答案">D</span></label>
|
|
|
|
|
<input type="hidden" name="choice[answer][]">
|
|
|
|
|
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question[cnt][]" placeholder="请输入选项内容"></textarea>
|
|
|
|
|
<a title="移除" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
|
|
|
|
|
</li>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="clearfix mb10" >
|
|
|
|
|
<label class="panel-form-label fl"><span class="add-option-item fr mr10 color-grey border-dash-orange" name="option_span"><%#= params[:action] == "edit" ? (@challenge.challenge_questions.count + 65).chr : (@st == 1 ? "E" : "C") %></span></label>
|
|
|
|
|
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" class="option_icon_add">新增选项</a></div>
|
|
|
|
|
</li>
|
|
|
|
|
<span style="display: none" class="c_red ml95" id="choice_error_tip"></span>
|
|
|
|
|
<li class="clearfix" ><label class="fl" style="margin-left: 10%">温馨提示:点击选项,可以直接设置答案</label><label class="fr">标准答案:<span id="current-option" class="color-orange"><%#= @challenge.right_answers.blank? ? "请点击正确选项" : @challenge.right_answers %></span></label></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="bor-bottom-greyE"></p>
|
|
|
|
|
<!--参考答案-->
|
|
|
|
|
<div class="panel-form">
|
|
|
|
|
<div id="edit_answer_show">
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="clearfix">
|
|
|
|
|
<label class=" panel-form-label fl"> 参考答案:</label>
|
|
|
|
|
<div class="fl task-bg-grey panel-box-sizing panel-form-width-690 new_li" id="tpm_answer_show" style="width: 90%;background: #fff!important;">
|
|
|
|
|
<textarea style="display:none;"><%= @challenge.answer.blank? ? "无" : (@challenge.answer) %></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="bor-bottom-greyE"></p>
|
|
|
|
|
<!--经验值设置-->
|
|
|
|
|
<div class="panel-form">
|
|
|
|
|
<div id="shixun_form">
|
|
|
|
|
<li class="clearfix">
|
|
|
|
|
<label class="panel-form-label fl"><span class="c_red mr5">*</span>难易度:</label>
|
|
|
|
|
<p class="bor-bottom-greyE"></p>
|
|
|
|
|
<!--经验值设置-->
|
|
|
|
|
<div class="panel-form">
|
|
|
|
|
<div id="shixun_form">
|
|
|
|
|
<li class="clearfix">
|
|
|
|
|
<label class="panel-form-label fl"><span class="c_red mr5">*</span>难易度:</label>
|
|
|
|
|
<span class="fl mt3 mr10">
|
|
|
|
|
<input id="challenge_difficulty_1" class="magic-radio" name="challenge[difficulty]" type="radio" value="1" <%= (@challenge.difficulty == 1 ? "checked" : "")%> >
|
|
|
|
|
<label for="challenge_difficulty_1">简单</label>
|
|
|
|
|
@ -85,154 +84,157 @@
|
|
|
|
|
<label for="challenge_difficulty_3">困难</label>
|
|
|
|
|
</span></li>
|
|
|
|
|
|
|
|
|
|
<li class="clearfix">
|
|
|
|
|
<label class="panel-form-label fl"><span class="c_red mr5">*</span>奖励经验值:</label>
|
|
|
|
|
<%= select_tag :challenge_score, options_for_select([100, 200]), :name => 'challenge[score]', :class => " fl", :style => "height: 40px; width:170px;" %>
|
|
|
|
|
<div class="clear"></div>
|
|
|
|
|
<span style="display: none" class="c_red ml90" id="new_shixun_score">分值设定不能为空</span>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix">
|
|
|
|
|
<label class="panel-form-label fl"><span class="c_red mr5">*</span>奖励经验值:</label>
|
|
|
|
|
<%= select_tag :challenge_score, options_for_select([100, 200]), :name => 'challenge[score]', :class => " fl", :style => "height: 40px; width:170px;" %>
|
|
|
|
|
<div class="clear"></div>
|
|
|
|
|
<span style="display: none" class="c_red ml90" id="new_shixun_score">分值设定不能为空</span>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
<div class="prop-notice-info mb10" style="margin-left: 10%">
|
|
|
|
|
<ol>
|
|
|
|
|
<% if @st == 0 %>
|
|
|
|
|
<li>如果学员查看了参考答案,则不能得到相应的经验值</li>
|
|
|
|
|
<li>如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+100经验值、+100金币</li>
|
|
|
|
|
<% else %>
|
|
|
|
|
<div class="prop-notice-info mb10" style="margin-left: 10%">
|
|
|
|
|
<ol>
|
|
|
|
|
<li>如果学员答题错误,则不能得到相应的经验值</li>
|
|
|
|
|
<li>如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="bor-bottom-greyE"></p>
|
|
|
|
|
<!--技能标签-->
|
|
|
|
|
<div class="panel-form">
|
|
|
|
|
<div id="shixun_form">
|
|
|
|
|
<li class="clearfix" style="margin-bottom: 0;">
|
|
|
|
|
<label class=" panel-form-label fl"> 技能标签:</label>
|
|
|
|
|
<div class="fl task-bd-grey">
|
|
|
|
|
<% if params[:action] == "edit" && @challenge_tags.count > 0 %>
|
|
|
|
|
<% @challenge_tags.each do |tag| %>
|
|
|
|
|
<div class="task-tag tag-grey mt5 mr10 fl">
|
|
|
|
|
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="close_tag(this)">×</button>
|
|
|
|
|
<input class='knowledge_frame' name='knowledge[input][]' value="<%= tag.try(:name)%>" />
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<div class="task-tag tag-grey mt5 mr10 fl <%#= @challenge_tags.count > 0 ? "undis" : "" %>" id="add_shixun_skill">
|
|
|
|
|
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="$('#add_shixun_skill').slideToggle();">×</button>
|
|
|
|
|
<input type="text" class="task-tag-input" onblur="add_tag();" id="shixun_skill_input" placeholder="请输入技能标签" />
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="bor-bottom-greyE"></p>
|
|
|
|
|
<!--技能标签-->
|
|
|
|
|
<div class="panel-form">
|
|
|
|
|
<div id="shixun_form">
|
|
|
|
|
<li class="clearfix" style="margin-bottom: 0;">
|
|
|
|
|
<label class=" panel-form-label fl"> 技能标签:</label>
|
|
|
|
|
<div class="fl task-bd-grey">
|
|
|
|
|
<% if params[:action] == "edit" && @challenge_tags.count > 0 %>
|
|
|
|
|
<% @challenge_tags.each do |tag| %>
|
|
|
|
|
<div class="task-tag tag-grey mt5 mr10 fl">
|
|
|
|
|
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="close_tag(this)">×</button>
|
|
|
|
|
<input class='knowledge_frame' name='knowledge[input][]' value="<%= tag.try(:name)%>" />
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="task-tag tag-grey mt5 mr10 fl <%#= @challenge_tags.count > 0 ? "undis" : "" %>" id="add_shixun_skill">
|
|
|
|
|
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="$('#add_shixun_skill').slideToggle();">×</button>
|
|
|
|
|
<input type="text" class="task-tag-input" onblur="add_tag();" id="shixun_skill_input" placeholder="请输入技能标签" />
|
|
|
|
|
</div>
|
|
|
|
|
<a href="javascript:void(0);" onclick="$('#add_shixun_skill').slideToggle();" id="add_knowledge" style="color: #627bfd;float: left;margin-top: 5px">+添加</a>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<p class="color-red" style="height: 25px;margin-left: 10%"><span id="stage_name_notice" style="display: none;"><i class="fa fa-exclamation-circle color-red mr5"></i>技能标签不能为空</span></p>
|
|
|
|
|
<div class="prop-notice-info mb10" style="margin-left: 10%">
|
|
|
|
|
<ol>
|
|
|
|
|
<li>学员答题正确将获得技能,否则不能获得技能</li>
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="javascript:void(0);" onclick="$('#add_shixun_skill').slideToggle();" id="add_knowledge" style="color: #627bfd;float: left;margin-top: 5px">+添加</a>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<p class="color-red" style="height: 25px;margin-left: 10%"><span id="stage_name_notice" style="display: none;"><i class="fa fa-exclamation-circle color-red mr5"></i>技能标签不能为空</span></p>
|
|
|
|
|
<div class="prop-notice-info mb10" style="margin-left: 10%">
|
|
|
|
|
<ol>
|
|
|
|
|
<% if @st == 0 %>
|
|
|
|
|
<li>学员未参考答案通过了本阶段的评测时将获得技能,否则不能获得技能</li>
|
|
|
|
|
<% else %>
|
|
|
|
|
<li>学员答题正确将获得技能,否则不能获得技能</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<li class="clearfix pr30 pb30">
|
|
|
|
|
<a href="javascript:void(0);" class="task-btn task-btn-green fr" >保存</a>
|
|
|
|
|
<a href="javascript:void(0)" class="task-btn fr mr10" id="skill_cancel">取消</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="clearfix pr30 pb30">
|
|
|
|
|
<a href="javascript:void(0);" class="task-btn task-btn-green fr" >保存</a>
|
|
|
|
|
<a href="javascript:void(0)" class="task-btn fr mr10" id="skill_cancel">取消</a>
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
<script>
|
|
|
|
|
function editor_tigan(){
|
|
|
|
|
taskpass_editormd = editormd("challenge_task_pass", {
|
|
|
|
|
width : "89.6%",
|
|
|
|
|
height : 400,
|
|
|
|
|
syncScrolling : "single",
|
|
|
|
|
//你的lib目录的路径,我这边用JSP做测试的
|
|
|
|
|
path : "/editormd/lib/",
|
|
|
|
|
tex : true,
|
|
|
|
|
autoFocus: false,
|
|
|
|
|
toolbarIcons : function() {
|
|
|
|
|
// Or return editormd.toolbarModes[name]; // full, simple, mini
|
|
|
|
|
// Using "||" set icons align right.
|
|
|
|
|
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ]
|
|
|
|
|
},
|
|
|
|
|
toolbarCustomIcons : {
|
|
|
|
|
testIcon : "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
|
|
|
|
|
testIcon1 : "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
|
|
|
|
|
},
|
|
|
|
|
//这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
|
|
|
|
|
saveHTMLToTextarea : true,
|
|
|
|
|
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
|
|
|
|
|
dialogMaskOpacity : 0.6,
|
|
|
|
|
placeholder: "请输入选择题的题干内容" ,
|
|
|
|
|
imageUpload : true,
|
|
|
|
|
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
|
|
|
|
|
imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>"//url
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//参考答案的编辑器
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
editormd.loadKaTeX(function() {
|
|
|
|
|
var answerMD = editormd.markdownToHTML("tpm_answer_show", {
|
|
|
|
|
htmlDecode: "style,script,iframe", // you can filter tags decode
|
|
|
|
|
taskList: true,
|
|
|
|
|
tex: true, // 默认不解析
|
|
|
|
|
flowChart: true, // 默认不解析
|
|
|
|
|
sequenceDiagram: true // 默认不解析
|
|
|
|
|
});
|
|
|
|
|
editormd.loadKaTeX(function() {
|
|
|
|
|
var answerMD = editormd.markdownToHTML("tpm_answer_show", {
|
|
|
|
|
htmlDecode: "style,script,iframe", // you can filter tags decode
|
|
|
|
|
taskList: true,
|
|
|
|
|
tex: true, // 默认不解析
|
|
|
|
|
flowChart: true, // 默认不解析
|
|
|
|
|
sequenceDiagram: true // 默认不解析
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
//添加单选、多选tab
|
|
|
|
|
$(".addoption-btn").on("click",function(){
|
|
|
|
|
var length= $(".stage-part-2").find(".nav_check_item li").length;
|
|
|
|
|
if(length<11){
|
|
|
|
|
var title=$(this).html();
|
|
|
|
|
if(title.indexOf("多选")>0){//多选
|
|
|
|
|
title="多选题";
|
|
|
|
|
}else{
|
|
|
|
|
title="单选题";
|
|
|
|
|
}
|
|
|
|
|
var li_con=length+".<span>"+title+"</span>";
|
|
|
|
|
var html="<li class=\"fl check_nav\"><a href=\"javascript:void(0)\" class=\"color-black\">"+li_con+"</a></li>";
|
|
|
|
|
$(".stage-part-2").find(".nav_check_item li").removeClass("check_nav");
|
|
|
|
|
$(".stage-part-2").find(".nav_check_item li").eq(length-1).after(html);
|
|
|
|
|
$("#set_content").show();
|
|
|
|
|
$("#task_content").hide();
|
|
|
|
|
}
|
|
|
|
|
editor_tigan();
|
|
|
|
|
})
|
|
|
|
|
//删除单选、多选tab
|
|
|
|
|
$(".deloption-btn").on("click",function(){
|
|
|
|
|
var index=0;
|
|
|
|
|
for(var i=1;i<$(".stage-part-2").find(".nav_check_item li").length;i++){
|
|
|
|
|
var length=$(".stage-part-2").find(".nav_check_item li").length;
|
|
|
|
|
var item=$(".stage-part-2").find(".nav_check_item li");
|
|
|
|
|
if(item.eq(i).hasClass("check_nav")){
|
|
|
|
|
if(length>1){
|
|
|
|
|
item.eq(0).addClass("check_nav");
|
|
|
|
|
item.eq(i).remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i=1;i<$(".stage-part-2").find(".nav_check_item li").length;i++){
|
|
|
|
|
var item=$(".stage-part-2").find(".nav_check_item li");
|
|
|
|
|
item.eq(i).html(i+".<span>"+item.eq(i).find("span").html()+"</span>");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
//第二个ul tab的切换事件
|
|
|
|
|
$(".stage-part-2").find(".nav_check_item li").live("click",function(){
|
|
|
|
|
if($(".nav_check_item li").length>1){
|
|
|
|
|
$(".nav_check_item li").removeClass("check_nav");
|
|
|
|
|
$(this).addClass("check_nav");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
subject_editormd = editormd("challenge_choose_subject", {
|
|
|
|
|
width : "89.6%",
|
|
|
|
|
height : 400,
|
|
|
|
|
syncScrolling : "single",
|
|
|
|
|
//你的lib目录的路径,我这边用JSP做测试的
|
|
|
|
|
path : "/editormd/lib/",
|
|
|
|
|
tex : true,
|
|
|
|
|
autoFocus: false,
|
|
|
|
|
toolbarIcons : function() {
|
|
|
|
|
// Or return editormd.toolbarModes[name]; // full, simple, mini
|
|
|
|
|
// Using "||" set icons align right.
|
|
|
|
|
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ]
|
|
|
|
|
},
|
|
|
|
|
toolbarCustomIcons : {
|
|
|
|
|
testIcon : "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
|
|
|
|
|
testIcon1 : "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
|
|
|
|
|
},
|
|
|
|
|
//这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
|
|
|
|
|
saveHTMLToTextarea : true,
|
|
|
|
|
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
|
|
|
|
|
dialogMaskOpacity : 0.6,
|
|
|
|
|
placeholder: "请输入选择题的题干内容" ,
|
|
|
|
|
imageUpload : true,
|
|
|
|
|
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
|
|
|
|
|
imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>"//url
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
choose_answer_editormd = editormd("challenge_choose_answer", {
|
|
|
|
|
width : "89.6%",
|
|
|
|
|
height : 400,
|
|
|
|
|
syncScrolling : "single",
|
|
|
|
|
//你的lib目录的路径,我这边用JSP做测试的
|
|
|
|
|
path : "/editormd/lib/",
|
|
|
|
|
tex : true,
|
|
|
|
|
autoFocus: false,
|
|
|
|
|
toolbarIcons : function() {
|
|
|
|
|
// Or return editormd.toolbarModes[name]; // full, simple, mini
|
|
|
|
|
// Using "||" set icons align right.
|
|
|
|
|
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ]
|
|
|
|
|
},
|
|
|
|
|
toolbarCustomIcons : {
|
|
|
|
|
testIcon : "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
|
|
|
|
|
testIcon1 : "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
|
|
|
|
|
},
|
|
|
|
|
//这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
|
|
|
|
|
saveHTMLToTextarea : true,
|
|
|
|
|
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
|
|
|
|
|
dialogMaskOpacity : 0.6,
|
|
|
|
|
placeholder: "<%= @type == 0 ? '' : "请输入各个选项的具体解析或其他相关信息" %>",
|
|
|
|
|
imageUpload : true,
|
|
|
|
|
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
|
|
|
|
|
imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>"//url
|
|
|
|
|
});
|
|
|
|
|
/*
|
|
|
|
|
function latex_event(){
|
|
|
|
|
$("#challenge_choose_answer [type=\"latex\"]").bind("click", function(){
|
|
|
|
|
alert(2);
|
|
|
|
|
choose_answer_editormd.cm.replaceSelection("```latex");
|
|
|
|
|
choose_answer_editormd.cm.replaceSelection("\n");
|
|
|
|
|
choose_answer_editormd.cm.replaceSelection("\n");
|
|
|
|
|
choose_answer_editormd.cm.replaceSelection("```");
|
|
|
|
|
var __Cursor = choose_answer_editormd.cm.getDoc().getCursor();
|
|
|
|
|
choose_answer_editormd.cm.setCursor(__Cursor.line-1, 0);
|
|
|
|
|
});
|
|
|
|
|
$("#challenge_choose_answer [type=\"inline\"]").bind("click", function(){
|
|
|
|
|
choose_answer_editormd.cm.replaceSelection("$$$$");
|
|
|
|
|
var __Cursor = choose_answer_editormd.cm.getDoc().getCursor();
|
|
|
|
|
choose_answer_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2);
|
|
|
|
|
choose_answer_editormd.cm.focus();
|
|
|
|
|
});
|
|
|
|
|
$("#challenge_choose_subject [type=\"latex\"]").bind("click", function(){
|
|
|
|
|
alert(1);
|
|
|
|
|
subject_editormd.cm.replaceSelection("```latex");
|
|
|
|
|
subject_editormd.cm.replaceSelection("\n");
|
|
|
|
|
subject_editormd.cm.replaceSelection("\n");
|
|
|
|
|
subject_editormd.cm.replaceSelection("```");
|
|
|
|
|
var __Cursor = subject_editormd.cm.getDoc().getCursor();
|
|
|
|
|
subject_editormd.cm.setCursor(__Cursor.line-1, 0);
|
|
|
|
|
});
|
|
|
|
|
$("#challenge_choose_subject [type=\"inline\"]").bind("click", function(){
|
|
|
|
|
subject_editormd.cm.replaceSelection("$$$$");
|
|
|
|
|
var __Cursor = subject_editormd.cm.getDoc().getCursor();
|
|
|
|
|
subject_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2);
|
|
|
|
|
subject_editormd.cm.focus();
|
|
|
|
|
});
|
|
|
|
|
$("[type=\"inline\"]").attr("title", "行内公式");
|
|
|
|
|
$("[type=\"latex\"]").attr("title", "多行公式");
|
|
|
|
|
}*/
|
|
|
|
|
//技能标签
|
|
|
|
|
var SnSkill = $(".knowledge_frame").length;
|
|
|
|
|
|
|
|
|
|
@ -323,7 +325,7 @@
|
|
|
|
|
$("#current-option").html("请点击正确选项");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//设置选项答案
|
|
|
|
|
function selectchoice(item, st){
|
|
|
|
|
@ -331,7 +333,7 @@
|
|
|
|
|
if($(item).hasClass('check-option-bg')){
|
|
|
|
|
$(item).removeClass('check-option-bg');
|
|
|
|
|
}else{
|
|
|
|
|
if(st == 2){
|
|
|
|
|
if(st == 1){
|
|
|
|
|
//单选
|
|
|
|
|
$(".select-choice").removeClass('check-option-bg');
|
|
|
|
|
$(item).addClass('check-option-bg');
|
|
|
|
|
|