123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <style>
- .reset-title{padding-left: 20px; line-height: 40px;font-size: 14px;border-bottom: 1px solid #eee;}
- .paper-title{margin-right: 20px;}
- .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;}
- .chk-all.active{background: url(/images/select_ipt.png) no-repeat left center;-webkit-background-size: 16px;background-size: 16px;}
- .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;}
- .class-box{padding-bottom:50px;}
- .class-box ul{padding:20px 0 0 24px;}
- .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;}
- .class-box li h3{margin:0; width: 180px; font-size: 16px;line-height: 24px; color: #15ae68;}
- .class-box li p{margin-top: 6px;}
- .selected-img{position: absolute;top:50%;right: 10px;transform:translateY(-50%);display: none;}
- .class-box li.active,.class-box li:hover{border-color: #15ae68}
- .class-box li.active .selected-img{display: block;}
- .reset-btn{position: fixed;left: 24px;bottom:0;padding-top:10px;padding-bottom: 16px;width: 100%;background-color: #fff;}
- .reset-btn span{color: #f00;}
- .reset-btn a{margin-right: 10px; display: inline-block;color: #fff;background-color: grey;width: 100px;line-height: 30px;text-align: center; }
- .reset-btn2 a{text-decoration: none;background:#15ae68;}
- .reset-btn2 a:hover{text-decoration: none;background-color: #008749;}
-
- </style>
- <div class="reset-title clearfix">
- <span class="fl paper-title"><?php echo isset($resultList[0]['exam_name'])?$resultList[0]['exam_name']:'';?></span>
- <div class="fl">
- <span class="fl">参考班级</span>
- <span class="chk-all fl">全选</span>
- <em class="fl chk-num reset-num">0</em>
- </div>
- </div>
- <div class="class-box">
- <ul class="clearfix" id="select-class">
- <?php foreach($resultList as $key => $value):?>
- <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'];?>">
- <div class="fl">
- <h3 class="ellipsis"><?php echo $value['class_name'];?></h3>
- <!--<p>已生成/总数:</p>-->
- </div>
- <img src="/images/select_li.png" class="selected-img">
- </li>
- <?php endforeach;?>
- </ul>
- </div>
- <div class="reset-btn">
- <a href="javascript:;">重置</a>
- <span>您将重置<em class="reset-num">0</em>个班级的
- <?php
- if($printType == 'wtb'){
- echo '错题本';
- }elseif($printType == 'isp'){
- echo '个性化学习方案';
- }elseif($printType == 'studytrend'){
- echo '个性化学习宝';
- }else{
- echo '错题前十和教师讲案';
- }
- ?>
- </span>
- </div>
- <script>
- $(function () {
- var printType = "<?php echo $printType;?>";
- $(".reset-btn a").click(function () {
- var obj = $("#select-class>li.active");
- var examIds = [];
- $.each(obj, function(key, value) {
- var temp = [];
- var v = $(value);
- temp.push(v.attr('examId'));
- temp.push(v.attr('isAcademicrPdf'));
- temp.push(v.attr('academicrPdfPath'));
- temp.push(v.attr('isTopwbPdf'));
- temp.push(v.attr('topwbPdfPath'));
- examIds.push(temp);
- });
-
- if(examIds.length > 0){
- var url = "<?php echo $this->createUrl('export/resetAc'); ?>";
- resetAction(examIds,url);
- }else{
- layer.msg('请选择班级!',{
- icon: 5
- }, function(){
- layer.closeAll();
- });
- }
- // $(".layout-reset").fadeIn(400);
- });
-
- $(".chk-all").click(function () {
- if ($(this).hasClass("active")) {
- $(this).removeClass("active");
- $(".class-box li").removeClass("active");
- $(".reset-num").html(0);
- $(".reset-btn").removeClass('reset-btn2');
- } else {
- $(this).addClass("active");
- $(".class-box li").addClass("active");
- $(".reset-num").html($(".class-box li").length);
- $(".reset-btn").addClass('reset-btn2');
- }
- });
- $("body").delegate(".class-box li", "click", function () {
- var count = 0;
- if ($(this).hasClass("active")) {
- $(this).removeClass("active");
- } else {
- $(this).addClass("active");
- }
- for (var i = 0; i < $(".class-box li").length; i++) {
- if ($(".class-box li").eq(i).hasClass("active")) {
- count++;
- }
- if(count > 0){
- $(".reset-btn").addClass('reset-btn2');
- }else{
- $(".reset-btn").removeClass('reset-btn2');
- }
- }
- if (count == $(".class-box li").length) {
- $(".chk-all").addClass("active");
- } else {
- $(".chk-all").removeClass("active");
- }
- $(".reset-num").html(count);
- });
- // toast("重置失败!请再次尝试")
- // toast("重置失败!请再次尝试",true)
- function toast(msg, flag) {
- /*flag参数为true,不能自动关闭,不传则3秒以后关闭*/
- $("body").append("<div class='toast'></div>");
- $(".toast").css({
- "position": "fixed",
- "left": "50%",
- "top": "50%",
- "transform": "translate(-50%,-50%)",
- "padding": "15px 25px",
- "max-width": "250px",
- "background": "rgba(0,0,0,.8)",
- "color": "#fff",
- "font-size": "14px",
- "border-radius": "5px",
- "display": "none",
- "z-index": "9999999"
- }).html(msg).fadeIn(400);
- if (flag)
- return;
- var tempTimer = setTimeout(function () {
- $(".toast").fadeOut(400).remove();
- clearTimeout(tempTimer)
- }, 3000)
- }
-
-
- function resetAction(examIds,url){
- $.ajax({
- url: url,
- type: "POST",
- dataType: "json",
- data: {examIds:examIds},
- success: function (data){
- if(data >= 0){
- layer.msg('操作成功!自动返回上一层',{
- icon: 1
- }, function(){
- layer.closeAll();
- window.history.go(-1);
- });
- }else{
- layer.msg('操作失败!请再次尝试',{
- icon: 5
- }, function(){
- layer.closeAll();
- });
- }
- },
- error: function (data, status, e){ //服务器响应失败处理函数
- layer.msg('返回失败!',{
- icon: 5
- }, function(){
- layer.closeAll();
- });
- }
- });
- }
- })
- </script>
|