123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590 |
- <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" />
- <link rel="stylesheet" href="/css/third/paperCard.css" />
- <style>
- #choose-error{color: #FF0000;}
- #examName-error{color: #FF0000;}
- #classIds-error{color: #FF0000;}
- #type-error{color: #FF0000;}
- #markType-error{color: #FF0000;}
- #subject-error{color: #FF0000;}
- #examDate{color: #FF0000;}
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="test-data">
- <div class="page-content">
- <div class="mcp-title">
- <span class="active">第1步、考试基本信息</span>
- <span><i class="horizontal-line"></i></span>
- <span>第2步、关联在线答题卡</span>
- </div>
- <form class="saveForm">
- <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="必填" 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">
- <select name="textbookId" id="textbookId" class="fl choose-subject choose-book">
- <option value="0">请选择教材</option>
- <?php
- if($textbookTree){
- foreach ($textbookTree as $item){
- echo '<option value="'.$item['textbook_id'].'">'.$item['textbook_name'].'</option>';
- }
- }
- ?>
- </select>
- </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">
- <div class="mcp-radio-sel fl">
- <span class="sel-btn select examType" value="1"></span>
- <span>周考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="2"></span>
- <span>单元考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="3"></span>
- <span>月考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="4"></span>
- <span>联考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="5"></span>
- <span>期中考试</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="6"></span>
- <span>期末考试</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="7"></span>
- <span>模拟考</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="8"></span>
- <span>冲刺考</span>
- </div>
- <div class="clear"></div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn examType" value="9"></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="inp-text pointer">选择阅卷员</div>
- <ul class="select-con tac" style="max-height: 300px;overflow: auto">
- <?php foreach($teacher_arr as $t):?>
- <li class="sel-option pointer" id="<?php echo $t['teacher_id']?>"><?php echo $t['teacher_name']?></li>
- <?php endforeach;?>
- </ul>
- </div>
- <div id="choose-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>
- <?php
- if(isset(Yii::app()->params['grade_config'])){
- $first=true;
- foreach (Yii::app()->params['grade_config'] as $id =>$item){
- if($first){
- $first=false;
- echo '<div class="sel-classes g'.$id.'" status="1"></div>';
- }else{
- echo '<div class="sel-classes g'.$id.'" style="display: none;" status="0"></div>';
- }
- }
- }
- ?>
- <div class="clearfix">
- <div class="grade-sel fl">
- <div class="grade-top">年级</div>
- <ul>
- <?php
- if(isset(Yii::app()->params['grade_config'])){
- foreach (Yii::app()->params['grade_config'] as $id =>$item){
- echo '<li grade="'.$id.'">'.$item['grade_name'].'</li>';
- }
- }
- ?>
- </ul>
- </div>
- <?php
- if(isset(Yii::app()->params['grade_config'])){
- $first=true;
- foreach (Yii::app()->params['grade_config'] as $id =>$item){
- if($first){
- $first=false;
- echo '<div class="bj-sel fl" id="grade'.$id.'">';
- echo '<div class="class-top">班级</div>';
- echo '<ul></ul>';
- echo '</div>';
- }else{
- echo '<div class="bj-sel fl" id="grade'.$id.'" style="display: none;">';
- echo '<div class="class-top">班级</div>';
- echo '<ul></ul>';
- echo '</div>';
- }
- }
- }
- ?>
- </div>
- </div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">阅卷方式</div>
- <div class="mcp-form-detail fl clearfix" id ="markType">
- <div class="mcp-radio-sel fl">
- <span class="sel-btn select markType" value="3"></span>
- <span class ="markType" value="3">班级混合阅卷</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn markType" value="4"></span>
- <span class="markType" value="4">班级单独阅卷</span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn markType" value="0"></span>
- <span class="markType" value="0">线下阅卷(暂只支持在线答题卡)</span>
- </div>
- <div id="markType-error"></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' style="width: 100px;" name="examDate" />
- </div>
- <div id="examDate"></div>
- </div>
- </div>
- <input name="type" value="1" type="hidden"/>
- <input name="teacherId" value="0" type="hidden"/>
- <input name="markType" value="3" type="hidden"/>
- <input name="classIds" value="0" type="hidden"/>
- <input name="subjectId" value="<?php echo Yii::app()->session['session_duoxueke_subject_id'];?>" type="hidden"/>
- <input name="tplIndex" value="1050" 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-sure-btn" active="true">
- <input type="button" value="返回" class="mcp-back-btn" >
- </div> -->
- <div class="template-flag-box">
- <a href="javascript:;" id="createThird" active="true">保存并返回</a>
- <!-- <a href="javascript:;" id="goNext" active="true">保存并下一步</a> -->
- <a href="javascript:;" id="goNextNew" active="true">保存并下一步</a>
- <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
- <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
- </div>
- </div>
- </div>
- </div>
- <script>
- $(document).ready(function(){
- var gradeArr=[];
- <?php
- if(Yii::app()->params['grade_list']){
- foreach (Yii::app()->params['grade_list'] as $param){
- echo "gradeArr.push('".$param['id']."');";
- }
- }
- ?>
- var teacher_name = '';
- var islocal = ~location.href.indexOf('xg.com');
- var baseUrl = '';
- if(islocal){
- // baseUrl ='http://192.168.1.51/index.php'
- baseUrl ='/index.php'
- }else {
- baseUrl =''
- }
- var saveFormData ="";
- function isReturn(){
- // var isCardReturn = localStorage.getItem('isCardReturn');
- // var isCardReturn = ~document.referrer.indexOf('online/third');
- var locationUrl = window.location.href;
- let isCardReturn = locationUrl.indexOf('isCardReturn')
- if(isCardReturn>-1){
- $('.test-data').hide();
- $('.relation-answer-card').show();
- saveFormData = JSON.parse(localStorage.getItem('testFormData'));
- }else{
- var locationUrl = window.location.href;
- localStorage.setItem('referrerUrl',JSON.stringify(locationUrl));
- }
- }
- isReturn();
- $('.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('third/index')?>";
- });
- $('input[name="examName"]').keydown(function(event){
- $('#examName-error').html("");
- });
- //阅卷方式
- $('.markType').click(function(){
- var markType = $(this).attr('value');
- if(markType){
- $('#markType-error').html("");
- }
- $('input[name="markType"]').val(markType);
- });
- //考试类型
- $('.examType').click(function(){
- var type = $(this).attr('value');
- if(type){
- $('#type-error').html("");
- }
- $('input[name="type"]').val(type);
- });
- //选择教师
- $('.sel-option').click(function(){
- var teacher_id = $(this).attr('id');
- teacher_name = $(this).text();
- if(teacher_id){
- $('#choose-error').html("");
- }
- $('input[name="teacherId"]').val(teacher_id);
- $.post(
- "<?php echo Yii::app()->createUrl('third/ajaxchangeclasses')?>",
- {teacher_id:teacher_id},
- function(result){
- if(result.error){
- $('#choose-error').html(result.error);
- }else{
- $.each(result.class_arr_select,function(k,v){
- $('.g'+v.grade).html($('.g'+v.grade).html()+"<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>");
- });
- $.each(result.class_arr_noselect,function(k,v){
- $('#grade'+v.grade+' ul').html($('#grade'+v.grade+' ul').html()+'<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>');
- });
- }
- },
- '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 grade=$(this).attr("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');
- }
- });
- $('.grade-sel ul li').click(function(){
- $(this).addClass('active').siblings().removeClass('active');
- });
- // $('.judge-sel').on('click',function(){
- // alert(1);
- // if (!$(this).hasClass('active')) {
- // $(this).addClass('active');
- // $('.sel-classes').append('<span>'+$(this).closest('.bjs-lis').text()+'</span>');
- // } else {
- // $(this).removeClass('active');
- // for (var i = 0;i < $('.sel-classes > span').length; i++) {
- // console.log($('.sel-classes > span').eq(i).text());
- // if ($('.sel-classes > span').eq(i).text().trim() == $(this).closest('.bjs-lis').text().trim()){
- // $('.sel-classes > span').eq(i).remove();
- // }
- // }
- // }
- // });
- $('.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');
- }
- }
- });
- // 下拉列表模拟
- $('.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();
- }
- });
- function saveThirdForm(e,btnType) {
- 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 teacherId = $('input[name="teacherId"]').val();
- var markType = $("#markType").find(".select").attr("value");
- var subjectId = $('input[name=subjectId]').val();
- var examDate = $("input[name='examDate']").val();
- var textbookId = $("#textbookId").val();
- if(examName == "" || examName == null){
- $('#examName-error').html('请指定考试名称');
- error.push('没有指定考试名称');
- }else{
- $('#examName-error').html('');
- }
- if(textbookId == 0 || textbookId == null){
- $('#subject-error').html('请选择教材版本');
- error.push('请选择教材版本');
- }else{
- $('#examName-error').html('');
- }
- if(type == "" || type == null){
- $('#type-error').html('请指定考试类型');
- error.push('没有指定考试类型');
- }else{
- $('#type-error').html('');
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- error.push('没有指定阅卷老师');
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- error.push('没有指定考试班级');
- }else{
- $('#classIds-error').html('');
- }
- }
- if(!markType){
- $('#markType-error').html('请指定阅卷方式');
- error.push('没有指定阅卷方式');
- }else{
- $('#markType-error').html('');
- }
- if (examDate == '') {
- $('#examDate').html('请设置考试日期');
- error.push('请设置考试日期');
- } else if (examDate < '<?php echo date('Y-m-d'); ?>') {
- // $('#examDate').html('考试日期设置错误');
- // error.push('考试日期设置错误');
- }else{
- $('#examDate').html('');
- }
- console.log(error);
- if(error.length == 0){
- // debugger
- $(e.target).attr("active","false");
- saveFormData = {
- examName:examName,
- subjectId:subjectId,
- textbookId:$('select[name="textbookId"]').val(),
- tpl_index:$('input[name="tplIndex"]').val(),
- examDate:examDate,
- type:type,
- teacherId:teacherId,
- markType:markType,
- classIds:classIds,
- };
- localStorage.setItem('testFormData',JSON.stringify(saveFormData))
- var formData = new FormData();
- for(var k in saveFormData){
- formData.append(k,saveFormData[k])
- }
- $.ajax({
- url:'<?php echo $this->createUrl('third/createthirdForNext')?>',
- method: 'POST',
- processData: false,
- contentType: false,
- dataType: 'json',
- data: formData,
- success: function (data) {
- if(data.status ==1){
- saveFormData.examGroupId = data.examGroupId;
- saveFormData.teacher_name = teacher_name;
- var addGrade = 0;
- $('.grade-sel ul li').each(function(){
- if($(this).hasClass('active')){
- addGrade = $(this).attr('grade')
- }
- })
- saveFormData.grade = addGrade;
- localStorage.setItem('testFormData',JSON.stringify(saveFormData));
- if(btnType===1){
- goBack();
- }else if(btnType===2){
- $('.test-data').hide();
- $('.relation-answer-card').show();
- }else if(btnType===3){
- // location.href = '/index.php/third/thirdCardSecond'
- location.href = '/index.php/online/answersheetList/examGroupId/'+saveFormData.examGroupId+'?isThird=1&examGroupId='+saveFormData.examGroupId
- }
- }else{
- if(data.info){
- layer.msg(data.info);
- }else{
- if(data.msg){
- layer.msg(data.msg);
- }
- //
- }
- $(e.target).attr("active","true");
- }
- }
- })
- }
- }
- function goBack(){
- location.href = '/index.php/third/index'
- }
- //保存并返回
- $("body").delegate("#createThird[active='true']", "click", function(e) {
- console.log('111');
- saveThirdForm(e,1);
- });
- //保存并关联答题卡
- $("body").delegate("#goNext[active='true']", "click", function(e) {
- saveThirdForm(e,2);
- });
- //保存并关联答题卡
- $("body").delegate("#goNextNew[active='true']", "click", function(e) {
- saveThirdForm(e,3);
- });
- //取消并返回
- $("body").delegate("#goBack[active='true']", "click", function(e) {
- localStorage.setItem('isCardReturn',0)
- goBack();
- });
- });
- </script>
- <script src="/js/third/submit.js"></script>
|