|
- /**
- * Created by cxt on 2016/12/21.
- */
-
- //提交新建竞赛
- function submit_new_contest()
- {
- if(regex_contest_name('new'))
- {
- $("#new_contest").submit();
- }
- }
-
- //验证课程名称
- function regex_contest_name(str)
- {
- var name = $.trim($("#"+str+"_course_name").val());
- if(name.length < 2)
- {
- $("#"+str+"_course_name_notice").show();
- return false;
- }
- else
- {
- $("#"+str+"_course_name_notice").hide();
- return true;
- }
- }
-
- // 公开作品弹框
- function alert_open_contestant_works(url, is_open){
- if(is_open){
- var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">取消公开作品</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
- '<div class="clear mt15"><p class="text_c f14 fontGrey7">本次题目的全部作品将不对未加入本竞赛的用户开放<br/>是否确定取消公开作品</p><div class="cl"></div>'+
- '<a href="'+ url + '" class="fr sy_btn_blue mt10" style="margin-right: 142px;" data-remote="true">确定</a>'+
- '<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
- }else{
- var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">公开作品</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
- '<div class="clear mt15"><p class="text_c f14 fontGrey7">本次题目的全部作品将对Trustie平台所有注册用户开放<br/>是否确定公开作品</p><div class="cl"></div>'+
- '<a href="'+ url + '" class="fr sy_btn_blue mt10" style="margin-right: 142px;" data-remote="true">确定</a>'+
- '<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
- }
- pop_box_new(htmlvalue, 400, 160);
- }
-
- //提交匿评参数设置
- function submit_set_score_rule(end_time){
- if($("#online_evaluation").is(":checked")){
- if(!regex_evaluation_start(end_time)){
- $("#evaluation_start_time").focus();
- }
- else if(!regex_evaluation_end()){
- $("#evaluation_end_time").focus();
- }
- else if($("#limit").is(":checked")){
- if(!regex_evaluation_num()){
- $("#evaluation_num").focus();
- }
- else{
- $('#muban_popup_box form').submit();
- hideModal();
- }
- }
- else{
- $('#muban_popup_box form').submit();
- hideModal();
- }
- }
- else{
- $('#muban_popup_box form').submit();
- hideModal();
- }
- }
-
- //验证匿评开启时间:大于截止时间,或者为空
- function regex_evaluation_start(end_time){
- var evaluation_start = $.trim($("#evaluation_start_time").val());
- if(evaluation_start == ""){
- $("#homework_evaluation_start_time").text("开启评审日期不能为空");
- return false;
- }
- var end_time = new Date(end_time);
- var evaluation_start_time = new Date(evaluation_start);
- if(evaluation_start_time > end_time){
- $("#homework_evaluation_start_time").text("");
- return true;
- }else{
- $("#homework_evaluation_start_time").text("开启评审日期必须大于截止日期");
- return false;
- }
- }
-
- //验证匿评结束时间:大于匿评开启时间,或者为空。当匿评开启时间为空时,匿评结束时间必须为空
- function regex_evaluation_end(){
- var evaluation_start = $.trim($("#evaluation_start_time").val());
- var evaluation_end = $.trim($("#evaluation_end_time").val());
- if(evaluation_end == ""){
- $("#homework_evaluation_end_time").text("关闭评审日期不能为空");
- return true;
- }
- var evaluation_start_time = new Date(evaluation_start);
- var evaluation_end_time = new Date(evaluation_end);
- if(evaluation_end_time >= evaluation_start_time){
- $("#homework_evaluation_end_time").text("");
- return true;
- }else{
- $("#homework_evaluation_end_time").text("关闭评审日期不能小于开启评审日期");
- return false;
- }
- }
-
-
-
- //验证匿评数量
- function regex_evaluation_num(){
- var evaluation_num = $.trim($("#evaluation_num").val());
- var regex = /^\d+$/;
- if(evaluation_num==""){
- $("#evaluation_num_notice").text("评审人数不能为空");
- return false;
- }
- else if(regex.test(evaluation_num)){
- if($("#score_valid").is(":checked")){
- if(evaluation_num <= 2){
- $("#evaluation_num_notice").html("最高分和最低分无效时,作品评审人数必须大于2");
- return true;
- }else{
- $("#evaluation_num_notice").html("");
- return true;
- }
- }else{
- if(evaluation_num > 0){
- $("#evaluation_num_notice").html("");
- return true;
- }
- else{
- $("#evaluation_num_notice").text("评审人数必须为大于0");
- return false;
- }
- }
- }
- else{
- $("#evaluation_num_notice").text("评审人数只能为正整数");
- return false;
- }
- }
-
- //留言
- function contest_jour_submit(){
- if(jourReplyVerify()){
- jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
- $("#contest_feedback_new").submit();
- }
- }
-
- function jourReplyVerify() {
- var content = jour_content_editor.html();//$.trim($("#message_content").val());
- if (jour_content_editor.isEmpty()) {
- $("#jour_content_span").text("留言不能为空");
- $("#jour_content_span").css('color', '#ff0000');
- $("#jour_content_span").show();
- $("#submit_feedback_user").one('click',function() {
- contest_jour_submit();
- });
- return false;
- }
- else {
- $("#jour_content_span").text("填写正确");
- $("#jour_content_span").css('color', '#008000');
- return true;
- }
- }
-
- function cancel_jour_submit(){
- jour_content_editor.html("");
- $("#jour_content_span").text("");
- $("#jour_content_span").hide();
- }
|