thirdview.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  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. <link type="text/css" rel="stylesheet" href="/js/select/select2.min.css" />
  7. <link rel="stylesheet" href="/css/alert.css"/>
  8. <script src="/js/select/select2.min.js"></script>
  9. <style>
  10. #choose-error{color: #FF0000;}
  11. #examName-error{color: #FF0000;}
  12. #classIds-error{color: #FF0000;}
  13. #type-error{color: #FF0000;}
  14. #markType-error{color: #FF0000;}
  15. #subject-error{color: #FF0000;}
  16. #examDate{color: #FF0000;}
  17. .class-box{
  18. width: 500px;
  19. }
  20. .class-box>p{
  21. margin-bottom: 10px;
  22. }
  23. .class-box>ul{
  24. width: 500px;
  25. height: 200px;
  26. padding: 10px 20px;
  27. background-color: #FAFAFA;
  28. box-sizing: border-box;
  29. border:1px solid #ddd;
  30. }
  31. .class-box>ul>li{
  32. float: left;
  33. margin-right: 15px;
  34. margin-bottom: 10px;
  35. cursor: pointer;
  36. }
  37. .class-box>ul>li>img{
  38. vertical-align: middle;
  39. margin-left: 3px;
  40. }
  41. .class-modal-body{margin-bottom:15px;}
  42. #gradeTxt{display:inline-block;border-left:2px solid #2677ff;padding-left:10px;}
  43. .class_right{
  44. width:650px;
  45. }
  46. .class_area li{
  47. width:185px;
  48. height:30px;
  49. line-height: 30px;
  50. text-align: center;
  51. border:1px solid #ccc;
  52. margin:5px;
  53. border-radius: 3px;
  54. cursor:pointer
  55. }
  56. .class_area li.active{
  57. color:#fff;
  58. background: #2977ff;
  59. cursor:pointer
  60. }
  61. .selected-box{overflow:auto}
  62. </style>
  63. <div class="main-content-inner">
  64. <!-- 导航栏开始-->
  65. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  66. <!-- 导航栏结束-->
  67. <div class="test-data">
  68. <div class="page-content">
  69. <div class="mcp-title">
  70. <span class="active">第1步、考试基本信息</span>
  71. <span><i class="horizontal-line"></i></span>
  72. <span>第2步、关联在线答题卡</span>
  73. </div>
  74. <form class="saveForm">
  75. <div class="mcp-main-con">
  76. <div class="mcp-form-list clearfix">
  77. <div class="mcp-form-menu fl">试卷名称</div>
  78. <div class="mcp-form-detail fl"><input type="text" placeholder="必填" class="test-paper-name" name="examName"></div>
  79. <div id="examName-error"></div>
  80. </div>
  81. <div class="mcp-form-list clearfix">
  82. <div class="mcp-form-menu fl">试卷类型</div>
  83. <div class="mcp-form-menu fl">
  84. <div class="mcp-form-detail fl clearfix">
  85. <select name="tpl_index" class="fl choose-subject">
  86. <option value="1050" selected>全国版</option>
  87. <option value="1051">江苏版</option>
  88. </select>
  89. </div>
  90. </div>
  91. <div id="subject-error"></div>
  92. </div>
  93. <div class="mcp-form-list clearfix">
  94. <div class="mcp-form-menu fl">考试类型</div>
  95. <div class="mcp-form-detail fl clearfix">
  96. <div class="mcp-radio-sel fl">
  97. <span class="sel-btn select examType" value="1"></span>
  98. <span>周考</span>
  99. </div>
  100. <div class="mcp-radio-sel fl">
  101. <span class="sel-btn examType" value="2"></span>
  102. <span>单元考</span>
  103. </div>
  104. <div class="mcp-radio-sel fl">
  105. <span class="sel-btn examType" value="3"></span>
  106. <span>月考</span>
  107. </div>
  108. <div class="mcp-radio-sel fl">
  109. <span class="sel-btn examType" value="4"></span>
  110. <span>联考</span>
  111. </div>
  112. <div class="mcp-radio-sel fl">
  113. <span class="sel-btn examType" value="5"></span>
  114. <span>期中考试</span>
  115. </div>
  116. <div class="mcp-radio-sel fl">
  117. <span class="sel-btn examType" value="6"></span>
  118. <span>期末考试</span>
  119. </div>
  120. <div class="mcp-radio-sel fl">
  121. <span class="sel-btn examType" value="7"></span>
  122. <span>模拟考</span>
  123. </div>
  124. <div class="mcp-radio-sel fl">
  125. <span class="sel-btn examType" value="8"></span>
  126. <span>冲刺考</span>
  127. </div>
  128. <div class="clear"></div>
  129. <div class="mcp-radio-sel fl">
  130. <span class="sel-btn examType" value="9"></span>
  131. <span>测验(适用于非正式考试)</span>
  132. </div>
  133. </div>
  134. <div id="type-error"></div>
  135. </div>
  136. <div class="mcp-form-list clearfix">
  137. <div class="mcp-form-menu fl">主阅卷员</div>
  138. <div class="mcp-form-detail fl">
  139. <select class="sel-option projSelect" style="width: 150px">
  140. <option value="0">选择阅卷员</option>
  141. <?php foreach($teacher_arr as $t):?>
  142. <option value="<?php echo $t['teacher_id']?>"><?php echo $t['teacher_name']?></option>
  143. <?php endforeach;?>
  144. </select>
  145. </div>
  146. <div id="choose-error"></div>
  147. </div>
  148. <div class="mcp-form-list clearfix">
  149. <div class="mcp-form-menu fl">选择年级</div>
  150. <div class="mcp-form-detail fl">
  151. <select class="select-grade" isthird="0" name="select-grade" style="width: 150px">
  152. <option value="0">请选择</option>
  153. <option value="1">高一</option>
  154. <option value="2">高二</option>
  155. <option value="3">高三</option>
  156. </select>
  157. </div>
  158. <div id="grade-error"></div>
  159. </div>
  160. <div class="mcp-form-list clearfix">
  161. <div class="mcp-form-menu fl">选择班级</div>
  162. <div class="mcp-form-detail fl">
  163. <a class="btn btn-success btn-sm select-class">添加班级</a>
  164. <span id="classIds-error"></span>
  165. <div class="select-class-list">
  166. <div class="class-box fl">
  167. <ul class="selected-box">
  168. </ul>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="mcp-form-list clearfix <?php echo $is_qxk?'hide':'';?>">
  174. <div class="mcp-form-menu fl">题源</div>
  175. <div class="mcp-form-detail fl clearfix" >
  176. <span class="show_text_book">
  177. <?php
  178. if(isset($textbookArr[1])){
  179. echo $textbookArr[1]['subject_name'].' 教材版本 '.$textbookArr[1]['text_book_name'];
  180. }
  181. ?>
  182. </span>
  183. <span class="red">
  184. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**请认真确认,如果信息有误,请在教材管理模块更改
  185. </span>
  186. <input type="hidden" name="subjectId" value="<?php echo $textbookArr[1]['subject_id']?>">
  187. <input type="hidden" name="textbookId" value="<?php echo $textbookArr[1]['textbook_id']?>">
  188. </div>
  189. </div>
  190. <div class="mcp-form-list clearfix">
  191. <div class="mcp-form-menu fl">阅卷方式</div>
  192. <div class="mcp-form-detail fl clearfix" id ="markType">
  193. <div class="mcp-radio-sel fl">
  194. <span class="sel-btn select markType" value="3"></span>
  195. <span class ="markType" value="3">班级混合阅卷</span>
  196. </div>
  197. <div class="mcp-radio-sel fl">
  198. <span class="sel-btn markType" value="4"></span>
  199. <span class="markType" value="4">班级单独阅卷</span>
  200. </div>
  201. <div class="mcp-radio-sel fl">
  202. <span class="sel-btn markType" value="0"></span>
  203. <span class="markType" value="0">线下阅卷(暂只支持在线答题卡)</span>
  204. </div>
  205. <div id="markType-error"></div>
  206. </div>
  207. </div>
  208. <div class="mcp-form-list clearfix">
  209. <div class="mcp-form-menu fl">考试时间</div>
  210. <div class="mcp-form-detail fl clearfix">
  211. <input type="text" class='core datetimepicker8' readonly style="width: 100px;" name="examDate" />
  212. </div>
  213. <div id="examDate"></div>
  214. </div>
  215. </div>
  216. <input name="type" value="1" type="hidden"/>
  217. <input name="teacherId" value="0" type="hidden"/>
  218. <input name="markType" value="3" type="hidden"/>
  219. <input name="classIds" value="0" type="hidden"/>
  220. <input name="isQxk" value="<?php echo $is_qxk?>" type="hidden"/>
  221. </form>
  222. <!--<button id="createThird">确定</button>-->
  223. <!-- <div class="mcp-form-list mcp-fl-btns clearfix">
  224. <input type="button" value="保存并返回" class="mcp-sure-btn" id="createThird" active="true">
  225. <input type="button" value="确定" class="mcp-sure-btn" active="true">
  226. <input type="button" value="返回" class="mcp-back-btn" >
  227. </div> -->
  228. <div class="template-flag-box">
  229. <a href="javascript:;" id="createThird" active="true">保存并返回</a>
  230. <!-- <a href="javascript:;" id="goNext" active="true">保存并下一步</a> -->
  231. <a href="javascript:;" id="goNextNew" active="true">保存并下一步</a>
  232. <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
  233. <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
  234. </div>
  235. </div>
  236. </div>
  237. <div class="relation-answer-card">
  238. <div class="page-content">
  239. <div class="mcp-title">
  240. <span >第1步、考试基本信息</span>
  241. <span><i class="horizontal-line"></i></span>
  242. <span class="active">第2步、关联在线答题卡</span>
  243. </div>
  244. <!-- 新版本右侧答题卡 -->
  245. <div class="hgc_leftContent">
  246. <div class="module">
  247. <h2>
  248. <span>当前答题卡</span>
  249. <span class="theme notice">新版本,无需切割模板,可通过扫描入口直接扫描</span>
  250. </h2>
  251. <div class="contentInfo">
  252. <div class="opratorBnts">
  253. <span class="theme" id="saveMyTpl">保存为我的模版</span>
  254. <span class="theme" id="downLoadPdfBtn">下载答题卡</span>
  255. <span class="theme" id="editMyTpl">修改答题卡>></span>
  256. </div>
  257. <div class="subjectInfo">
  258. <div class="infoItem">
  259. <em>基本信息:</em>
  260. <div class="info">
  261. <p>
  262. <span>板式:A3-横版-三栏</span>
  263. <span>考号:填涂(10位)</span>
  264. <span>装订线:有</span>
  265. <span>总分:150分</span>
  266. <span>题量:50</span>
  267. </p>
  268. </div>
  269. </div>
  270. <div class="infoItem">
  271. <em>题目信息:</em>
  272. <div class="info">
  273. <p>
  274. <span>一、单项填空</span>
  275. <span>单选</span>
  276. <span>20题</span>
  277. <span>共20分</span>
  278. </p>
  279. </div>
  280. </div>
  281. </div>
  282. </div>
  283. <div class="contentNoInfo">
  284. <!-- <img src="" alt=""> -->
  285. <span>未创建答题卡</span>
  286. <div class="hbtn">创建在线答题卡</div>
  287. </div>
  288. </div>
  289. <div class="module">
  290. <h2>
  291. <span>我的模版(<em id="tplLength">0</em>)</span>
  292. </h2>
  293. <div class="tplBox">
  294. <div class="leftBtn btnItem"></div>
  295. <div class="tplCut">
  296. <div class="tplList">
  297. </div>
  298. <p id="tplListMsg" style="text-align: center;">暂未保存模板</p>
  299. </div>
  300. <div class="rightBtn btnItem"></div>
  301. </div>
  302. </div>
  303. </div>
  304. <div class="template-flag-box">
  305. <a href="javascript:;" id="createThirdCard" active="true">保存并返回</a>
  306. <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
  307. </div>
  308. </div>
  309. </div>
  310. </div>
  311. <!-- 弹窗 -->
  312. <div class="confirmbox-mask" style="display: none;" id="fieldModal">
  313. <div class="class-modal" style="padding: 0px;">
  314. <div class="class-modal-head" style="background-color: #2977ff;color: white;height: 30px;font-size: 16px;font-weight: initial;"><span style="float: left;padding: 5px;">选择考试班级</span><span class=" add-class-close" style="float: right;padding: 5px;cursor: pointer;">X</span></div>
  315. <form id="examSelect">
  316. <div class="class-modal-body">
  317. <p class="title">
  318. <input type="hidden" id="grade_id" name="grade_id" value="0">
  319. <span style="float: left;" id="gradeTxt">
  320. </span>
  321. <span style="margin-left: 300px;">
  322. <input type="checkbox" id="global_check_all" class="add_class_input">&nbsp;全选 &nbsp;&nbsp;
  323. <input type="checkbox" id="global_check_arts" class="add_class_input">&nbsp;全部文科班 &nbsp;&nbsp;
  324. <input type="checkbox" id="global_check_science" class="add_class_input">&nbsp;全部理科班 &nbsp;&nbsp;
  325. </span>
  326. </p>
  327. <div class="class_area" id="class_area">
  328. <ul class="class_right area_1">
  329. </ul>
  330. </div>
  331. </div>
  332. <p class="class_btn" style="text-align: center;">
  333. <input type="hidden" name="exam_gruop_id" value="0">
  334. <button type="button" class="setting_sumbit" style="margin-right: 10px;">确定</button>
  335. <button type="button" class="cancel-btn">取消</button>
  336. </p>
  337. </form>
  338. </div>
  339. </div>
  340. <script>
  341. var subjects = <?php echo json_encode($textbookArr); ?>;
  342. $(document).ready(function(){
  343. $('.projSelect').select2();
  344. var teacher_name = '';
  345. var islocal = ~location.href.indexOf('xg.com');
  346. var baseUrl = '';
  347. if(islocal){
  348. // baseUrl ='http://192.168.1.51/index.php'
  349. baseUrl ='/index.php'
  350. }else {
  351. baseUrl =''
  352. }
  353. var saveFormData ="";
  354. function isReturn(){
  355. // var isCardReturn = localStorage.getItem('isCardReturn');
  356. // var isCardReturn = ~document.referrer.indexOf('online/third');
  357. var locationUrl = window.location.href;
  358. let isCardReturn = locationUrl.indexOf('isCardReturn')
  359. if(isCardReturn>-1){
  360. $('.test-data').hide();
  361. $('.relation-answer-card').show();
  362. saveFormData = JSON.parse(localStorage.getItem('testFormData'));
  363. }else{
  364. var locationUrl = window.location.href;
  365. localStorage.setItem('referrerUrl',JSON.stringify(locationUrl));
  366. }
  367. }
  368. isReturn();
  369. $('.datetimepicker8').datetimepicker({
  370. onGenerate:function( ct ){
  371. $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
  372. $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
  373. },
  374. format:'Y-m-d',
  375. formatDate:'Y-m-d',
  376. minDate:'-1970/01/2',
  377. maxDate:'+1970/01/2',
  378. timepicker:false
  379. });
  380. //选择考试时间
  381. //选择教材题源
  382. console.log(subjects);
  383. for(var key in subjects){
  384. $(".choose-grade").append('<option value="'+ key +'">'+ subjects[key] +'</option>');
  385. }
  386. $(".choose-grade").change(function(){
  387. var obj = $(this);
  388. var val = obj.val();
  389. var child = $('.choose-book');
  390. child.html('<option value="0">选择教材</option>');
  391. for (var key in textbooks) {
  392. if (key == val) {
  393. child.html('');
  394. for (var name in textbooks[key]) {
  395. child.append('<option value="'+ [name] +'">'+ textbooks[key][name] +'</option>');
  396. }
  397. }
  398. }
  399. });
  400. //返回
  401. $('.mcp-back-btn').click(function(){
  402. location.href="<?php echo Yii::app()->createUrl('third/index')?>";
  403. });
  404. $('input[name="examName"]').keydown(function(event){
  405. $('#examName-error').html("");
  406. });
  407. //阅卷方式
  408. $('.markType').click(function(){
  409. var markType = $(this).attr('value');
  410. if(markType){
  411. $('#markType-error').html("");
  412. }
  413. $('input[name="markType"]').val(markType);
  414. });
  415. //考试类型
  416. $('.examType').click(function(){
  417. var type = $(this).attr('value');
  418. if(type){
  419. $('#type-error').html("");
  420. }
  421. $('input[name="type"]').val(type);
  422. });
  423. //选择教师
  424. $('.sel-option').change(function(){
  425. var teacher_id = $(this).val();
  426. teacher_name = $(this).text();
  427. if(teacher_id){
  428. $('#choose-error').html("");
  429. }
  430. $('input[name="teacherId"]').val(teacher_id);
  431. });
  432. if ($('.sel-classes > span').length > 0){
  433. for (var i = 0;i < $('.sel-classes > span').length; i++){
  434. for (var k = 0;k < $('.bjs-lis').length; k++){
  435. if ($('.bjs-lis').eq(k).text().trim()==$('.sel-classes > span').eq(i).text().trim()) {
  436. $('.bjs-lis').eq(k).find('.judge-sel').addClass('active');
  437. }
  438. }
  439. }
  440. }
  441. $('.mcp-radio-sel').click(function(){
  442. if (!$(this).find('.sel-btn').hasClass('select')) {
  443. $(this).find('.sel-btn').addClass('select');
  444. $(this).siblings().find('.sel-btn').removeClass('select');
  445. }
  446. });
  447. $('.grade-sel ul li').click(function(){
  448. $(this).addClass('active').siblings().removeClass('active');
  449. });
  450. // $('.judge-sel').on('click',function(){
  451. // alert(1);
  452. // if (!$(this).hasClass('active')) {
  453. // $(this).addClass('active');
  454. // $('.sel-classes').append('<span>'+$(this).closest('.bjs-lis').text()+'</span>');
  455. // } else {
  456. // $(this).removeClass('active');
  457. // for (var i = 0;i < $('.sel-classes > span').length; i++) {
  458. // console.log($('.sel-classes > span').eq(i).text());
  459. // if ($('.sel-classes > span').eq(i).text().trim() == $(this).closest('.bjs-lis').text().trim()){
  460. // $('.sel-classes > span').eq(i).remove();
  461. // }
  462. // }
  463. // }
  464. // });
  465. $('.sel-classes > span').click(function(){
  466. $(this).remove();
  467. for (var i = 0;i < $('.bjs-lis').length; i++) {
  468. if ($('.bjs-lis').eq(i).text().trim()==$(this).text().trim()){
  469. $('.bjs-lis').eq(i).find('.judge-sel').removeClass('active');
  470. }
  471. }
  472. });
  473. // 下拉列表模拟
  474. $('.inp-text').click(function(){
  475. if ($(this).next().is(':hidden')){
  476. $(this).next().show();
  477. } else {
  478. $(this).next().hide();
  479. }
  480. });
  481. // 点下拉列表选项
  482. $('.select-con li').click(function(){
  483. $(this).closest('.select-con').hide();
  484. $(this).closest('.mcp-form-detail').find('.inp-text').text($(this).text());
  485. });
  486. // 点击空白处下拉列表消失
  487. $(document).click(function(e){
  488. var targetNode = $(e.target).closest(".inp-text");
  489. if (targetNode.length>0){
  490. return;
  491. }else{
  492. $(".select-con").hide();
  493. }
  494. });
  495. function saveThirdForm(e,btnType) {
  496. var classIds='';
  497. $(".selected-box").find('li').each(function(index,el){
  498. classIds += $(el).attr('value')+",";
  499. });
  500. $('input[name="classIds"]').val(classIds);
  501. var error = new Array();
  502. var classIds = $('input[name="classIds"]').val();
  503. var examName = $('input[name="examName"]').val();
  504. var type = $('input[name="type"]').val();
  505. var teacherId = $('input[name="teacherId"]').val();
  506. // var markType = $('input[name="markType"]').val();
  507. var markType = $("#markType").find(".select").attr("value");
  508. var subjectId = $('input[name=subjectId]').val();
  509. var examDate = $("input[name='examDate']").val();
  510. if(subjectId == 0 || subjectId == null){
  511. $('#subject-error').html('请指定题源');
  512. error.push('没有指定题源');
  513. }else{
  514. $('#subject-error').html('');
  515. }
  516. if(examName == "" || examName == null){
  517. $('#examName-error').html('请指定考试名称');
  518. error.push('没有指定考试名称');
  519. }else{
  520. $('#examName-error').html('');
  521. }
  522. if(type == "" || type == null){
  523. $('#type-error').html('请指定考试类型');
  524. error.push('没有指定考试类型');
  525. }else{
  526. $('#type-error').html('');
  527. }
  528. if(teacherId == '0' || teacherId == null){
  529. $('#choose-error').html('请指定阅卷老师');
  530. error.push('没有指定阅卷老师');
  531. }
  532. $('#choose-error').html('');
  533. if(classIds == "" || classIds == null){
  534. $('#classIds-error').html('请指定考试班级');
  535. error.push('没有指定考试班级');
  536. }else{
  537. $('#classIds-error').html('');
  538. }
  539. console.log(classIds);
  540. if(!markType){
  541. $('#markType-error').html('请指定阅卷方式');
  542. error.push('没有指定阅卷方式');
  543. }else{
  544. $('#markType-error').html('');
  545. }
  546. if (examDate == '') {
  547. $('#examDate').html('请设置考试日期');
  548. error.push('请设置考试日期');
  549. } else if (examDate < '<?php echo date('Y-m-d'); ?>') {
  550. //$('#examDate').html('考试日期设置错误');
  551. // error.push('考试日期设置错误');
  552. }else{
  553. $('#examDate').html('');
  554. }
  555. if(error.length == 0){
  556. // debugger
  557. $(e.target).attr("active","false");
  558. saveFormData = {
  559. examName:examName,
  560. subjectId:subjectId,
  561. textbookId:$('input[name="textbookId"]').val(),
  562. tpl_index:$('select[name="tpl_index"]').val(),
  563. examDate:examDate,
  564. type:type,
  565. teacherId:teacherId,
  566. markType:markType,
  567. classIds:classIds,
  568. isQxk:$('input[name="isQxk"]').val()
  569. };
  570. localStorage.setItem('testFormData',JSON.stringify(saveFormData))
  571. var formData = new FormData();
  572. for(var k in saveFormData){
  573. formData.append(k,saveFormData[k])
  574. }
  575. $.ajax({
  576. url:baseUrl+'/index.php/third/createthirdForNext',
  577. method: 'POST',
  578. processData: false,
  579. contentType: false,
  580. dataType: 'json',
  581. data: formData,
  582. success: function (data) {
  583. if(data.status ==1){
  584. saveFormData.examGroupId = data.examGroupId;
  585. saveFormData.teacher_name = teacher_name;
  586. var addGrade = 0;
  587. $('.grade-sel ul li').each(function(){
  588. if($(this).hasClass('active')){
  589. addGrade = $(this).attr('grade')
  590. }
  591. })
  592. saveFormData.grade = addGrade;
  593. localStorage.setItem('testFormData',JSON.stringify(saveFormData));
  594. if(btnType===1){
  595. goBack();
  596. }else if(btnType===2){
  597. $('.test-data').hide();
  598. $('.relation-answer-card').show();
  599. }else if(btnType===3){
  600. // location.href = '/index.php/third/thirdCardSecond'
  601. location.href = '/index.php/online/answersheetList/examGroupId/'+saveFormData.examGroupId+'?isThird=1&examGroupId='+saveFormData.examGroupId
  602. }
  603. }else{
  604. if(data.info){
  605. layer.msg(data.info);
  606. }else{
  607. if(data.msg){
  608. layer.msg(data.msg);
  609. }
  610. //
  611. }
  612. $(e.target).attr("active","true");
  613. }
  614. }
  615. })
  616. }else{
  617. layer.msg(error.join(','));
  618. $(e.target).attr("active","true");
  619. }
  620. }
  621. function goBack(){
  622. //location.href = '/index.php/third/index'
  623. window.history.back();
  624. }
  625. //保存并返回
  626. $("body").delegate("#createThird[active='true']", "click", function(e) {
  627. $('#createThird').attr('active',false);
  628. $('#goNext').attr('active',false);
  629. $('#goNextNew').attr('active',false);
  630. saveThirdForm(e,1);
  631. });
  632. //保存并关联答题卡
  633. $("body").delegate("#goNext[active='true']", "click", function(e) {
  634. $('#createThird').attr('active',false);
  635. $('#goNext').attr('active',false);
  636. $('#goNextNew').attr('active',false);
  637. saveThirdForm(e,2);
  638. });
  639. //保存并关联答题卡
  640. $("body").delegate("#goNextNew[active='true']", "click", function(e) {
  641. $('#createThird').attr('active',false);
  642. $('#goNext').attr('active',false);
  643. $('#goNextNew').attr('active',false);
  644. saveThirdForm(e,3);
  645. });
  646. //取消并返回
  647. $("body").delegate("#goBack[active='true']", "click", function(e) {
  648. localStorage.setItem('isCardReturn',0)
  649. goBack();
  650. });
  651. });
  652. </script>
  653. <script src="/js/third/submit.js"></script>
  654. <script src="/js/third/select-class.js"></script>