@ -4,35 +4,35 @@
</div>
<div class="task_popup_con mt15 ml30">
<div class="mr15">
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do % >
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl">课堂邀请码:</label>
<input type="text" class="input-60-40 fl" name="invite_code" placeholder="请输入5位课堂邀请码或6位分班邀请码" style="width: 70%;" value="<%= @invitation_code %>">
</li>
<p id="none_invite_code_notice" class="color-orange none f12" style="margin-left: 90px;">请输入5位课堂邀请码或6位分班邀请码</p>
<li class="clearfix ">
<label class="panel-form-label fl">身份:</label>
<span class="fl mr20 mt2">
<form id="new-watcher-form" >
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl">课堂邀请码:</label>
<input type="text" class="input-60-40 fl" name="invite_code" placeholder="请输入5位课堂邀请码或6位分班邀请码" style="width: 70%;" value="<%= @invitation_code %>">
</li>
<p id="none_invite_code_notice" class="color-orange none f12" style="margin-left: 90px;">请输入5位课堂邀请码或6位分班邀请码</p>
<li class="clearfix ">
<label class="panel-form-label fl">身份:</label>
<span class="fl mr20 mt2">
<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml-3 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_9">教师</label>
</span>
<span class="fl mr20 mt2">
<span class="fl mr20 mt2">
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_7">助教</label>
</span>
<span class="fl mr20 mt2">
<span class="fl mr20 mt2">
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_10">学生/参赛者</label>
</span>
</li>
<p id="none_checked_notice" class="color-orange none f12" style="margin-left: 90px;">请至少选择一个身份</p>
<li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_join_course();">确定</a>
</li>
</ul>
<% end % >
</li>
<p id="none_checked_notice" class="color-orange none f12" style="margin-left: 90px;">请至少选择一个身份</p>
<li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_join_course();">确定</a>
</li>
</ul>
</form >
</div>
</div>
</div>
@ -45,10 +45,30 @@
$("#none_invite_code_notice").hide();
if ($("input[name='role[]']:checked").length >= 1){
$("#none_checked_notice").hide();
$('#new-watcher-form').submit();
hideModal();
$.ajax({
url: "/api/courses/apply_to_join_course.json",
type: "post",
dataType: 'json',
data: {
student: $("#join_course_role_10").is(":checked") ? 1 : "",
professor: $("#join_course_role_9").is(":checked") ? 1 : "",
assistant_professor: $("#join_course_role_7").is(":checked") ? 1 : "",
invite_code: $("input[name='invite_code']").val(),
},
success: function(data){
if(data.status == -1){
$("#none_checked_notice").html(data.message).show();
} else if(data.status == 0 && data.message == "成功"){
window.location = "/courses/"+data.course_id+"/students";
} else{
hideModal();
notice_box(data.message);
}
}
});
return;
}else{
$("#none_checked_notice").show();
$("#none_checked_notice").html("请至少选择一个身份"). show();
}
}
}