reset_isp.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <style>
  2. .reset-title{padding-left: 20px; line-height: 40px;font-size: 14px;border-bottom: 1px solid #eee;}
  3. .paper-title{margin-right: 20px;font-weight: bold;}
  4. .chk-all{margin-left: 20px; padding-left:20px; cursor: pointer;background: url(/images/select_no.png) no-repeat left center;-webkit-background-size: 16px;background-size: 16px;}
  5. .chk-all.active{background: url(/images/select_ipt.png) no-repeat left center;-webkit-background-size: 16px;background-size: 16px;}
  6. .chk-num{margin-top: 10px;margin-left: 5px; width: 20px;height: 20px;line-height: 20px; text-align: center;font-style:normal; border-radius: 50%;background-color: #f40;color: #fff;}
  7. .class-box{padding-bottom:50px;}
  8. .class-box ul{padding:20px 0 0 24px;}
  9. .class-box li{position: relative;margin-right: 28px;margin-bottom: 20px; padding:10px 16px;width: 210px;height: 105px; border:1px solid #ccc;box-sizing: border-box;cursor: pointer;}
  10. .class-box li h3{margin:0; width: 180px; font-size: 16px;line-height: 24px; color: #697aff;}
  11. .class-box li p{margin-top: 6px;}
  12. .selected-img{position: absolute;top:50%;right: 10px;transform:translateY(-50%);display: none;}
  13. .class-box li.active,.class-box li:hover{border-color: #2977ff}
  14. .class-box li.active .selected-img{display: block;}
  15. .reset-btn{position: fixed;left: 24px;bottom:0;padding-top:10px;padding-bottom: 16px;width: 100%;background-color: #fff;}
  16. .reset-btn span{color: #f00;}
  17. .reset-btn a{margin-right: 10px; display: inline-block;color: #fff;background-color: grey;width: 100px;line-height: 30px;text-align: center; }
  18. .reset-btn2 a{text-decoration: none;background:#2977ff;}
  19. .reset-btn2 a:hover{text-decoration: none;background-color: #2977ff;}
  20. .reset-num{font-style:normal;}
  21. /*.topic-content*/
  22. .choose-topic h3,.filling-topic h3,.answer-topic h3{font-weight: 700;font-size: 14px;line-height: 34px;}
  23. .topic a{margin:0 5px; color: #4395ff}
  24. .topic p{display: inline;}
  25. .batch_topic a{margin:0 5px; color: #4395ff}
  26. .batch_topic p{display: inline;}
  27. /*.topic .score{color: #f00;}*/
  28. .score input,.right-answer{width: 30px;text-align: center; background: #fff;border:0;color: #50d2c2}
  29. .score input:focus,.right-answer:focus{border:1px solid #50d2c2;outline: none;}
  30. /*.right-answer{color: #f40;}*/
  31. .topic-answer input{width: 60px;}
  32. .model-score input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  33. .model-score input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
  34. .modal-btn{text-align: center;margin:10px 0;}
  35. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
  36. .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
  37. .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #009965;color:#fff;}
  38. .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
  39. .model-score1 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  40. .model-score1 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
  41. .modal-btn{text-align: center;margin:10px 0;}
  42. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
  43. .model-score2 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  44. .model-score2 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
  45. .modal-btn{text-align: center;margin:10px 0;}
  46. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #009965;color: #fff;}
  47. .modal-btn .close3{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #fff;color: #000;border:1px solid #555;border-radius: 3px;}
  48. .modal1_multi{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display:none ;background: rgba(0,0,0,.4)}
  49. .model-rule{width:80%;margin:15px auto;text-align: center;font-size:18px;}
  50. .modal1_multi .model-score1{width:80%;margin:10px auto;text-align: left}
  51. .modal1_multi .model-score-m{width:80%;margin:5px auto;}
  52. #update_msg{color:red}
  53. .modal1_multi .model-score-m label{margin:5px 0;font-size: 12px;color:red;font-weight: initial}
  54. .btn-garder {
  55. cursor: pointer;
  56. margin-top: 5px;
  57. margin-left: 10px;
  58. margin-right: 50px;
  59. display: inline-block;
  60. width: 100px;
  61. border: none;
  62. text-align: center;
  63. line-height: 30px;
  64. color: #fff;
  65. background-color: #2977ff;
  66. }
  67. .clearfix .fl .is-cool-down{text-align:right;margin: -10px 0 0 0;float:right;}
  68. .clearfix .fl .is-cool-down .cool-down-prompt{color:red;font-size:5px;}
  69. </style>
  70. <div class="reset-title clearfix">
  71. <span class="fl paper-title"><?php echo isset($resultList[0]['exam_name'])?$resultList[0]['exam_name']:'';?></span>
  72. <div class="fl">
  73. <span class="fl">参考班级</span>
  74. <span class="chk-all fl">全选</span>
  75. <em class="fl chk-num reset-num">0</em>
  76. </div>
  77. </div>
  78. <div class="class-box">
  79. <ul class="clearfix" id="select-class">
  80. <?php foreach($resultList as $key => $value):?>
  81. <li class="fl" classId="<?php echo $value['class_id'];?>" examId="<?php echo $value['exam_id'];?>">
  82. <?php
  83. $downloadCount = '0/0';
  84. if($printType == 'wp'){
  85. $downloadCount = "{$value["is_uploaded_count"]}/{$value["students_count"]}";
  86. }elseif($printType == 'wtb'){
  87. $downloadCount = "{$value["wrongbook_pdf_count"]}/{$value["is_uploaded_count"]}";
  88. }elseif($printType == 'third_wb'){
  89. $downloadCount = "{$value["wrongbook_pdf_count"]}/{$value["is_uploaded_count"]}";
  90. }elseif($printType == 'isp'){
  91. $downloadCount = "{$value["isp_pdf_count"]}/{$value["is_uploaded_count"]}";
  92. }elseif($printType == 'studytrend'){
  93. $downloadCount = "{$value["wbisp_pdf_count"]}/{$value["is_uploaded_count"]}";
  94. }elseif($printType == 'third_isp') {
  95. $downloadCount = "{$value["wbisp_pdf_count"]}/{$value["is_uploaded_count"]}";
  96. }elseif ($printType == 'exam_product'){
  97. $downloadCount = "{$value["pdfCount"]}/{$value["totalCount"]}";
  98. }
  99. ?>
  100. <div class="fl">
  101. <p class="is-cool-down" data-is-cool-down="<?php echo $value['is_cool_down'] ?>" style="display:<?php echo $value['is_cool_down_prompt']?'':'none';?>; ">
  102. <span class="cool-down-prompt">冷却中</span>
  103. </p>
  104. <h3 class="ellipsis"><?php echo $value['class_name'];?></h3>
  105. <p>已生成/总数:<?php echo $downloadCount;?></p>
  106. <p class="residue-count" data-residue-count="<?php echo $value['learn_tube_reset_residue_count']; ?>">已重置<?php echo $value['learn_tube_reset_count']; ?>次,还剩<?php echo $value['learn_tube_reset_residue_count']; ?>次</p>
  107. </div>
  108. <img src="/images/select_li.png" class="selected-img">
  109. </li>
  110. <?php endforeach;?>
  111. </ul>
  112. </div>
  113. <div class="reset-btn">
  114. <a href="javascript:;">重置</a>
  115. <span>您将重置<em class="reset-num">0</em>个班级的
  116. <?php
  117. if($printType == 'wtb'){
  118. echo '错题本';
  119. }elseif($printType == 'isp'){
  120. echo '个性化学习方案';
  121. }elseif($printType == 'third_wb'){
  122. echo '错题本';
  123. }elseif($printType == 'third_isp'){
  124. echo '个性化学习宝';
  125. }elseif($printType == 'studytrend'){
  126. echo '个性化学习宝';
  127. }elseif($printType == 'exam_product'){
  128. echo $productType == 1 ? '错题本' : '方法宝';
  129. }else{
  130. echo '错题前十和教师讲案';
  131. }
  132. ?>
  133. </span>
  134. </div>
  135. <!-- 重置提示框 -->
  136. <div class="modal1_multi">
  137. <div class="modal-shadow"></div>
  138. <div class="modal-content">
  139. <div class="modal-title clearfix">
  140. 提示<em class="fr close3">×</em>
  141. </div>
  142. <div class="model-rule">
  143. 同一场考试,只提供一次重置机会。 <br>确定需要重置吗?
  144. </div>
  145. <div class="model-score-m">
  146. <label>产品生成会占用服务器资源,请谨慎操作,重置后需排队等待哦!</label>
  147. </div>
  148. <div class="modal-btn">
  149. <a href="javascript:;" class="sumbit3">确定重置</a>
  150. <a href="javascript:;" class="close3 chameleon">取消</a>
  151. </div>
  152. </div>
  153. </div>
  154. <script>
  155. $(function () {
  156. var printType = "<?php echo $printType;?>";
  157. var isTechnicalSupport=<?php echo $is_technical_support; ?>;
  158. $(".reset-btn a").click(function () {
  159. //判断重置次数
  160. $('.model-rule').html("确定需要重置吗?");
  161. $('.sumbit3').show();
  162. $('.chameleon').html('取消');
  163. $('.model-score-m').show();
  164. $('.modal1_multi').show();
  165. // $(".layout-reset").fadeIn(400);
  166. });
  167. $('.close3').click(function(){
  168. $('.modal1_multi').hide();
  169. });
  170. $('.sumbit3').click(function(){
  171. doSubmit();
  172. });
  173. //提交重置
  174. function doSubmit(){
  175. var obj = $("#select-class>li.active");
  176. var classExam = [];
  177. $.each(obj, function(key, value) {
  178. var temp = [];
  179. temp.push($(value).attr('classId'));
  180. temp.push($(value).attr('examId'));
  181. classExam.push(temp);
  182. });
  183. if(classExam.length > 0){
  184. if(printType == 'wtb'){
  185. var url = "<?php echo $this->createUrl('client/mulWbhtml'); ?>";
  186. resetAction(classExam,url);
  187. }else if(printType == 'isp'){
  188. var url = "<?php echo $this->createUrl('client/mulIsp2html'); ?>";
  189. resetAction(classExam,url);
  190. }else if(printType == 'third_isp'){
  191. var url = "<?php echo $this->createUrl('client/mulIsp3html'); ?>";
  192. resetAction(classExam,url);
  193. }else if(printType == 'studytrend'){
  194. var url = "<?php echo $this->createUrl('client/mulIsp3html'); ?>";
  195. resetAction(classExam,url);
  196. }else if(printType == 'exam_product'){
  197. var url = "<?php echo $this->createUrl('client/mulExamProducthtml',array('productType'=>$productType)); ?>";
  198. resetAction(classExam,url);
  199. }else{
  200. var url = "<?php echo $this->createUrl('client/mulWbhtml'); ?>";
  201. resetAction(classExam,url);
  202. }
  203. }else{
  204. layer.msg('请选择班级!',{
  205. icon: 5
  206. }, function(){
  207. layer.closeAll();
  208. });
  209. }
  210. }
  211. $(".chk-all").click(function () {
  212. if ($(this).hasClass("active")) {
  213. $(this).removeClass("active");
  214. $(".class-box li").removeClass("active");
  215. $(".reset-num").html(0);
  216. $(".reset-btn").removeClass('reset-btn2');
  217. } else {
  218. var resetNum=0;
  219. for(var $i=0;$i<$(".class-box li").length;$i++){
  220. $(this).addClass("active")
  221. var isCoolDown=$(".class-box li").eq($i).find('.is-cool-down').attr('data-is-cool-down');
  222. var residueCount=$(".class-box li").eq($i).find('.residue-count').attr('data-residue-count');
  223. if(!isTechnicalSupport && (isCoolDown==0 || residueCount==0)){
  224. continue;
  225. }
  226. resetNum++;
  227. $(".class-box li").eq($i).addClass("active");
  228. $(".reset-num").html(resetNum);
  229. $(".reset-btn").addClass('reset-btn2');
  230. }
  231. }
  232. });
  233. $("body").delegate(".class-box li", "click", function () {
  234. var count = 0;
  235. if ($(this).hasClass("active")) {
  236. $(this).removeClass("active");
  237. } else {
  238. if(!isTechnicalSupport && ($(this).find('.is-cool-down').attr('data-is-cool-down')==0 || $(this).find('.residue-count').attr('data-residue-count')==0)){
  239. layer.msg('冷却中或者重置次数已用完',{
  240. icon: 5
  241. }, function(){
  242. layer.closeAll();
  243. });
  244. return false;
  245. }
  246. $(this).addClass("active");
  247. }
  248. for (var i = 0; i < $(".class-box li").length; i++) {
  249. if ($(".class-box li").eq(i).hasClass("active")) {
  250. count++;
  251. }
  252. if(count > 0){
  253. $(".reset-btn").addClass('reset-btn2');
  254. }else{
  255. $(".reset-btn").removeClass('reset-btn2');
  256. }
  257. }
  258. var resetNum=0;
  259. for(var $i=0;$i<$(".class-box li").length;$i++){
  260. var isCoolDown=$(".class-box li").eq($i).find('.is-cool-down').attr('data-is-cool-down');
  261. var residueCount=$(".class-box li").eq($i).find('.residue-count').attr('data-residue-count');
  262. if(!isTechnicalSupport && (isCoolDown==0 || residueCount==0)){
  263. continue;
  264. }
  265. resetNum++;
  266. }
  267. if (count == resetNum) {
  268. $(".chk-all").addClass("active");
  269. } else {
  270. $(".chk-all").removeClass("active");
  271. }
  272. $(".reset-num").html(count);
  273. });
  274. // toast("重置失败!请再次尝试")
  275. // toast("重置失败!请再次尝试",true)
  276. function toast(msg, flag) {
  277. /*flag参数为true,不能自动关闭,不传则3秒以后关闭*/
  278. $("body").append("<div class='toast'></div>");
  279. $(".toast").css({
  280. "position": "fixed",
  281. "left": "50%",
  282. "top": "50%",
  283. "transform": "translate(-50%,-50%)",
  284. "padding": "15px 25px",
  285. "max-width": "250px",
  286. "background": "rgba(0,0,0,.8)",
  287. "color": "#fff",
  288. "font-size": "14px",
  289. "border-radius": "5px",
  290. "display": "none",
  291. "z-index": "9999999"
  292. }).html(msg).fadeIn(400);
  293. if (flag)
  294. return;
  295. var tempTimer = setTimeout(function () {
  296. $(".toast").fadeOut(400).remove();
  297. clearTimeout(tempTimer)
  298. }, 3000)
  299. }
  300. function resetAction(classExam,url){
  301. $.ajax({
  302. url: url,
  303. type: "POST",
  304. dataType: "json",
  305. data: {classExam:classExam},
  306. success: function (data){
  307. if(data >= 0){
  308. layer.msg('操作成功!自动返回上一层',{
  309. icon: 1
  310. }, function(){
  311. layer.closeAll();
  312. window.history.go(-1);
  313. });
  314. }else{
  315. layer.msg('操作失败!请再次尝试',{
  316. icon: 5
  317. }, function(){
  318. layer.closeAll();
  319. });
  320. }
  321. },
  322. error: function (data, status, e){ //服务器响应失败处理函数
  323. layer.msg('返回失败!',{
  324. icon: 5
  325. }, function(){
  326. layer.closeAll();
  327. });
  328. }
  329. });
  330. }
  331. })
  332. </script>