reset_ac.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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;}
  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: 70px; 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: #15ae68;}
  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: #15ae68}
  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:#15ae68;}
  19. .reset-btn2 a:hover{text-decoration: none;background-color: #008749;}
  20. </style>
  21. <div class="reset-title clearfix">
  22. <span class="fl paper-title"><?php echo isset($resultList[0]['exam_name'])?$resultList[0]['exam_name']:'';?></span>
  23. <div class="fl">
  24. <span class="fl">参考班级</span>
  25. <span class="chk-all fl">全选</span>
  26. <em class="fl chk-num reset-num">0</em>
  27. </div>
  28. </div>
  29. <div class="class-box">
  30. <ul class="clearfix" id="select-class">
  31. <?php foreach($resultList as $key => $value):?>
  32. <li class="fl" classId="<?php echo $value['class_id'];?>" examId="<?php echo $value['exam_id'];?>" isAcademicrPdf="<?php echo $value['is_academicr_pdf'];?>" academicrPdfPath="<?php echo $value['academicr_pdf_path'];?>" isTopwbPdf="<?php echo $value['is_topwb_pdf'];?>" topwbPdfPath="<?php echo $value['topwb_pdf_path'];?>">
  33. <div class="fl">
  34. <h3 class="ellipsis"><?php echo $value['class_name'];?></h3>
  35. <!--<p>已生成/总数:</p>-->
  36. </div>
  37. <img src="/images/select_li.png" class="selected-img">
  38. </li>
  39. <?php endforeach;?>
  40. </ul>
  41. </div>
  42. <div class="reset-btn">
  43. <a href="javascript:;">重置</a>
  44. <span>您将重置<em class="reset-num">0</em>个班级的
  45. <?php
  46. if($printType == 'wtb'){
  47. echo '错题本';
  48. }elseif($printType == 'isp'){
  49. echo '个性化学习方案';
  50. }elseif($printType == 'studytrend'){
  51. echo '个性化学习宝';
  52. }else{
  53. echo '错题前十和教师讲案';
  54. }
  55. ?>
  56. </span>
  57. </div>
  58. <script>
  59. $(function () {
  60. var printType = "<?php echo $printType;?>";
  61. $(".reset-btn a").click(function () {
  62. var obj = $("#select-class>li.active");
  63. var examIds = [];
  64. $.each(obj, function(key, value) {
  65. var temp = [];
  66. var v = $(value);
  67. temp.push(v.attr('examId'));
  68. temp.push(v.attr('isAcademicrPdf'));
  69. temp.push(v.attr('academicrPdfPath'));
  70. temp.push(v.attr('isTopwbPdf'));
  71. temp.push(v.attr('topwbPdfPath'));
  72. examIds.push(temp);
  73. });
  74. if(examIds.length > 0){
  75. var url = "<?php echo $this->createUrl('export/resetAc'); ?>";
  76. resetAction(examIds,url);
  77. }else{
  78. layer.msg('请选择班级!',{
  79. icon: 5
  80. }, function(){
  81. layer.closeAll();
  82. });
  83. }
  84. // $(".layout-reset").fadeIn(400);
  85. });
  86. $(".chk-all").click(function () {
  87. if ($(this).hasClass("active")) {
  88. $(this).removeClass("active");
  89. $(".class-box li").removeClass("active");
  90. $(".reset-num").html(0);
  91. $(".reset-btn").removeClass('reset-btn2');
  92. } else {
  93. $(this).addClass("active");
  94. $(".class-box li").addClass("active");
  95. $(".reset-num").html($(".class-box li").length);
  96. $(".reset-btn").addClass('reset-btn2');
  97. }
  98. });
  99. $("body").delegate(".class-box li", "click", function () {
  100. var count = 0;
  101. if ($(this).hasClass("active")) {
  102. $(this).removeClass("active");
  103. } else {
  104. $(this).addClass("active");
  105. }
  106. for (var i = 0; i < $(".class-box li").length; i++) {
  107. if ($(".class-box li").eq(i).hasClass("active")) {
  108. count++;
  109. }
  110. if(count > 0){
  111. $(".reset-btn").addClass('reset-btn2');
  112. }else{
  113. $(".reset-btn").removeClass('reset-btn2');
  114. }
  115. }
  116. if (count == $(".class-box li").length) {
  117. $(".chk-all").addClass("active");
  118. } else {
  119. $(".chk-all").removeClass("active");
  120. }
  121. $(".reset-num").html(count);
  122. });
  123. // toast("重置失败!请再次尝试")
  124. // toast("重置失败!请再次尝试",true)
  125. function toast(msg, flag) {
  126. /*flag参数为true,不能自动关闭,不传则3秒以后关闭*/
  127. $("body").append("<div class='toast'></div>");
  128. $(".toast").css({
  129. "position": "fixed",
  130. "left": "50%",
  131. "top": "50%",
  132. "transform": "translate(-50%,-50%)",
  133. "padding": "15px 25px",
  134. "max-width": "250px",
  135. "background": "rgba(0,0,0,.8)",
  136. "color": "#fff",
  137. "font-size": "14px",
  138. "border-radius": "5px",
  139. "display": "none",
  140. "z-index": "9999999"
  141. }).html(msg).fadeIn(400);
  142. if (flag)
  143. return;
  144. var tempTimer = setTimeout(function () {
  145. $(".toast").fadeOut(400).remove();
  146. clearTimeout(tempTimer)
  147. }, 3000)
  148. }
  149. function resetAction(examIds,url){
  150. $.ajax({
  151. url: url,
  152. type: "POST",
  153. dataType: "json",
  154. data: {examIds:examIds},
  155. success: function (data){
  156. if(data >= 0){
  157. layer.msg('操作成功!自动返回上一层',{
  158. icon: 1
  159. }, function(){
  160. layer.closeAll();
  161. window.history.go(-1);
  162. });
  163. }else{
  164. layer.msg('操作失败!请再次尝试',{
  165. icon: 5
  166. }, function(){
  167. layer.closeAll();
  168. });
  169. }
  170. },
  171. error: function (data, status, e){ //服务器响应失败处理函数
  172. layer.msg('返回失败!',{
  173. icon: 5
  174. }, function(){
  175. layer.closeAll();
  176. });
  177. }
  178. });
  179. }
  180. })
  181. </script>