reset.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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: #4395ff;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: #4395ff;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 $productName;?></span>
  72. <div class="fr">
  73. <span class="chk-all fl">全选</span>
  74. <em class="fl chk-num reset-num">0</em>
  75. <span class="fr btn-garder" id="goBack">返回</span>
  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" gpId="<?php echo $value['gp_id'];?>">
  82. <?php
  83. $downloadCount = '0/0';
  84. $downloadCount = "{$value["pdfCount"]}/{$value["totalCount"]}";
  85. ?>
  86. <div class="fl">
  87. <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';?>; ">
  88. <span class="cool-down-prompt">冷却中</span>
  89. </p>
  90. <h3 class="ellipsis"><?php echo $value['class_name'];?>
  91. </h3>
  92. <p>已生成/总数:<?php echo $downloadCount;?></p>
  93. <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>
  94. </div>
  95. <img src="/images/select_li.png" class="selected-img">
  96. </li>
  97. <?php endforeach;?>
  98. </ul>
  99. </div>
  100. <div class="reset-btn">
  101. <a href="javascript:;">重置</a>
  102. <span>您将重置<em class="reset-num">0</em>个班级的专题宝
  103. </span>
  104. </div>
  105. <!-- 重置提示框 -->
  106. <div class="modal1_multi">
  107. <div class="modal-shadow"></div>
  108. <div class="modal-content">
  109. <div class="modal-title clearfix">
  110. 提示<em class="fr close3">×</em>
  111. </div>
  112. <div class="model-rule">
  113. 确定需要重置吗?
  114. </div>
  115. <div class="model-score-m">
  116. <label>产品生成会占用服务器资源,请谨慎操作,重置后需排队等待哦!</label>
  117. </div>
  118. <div class="modal-btn">
  119. <a href="javascript:;" class="sumbit3">确定重置</a>
  120. <a href="javascript:;" class="close3 chameleon">取消</a>
  121. </div>
  122. </div>
  123. </div>
  124. <script>
  125. $(function () {
  126. //var printType = "<?php //echo $printType;?>//",
  127. // resetCount=parseInt(<?php //echo $resetCount;?>//);
  128. // resetCount=1;
  129. var isTechnicalSupport=<?php echo $is_technical_support; ?>;
  130. $(".reset-btn a").click(function () {
  131. $('.model-rule').html("确定需要重置吗?");
  132. $('.sumbit3').show();
  133. $('.chameleon').html('取消');
  134. $('.model-score-m').show();
  135. $('.modal1_multi').show();
  136. //判断重置次数
  137. // if(resetCount==0){
  138. // $('.model-rule').html("同一场考试,只提供一次重置机会。 <br>确定需要重置吗?");
  139. // $('.sumbit3').show();
  140. // $('.chameleon').html('取消');
  141. // $('.model-score-m').show();
  142. // $('.modal1_multi').show();
  143. // }else{
  144. // $('.model-score-m').hide();
  145. // $('.sumbit3').hide();
  146. // $('.chameleon').html('知道了');
  147. // $('.model-rule').html("当前考试已重置,不能继续重置!<br>请联系技术支持,谢谢!");
  148. // $('.modal1_multi').show();
  149. //
  150. // }
  151. // $(".layout-reset").fadeIn(400);
  152. });
  153. $('.close3').click(function(){
  154. $('.modal1_multi').hide();
  155. });
  156. $('.sumbit3').click(function(){
  157. doSubmit();
  158. });
  159. //提交重置
  160. function doSubmit(){
  161. var obj = $("#select-class>li.active");
  162. var classExam = [];
  163. $.each(obj, function(key, value) {
  164. classExam.push($(value).attr('gpId'));
  165. });
  166. if(classExam.length > 0){
  167. var url = "<?php echo $this->createUrl('special/reset'); ?>";
  168. resetAction(classExam,url);
  169. }else{
  170. layer.msg('请选择班级!',{
  171. icon: 5
  172. }, function(){
  173. layer.closeAll();
  174. });
  175. }
  176. }
  177. $(".chk-all").click(function () {
  178. if ($(this).hasClass("active")) {
  179. $(this).removeClass("active");
  180. $(".class-box li").removeClass("active");
  181. $(".reset-num").html(0);
  182. $(".reset-btn").removeClass('reset-btn2');
  183. } else {
  184. var resetNum=0;
  185. for(var $i=0;$i<$(".class-box li").length;$i++) {
  186. $(this).addClass("active")
  187. var isCoolDown = $(".class-box li").eq($i).find('.is-cool-down').attr('data-is-cool-down');
  188. var residueCount = $(".class-box li").eq($i).find('.residue-count').attr('data-residue-count');
  189. if (!isTechnicalSupport && (isCoolDown == 0 || residueCount == 0)) {
  190. continue;
  191. }
  192. resetNum++;
  193. $(".class-box li").eq($i).addClass("active");
  194. $(".reset-num").html(resetNum);
  195. $(".reset-btn").addClass('reset-btn2');
  196. }
  197. }
  198. });
  199. $("body").delegate(".class-box li", "click", function () {
  200. var count = 0;
  201. if ($(this).hasClass("active")) {
  202. $(this).removeClass("active");
  203. } else {
  204. if(!isTechnicalSupport && ($(this).find('.is-cool-down').attr('data-is-cool-down')==0 || $(this).find('.residue-count').attr('data-residue-count')==0)){
  205. layer.msg('冷却中或者重置次数已用完',{
  206. icon: 5
  207. }, function(){
  208. layer.closeAll();
  209. });
  210. return false;
  211. }
  212. $(this).addClass("active");
  213. }
  214. for (var i = 0; i < $(".class-box li").length; i++) {
  215. if ($(".class-box li").eq(i).hasClass("active")) {
  216. count++;
  217. }
  218. if(count > 0){
  219. $(".reset-btn").addClass('reset-btn2');
  220. }else{
  221. $(".reset-btn").removeClass('reset-btn2');
  222. }
  223. }
  224. var resetNum=0;
  225. for(var $i=0;$i<$(".class-box li").length;$i++){
  226. var isCoolDown=$(".class-box li").eq($i).find('.is-cool-down').attr('data-is-cool-down');
  227. var residueCount=$(".class-box li").eq($i).find('.residue-count').attr('data-residue-count');
  228. if(!isTechnicalSupport && (isCoolDown==0 || residueCount==0)){
  229. continue;
  230. }
  231. resetNum++;
  232. }
  233. if (count == resetNum) {
  234. $(".chk-all").addClass("active");
  235. } else {
  236. $(".chk-all").removeClass("active");
  237. }
  238. $(".reset-num").html(count);
  239. });
  240. // toast("重置失败!请再次尝试")
  241. // toast("重置失败!请再次尝试",true)
  242. function toast(msg, flag) {
  243. /*flag参数为true,不能自动关闭,不传则3秒以后关闭*/
  244. $("body").append("<div class='toast'></div>");
  245. $(".toast").css({
  246. "position": "fixed",
  247. "left": "50%",
  248. "top": "50%",
  249. "transform": "translate(-50%,-50%)",
  250. "padding": "15px 25px",
  251. "max-width": "250px",
  252. "background": "rgba(0,0,0,.8)",
  253. "color": "#fff",
  254. "font-size": "14px",
  255. "border-radius": "5px",
  256. "display": "none",
  257. "z-index": "9999999"
  258. }).html(msg).fadeIn(400);
  259. if (flag)
  260. return;
  261. var tempTimer = setTimeout(function () {
  262. $(".toast").fadeOut(400).remove();
  263. clearTimeout(tempTimer)
  264. }, 3000)
  265. }
  266. function resetAction(classExam,url){
  267. $.ajax({
  268. url: url,
  269. type: "POST",
  270. dataType: "json",
  271. data: {classExam:classExam},
  272. success: function (data){
  273. if(data.status){
  274. layer.msg('操作成功!自动返回上一层',{
  275. icon: 1
  276. }, function(){
  277. layer.closeAll();
  278. window.history.go(-1);
  279. });
  280. }else{
  281. layer.msg(data.message,{
  282. icon: 5
  283. }, function(){
  284. layer.closeAll();
  285. });
  286. }
  287. },
  288. error: function (data, status, e){ //服务器响应失败处理函数
  289. layer.msg('返回失败!',{
  290. icon: 5
  291. }, function(){
  292. layer.closeAll();
  293. });
  294. }
  295. });
  296. }
  297. })
  298. $('#goBack').click(function () {
  299. window.history.go(-1);
  300. })
  301. </script>