class_exam.php 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477
  1. <script type="text/javascript">
  2. function in_array(search, array){
  3. for(var i in array){
  4. if(array[i]==search){
  5. return true;
  6. }
  7. }
  8. return false;
  9. }
  10. testFlag = "<?php echo $this->testFlag;?>";
  11. customTplsIds = new Array();
  12. var i = 0;
  13. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  14. customTplsIds[i] = "<?php echo $tplId;?>";
  15. i++;
  16. <?php }?>
  17. jQuery(document).ready(function(){
  18. // 打印答案解析
  19. $(".answerAnalysis").click(function(){
  20. var element = this;
  21. layer.msg('您确定下载答案解析嘛?', {
  22. time: 0,
  23. btn: ['确定', '取消'],
  24. yes: function(index){
  25. layer.close(index);
  26. var wpCode = jQuery(element).attr("examId");
  27. if (!wpCode) {
  28. layer.msg('周周练id有误!');return false;
  29. }
  30. jQuery.post(
  31. '<?php echo $this->createUrl('print/createtempelate');?>',
  32. {"eid":wpCode},
  33. function(data){
  34. var obj = JSON.parse(data);
  35. if (obj.success == 1) {
  36. /*alert(obj.message);
  37. alert(obj);*/
  38. evaluationClient.printDAJX(JSON.stringify(obj.object));
  39. } else {
  40. layer.msg(obj.message);
  41. }
  42. }
  43. );
  44. }
  45. });
  46. });
  47. // 根据年级筛选班级
  48. });
  49. </script>
  50. <style>
  51. .loading-pop{position: fixed;left: 0;top: 0;bottom: 0;right: 0;background: rgba(0,0,0,0.5);z-index: 200;}
  52. .loading-pop-msg{color: #fff;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);font-size: 22px;letter-spacing: 4px;}
  53. /*切换选择*/
  54. .tab-con{
  55. position: relative;
  56. height: 30px;
  57. width: 200px;
  58. background: #F2F2F2;
  59. border: 1px solid #01B677;
  60. border-radius: 15px;
  61. }
  62. .has-sel{
  63. background: #01B677;
  64. color: #fff;
  65. width: 50%;
  66. height: 30px;
  67. border-top-left-radius: 15px;
  68. border-bottom-left-radius: 15px;
  69. text-align: center;
  70. line-height: 30px;
  71. }
  72. .sel-opt{
  73. width: 50%;
  74. position: relative;
  75. color: #01B677;
  76. line-height: 30px;
  77. text-indent: 6px;
  78. cursor: pointer;
  79. }
  80. .sel-opt:after{
  81. content: '';
  82. border-left: 6px solid transparent;
  83. border-right: 6px solid transparent;
  84. border-top: 8px solid #01B677;
  85. position: absolute;
  86. right: 12px;
  87. top: 12px;
  88. }
  89. // .sel-opt select{
  90. // width: 100%;
  91. // height: 30px;
  92. // background: #F2F2F2;
  93. // color: #01B677;
  94. // text-indent: 6px;
  95. // font-size: inherit;
  96. // border-top-right-radius: 15px;
  97. // border-bottom-right-radius: 15px;
  98. // cursor: pointer;
  99. // }
  100. // .sel-opt select option{
  101. // position: relative;
  102. // }
  103. .points{
  104. position: absolute;
  105. top: -2px;
  106. right: 0;
  107. width: 10px;
  108. height: 10px;
  109. background: #F01516;
  110. border-radius: 50%;
  111. }
  112. .sel-cons{
  113. border: 1px solid #01B677;
  114. width: 50%;
  115. position: absolute;
  116. right: 0;
  117. top: 30px;
  118. text-indent: 10px;
  119. display: none;
  120. }
  121. .sc-lis{
  122. line-height: 30px;
  123. cursor: pointer;
  124. }
  125. .sc-lis span{
  126. position: relative;
  127. }
  128. .sc-lis .points{
  129. top: 2px;
  130. right: -16px;
  131. }
  132. .h_list span {font-size: 14px;}
  133. .icon-zip:before { content: "\e60b"; }
  134. .add_class_input {width: 20px;height: 20px;vertical-align: -4px;}
  135. .class_right li{margin-bottom: 2px;}
  136. </style>
  137. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  138. <link rel="stylesheet" href="/fonts/zip/iconfont.css" />
  139. <link rel="stylesheet" href="/css/alert.css"/>
  140. <div class="main-content-inner">
  141. <ul class="clearfix main-content-inner-ul">
  142. <?php if((isset(Yii::app()->session['session_subject_id']) && Yii::app()->session['session_subject_id']==3) || (isset(Yii::app()->session['session_subject_id']) && Yii::app()->session['session_subject_id']==6)){?>
  143. <li class="pull-left">
  144. <button onclick='location.href="<?php echo $this->createUrl("print/index",array('type'=>'wp'));?>"' class="button button_normal button_group button_arrow button_active" data-button="red">打印试卷</button>
  145. <img src="/images/line.jpg" style="height:45px;" />
  146. </li>
  147. <li class="pull-left">
  148. <button onclick='location.href="<?php echo $this->createUrl("print/sub_index",array('type'=>'wtb'));?>"' class="button button_normal button_group button_arrow " data-button="red">下载错题本</button>
  149. <img src="/images/line.jpg" style="height:45px;" />
  150. </li>
  151. <li class="pull-left">
  152. <button onclick='location.href="<?php echo $this->createUrl("print/sub_index",array('type'=>'isp'));?>"' class="button button_normal button_group button_arrow " data-button="red">下载个性化学习方案</button>
  153. <img src="/images/line.jpg" style="height:45px;" />
  154. </li>
  155. <li class="pull-left">
  156. <button onclick='location.href="<?php echo $this->createUrl("print/sub_index",array('type'=>'studytrend'));?>"' class="button button_normal button_group button_arrow " data-button="red">下载个性化学习宝</button>
  157. <img src="/images/line.jpg" style="height:45px;" />
  158. </li>
  159. <li class="pull-left">
  160. <button onclick='location.href="<?php echo $this->createUrl("print/student_product");?>"' class="button button_normal button_group button_arrow " data-button="red">阶段复习个性化学习宝</button>
  161. <img src="/images/line.jpg" style="height:45px;" />
  162. </li>
  163. <li class="pull-left">
  164. <button onclick='location.href="<?php echo $this->createUrl("third/index");?>"' class="button button_normal button_group button_arrow" data-button="red">第三方试卷</button>
  165. <img src="/images/line.jpg" style="height:45px;" />
  166. </li>
  167. <li class="pull-left">
  168. <button onclick='location.href="<?php echo $this->createUrl("export/index");?>"' class="button button_normal button_group button_arrow " data-button="red">导出报告</button>
  169. <img src="/images/line.jpg" style="height:45px;" />
  170. </li>
  171. <li class="pull-left">
  172. <button onclick='location.href="<?php echo $this->createUrl("upload/index");?>"' class="button button_normal button_group button_arrow" data-button="red">上传试卷</button>
  173. <img src="/images/line.jpg" style="height:45px;" />
  174. </li>
  175. <?php if(isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)){
  176. ?>
  177. <li class="pull-left">
  178. <button onclick='location.href="<?php echo $this->createUrl("print/restore");?>"' class="button button_normal button_group button_arrow" data-button="red">还原考试</button>
  179. <img src="/images/line.jpg" style="height:45px;" />
  180. </li>
  181. <?php
  182. }?>
  183. <li class="pull-left">
  184. <button onclick='location.href="<?php echo $this->createUrl("record/importscore"); ?>"'
  185. class="button button_normal button_group button_arrow " data-button="red">导入成绩
  186. </button>
  187. <img src="/images/line.jpg" style="height:45px;"/>
  188. </li>
  189. <?php }else{ ?>
  190. <li class="pull-left">
  191. <button onclick='location.href="<?php echo $this->createUrl("print/index");?>"' class="button button_normal button_group button_arrow button_active" data-button="red">打印试卷</button>
  192. <img src="/images/line.jpg" style="height:45px;" />
  193. </li>
  194. <li class="pull-left">
  195. <button onclick='location.href="<?php echo $this->createUrl("export/index");?>"' class="button button_normal button_group button_arrow " data-button="red">导出报告</button>
  196. <img src="/images/line.jpg" style="height:45px;" />
  197. </li>
  198. <li class="pull-left">
  199. <button onclick='location.href="<?php echo $this->createUrl("print/do_ruanyun_pdf");?>"' class="button button_normal button_group button_arrow" data-button="red">下载PDF</button>
  200. <img src="/images/line.jpg" style="height:45px;" />
  201. </li>
  202. <?php }?>
  203. <li class="pull-left">
  204. <button onclick='location.href="<?php echo $this->createUrl("cylet/index");?>"' class="button button_normal button_group button_arrow" data-button="red">全学科统考</button>
  205. </li>
  206. </ul>
  207. <div class="page-content">
  208. <div class="row" style="margin:0px;">
  209. <div class="col-xs-12">
  210. <!-- PAGE CONTENT BEGINS -->
  211. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  212. <div class="row">
  213. <form method="get" id="form1" action="<?php echo $this->createUrl("print/class_exam");?>">
  214. <div class="clearfix">
  215. <div class="dataTables_length margin-zy fl">
  216. <input type="text" class="form-control input-sm" placeholder="请输入班级名称" name="class_name" value="<?php echo $class_name;?>"> <input type="hidden" name="exam_group_id" value="<?php echo $exam_group_data->exam_group_id?>">
  217. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  218. </div>
  219. <div style="float: right;margin-right: 30px;margin-top:12px; padding-bottom: 10px;" class="h_list">
  220. <?php if($print['paper_tpl_type'] == 1){?>
  221. <span class="click-sc addbx" aria-hidden="true" title="生成模板" onclick="createTemplate('<?php echo $exam_id;?>',1)">生成模板</span>
  222. <span class=" click-sc addbx" aria-hidden="true" title="上传模板" onclick="uploadTemplate('<?php echo $exam_id?>','<?php echo $exam_name;?>', 1)">上传模板</span>
  223. <span class="click-sc addbx answerAnalysis" examId="<?php echo $exam_id;?>" aria-hidden="true" title="下载答案解析">下载答案解析</span>
  224. <?php };?>
  225. <?php if($print['paper_tpl_type'] == 2){?>
  226. <span class=" click-sc addbx" aria-hidden="true" title="下载试卷" onclick="createTemplate('<?php echo $exam_id;?>',2)">下载试卷</span>
  227. <span class=" click-sc addbx" aria-hidden="true" title="下载答题卡" onclick="createTemplate('<?php echo $exam_id;?>',3)">下载答题卡</span>
  228. <?php if(!$print['is_custom_tpl']){?><span class=" click-sc addbx" aria-hidden="true" title="上传答题卡" onclick="uploadTemplate('<?php echo $exam_id;?>','<?php echo $exam_name ?>', 2)">上传答题卡</span><?php }?>
  229. <span class=" click-sc addbx answerAnalysis" examId="<?php echo $exam_id;?>" aria-hidden="true" title="下载答案解析">下载答案解析</span>
  230. <?php };?>
  231. <?php if($print['paper_tpl_type'] == 3){
  232. ?>
  233. <span class=" click-sc addbx" aria-hidden="true" title="下载题卡合一" onclick="createTemplate('<?php echo $exam_id;?>',4)">下载题卡合一</span>
  234. <span class=" click-sc addbx answerAnalysis" examId="<?php echo $exam_id;?>" aria-hidden="true" title="下载答案解析">下载答案解析</span>
  235. <?php
  236. }?>
  237. <?php if($print['paper_tpl_type'] == 4) {
  238. ?>
  239. <span class="click-sc addbx" aria-hidden="true" title="下载试卷" onclick="createTemplate('<?php echo $exam_id; ?>',2)">下载试卷</span>
  240. <span class=" click-sc addbx" aria-hidden="true" title="下载题卡分离" onclick="createTemplate('<?php echo $exam_id; ?>',4)">下载题卡分离</span>
  241. <span class=" click-sc addbx answerAnalysis" examId="<?php echo $exam_id;?>" aria-hidden="true" title="下载答案解析">下载答案解析</span>
  242. <?php
  243. }
  244. ?>
  245. <?php if($exam_group_data->mark_type > 0 && $exam_group_data->mark_status==2 && $exam_group_data->upload_status==2)
  246. {
  247. ?>
  248. <span class="click-sc addbx" aria-hidden="true" title="恢复考试状态" onclick="renewExamStat('<?php echo $exam_id; ?>')">恢复考试状态</span>
  249. <?php
  250. }?>
  251. <span class=" click-sc addbx" id="addClass" <?php if(!$enable_add_class){echo 'style="background-color:gray;border-color:gray" enable=0';}else{echo 'enable=1';}?> grade="<?php echo $grade;?>" branch="<?php echo $branch; ?>" eid="<?php echo $exam_group_id;?>" aria-hidden="true" title="添加班级">添加班级</span>
  252. </div>
  253. </div>
  254. </form>
  255. </div>
  256. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  257. <thead>
  258. <tr>
  259. <th>名称</th>
  260. <th>班级</th>
  261. <th>是否打印</th>
  262. <th >已上传/总数</th>
  263. <th >操作</th>
  264. </tr>
  265. </thead>
  266. <tbody>
  267. <?php if(!empty($printList)):foreach($printList as $cl):?>
  268. <tr>
  269. <td style="max-width:260px"><?php
  270. $imgSrc = "";if($exam_group_data->mark_type > 0){$imgTitle="线上阅卷";$imgSrc.="/images/online/";}else{$imgTitle="线下阅卷";$imgSrc.="/images/offline/";}$imgSrc.="{$cl["paper_size"]}.png";$cursor = "pointer";echo "<img class='paperType' style='cursor:pointer;width:22px;height:22px;margin-right:5px;' title='{$imgTitle}' src='{$imgSrc}'/>";?>
  271. <?php echo $cl['print_name'];?>
  272. </td>
  273. <td style="max-width:100px"><?php if(isset($class_data[$cl['class_id']])){echo $class_data[$cl['class_id']];}?></td>
  274. <td><?php if(isset($exam_print[$cl['exam_id']]) && !empty($exam_print[$cl['exam_id']])){echo '已打印';}else{echo '未打印';}?></td>
  275. <td>
  276. <?php if(isset($exam_up_student[$cl['exam_id']])){echo count($exam_up_student[$cl['exam_id']]);}else{ echo 0;}?>/<?php if(isset($exam_student[$cl['exam_id']])){echo count($exam_student[$cl['exam_id']]);}else{ echo 0;}?>
  277. </td>
  278. <td style="width:265px;">
  279. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生" onclick="javascript:location.href='<?php echo $this->createUrl('print/change',array('cid'=>$cl['class_id'],'eid'=>$cl['exam_id'],'tid'=>$cl['type']));?>'">&#xe668;</span>
  280. <?php if(!$print['is_custom_tpl'] && $print['paper_tpl_type'] != 3){ ?><span class="iconfont click-sc addbx" aria-hidden="true" title="<?php if($print['paper_tpl_type'] == 2){echo '打印答题卡';}else{echo '打印试卷';}?>" onclick="<?php if($print["paper_tpl_type"] == 2 && !$print["answer_card_uploaded"]){?>layer.msg('请先上传答题卡模板');<?php }else{?>print('<?php echo $cl['class_id'];?>','<?php echo $cl['exam_id'];?>','0',<?php echo $print['is_tpl'];?>);<?php }?>">&#xe6bb;</span>
  281. <!-- <span class="iconfont icon-zip click-sc addbx print_pack" w_class_id="--><?php //echo $cl['class_id'];?><!--" w_exam_id="--><?php //echo $cl['exam_id']; ?><!--" title="打包打印" ></span>-->
  282. <?php }?>
  283. <span class="iconfont addbx click-delete delClass" <?php if($cl['upload_status']==0 && $page_total>1){ echo 'style="background-color: red;" w_enable=1';}else{echo 'style="background-color: gray;border-color:gray;" w_enable=0';}?> w_class_id="<?php echo $cl['class_id'];?>" w_exam_id="<?php echo $cl['exam_id']; ?>" title="删除" onclick="delExam(this)">删</span>
  284. <?php if(Yii::app()->session['session_subject_id']!=3 && Yii::app()->session['session_subject_id']!=6){
  285. if(isset($exam_student[$cl['exam_id']]) && isset($exam_up_student[$cl['exam_id']]) && count($exam_up_student[$cl['exam_id']]) == count($exam_student[$cl['exam_id']])){
  286. ?>
  287. <span class="iconfont click-sc icon-yifasong addbx ruanyun" exam_id="<?php echo $cl['exam_id']; ?>" title="发送第三方,并生成提分方案"></span>
  288. <?php }}?>
  289. </td>
  290. </tr>
  291. <?php endforeach;else:?>
  292. <tr><td colspan="5">暂无数据!</td></tr>
  293. <?php endif;?>
  294. </tbody>
  295. </table>
  296. <?php if(!empty($page_total)):?>
  297. <div class="row">
  298. <div class="col-xs-6">
  299. &nbsp;
  300. </div>
  301. <div class="col-xs-6">
  302. <div class="dataTables_paginate paging_simple_numbers">
  303. <?php
  304. $this->widget('CLinkPager', array(
  305. 'header' => '',
  306. 'firstPageLabel'=> '首页',
  307. 'lastPageLabel' => '末页',
  308. 'prevPageLabel' => '上一页',
  309. 'nextPageLabel' => '下一页',
  310. 'pages' => $pages,
  311. 'maxButtonCount'=> 5,
  312. ));
  313. echo '共:'.$page_total.'条';
  314. ?>
  315. </div>
  316. </div>
  317. </div>
  318. <?php endif;?>
  319. </div>
  320. <!--上传模板弹窗-->
  321. <!-- PAGE CONTENT ENDS -->
  322. </div>
  323. </div>
  324. </div>
  325. </div>
  326. <div class="loading-pop" style="display:none;">
  327. <div class="loading-pop-msg">正在打包,请稍候···</div>
  328. </div>
  329. <!-- 弹窗 -->
  330. <div class="confirmbox-mask" style="display: none;" id="fieldModal">
  331. <div class="class-modal" style="padding: 0px;">
  332. <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>
  333. <form id="examSelect">
  334. <div class="class-modal-body">
  335. <p class="title">
  336. <input type="hidden" id="grade_id" name="grade_id" value="0">
  337. <span style="float: left;" id="grade">
  338. </span>
  339. <span style="margin-left: 20px;">
  340. <select class="form-control" id="branch" name="branch" style="width: auto;display: inline-block">
  341. <option value="0">全部</option>
  342. <option value="1">文科</option>
  343. <option value="2">理科</option>
  344. </select>
  345. <span style="margin-left: 20px;">
  346. <input type="checkbox" id="global_check_all" class="add_class_input">&nbsp;全选 &nbsp;&nbsp;<span style="color: red;">(共选中<i id="allCheckCount">0</i>个)</span>
  347. </span>
  348. </span>
  349. <span style="float: right;color: red;margin-right: 20px;">已自动过滤考试中的班级</span>
  350. </p>
  351. <div class="class_area" id="class_area">
  352. <div class="class_left">
  353. <p><span style="font-weight: bold">A层班级</span> (已选: <i id="aCheckCount">0</i>)</p>
  354. </div>
  355. <ul class="class_right area_1">
  356. </ul>
  357. <div class="clear"></div>
  358. <div class="class_left">
  359. <p><span style="font-weight: bold">B层班级</span> (已选: <i id="bCheckCount">0</i>)</p>
  360. </div>
  361. <ul class="class_right area_2">
  362. </ul>
  363. <div class="clear"></div>
  364. <div class="class_left">
  365. <p><span style="font-weight: bold">C层班级</span> (已选: <i id="cCheckCount">0</i>)</p>
  366. </div>
  367. <ul class="class_right area_3">
  368. </ul>
  369. </div>
  370. </div>
  371. <p class="class_btn" style="text-align: center;">
  372. <input type="hidden" name="exam_gruop_id" value="0">
  373. <button type="button" class="setting_sumbit" style="margin-right: 10px;">确定</button>
  374. <button type="button" class="cancel-btn">取消</button>
  375. </p>
  376. </form>
  377. </div>
  378. </div>
  379. <script src="/js/jquery.ajaxfileupload.js"></script>
  380. <script type="text/javascript">
  381. $(document).ready(function(){
  382. var gradeArr=[];
  383. gradeArr[1]='高一';
  384. gradeArr[2]='高二';
  385. gradeArr[3]='高三';
  386. $('#addClass').click(function(){
  387. var eid=$(this).attr('eid');
  388. var grade=$(this).attr('grade');
  389. var enable=$(this).attr('enable');
  390. if(enable == 0){
  391. return false;
  392. }
  393. $('.area_1').html('');
  394. $('.area_2').html('');
  395. $('.area_3').html('');
  396. $('.checkAll').prop('checked',false);
  397. $('#grade').html(gradeArr[grade]);
  398. $('#grade_id').val(grade);
  399. $.ajax({
  400. url:'<?php echo $this->createUrl('print/loadclass')?>',
  401. type:'POST',
  402. dataType:'json',
  403. data:{'branch':0,'eid':eid,'grade':grade},
  404. success:function(res){
  405. if(res.status==1){
  406. class_data=res.classData;
  407. $('input[name=exam_gruop_id]').val(eid);
  408. if(class_data[1]!=undefined){
  409. area_1_html='';
  410. for(var i=0;i<class_data[1].length;i++){
  411. if(class_data[1][i]['is_used']==1){
  412. area_1_html+="<li style='color: gray;' class='ellipsis' title='"+class_data[1][i]['class_name']+"'><input onclick='syncCount()' name='a_check_class' type='checkbox' class='add_class_input choose_class' disabled='disabled' checked value='"+class_data[1][i]['class_id']+"'>"+handleLongName(class_data[1][i]['class_name'],6)+"</li>";
  413. }else{
  414. area_1_html+="<li class='ellipsis' title='"+class_data[1][i]['class_name']+"'><input name='a_check_class' onclick='syncCount()' type='checkbox' class='add_class_input choose_class' title='"+class_data[1][i]['class_name']+"' value='"+class_data[1][i]['class_id']+"'>"+handleLongName(class_data[1][i]['class_name'],6)+"</li>";
  415. }
  416. }
  417. $('.area_1').html(area_1_html);
  418. }
  419. if(class_data[2]!=undefined){
  420. area_2_html='';
  421. for(var i=0;i<class_data[2].length;i++){
  422. if(class_data[2][i]['is_used']==1){
  423. area_2_html+="<li style='color: gray;' class='ellipsis' title='"+class_data[2][i]['class_name']+"'><input onclick='syncCount()' name='b_check_class' type='checkbox' class='add_class_input choose_class' disabled='disabled' checked value='"+class_data[2][i]['class_id']+"'>"+handleLongName(class_data[2][i]['class_name'],6)+"</li>";
  424. }else{
  425. area_2_html+="<li class='ellipsis' title='"+class_data[2][i]['class_name']+"'><input onclick='syncCount()' name='b_check_class' type='checkbox' class='add_class_input choose_class' value='"+class_data[2][i]['class_id']+"'>"+handleLongName(class_data[2][i]['class_name'],6)+"</li>";
  426. }
  427. }
  428. $('.area_2').html(area_2_html);
  429. }
  430. if(class_data[3]!=undefined){
  431. area_3_html='';
  432. for(var i=0;i<class_data[3].length;i++){
  433. if(class_data[3][i]['is_used']==1){
  434. area_3_html+="<li style='color: gray;' class='ellipsis' title='"+class_data[3][i]['class_name']+"'><input onclick='syncCount()' name='c_check_class' type='checkbox' class='add_class_input choose_class' disabled='disabled' title='"+class_data[3][i]['class_name']+"' checked value='"+class_data[3][i]['class_id']+"'>"+handleLongName(class_data[3][i]['class_name'],6)+"</li>";
  435. }else{
  436. area_3_html+="<li class='ellipsis' title='"+class_data[3][i]['class_name']+"'><input onclick='syncCount()' name='c_check_class' type='checkbox' class='add_class_input choose_class' title='"+class_data[3][i]['class_name']+"' value='"+class_data[3][i]['class_id']+"'>"+handleLongName(class_data[3][i]['class_name'],6)+"</li>";
  437. }
  438. }
  439. $('.area_3').html(area_3_html);
  440. }
  441. syncCount();
  442. $('#fieldModal').show();
  443. }
  444. }
  445. });
  446. });
  447. $('#branch').change(function () {
  448. var branch=$(this).val();
  449. var eid=$('input[name=exam_gruop_id]').val();
  450. var grade=$('#grade_id').val();
  451. $('.area_1').html('');
  452. $('.area_2').html('');
  453. $('.area_3').html('');
  454. $('.checkAll').prop('checked',false);
  455. $.ajax({
  456. url:'<?php echo $this->createUrl('print/loadclass')?>',
  457. type:'POST',
  458. dataType:'json',
  459. data:{'branch':branch,'eid':eid,'grade':grade},
  460. success:function(res){
  461. if(res.status==1){
  462. class_data=res.classData;
  463. $('input[name=exam_gruop_id]').val(eid);
  464. if(class_data[1]!=undefined){
  465. area_1_html='';
  466. for(var i=0;i<class_data[1].length;i++){
  467. if(class_data[1][i]['is_used']==1){
  468. area_1_html+="<li style='color: gray;' class='ellipsis' title='"+class_data[1][i]['class_name']+"'><input onclick='syncCount()' name='a_check_class' type='checkbox' class='add_class_input choose_class' disabled='disabled' checked value='"+class_data[1][i]['class_id']+"'>"+handleLongName(class_data[1][i]['class_name'],6)+"</li>";
  469. }else{
  470. area_1_html+="<li class='ellipsis' title='"+class_data[1][i]['class_name']+"'><input name='a_check_class' onclick='syncCount()' type='checkbox' class='add_class_input choose_class' title='"+class_data[1][i]['class_name']+"' value='"+class_data[1][i]['class_id']+"'>"+handleLongName(class_data[1][i]['class_name'],6)+"</li>";
  471. }
  472. }
  473. $('.area_1').html(area_1_html);
  474. }
  475. if(class_data[2]!=undefined){
  476. area_2_html='';
  477. for(var i=0;i<class_data[2].length;i++){
  478. if(class_data[2][i]['is_used']==1){
  479. area_2_html+="<li style='color: gray;' class='ellipsis' title='"+class_data[2][i]['class_name']+"'><input onclick='syncCount()' name='b_check_class' type='checkbox' class='add_class_input choose_class' disabled='disabled' checked value='"+class_data[2][i]['class_id']+"'>"+handleLongName(class_data[2][i]['class_name'],6)+"</li>";
  480. }else{
  481. area_2_html+="<li class='ellipsis' title='"+class_data[2][i]['class_name']+"'><input onclick='syncCount()' name='b_check_class' type='checkbox' class='add_class_input choose_class' value='"+class_data[2][i]['class_id']+"'>"+handleLongName(class_data[2][i]['class_name'],6)+"</li>";
  482. }
  483. }
  484. $('.area_2').html(area_2_html);
  485. }
  486. if(class_data[3]!=undefined){
  487. area_3_html='';
  488. for(var i=0;i<class_data[3].length;i++){
  489. if(class_data[3][i]['is_used']==1){
  490. area_3_html+="<li style='color: gray;' class='ellipsis' title='"+class_data[3][i]['class_name']+"'><input onclick='syncCount()' name='c_check_class' type='checkbox' class='add_class_input choose_class' disabled='disabled' title='"+class_data[3][i]['class_name']+"' checked value='"+class_data[3][i]['class_id']+"'>"+handleLongName(class_data[3][i]['class_name'],6)+"</li>";
  491. }else{
  492. area_3_html+="<li class='ellipsis' title='"+class_data[3][i]['class_name']+"'><input onclick='syncCount()' name='c_check_class' type='checkbox' class='add_class_input choose_class' title='"+class_data[3][i]['class_name']+"' value='"+class_data[3][i]['class_id']+"'>"+handleLongName(class_data[3][i]['class_name'],6)+"</li>";
  493. }
  494. }
  495. $('.area_3').html(area_3_html);
  496. }
  497. syncCount();
  498. $('#fieldModal').show();
  499. }
  500. }
  501. });
  502. });
  503. $('.add-class-close,.cancel-btn').click(function () {
  504. $('#fieldModal').hide();
  505. });
  506. $('#global_check_all').change(function(){
  507. var hasChecked = $(this).prop('checked');
  508. var allChecks = $('#class_area').find('input[type="checkbox"]');
  509. allChecks.each(function (index,el) {
  510. if($(el).prop('disabled'))return;
  511. $(el).prop('checked',hasChecked);
  512. });
  513. syncCount();
  514. });
  515. //保存班级加减操作
  516. $('.setting_sumbit').click(function(){
  517. var class_id=[];
  518. // console.log($('.choose_class').length);
  519. for(var i=0;i<$('.choose_class').length;i++){
  520. var checkItem = $('.choose_class').eq(i);
  521. if(checkItem.is(':checked') && !checkItem.prop('disabled')){
  522. class_id.push($('.choose_class').eq(i).val());
  523. }
  524. }
  525. var eid=$('input[name=exam_gruop_id]').val();
  526. console.log(class_id);
  527. if(class_id.length==0){
  528. layer.msg('请选择考试班级');
  529. return false;
  530. }else{
  531. $.ajax({
  532. url:'<?php echo $this->createUrl('print/addexamclass')?>',
  533. type:'POST',
  534. dataType:'json',
  535. data:{'eid':eid,'classId':class_id,'is_third':0},
  536. success:function(res){
  537. if(res.status==1){
  538. layer.msg('修改成功');
  539. $('#fieldModal').hide();
  540. window.location.reload();
  541. }else{
  542. layer.msg(res.msg);
  543. }
  544. }
  545. });
  546. }
  547. });
  548. /*var str = '<div class="points"></div>';
  549. $(".sc-lis").each(function(){
  550. if($(this).find(".points").length>0){
  551. $(".sel-opt").append(str);
  552. }
  553. });*/
  554. $(".sel-opt,.sel-cons").mouseover(function(){
  555. $(".sel-cons").show();
  556. }).mouseout(function(){
  557. $(".sel-cons").hide();
  558. });
  559. $(".sc-lis").click(function(){
  560. var data = {
  561. subjectId : $(this).attr('val')
  562. };
  563. $.post("<?php echo Yii::app()->createUrl('print/setSubjectId')?>",data,function(flags){
  564. if(flags)
  565. {
  566. location.reload();
  567. }else
  568. {
  569. alert('网络异常');
  570. }
  571. });
  572. $('.has-sel').text($(this).text());
  573. $(".sel-cons").hide();
  574. });
  575. $(".ruanyun").click(function(){
  576. var exam_id = $(this).attr('exam_id');
  577. layer.msg("确定发送吗?学生是否全部上传成绩", {
  578. time: 0,
  579. btn: ['确定', '取消'],
  580. yes: function(index){
  581. layer.close(index);
  582. $.ajax({
  583. url: "<?php echo $this->createUrl('print/send_ruanyun_pdf');?>",
  584. type: "POST",
  585. dataType: "json",
  586. data:{ examId: exam_id
  587. },
  588. success: function (data){
  589. if(data.status == 1){
  590. layer.msg('发送成功',{
  591. icon: 1
  592. }, function(){
  593. layer.closeAll();
  594. location.reload();
  595. });
  596. }else if(data.status == 2){
  597. layer.msg('发送失败,未上传成绩',{
  598. icon: 5
  599. }, function(){
  600. layer.closeAll();
  601. location.reload();
  602. });
  603. }else{
  604. layer.msg('发送失败',{
  605. icon: 5
  606. }, function(){
  607. layer.closeAll();
  608. location.reload();
  609. });
  610. }
  611. },
  612. error: function (data, status, e){ //服务器响应失败处理函数
  613. layer.msg('返回失败!',{
  614. icon: 5
  615. }, function(){
  616. layer.closeAll();
  617. });
  618. }
  619. });
  620. }
  621. });
  622. });
  623. $(".print_pack").click(function(){
  624. $(".loading-pop").show();
  625. var data = {
  626. exam_id:$(this).attr("w_exam_id")
  627. };
  628. $.post("<?php echo Yii::app()->createUrl('print/print_pack')?>",data,function(flags){
  629. var m = JSON.parse(flags);
  630. if(m.status==1)
  631. {
  632. html = ""+
  633. '<div style="padding:20px 30px 0px 30px">'+
  634. '<div style="padding:8px 0;">请复制下方链接打印包。</div>'+
  635. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  636. '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>'+
  637. '</div>'+
  638. '</div>'+
  639. "";
  640. layer.open({
  641. type: 1,
  642. area: ['550px', '220px'],
  643. title: '打印包',
  644. content: html,
  645. success: function(index, layerObj){
  646. $(".loading-pop").hide();
  647. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="'+m.result+'" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  648. jQuery("#confirm, #cancel").on("click", function(){
  649. layer.close(layerObj);
  650. });
  651. jQuery("#copy").on("click", function(){
  652. jQuery("#url").select();
  653. });
  654. },
  655. end: function(){
  656. }
  657. });
  658. $(".loading-pop").hide();
  659. return;
  660. }else
  661. {
  662. layer.msg(m.result);
  663. $(".loading-pop").hide();return;
  664. }
  665. setTimeout(function() {
  666. $(".loading-pop").hide();
  667. }, 2000);
  668. });
  669. });
  670. });
  671. function objToJson(obj){
  672. var json = "{ ";
  673. for(var item in obj){
  674. json += "'"+item+"':'"+obj[item]+"',";
  675. }
  676. json += " }";
  677. return json;
  678. }
  679. function renewExamStat(exam_id) {
  680. if(!exam_id)
  681. {
  682. layer.msg('参数不正确!')
  683. }
  684. var msg = '您确定恢复本次考试状态吗?';
  685. layer.msg(msg, {
  686. time: 0,
  687. btn: ['确定', '取消'],
  688. yes: function(index){
  689. layer.close(index);
  690. $.ajax({
  691. url: "<?php echo $this->createUrl('paper/recover');?>",
  692. type: "POST",
  693. dataType: "json",
  694. data: {
  695. exam_id: exam_id,
  696. },
  697. success: function (data){
  698. var m = data;
  699. if(m.status == 1){
  700. layer.msg('恢复成功,可以继续上传试卷',{
  701. icon: 1
  702. }, function(){
  703. layer.closeAll();
  704. location.reload();
  705. });
  706. }else{
  707. layer.msg('恢复失败,'+m.msg,{
  708. icon: 5
  709. }, function(){
  710. layer.closeAll();
  711. location.reload();
  712. });
  713. }
  714. },
  715. error: function (data, status, e){ //服务器响应失败处理函数
  716. layer.msg('返回失败!',{
  717. icon: 5
  718. }, function(){
  719. layer.closeAll();
  720. });
  721. }
  722. });
  723. }
  724. });
  725. }
  726. function ccc(){
  727. layer.msg('敬请期待!', {
  728. time: 0,
  729. btn: ['确定', '取消'],
  730. yes: function(index){
  731. layer.close(index);
  732. return false;
  733. }
  734. });
  735. }
  736. function delExam(odj){
  737. if (!odj) return false;
  738. var classId = odj.getAttribute("w_class_id");
  739. var examId = odj.getAttribute("w_exam_id");
  740. var enable = odj.getAttribute("w_enable");
  741. var totalCount = <?php echo $page_total;?>;
  742. if(totalCount <=1){
  743. return;
  744. }
  745. if(enable == 0){
  746. return;
  747. }
  748. if (!classId || !examId) return false;
  749. var msg = '您确定要删除此班的考试吗?';
  750. layer.msg(msg, {
  751. time: 0,
  752. btn: ['确定', '取消'],
  753. yes: function(index){
  754. layer.close(index);
  755. $.ajax({
  756. url: "<?php echo $this->createUrl('print/delexam');?>",
  757. type: "POST",
  758. dataType: "json",
  759. data: {
  760. examId: examId,
  761. classId:classId,
  762. is_third:0
  763. },
  764. success: function (data){
  765. if(data.status == 1){
  766. layer.msg('删除成功',{
  767. icon: 1
  768. }, function(){
  769. layer.closeAll();
  770. location.reload();
  771. });
  772. }else{
  773. layer.msg('删除失败',{
  774. icon: 5
  775. }, function(){
  776. layer.closeAll();
  777. location.reload();
  778. });
  779. }
  780. },
  781. error: function (data, status, e){ //服务器响应失败处理函数
  782. layer.msg('返回失败!',{
  783. icon: 5
  784. }, function(){
  785. layer.closeAll();
  786. });
  787. }
  788. });
  789. }
  790. });
  791. }
  792. // 确认上传成绩
  793. function uploadConfirm(classId, examId,className,is_uploaded_count,students_count) {
  794. //if (confirm('您确定已上传成绩了吗?')) {
  795. msg = "<div style='text-align:left;'>("+className+")已上传(<span style=' font-size:20px;color:#15ae68 ;font-weight: bold'>"+is_uploaded_count+"</span>)份试卷,还有(<span style='font-size:20px;color: red;font-weight: bold'>"+(students_count-is_uploaded_count)+"</span>)份试卷未上传!是否确认本班级试卷都已上传?<br/><br/><span style='color: red'>请注意!试卷上传确认后将不能再次上传本班的试卷!!!</span></div>";
  796. layer.msg(msg, {
  797. time: 0,
  798. btn: ['确定', '取消'],
  799. yes: function(index, layerObj){
  800. layer.close(index);
  801. $.ajax({
  802. url: "<?php echo $this->createUrl('print/uploadConfirm');?>",
  803. type: "POST",
  804. data: {
  805. classId: classId,
  806. examId: examId
  807. },
  808. beforeSend:function(){
  809. // 发送请求显示打印中
  810. layer.msg('确认中...', {time: 20000});
  811. },
  812. dataType: "JSON",
  813. success: function(data) {
  814. if (data.status == 1) {
  815. layer.msg('确认成功!');
  816. setTimeout(function(){location.reload();}, 1300);
  817. } else {
  818. layer.msg(data.error);
  819. }
  820. },
  821. complete:function(){
  822. },
  823. error:function(){
  824. }
  825. });
  826. }
  827. });
  828. //}
  829. }
  830. // 打印错题本
  831. function printBook(cid,eid,type){
  832. if (!cid || !eid || !type) {
  833. layer.msg("打印参数有误");return;
  834. }
  835. var message = '';
  836. var objUrl = '';
  837. if (type == 1) {
  838. message = "您确定要下载该班级纠错本吗?";
  839. objUrl = "<?php echo $this->createUrl('print/downloadwrongtopic');?>";
  840. divTitle = "下载错题本";
  841. improveName = "错题本";
  842. } else if (type == 2){
  843. message = "您确定要下载该班级个性化学习方案吗?";
  844. objUrl = "<?php echo $this->createUrl('print/downloadraisescheme');?>";
  845. divTitle = "下载个性化学习方案";
  846. improveName = "个性化学习方案";
  847. }else if (type == 3){
  848. message = "您确定要下载该班级个性化学习宝吗?";
  849. objUrl = "<?php echo $this->createUrl('print/downloadraisescheme');?>";
  850. divTitle = "下载个性化学习宝";
  851. improveName = "个性化学习宝";
  852. }
  853. else{
  854. layer.msg("打印参数有误");return;
  855. }
  856. html = ""+
  857. '<div style="padding:20px 30px 0px 30px">'+
  858. '<div style="padding:8px 0;">请复制下方链接下载'+improveName+'。</div>'+
  859. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  860. '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>'+
  861. '</div>'+
  862. '</div>'+
  863. "";
  864. layer.msg(message, {
  865. time: 0,
  866. btn: ['确定', '取消'],
  867. yes: function(index){
  868. layer.close(index);
  869. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  870. // 更试卷打印时间
  871. $.post("<?php echo $this->createUrl('print/updatepaperprinttime');?>", {cid: cid, eid: eid,type:type } );
  872. /*if(type == 1)
  873. location.href = objUrl+"/cid/"+cid+"/eid/"+eid;
  874. else
  875. location.href = objUrl+"/cid/"+cid+"/eid/"+eid+"/type/"+type;*/
  876. startTime = (new Date()).getTime();
  877. showTip = true;
  878. tipShowed = false;
  879. toPromptTime = 3000;
  880. window.interval = setInterval(function(){
  881. execTime = (new Date()).getTime() - startTime;
  882. if(execTime > toPromptTime && showTip && !tipShowed){
  883. // msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  884. // tipShowed = true;
  885. }
  886. }, 1000);
  887. jQuery.get(
  888. "<?php echo $this->createUrl("print/getImproveFile");?>",
  889. {"examId": eid, "classId": cid, "type": type},
  890. function(data){
  891. data = JSON.parse(data);
  892. if(data.success == 1||data.success == 2){
  893. layer.open({
  894. type: 1,
  895. area: ['550px', '220px'],
  896. title: divTitle,
  897. content: html,
  898. success: function(index, layerObj){
  899. clearInterval(window.interval);
  900. msgIndex = layer.msg(data.limitinfo, {"time": 3000});
  901. clearInterval(window.interval);
  902. layer.close(msgIndex);
  903. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="'+data.downloadPath+'" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  904. jQuery("#confirm, #cancel").on("click", function(){
  905. layer.close(layerObj);
  906. });
  907. jQuery("#copy").on("click", function(){
  908. jQuery("#url").select();
  909. });
  910. },
  911. end: function(){
  912. }
  913. });
  914. }
  915. else if(data.success == 0){
  916. clearInterval(window.interval);
  917. msgIndex = layer.msg(data.message, {"time": 3000});
  918. }
  919. }
  920. );
  921. }
  922. });
  923. }
  924. // 上传试卷模板
  925. function uploadTemplate(eid,name, type){
  926. if (!eid) {
  927. layer.msg('考试信息不存在!');
  928. return false;
  929. }
  930. if(type == 1)
  931. forCheckUrl = "<?php echo $this->createUrl('print/verifyTpl');?>";
  932. else
  933. forCheckUrl = "<?php echo $this->createUrl('print/checkanswercard');?>";
  934. $.post(forCheckUrl,{eid:eid},function(data){
  935. var obj = JSON.parse(data);
  936. var html ='<div class="layer_notice" style="padding:5px;">';
  937. html +='<table class="table table-striped table-bordered table-hover ">';
  938. html +='<thead class="thin-border-bottom">';
  939. html +='<tr>';
  940. html +='<th>试卷名称</th>';
  941. html +='<th>是否上传</th>';
  942. html +='<th>操作</th>';
  943. html +='</tr>';
  944. html +='</thead>';
  945. html +='<tbody class="content_tbody">';
  946. if (obj.success == 1) {
  947. html +='<td>'+name+'</td><td><span style="color:red;">已上传</span></td><td><input type="file" name="word_file" id="word_file" /></td></tr>';
  948. } else {
  949. html +='<td>'+name+'</td><td id="alreadUpload">未上传</td><td><input type="file" name="word_file" id="word_file" /></td></tr>';
  950. }
  951. html +='</tbody>';
  952. html +='</table>';
  953. html +='<span style="width:582px;display:inline-block;text-align:center;">';
  954. html +='<button class="btn btn-success btn-sm" onclick="uploadWord('+type+')"><i class="ace-icon fa fa-check bigger-110"></i>确定</button>';
  955. html +='</span>';
  956. html +='<input type="hidden" id="mpEid" value="'+eid+'">';
  957. html +='</div>';
  958. layer.open({
  959. type: 1,
  960. skin: 'layui-layer-rim', //加上边框
  961. area: ['600px', '300px'], //宽高
  962. content: html
  963. });
  964. });
  965. }
  966. function uploadWord(type) {
  967. var paramEid = $('#mpEid').val();
  968. if (!paramEid) {
  969. layer.msg('考试信息不存在!');
  970. return false;
  971. }
  972. var obj_file = $("#word_file").val();
  973. if (!obj_file) {
  974. layer.msg('请选择上传文件');
  975. return false;
  976. }
  977. var extStart = obj_file.lastIndexOf('.');
  978. var extName = obj_file.substring(extStart,obj_file.length).toLowerCase();
  979. if (extName != ".dotx" && extName != ".dotm") {
  980. layer.msg('模板格式有误,请上传dotx格式word!');
  981. return false;
  982. }
  983. $.ajaxFileUpload({
  984. url: "<?php echo $this->createUrl('print/uploadTpl');?>", //用于文件上传的服务器端请求地址
  985. secureuri: false, //是否需要安全协议,一般设置为false
  986. fileElementId: 'word_file', //文件上传域的ID
  987. dataType: 'text', //返回值类型 一般设置为json
  988. data:{"eid":paramEid, "type": type},
  989. success: function (data, status){
  990. var obj = JSON.parse(data);
  991. if (obj.success == 1) {
  992. layer.msg(obj.message,{
  993. icon: 1,
  994. }, function(){
  995. layer.closeAll();
  996. });
  997. $("#alreadUpload").html('<span style="color:red;">已上传</span>');
  998. } else {
  999. layer.msg(obj.message,{
  1000. icon: 5,
  1001. }, function(){
  1002. layer.closeAll();
  1003. });
  1004. }
  1005. },
  1006. error: function (data, status, e){ //服务器响应失败处理函数
  1007. layer.msg('返回失败!',{
  1008. icon: 5,
  1009. }, function(){
  1010. layer.closeAll();
  1011. });
  1012. }
  1013. });
  1014. return false;
  1015. }
  1016. // 搜索事件
  1017. $("#search").click(function(){
  1018. $("#form1").submit();
  1019. });
  1020. function print(cid,eid,tid,fg){
  1021. if (!cid || !eid) return false;
  1022. var msg = '';
  1023. if (fg == 1) {
  1024. msg = '打印答题卡';
  1025. } else {
  1026. msg = '您确定要打印该试卷嘛?';
  1027. }
  1028. layer.msg(msg, {
  1029. time: 0,
  1030. btn: ['确定', '取消'],
  1031. yes: function(index){
  1032. layer.close(index);
  1033. ajaxPrint(cid, eid, tid);
  1034. }
  1035. });
  1036. }
  1037. function ajaxPrint(cid, eid, tid) {
  1038. $.ajax({
  1039. url:"<?php echo $this->createUrl('print/ajaxupdate');?>",
  1040. type:"post",
  1041. data:{cid:cid,eid:eid,tid:tid},
  1042. dataType: "json",
  1043. beforeSend:function(){
  1044. // 发送请求显示打印中
  1045. layer.msg('打印中', {icon: 16,time: 20000});
  1046. },
  1047. success:function(obj){
  1048. var index = layer.msg();
  1049. layer.close(index);
  1050. if (obj.success == 1) {
  1051. if (tid == 0) {//console.log(JSON.stringify(obj.message));
  1052. evaluationClient.printPaper(JSON.stringify(obj.message));
  1053. //alert('提交打印试卷成功!');
  1054. } else if (tid == 1) {
  1055. evaluationClient.printCTB(JSON.stringify(obj.message));
  1056. //alert('提交打印错题本成功!');
  1057. } else if (tid == 2) {
  1058. evaluationClient.printTFFA(JSON.stringify(obj.message));
  1059. //alert('提交打印提分册成功!');
  1060. } else {
  1061. layer.msg('操作错误!');
  1062. }
  1063. location.reload();
  1064. } else {//alert(obj.message);
  1065. layer.msg(obj.message);
  1066. }
  1067. },
  1068. complete:function(){
  1069. //layer.msg('打印失败!');
  1070. //var index = layer.msg();
  1071. //layer.close(index);
  1072. },
  1073. error:function(){
  1074. //var index = layer.msg();
  1075. //layer.close(index);
  1076. }
  1077. });
  1078. }
  1079. // 生成试卷模板
  1080. function createTemplate (eid,flag){
  1081. if (!eid) {
  1082. layer.msg('未找到考试信息');
  1083. }
  1084. var msg = '';
  1085. if (flag == 2) {
  1086. msg = '您确定要下载试卷嘛?';
  1087. } else if(flag == 1){
  1088. msg = '您确定要生成模板嘛?';
  1089. }
  1090. else if(flag == 3){
  1091. msg = "<div style='text-align:left;'>编辑答题卡注意事项:<br/>1、试卷的名字最多支持2行,字体的大小和字体种类保持原有格式不变<br/>2、选择题和填空题的答题区域中里面的内容和识别点不许更改<br/>3、整套试卷中所有的识别点不许更改<br/><br/>点击确定下载</div>";
  1092. }else if(flag == 4){
  1093. msg = "<div style='text-align:left;'>编辑题卡合一注意事项:<br/>1、试卷的名字最多支持2行,字体的大小和字体种类保持原有格式不变<br/>2、选择题和填空题的答题区域中里面的内容和识别点不许更改<br/>3、整套试卷中所有的识别点不许更改<br/><br/>点击确定下载</div>";
  1094. }else{
  1095. layer.msg("参数错误");
  1096. }
  1097. layer.msg(msg, {
  1098. time: 0,
  1099. btn: ['确定', '取消'],
  1100. yes: function(index){
  1101. layer.close(index);
  1102. $.post('<?php echo $this->createUrl('print/createtempelate');?>',{"eid":eid,"flag":flag},function(data){
  1103. var obj = JSON.parse(data);
  1104. if (obj.success == 1) {
  1105. if (flag == 2) {
  1106. evaluationClient.CreatePaperTiGan(JSON.stringify(obj.object));
  1107. } else if(flag == 1){
  1108. evaluationClient.createPaper(JSON.stringify(obj.object));
  1109. }
  1110. else if(flag == 3){
  1111. evaluationClient.CreatePaperDaTiKa(JSON.stringify(obj.object));
  1112. }else if(flag == 4){
  1113. evaluationClient.CreatePaperDaTiKa(JSON.stringify(obj.object));
  1114. }else{
  1115. layer.msg("参数错误");
  1116. }
  1117. } else {
  1118. layer.msg(obj.message);
  1119. }
  1120. });
  1121. }
  1122. });
  1123. }
  1124. function wb_html(odj){
  1125. if (!odj) return false;
  1126. var classId = odj.getAttribute("w_class_id");
  1127. var examId = odj.getAttribute("w_exam_id");
  1128. if (!classId || !examId) return false;
  1129. var msg = '您确定要生成该班级的错题本吗?';
  1130. layer.msg(msg, {
  1131. time: 0,
  1132. btn: ['确定', '取消'],
  1133. yes: function(index){
  1134. layer.close(index);
  1135. $.ajax({
  1136. url: "<?php echo $this->createUrl('client/wbhtml');?>",
  1137. type: "POST",
  1138. dataType: "json",
  1139. data: {
  1140. examId: examId,
  1141. classId:classId
  1142. },
  1143. success: function (data){
  1144. if(data > 0){
  1145. layer.msg('操作成功,重新生成错题本',{
  1146. icon: 1
  1147. }, function(){
  1148. layer.closeAll();
  1149. });
  1150. }else if(data==0){
  1151. layer.msg('操作失败,此班无错题本',{
  1152. icon: 5
  1153. }, function(){
  1154. layer.closeAll();
  1155. });
  1156. }
  1157. else{
  1158. layer.msg('操作失败,重新生成错题本',{
  1159. icon: 5
  1160. }, function(){
  1161. layer.closeAll();
  1162. });
  1163. }
  1164. },
  1165. error: function (data, status, e){ //服务器响应失败处理函数
  1166. layer.msg('返回失败!',{
  1167. icon: 5
  1168. }, function(){
  1169. layer.closeAll();
  1170. });
  1171. }
  1172. });
  1173. }
  1174. });
  1175. }
  1176. function isp2_html(odj){
  1177. if (!odj) return false;
  1178. var classId = odj.getAttribute("w_class_id");
  1179. var examId = odj.getAttribute("w_exam_id");
  1180. if (!classId || !examId) return false;
  1181. var msg = '您确定要生成该班级的二步提分方案吗?';
  1182. layer.msg(msg, {
  1183. time: 0,
  1184. btn: ['确定', '取消'],
  1185. yes: function(index){
  1186. layer.close(index);
  1187. $.ajax({
  1188. url: "<?php echo $this->createUrl('client/isp2html');?>",
  1189. type: "POST",
  1190. dataType: "json",
  1191. data: {
  1192. examId: examId,
  1193. classId:classId
  1194. },
  1195. success: function (data){
  1196. if(data > 0){
  1197. layer.msg('操作成功,重新生成提分方案',{
  1198. icon: 1
  1199. }, function(){
  1200. layer.closeAll();
  1201. });
  1202. }else if(data==0){
  1203. layer.msg('操作失败,此班无提分方案',{
  1204. icon: 5
  1205. }, function(){
  1206. layer.closeAll();
  1207. });
  1208. }
  1209. else{
  1210. layer.msg('操作失败,重新生成提分方案',{
  1211. icon: 5
  1212. }, function(){
  1213. layer.closeAll();
  1214. });
  1215. }
  1216. },
  1217. error: function (data, status, e){ //服务器响应失败处理函数
  1218. layer.msg('返回失败!',{
  1219. icon: 5
  1220. }, function(){
  1221. layer.closeAll();
  1222. });
  1223. }
  1224. });
  1225. }
  1226. });
  1227. }
  1228. function isp3_html(odj){
  1229. if (!odj) return false;
  1230. var classId = odj.getAttribute("w_class_id");
  1231. var examId = odj.getAttribute("w_exam_id");
  1232. if (!classId || !examId) return false;
  1233. var msg = '您确定要生成该班级的个性化学习宝吗?';
  1234. layer.msg(msg, {
  1235. time: 0,
  1236. btn: ['确定', '取消'],
  1237. yes: function(index){
  1238. layer.close(index);
  1239. $.ajax({
  1240. url: "<?php echo $this->createUrl('client/isp3html');?>",
  1241. type: "POST",
  1242. dataType: "json",
  1243. data: {
  1244. examId: examId,
  1245. classId:classId
  1246. },
  1247. success: function (data){
  1248. if(data > 0){
  1249. layer.msg('操作成功,重新生成提分方案',{
  1250. icon: 1
  1251. }, function(){
  1252. layer.closeAll();
  1253. });
  1254. }else if(data==0){
  1255. layer.msg('操作失败,此班无提分方案',{
  1256. icon: 5
  1257. }, function(){
  1258. layer.closeAll();
  1259. });
  1260. }
  1261. else{
  1262. layer.msg('操作失败,重新生成提分方案',{
  1263. icon: 5
  1264. }, function(){
  1265. layer.closeAll();
  1266. });
  1267. }
  1268. },
  1269. error: function (data, status, e){ //服务器响应失败处理函数
  1270. layer.msg('返回失败!',{
  1271. icon: 5
  1272. }, function(){
  1273. layer.closeAll();
  1274. });
  1275. }
  1276. });
  1277. }
  1278. });
  1279. }
  1280. // 隐藏试卷
  1281. function oprateExam(examId,flag){
  1282. if (examId) {
  1283. layer.msg('未找到周周练id');
  1284. }
  1285. var msg = '您确定要隐藏该试卷吗?';
  1286. if (flag == 0) {
  1287. msg = '您确定要恢复该试卷吗?';
  1288. }
  1289. layer.msg(msg, {
  1290. time: 0,
  1291. btn: ['确定', '取消'],
  1292. yes: function(index){
  1293. layer.close(index);
  1294. $.post('<?php echo $this->createUrl("print/oprateexam");?>',{examId:examId,flag:flag},function(data){
  1295. var obj = JSON.parse(data);
  1296. if (obj.success == 1) {
  1297. location.reload();
  1298. } else {
  1299. layer.msg(obj.message);
  1300. }
  1301. });
  1302. }
  1303. });
  1304. }
  1305. // 统计数量
  1306. function syncCount()
  1307. {
  1308. var a = $("input[name='a_check_class']:checked").length;
  1309. var b = $("input[name='b_check_class']:checked").length;
  1310. var c = $("input[name='c_check_class']:checked").length;
  1311. $('#aCheckCount').html(a);
  1312. $('#bCheckCount').html(b);
  1313. $('#cCheckCount').html(c);
  1314. $('#allCheckCount').html((a+b+c));
  1315. }
  1316. function handleLongName(str,length) {
  1317. var str_len = str.length;
  1318. if(str_len > length){
  1319. return str.substring(0,length-1) + '...';
  1320. }else {
  1321. return str;
  1322. }
  1323. }
  1324. </script>