
/********导航颜色*********/
$(".nav_right .nav").eq(8).addClass("active");

// 讲师轮播
new Swiper(".swiper-teach", {
  slidesPerView: 3,
  slidesPerGroup: 3,
  spaceBetween: 18,
  direction: "vertical",
  autoplay: true,
});
new Swiper(".swiper-phone", {
  slidesPerView: 4,
  autoplay: true,
  spaceBetween: 0,
  loop: true,
  direction: "vertical",
});

// 开班信息模块
function kbxx() {
  var cityId = arguments[0] !== undefined ? arguments[0] : 10;
  $.ajax({
    url:
      "https://owzsapi.qfedu.com/v1/api/openApiRestController/getAllClass?type=1",
    type: "GET",
    success: function success(res) {
      var r = "";
      var curTime = new Date().getTime();
      var filterArr = res.data.filter(function (v) {
        return v.cityId == cityId;
      });
      console.log(filterArr);
      filterArr.reverse().forEach(function (v, idx) {
        // 最大条数
        if (idx > 20) return;
        // 判断时间
        var timeMode = "预约占座";
        var kbTime = new Date(v.beginTime).getTime();
        // 一个月
        if (kbTime - curTime > 2592000000) {
          timeMode = "预约占座";
        }
        if (kbTime - curTime > 0 && kbTime - curTime < 2642268030) {
          timeMode = "即将报满";
        }
        if (kbTime - curTime < 0) {
          timeMode = "爆满开班";
        }

        r +=
          "<li class=''>\n        <a href='javascript:;' onclick='open53_pc()'>\n        <span>" +
          (v.name.replace(v.cityName, "").split("班")[0] + "班") +
          "</span>\n          <span>" +
          v.beginTime +
          "</span>\n          <span data-mode='" +
          (timeMode === "即将报满"
            ? 0
            : timeMode === "爆满开班"
            ? 2
            : 1) +
          "'>" +
          timeMode +
          " " +
          (timeMode === "即将报满" ? "" : "") +
          "</span>\n          </a>\n          </li>";
      });

      $(".kbxx-con").html(r);
    },
  });
}
kbxx(10);

$(".item-wrap_2oCLZ").mouseover(function () {
  $(this).addClass("active").siblings().removeClass("active");
});

(function () {
  // var tabIdx = 0
  var acIdx = 0;
  $(".wyrs-con a").removeClass("active").eq(acIdx).addClass("active");

  var timer = setInterval(function () {
    acIdx = acIdx >= 12 ? 0 : acIdx + 1;
    $(".wyrs-con a").removeClass("active").eq(acIdx).addClass("active");
  }, 1500);

  $(".wyrs-con a")
    .mouseover(function () {
      clearInterval(timer);
      timer = null;
      $(".wyrs-con a").removeClass("active");
    })
    .mouseleave(function () {
      timer = setInterval(function () {
        acIdx = acIdx >= 12 ? 0 : acIdx + 1;
        $(".wyrs-con a")
          .removeClass("active")
          .eq(acIdx)
          .addClass("active");
      }, 1500);
    });
})();

var bot =
  $(".idkstd").offset().top +
  $(".idkstd").outerHeight() -
  $(window).height() +
  30;
var left = $("#fixTop").offset().left;
$(document).scroll(function () {
  var scroH = $(document).scrollTop();
  var footTop = $(".kbxx ").offset().top - $(window).height();
  if (scroH > bot) {
    $("#fixTop").addClass("rig_fixed");
    $("#fixTop").css({ left: left });
    if (scroH > footTop) {
      $("#fixTop").addClass("rig_bottom");
      $("#fixTop").css({ left: "909px" });
    } else {
      $("#fixTop").removeClass("rig_bottom");
    }
  } else {
    $("#fixTop").removeClass("rig_fixed");
    $("#fixTop").removeClass("rig_bottom");
  }
});
/********底部链接*********/
$(".list-more").click(function () {
  $(this).parent().find("li").css("display", "block");
  $(this).css("display", "none");
});
$(".list-hidden").click(function () {
  $(this).parent().find("li").css("display", "none");
  $(this).parent().find("li:lt(5)").css("display", "block");
});

$(".footer-link .links-tab span").click(function () {
  $(this).addClass("active").siblings().removeClass("active");
  $(".footer-link .links-a").removeClass("active");
  $(".footer-link .links-a").eq($(this).index()).addClass("active");
});
