123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 |
- <script src="/js/jquery.datetimepicker.js"></script>
- <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
- <link rel="stylesheet" href="/css/modelCreatePaper.css" />
- <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
- <style>
- #choose-error{color: #FF0000;}
- #examName-error{color: #FF0000;}
- #classIds-error{color: #FF0000;}
- #type-error{color: #FF0000;}
- #markType-error{color: #FF0000;}
- #subject-error,#score-error{color: #FF0000;}
- #examDate{color: #FF0000;}
- .check_subject{margin-right:15px;}
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="page-content">
- <div class="mcp-title">模板组卷</div>
- <form class="saveForm" action="<?php echo Yii::app()->createUrl('zhiliao/createexam')?>" method="post" enctype="multipart/form-data">
- <div class="mcp-main-con">
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">试卷名称</div>
- <div class="mcp-form-detail fl"><input type="text" placeholder="必填" value="<?php if(isset($exam['zl_exam_name'])){echo $exam['zl_exam_name'];}?>" class="test-paper-name" name="examName"></div>
- <div id="examName-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">参考科目</div>
- <div class="mcp-form-detail fl clearfix">
- <?php
- if(isset($subject) && $subject){
- foreach($subject as $key=> $val){
- if(isset($exam['items']) && isset($exam['items'][$key])){
- echo '<label for="k1" class="check_subject mlr5"><input type="checkbox" checked class="subject" name="subject" data="'.$val.'" value="'.$key.'">'.$val.'</label>';
- }else{
- echo '<label for="k1" class="check_subject mlr5"><input type="checkbox" class="subject" name="subject" data="'.$val.'" value="'.$key.'">'.$val.'</label>';
- }
- }
- }
- ?>
- </div>
- <div id="subject-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">考试总分</div>
- <div class="mcp-form-detail fl clearfix subject_scores">
- <?php
- if(isset($exam['items'])){
- foreach ($exam['items'] as $key => $val){
- echo '<label for="k1" class="check_subject mlr5">'.$subject[$key].':<input type="text" style="width:75px;" name="subject_s" id="subject_'.$key.'" value="'.$val.'"></label>';
- }
- }
- ?>
- </div>
- <div id="score-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">选择考试类型</div>
- <div class="mcp-form-detail fl clearfix">
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==1){echo 'select';}?> examType" value="1"></span>
- <span>周考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==2){echo 'select';}?> examType" value="2"></span>
- <span>单元考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==3){echo 'select';}?> examType" value="3"></span>
- <span>月考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==4){echo 'select';}?> examType" value="4"></span>
- <span>联考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==5){echo 'select';}?> examType" value="5"></span>
- <span>期中考试</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==6){echo 'select';}?> examType" value="6"></span>
- <span>期末考试</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==7){echo 'select';}?> examType" value="7"></span>
- <span>模拟考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn <?php if(isset($exam['zl_exam_type']) && $exam['zl_exam_type']==8){echo 'select';}?> examType" value="8"></span>
- <span>冲刺考</span>
- </div>
- </div>
- <div id="type-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">考试班级</div>
- <div class="mcp-form-detail fl">
- <div class="test-classes-desc">(<span class="">单击移除</span>)<span id="classIds-error"></span></div>
- <div class="sel-classes g1" status="1">
- </div>
- <div class="sel-classes g2" style="display: none;" status="0">
- </div>
- <div class="sel-classes g3" style="display: none;" status="0">
- </div>
- <div class="clearfix">
- <div class="grade-sel fl">
- <div class="grade-top">年级</div>
- <ul>
- <li class="active" grade="1">高一</li>
- <li class="" grade="2">高二</li>
- <li class="" grade="3">高三</li>
- </ul>
- </div>
- <div class="bj-sel fl" id="grade1">
- <div class="class-top">班级</div>
- <ul>
-
-
- </ul>
- </div>
- <div class="bj-sel fl" id="grade2" style="display: none;">
- <div class="class-top">班级</div>
- <ul>
- </ul>
- </div>
- <div class="bj-sel fl" id="grade3" style="display: none;">
- <div class="class-top">班级</div>
- <ul>
- </ul>
- </div>
- </div>
- </div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">考试时间</div>
- <div class="mcp-form-detail fl clearfix">
- <input type="text" class='core datetimepicker8' readonly value="<?php if(isset($exam['examDate'])) echo $exam['examDate'] ?>" style="width: 100px;" name="examDate" />
- </div>
- <div id="examDate"></div>
- </div>
-
- </div>
- <input name="type" value="<?php if(isset($exam['zl_exam_type'])){echo $exam['zl_exam_type'];}?>" type="hidden"/>
- <input name="subjects" value="" type="hidden"/>
- <input name="classIds" value="0" type="hidden"/>
- <input name="grade" value="1" type="hidden"/>
- <input name="exam_group_id" value="<?php if(isset($exam_group_id)){echo $exam_group_id;}else{echo 0;}?>" type="hidden"/>
- </form>
- <!--<button id="createThird">确定</button>-->
- <div class="mcp-form-list mcp-fl-btns clearfix">
- <input type="button" value="确定" class="mcp-sure-btn" id="createThird" active="true">
- <input type="button" value="返回" class="mcp-back-btn">
- </div>
- </div>
- </div>
- <script>
- $(document).ready(function(){
- var selectedClassId=[];
- <?php
- if(isset($exam['classes'])){
- foreach ($exam['classes'] as $cid=>$cname){
- echo "selectedClassId.push('".$cid."');";
- }
- }
- ?>
- loadClass();
- $('.datetimepicker8').datetimepicker({
- onGenerate:function( ct ){
- $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
- $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
- },
- format:'Y-m-d',
- formatDate:'Y-m-d',
- minDate:'-1970/01/2',
- maxDate:'+1970/01/2',
- //minDate: '-<?php echo date('Y-m-d', strtotime('Yesterday')); ?>',
- timepicker:false
- });
- //返回
- $('.mcp-back-btn').click(function(){
- location.href="<?php echo Yii::app()->createUrl('zhiliao/index')?>";
- });
-
- $('input[name="examName"]').keydown(function(event){
- $('#examName-error').html("");
- });
- //考试类型
- $('.examType').click(function(){
- var type = $(this).attr('value');
- if(type){
- $('#type-error').html("");
- }
- $('input[name="type"]').val(type);
- });
- //加载班级
- function loadClass(){
- $.post(
- "<?php echo Yii::app()->createUrl('zhiliao/ajaxchangeclasses')?>",
- {'selectedClassId':selectedClassId},
- function(result){
- if(result.error){
- $('#choose-error').html(result.error);
- }else{
- var htmlg1 = "";
- var htmlg2 = "";
- var htmlg3 = "";
- $('.g1').hide();
- $('.g2').hide();
- $('.g3').hide();
- $('.g1').attr('status',0);
- $('.g2').attr('status',0);
- $('.g3').attr('status',0);
- if(result.class_arr_select.length>0){
- $.each(result.class_arr_select,function(k,v){
- if(v.grade == 1){
- htmlg1+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- $('.g1').show();
- $('.g1').attr('status',1);
- $('.grade-sel ul li').eq(0).addClass('active');
- $('.grade-sel ul li').eq(1).removeClass('active');
- $('.grade-sel ul li').eq(2).removeClass('active');
- $('#grade1').show();
- $('#grade2').hide();
- $('#grade3').hide();
- $('input[name=grade]').val(1);
- }
- if(v.grade == 2){
- htmlg2+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- $('.g2').show();
- $('.g2').attr('status',1);
- $('.grade-sel ul li').eq(1).addClass('active');
- $('.grade-sel ul li').eq(0).removeClass('active');
- $('.grade-sel ul li').eq(2).removeClass('active');
- $('#grade1').hide();
- $('#grade2').show();
- $('#grade3').hide();
- $('input[name=grade]').val(2);
- }
- if(v.grade == 3){
- htmlg3+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- $('.g3').show();
- $('.g3').attr('status',1);
- $('.grade-sel ul li').eq(2).addClass('active');
- $('.grade-sel ul li').eq(0).removeClass('active');
- $('.grade-sel ul li').eq(1).removeClass('active');
- $('#grade1').hide();
- $('#grade2').hide();
- $('#grade3').show();
- $('input[name=grade]').val(3);
- }
- });
- }else{
- $('.g1').show();
- $('.g1').attr('status',1);
- }
- $('.g1').html(htmlg1);
- $('.g2').html(htmlg2);
- $('.g3').html(htmlg3);
- var htmlidg1 = "";
- var htmlidg2 = "";
- var htmlidg3 = "";
- $.each(result.class_arr_noselect,function(k,v){
- if(v.grade == 1){
- htmlidg1 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- if(v.grade == 2){
- htmlidg2 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- if(v.grade == 3){
- htmlidg3 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- });
- $('#grade1 ul').html(htmlidg1);
- $('#grade2 ul').html(htmlidg2);
- $('#grade3 ul').html(htmlidg3);
- }
- },
- 'json'
- );
- }
- //切换年级
- $('.a-years,.a-province,.paper-type > span, .grade-sel ul li').click(function(){
- if(!$(this).hasClass('active')){
- $(this).addClass('active').siblings().removeClass('active');
- var gradearr=[1,2,3];
- var grade=$(this).attr("grade");
- $('input[name=grade]').val(grade);
- for(var i=0;i<=gradearr.length;i++){
- if(gradearr[i]==grade){
- $("#grade"+grade).show();
- $('.g'+grade).show();
- $('.g'+grade).attr('status',1);
- }else{
- $("#grade"+gradearr[i]).hide();
- $(".g"+gradearr[i]).hide();
- $(".g"+gradearr[i]).attr('status',0);
- }
- }
- }
- });
- //添加班级
- $(".bj-sel ul").on("click","li", function(){
- $('#classIds-error').html("");
- $(this).find('.judge-sel').addClass('active');
- $(this).remove();
- var grade = $(this).attr('grade');
- $('.g'+grade).append('<span grade="'+$(this).attr("grade")+'" classid="'+$(this).attr("classid")+'">'+$(this).text()+'</span>');
- });
- //移除班级
- $('.sel-classes').delegate('span','click',function(){
- $(this).remove();
- $("#grade"+$(this).attr("grade")).children("ul").append('<li class="bjs-lis" grade="'+$(this).attr("grade")+'" classid="'+$(this).attr("classid")+'"><span class="judge-sel"></span>'+$(this).html()+'</li>');
- });
-
- if ($('.sel-classes > span').length > 0){
- for (var i = 0;i < $('.sel-classes > span').length; i++){
- for (var k = 0;k < $('.bjs-lis').length; k++){
- if ($('.bjs-lis').eq(k).text().trim()==$('.sel-classes > span').eq(i).text().trim()) {
- $('.bjs-lis').eq(k).find('.judge-sel').addClass('active');
- }
- }
- }
- }
- $('.mcp-radio-sel').click(function(){
- if (!$(this).find('.sel-btn').hasClass('select')) {
- $(this).find('.sel-btn').addClass('select');
- $(this).siblings().find('.sel-btn').removeClass('select');
- var type = $(this).find('.examType').attr('value');
- // console.log(type);
- if(type){
- $('#type-error').html("");
- }
- $('input[name="type"]').val(type);
- }
- });
- $('.grade-sel ul li').click(function(){
- $(this).addClass('active').siblings().removeClass('active');
- });
- $('.sel-classes > span').click(function(){
- $(this).remove();
- for (var i = 0;i < $('.bjs-lis').length; i++) {
- if ($('.bjs-lis').eq(i).text().trim()==$(this).text().trim()){
- $('.bjs-lis').eq(i).find('.judge-sel').removeClass('active');
- }
- }
- });
- //选择科目
- $('body').on('click','.subject',function(){
- var subject_id=$(this).val(),
- subject_name=$(this).attr('data');
- HandleSubject(subject_id);
- if($(this).is(":checked")){
- html='<label for="k1" class="check_subject mlr5">'+subject_name+':<input type="text" style="width:75px;" name="subject_s" id="subject_'+subject_id+'" value=""></label>';
- $('.subject_scores').append(html);
- }else{
- $('#subject_'+subject_id).closest('label').remove();
- }
- });
- // 下拉列表模拟
- $('.inp-text').click(function(){
- if ($(this).next().is(':hidden')){
- $(this).next().show();
- } else {
- $(this).next().hide();
- }
- });
- // 点下拉列表选项
- $('.select-con li').click(function(){
- $(this).closest('.select-con').hide();
- $(this).closest('.mcp-form-detail').find('.inp-text').text($(this).text());
- });
- // 点击空白处下拉列表消失
- $(document).click(function(e){
- var targetNode = $(e.target).closest(".inp-text");
- if (targetNode.length>0){
- return;
- }else{
- $(".select-con").hide();
- }
- });
-
-
- $("body").delegate("#createThird[active='true']", "click", function(e) {
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var error = new Array();
- var classIds = $('input[name="classIds"]').val();
- var examName = $('input[name="examName"]').val();
- var type = $('input[name="type"]').val();
- var examDate = $("input[name='examDate']").val();
- if(examName == "" || examName == null){
- $('#examName-error').html('请指定考试名称');
- error.push('没有指定考试名称');
- }else{
- $('#examName-error').html('');
- }
- if(type == "" || type == null){
- $('#type-error').html('请指定考试类型');
- error.push('没有指定考试类型');
- }else{
- $('#type-error').html('');
- }
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- error.push('没有指定考试班级');
- }else{
- $('#classIds-error').html('');
- }
- if (examDate == '') {
- $('#examDate').html('请设置考试日期');
- error.push('请设置考试日期');
- } else if (examDate < '<?php echo date('Y-m-d',(time()-86400*90)); ?>') {
- $('#examDate').html('考试日期设置错误');
- error.push('考试日期设置错误');
- }else{
- $('#examDate').html('');
- }
- //检测科目
- var subjects=[];
- // console.log($('.subject').length);
- for(var i=0;i<$('.subject').length;i++){
- if($('.subject').eq(i).is(":checked")){
- // subjects.push($('input[name=subject]').eq(i).val());
- subject_id=$('.subject').eq(i).val();
- score=$('#subject_'+subject_id).val();
- if(score=='' || isNaN(score)){
- $('#score-error').html('科目分数设置错误');
- error.push('科目分数设置错误');
- break;
- }else{
- subjects.push(subject_id+'///'+score);
- }
- }
- }
- if(subjects.length==0){
- $('#subject-error').html('未选择考试科目或分数设置错误');
- error.push('未选择考试科目或分数设置错误');
- }
- $('input[name=subjects]').val(subjects.join(','));
- if(error.length == 0){
- $(this).attr("active","false");
- $(".saveForm").submit();
- }
-
-
-
- });
- //理综,文综科目选择处理
- function HandleSubject(Subject_id) {
- if($.inArray(Subject_id,['12','13','14','15','16','17','18','19'])!=-1){
- var Arts=$('input[name="subject"]').eq(9);
- var Science=$('input[name="subject"]').eq(10);
- var ArtsStatus=Arts.is(':checked') ;
- var ScienceStatus=Science.is(':checked') ;
- var ArtsSubject=['12','13','14'];
- var ScienceSubject=['15','16','17'];
- for(var i in ArtsSubject){
- if($('input[name="subject"][value='+ArtsSubject[i]+']').is(':checked')==true){
- Arts.attr('disabled',true);
- break;
- }
- Arts.attr('disabled',false);
- }
- for(var i in ScienceSubject){
- if($('input[name="subject"][value='+ScienceSubject[i]+']').is(':checked')==true){
- Science.attr('disabled',true);
- break;
- }
- Science.attr('disabled',false);
- }
- if(Subject_id==18){
- var Artsdisabled=ArtsStatus==true?true:false;
- for(var i in ArtsSubject){
- $('input[name="subject"][value='+ArtsSubject[i]+']').attr('disabled',Artsdisabled);
- }
- }
- if(Subject_id==19){
- var Sciencedisabled=ScienceStatus?true:false;
- for(var i in ScienceSubject){
- $('input[name="subject"][value='+ScienceSubject[i]+']').attr('disabled',Sciencedisabled);
- }
- }
- }
- }
-
- });
- </script>
|