modify_exam.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <script src="/js/jquery.datetimepicker.js"></script>
  2. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  3. <link rel="stylesheet" href="/css/modelCreatePaper.css" />
  4. <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
  5. <link rel="stylesheet" href="/css/third/paperCard.css" />
  6. <style>
  7. #choose-error{color: #FF0000;}
  8. #examName-error{color: #FF0000;}
  9. #classIds-error{color: #FF0000;}
  10. #type-error{color: #FF0000;}
  11. #markType-error{color: #FF0000;}
  12. #subject-error{color: #FF0000;}
  13. #examDate{color: #FF0000;}
  14. .dialog-information-inquiry{
  15. display: none;
  16. width: 400px;
  17. margin: 0 auto;
  18. border: 1px solid #f1f1f1;
  19. /*box-shadow:4px 4px 10px #7c7c7c;*/
  20. }
  21. .dialog-information-inquiry .title{
  22. padding: 0 16px;
  23. height: 30px;
  24. line-height: 30px;
  25. background-color: #1BBF7B;
  26. }
  27. .dialog-information-inquiry .title .title-text{
  28. font-size: 16px;
  29. color: #fff;
  30. font-weight: 650px;
  31. }
  32. .dialog-information-inquiry .title .title-tag{
  33. display: inline-block;
  34. margin-right: 20px;
  35. margin-top: 10px;
  36. padding: 6px 12px;
  37. height: 16px;
  38. line-height: 16px;
  39. color: #fff;
  40. border: 1px solid #F8F8FA;
  41. border-radius: 4px;
  42. background-color: #1BBF7B;
  43. cursor: pointer;
  44. }
  45. .dialog-information-inquiry .dialog-btn-close{
  46. display: inline-block;
  47. color: #fff;
  48. cursor: pointer;
  49. }
  50. .dialog-information-inquiry .dialog-msg{
  51. margin: 20px 0;
  52. text-align: center;
  53. line-height: 20px;
  54. font-size: 16px;
  55. }
  56. .dialog-information-inquiry .btn-box{
  57. margin-bottom: 28px;
  58. text-align: center;
  59. }
  60. .dialog-information-inquiry .btn-yes{
  61. display: inline-block;
  62. /* padding: 6px 12px; */
  63. height: 30px;
  64. line-height: 30px;
  65. border-radius: 4px;
  66. color: #fff;
  67. cursor: pointer;
  68. background-color: #1BBF7B;
  69. }
  70. </style>
  71. <div class="main-content-inner">
  72. <!-- 导航栏开始-->
  73. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  74. <!-- 导航栏结束-->
  75. <div class="test-data">
  76. <div class="page-content">
  77. <div class="mcp-title">
  78. <span class="active">第1步、考试基本信息</span>
  79. <span><i class="horizontal-line"></i></span>
  80. <span>第2步、关联在线答题卡</span>
  81. </div>
  82. <form class="saveForm">
  83. <div class="mcp-main-con">
  84. <div class="mcp-form-list clearfix">
  85. <div class="mcp-form-menu fl">试卷名称</div>
  86. <div class="mcp-form-detail fl"><input type="text" placeholder="必填" class="test-paper-name" name="examName" value='<?php echo $name?>'></div>
  87. <div id="examName-error"></div>
  88. </div>
  89. <?php if(Yii::app()->params['section']!=0):?>
  90. <div class="mcp-form-list clearfix">
  91. <div class="mcp-form-menu fl">试卷类型</div>
  92. <div class="mcp-form-menu fl">
  93. <div class="mcp-form-detail fl clearfix">
  94. <select name="paperType" class="fl choose-subject" <?php if($examStatus==2){echo 'disabled';}?> >
  95. <?php
  96. if(in_array(Yii::app()->session['session_duoxueke_subject_id'],array(3,6,51))):
  97. ?>
  98. <option value="1050" <?php if($paperType==1050)echo 'selected';?> >全国版</option>
  99. <option value="1051" <?php if($paperType==1051)echo 'selected';?> >江苏版</option>
  100. <?php elseif(!in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19))):?>
  101. <option value="0" <?php if($paperType==0)echo 'selected';?> >全国版</option>
  102. <option value="1" <?php if($paperType==1)echo 'selected';?> >江苏版</option>
  103. <option value="2" <?php if($paperType==2)echo 'selected';?> >浙江版</option>
  104. <option value="1050" <?php if($paperType==1050)echo 'selected';?> >其它</option>
  105. <?php else:?>
  106. <option value="1050" <?php if($paperType==1050)echo 'selected';?> >其它</option>
  107. <?php endif;?>
  108. </select>
  109. </div>
  110. </div>
  111. <div id="subject-error"></div>
  112. </div>
  113. <?php endif;?>
  114. <div class="mcp-form-list clearfix">
  115. <div class="mcp-form-menu fl">考试类型</div>
  116. <div class="mcp-form-detail fl clearfix">
  117. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  118. <span class="sel-btn <?php if($type==1) echo 'select';?> examType" value="1"></span>
  119. <span>周考</span>
  120. </div>
  121. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  122. <span class="sel-btn <?php if($type==2) echo 'select';?> examType" value="2"></span>
  123. <span>单元考</span>
  124. </div>
  125. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  126. <span class="sel-btn <?php if($type==3) echo 'select';?> examType" value="3"></span>
  127. <span>月考</span>
  128. </div>
  129. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  130. <span class="sel-btn <?php if($type==4) echo 'select';?> examType" value="4"></span>
  131. <span>联考</span>
  132. </div>
  133. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  134. <span class="sel-btn <?php if($type==5) echo 'select';?> examType" value="5"></span>
  135. <span>期中考试</span>
  136. </div>
  137. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  138. <span class="sel-btn <?php if($type==6) echo 'select';?> examType" value="6"></span>
  139. <span>期末考试</span>
  140. </div>
  141. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  142. <span class="sel-btn <?php if($type==7) echo 'select';?> examType" value="7"></span>
  143. <span>模拟考</span>
  144. </div>
  145. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  146. <span class="sel-btn <?php if($type==8) echo 'select';?> examType" value="8"></span>
  147. <span>冲刺考</span>
  148. </div>
  149. <div class="clear"></div>
  150. <div class="mcp-radio-sel fl <?php if($examStatus==2){echo 'disabled';}?>">
  151. <span class="sel-btn <?php if($type==9) echo 'select';?> examType" value="9"></span>
  152. <span>测验(适用于非正式考试)</span>
  153. </div>
  154. </div>
  155. <div id="type-error"></div>
  156. </div>
  157. <!--
  158. <div class="mcp-form-list clearfix">
  159. <div class="mcp-form-menu fl">线上阅卷</div>
  160. <div class="mcp-form-detail fl clearfix" id ="markType">
  161. <div class="mcp-radio-sel fl">
  162. <span class="sel-btn <?php if($markType==3) echo 'select';?> markType" value="3"></span>
  163. <span class ="markType" value="3">班级混合阅卷</span>
  164. </div>
  165. <div class="mcp-radio-sel fl">
  166. <span class="sel-btn <?php if($markType==4) echo 'select';?> markType" value="4"></span>
  167. <span class="markType" value="4">班级单独阅卷</span>
  168. </div>
  169. <div id="markType-error"></div>
  170. </div>
  171. </div>
  172. -->
  173. <div class="mcp-form-list clearfix">
  174. <div class="mcp-form-menu fl">考试时间</div>
  175. <div class="mcp-form-detail fl clearfix">
  176. <input type="text" class='core datetimepicker8' <?php if($examStatus==2){echo 'disabled="disabled"';}?> style="width: 100px;" name="examDate" value='<?php echo $examDate?>' />
  177. </div>
  178. <div id="examDate"></div>
  179. </div>
  180. </div>
  181. <input name="examGroupId" value="<?php echo $examGroupId?>" type="hidden"/>
  182. <input name="type" value="<?php echo $type?>" type="hidden"/>
  183. <input name="markType" value="<?php echo $markType?>" type="hidden"/>
  184. <input name="grade" value="<?php echo $grade?>" type="hidden"/>
  185. </form>
  186. <!--<button id="createThird">确定</button>-->
  187. <!-- <div class="mcp-form-list mcp-fl-btns clearfix" style="float: left;padding-left: 150px;">
  188. <input type="button" value="确定" class="mcp-sure-btn" id="createThird" active="true">
  189. <input type="button" value="返回" class="mcp-back-btn">
  190. </div> -->
  191. <div class="template-flag-box">
  192. <a href="javascript:;" id="createThird" active="true">保存并返回</a>
  193. <a href="javascript:;" id="goNextNew" active="true" >保存并下一步</a>
  194. <!-- <a href="javascript:;" id="goNext" active="true">保存并下一步</a> -->
  195. <!-- <a href="javascript:;" id="goNextNew" active="true" style="width:140px">保存并下一步(新版)</a> -->
  196. <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
  197. <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
  198. </div>
  199. </div>
  200. </div>
  201. <div class="relation-answer-card">
  202. <div class="page-content">
  203. <div class="mcp-title">
  204. <span >第1步、考试基本信息</span>
  205. <span><i class="horizontal-line"></i></span>
  206. <span class="active">第2步、关联在线答题卡</span>
  207. </div>
  208. <!-- 新版本右侧答题卡 -->
  209. <div class="hgc_leftContent">
  210. <div class="module">
  211. <h2>
  212. <span>当前答题卡</span>
  213. <span class="theme notice">新版本,无需切割模板,可通过扫描入口直接扫描</span>
  214. </h2>
  215. <div class="contentInfo">
  216. <div class="opratorBnts">
  217. <span class="theme" id="saveMyTpl">保存为我的模版</span>
  218. <span class="theme" id="downLoadPdfBtn">下载答题卡</span>
  219. <span class="theme" id="editMyTpl">修改答题卡>></span>
  220. </div>
  221. <div class="subjectInfo">
  222. <div class="infoItem">
  223. <em>基本信息:</em>
  224. <div class="info">
  225. <p>
  226. <span>板式:A3-横版-三栏</span>
  227. <span>考号:填涂(10位)</span>
  228. <span>装订线:有</span>
  229. <span>总分:150分</span>
  230. <span>题量:50</span>
  231. </p>
  232. </div>
  233. </div>
  234. <div class="infoItem">
  235. <em>题目信息:</em>
  236. <div class="info">
  237. <p>
  238. <span>一、单项填空</span>
  239. <span>单选</span>
  240. <span>20题</span>
  241. <span>共20分</span>
  242. </p>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. <div class="contentNoInfo">
  248. <!-- <img src="" alt=""> -->
  249. <span>未创建答题卡</span>
  250. <div class="hbtn">创建在线答题卡</div>
  251. </div>
  252. </div>
  253. <div class="module">
  254. <h2>
  255. <span>我的模版(<em id="tplLength">0</em>)</span>
  256. </h2>
  257. <div class="tplBox">
  258. <div class="leftBtn btnItem"></div>
  259. <div class="tplCut">
  260. <div class="tplList">
  261. </div>
  262. <p id="tplListMsg" style="text-align: center;">暂未保存模板</p>
  263. </div>
  264. <div class="rightBtn btnItem"></div>
  265. </div>
  266. </div>
  267. </div>
  268. <div class="template-flag-box">
  269. <a href="javascript:;" id="createThirdCard" active="true">保存并返回</a>
  270. <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
  271. </div>
  272. </div>
  273. </div>
  274. <div class="dialog-information-inquiry">
  275. <div class="title clearfix">
  276. <span class="title-text fl">提示</span>
  277. <span class="dialog-btn-close fr">X</span>
  278. </div>
  279. <div class="content-box clearfix">
  280. <p class="dialog-msg">在线答题卡版本已更新,不支持查看历史数据,如有问题,请联系技术支持</p>
  281. <div class="btn-box">
  282. <span class="btn-yes dialog-btn-close">知道了</span>
  283. </div>
  284. </div>
  285. </div>
  286. </div>
  287. <script>
  288. var hasThirdCard=0,hasOnlineCard=0;
  289. var subjectId=<?php echo Yii::app()->session['session_duoxueke_subject_id'] ?>;
  290. var grade = <?php echo $grade?>;
  291. <?php
  292. if(isset($answerSheet) && $answerSheet==1){
  293. echo 'hasThirdCard=1;';
  294. }
  295. if(isset($onlineCard) && $onlineCard==1){
  296. echo 'hasOnlineCard=1;';
  297. }
  298. ?>
  299. var examStatus = <?php echo json_encode($examStatus); ?>;
  300. localStorage.setItem('examStatus',examStatus)
  301. // var exam_group_id = 0;
  302. var locationUrl = window.location.href;
  303. var isCardReturn = locationUrl.indexOf('isCardReturn')
  304. // if(isCardReturn==-1){
  305. // var reg2 = /([^exam_group_id/]+)$/;
  306. // exam_group_id = locationUrl.match(reg2)[1];
  307. // }
  308. function isReturn(){
  309. // var isCardReturn = localStorage.getItem('isCardReturn');
  310. // var isCardReturn = ~document.referrer.indexOf('online/third');
  311. // if(document.referrer.length<1){
  312. // isCardReturn = true;
  313. // }
  314. if(isCardReturn>-1){
  315. $('.test-data').hide();
  316. $('.relation-answer-card').show();
  317. saveFormData = JSON.parse(localStorage.getItem('testFormData'));
  318. }else{
  319. localStorage.setItem('referrerUrl',JSON.stringify(locationUrl));
  320. }
  321. }
  322. isReturn();
  323. $(document).ready(function(){
  324. var saveFormData ="";
  325. $('.datetimepicker8').datetimepicker({
  326. onGenerate:function( ct ){
  327. $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
  328. $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
  329. },
  330. format:'Y-m-d',
  331. formatDate:'Y-m-d',
  332. minDate:'-1970/01/2',
  333. maxDate:'+1970/01/2',
  334. //minDate: '-<?php echo date('Y-m-d', strtotime('Yesterday')); ?>',
  335. timepicker:false
  336. });
  337. //选择考试时间
  338. //返回
  339. $('.mcp-back-btn').click(function(){
  340. location.href="<?php echo Yii::app()->createUrl('third/index')?>";
  341. });
  342. $('input[name="examName"]').keydown(function(event){
  343. $('#examName-error').html("");
  344. });
  345. //阅卷方式
  346. $('.markType').click(function(){
  347. var markType = $(this).attr('value');
  348. if(markType){
  349. $('#markType-error').html("");
  350. }
  351. $('input[name="markType"]').val(markType);
  352. });
  353. //考试类型
  354. $('.examType').click(function(){
  355. var type = $(this).attr('value');
  356. if(type){
  357. $('#type-error').html("");
  358. }
  359. $('input[name="type"]').val(type);
  360. });
  361. if ($('.sel-classes > span').length > 0){
  362. for (var i = 0;i < $('.sel-classes > span').length; i++){
  363. for (var k = 0;k < $('.bjs-lis').length; k++){
  364. if ($('.bjs-lis').eq(k).text().trim()==$('.sel-classes > span').eq(i).text().trim()) {
  365. $('.bjs-lis').eq(k).find('.judge-sel').addClass('active');
  366. }
  367. }
  368. }
  369. }
  370. $('.mcp-radio-sel').click(function(){
  371. if (!$(this).find('.sel-btn').hasClass('select') && !$(this).hasClass('disabled')) {
  372. $(this).find('.sel-btn').addClass('select');
  373. $(this).siblings().find('.sel-btn').removeClass('select');
  374. }
  375. });
  376. $('.grade-sel ul li').click(function(){
  377. $(this).addClass('active').siblings().removeClass('active');
  378. });
  379. // $('.judge-sel').on('click',function(){
  380. // alert(1);
  381. // if (!$(this).hasClass('active')) {
  382. // $(this).addClass('active');
  383. // $('.sel-classes').append('<span>'+$(this).closest('.bjs-lis').text()+'</span>');
  384. // } else {
  385. // $(this).removeClass('active');
  386. // for (var i = 0;i < $('.sel-classes > span').length; i++) {
  387. // console.log($('.sel-classes > span').eq(i).text());
  388. // if ($('.sel-classes > span').eq(i).text().trim() == $(this).closest('.bjs-lis').text().trim()){
  389. // $('.sel-classes > span').eq(i).remove();
  390. // }
  391. // }
  392. // }
  393. // });
  394. $('.sel-classes > span').click(function(){
  395. $(this).remove();
  396. for (var i = 0;i < $('.bjs-lis').length; i++) {
  397. if ($('.bjs-lis').eq(i).text().trim()==$(this).text().trim()){
  398. $('.bjs-lis').eq(i).find('.judge-sel').removeClass('active');
  399. }
  400. }
  401. });
  402. // 下拉列表模拟
  403. $('.inp-text').click(function(){
  404. if ($(this).next().is(':hidden')){
  405. $(this).next().show();
  406. } else {
  407. $(this).next().hide();
  408. }
  409. });
  410. // 点下拉列表选项
  411. $('.select-con li').click(function(){
  412. $(this).closest('.select-con').hide();
  413. $(this).closest('.mcp-form-detail').find('.inp-text').text($(this).text());
  414. });
  415. // 点击空白处下拉列表消失
  416. $(document).click(function(e){
  417. var targetNode = $(e.target).closest(".inp-text");
  418. if (targetNode.length>0){
  419. return;
  420. }else{
  421. $(".select-con").hide();
  422. }
  423. });
  424. function saveEditThirdForm(e,btnType){
  425. var error = new Array();
  426. var examName = $('input[name="examName"]').val();
  427. var type = $('input[name="type"]').val();
  428. // var markType = $("#markType").find(".select").attr("value");
  429. var examDate = $("input[name='examDate']").val();
  430. if(examName == "" || examName == null){
  431. $('#examName-error').html('请指定考试名称');
  432. error.push('没有指定考试名称');
  433. }else{
  434. $('#examName-error').html('');
  435. }
  436. if(type == "" || type == null){
  437. $('#type-error').html('请指定考试类型');
  438. error.push('没有指定考试类型');
  439. }else{
  440. $('#type-error').html('');
  441. }
  442. if (examDate == '') {
  443. $('#examDate').html('请设置考试日期');
  444. error.push('请设置考试日期');
  445. } else{
  446. $('#examDate').html('');
  447. }
  448. if(error.length == 0){
  449. $(e.target).attr("active","false");
  450. saveFormData = {
  451. examName:examName,
  452. paperType:$('select[name="paperType"]').val(),
  453. examDate:examDate,
  454. examGroupId:$('input[name="examGroupId"]').val(),
  455. type:type,
  456. // markType:markType,
  457. }
  458. var formData = new FormData();
  459. for(var k in saveFormData){
  460. formData.append(k,saveFormData[k])
  461. }
  462. $.ajax({
  463. url:"<?php echo Yii::app()->createUrl('third/ajaxModifyThirdExam')?>",
  464. method: 'POST',
  465. processData: false,
  466. contentType: false,
  467. dataType: 'json',
  468. data: formData,
  469. success: function (data) {
  470. if(data.success ==1){
  471. saveFormData.hasThirdCard = hasThirdCard;
  472. saveFormData.hasOnlineCard = hasOnlineCard;
  473. saveFormData.grade = grade;
  474. saveFormData.subjectId = subjectId;
  475. saveFormData.referrerUrl = locationUrl;
  476. localStorage.setItem('testFormData',JSON.stringify(saveFormData));
  477. if(btnType===1){
  478. goBack();
  479. }else if(btnType===2){
  480. $('.test-data').hide();
  481. $('.relation-answer-card').show();
  482. }else if(btnType===3){
  483. // location.href = '/index.php/third/thirdCardSecond?isThird=1'
  484. location.href = '/index.php/online/answersheetList/examGroupId/'+saveFormData.examGroupId+'?isThird=1&examGroupId='+saveFormData.examGroupId
  485. }
  486. }else{
  487. if(data.info){
  488. layer.msg(data.info);
  489. }else if(data.msg){
  490. layer.msg(data.msg);
  491. }
  492. $(e.target).attr("active","true");
  493. }
  494. }
  495. })
  496. // $(".saveForm").submit();
  497. }
  498. }
  499. function goBack(){
  500. //location.href = '/index.php/third/index'
  501. window.history.back();
  502. }
  503. $("body").delegate("#createThird[active='true']", "click", function(e) {
  504. // console.log($(".saveForm").serialize())
  505. $('#createThird').attr('active',false);
  506. $('#goNext').attr('active',false);
  507. $('#goNextNew').attr('active',false);
  508. saveEditThirdForm(e,1);
  509. });
  510. //保存并关联答题卡
  511. $("body").delegate("#goNext[active='true']", "click", function(e) {
  512. $('#createThird').attr('active',false);
  513. $('#goNext').attr('active',false);
  514. $('#goNextNew').attr('active',false);
  515. saveEditThirdForm(e,2);
  516. });
  517. //保存并关联答题卡新版
  518. $("body").delegate("#goNextNew[active='true']", "click", function(e) {
  519. var savePrintInfoData = localStorage.getItem('savePrintInfo')!=undefined? JSON.parse(localStorage.getItem('savePrintInfo')):{}
  520. $('#createThird').attr('active',false);
  521. $('#goNext').attr('active',false);
  522. $('#goNextNew').attr('active',false);
  523. if(savePrintInfoData.position&&savePrintInfoData.online_card_version != '3.0.0'){
  524. layer.open({
  525. title: false,
  526. closeBtn: 0,
  527. type: 1,
  528. area: ['400px', '170px'],
  529. offset: '100px',
  530. content: $(".dialog-information-inquiry")
  531. });
  532. }else{
  533. saveEditThirdForm(e,3);
  534. }
  535. });
  536. //关闭弹窗
  537. $(".dialog-btn-close").on("click", function() {
  538. layer.close(layer.index);
  539. });
  540. //取消并返回
  541. $("body").delegate("#goBack[active='true']", "click", function(e) {
  542. goBack();
  543. });
  544. });
  545. </script>
  546. <script src="/js/third/submit.js"></script>