var shutime = {
percent: 0,
timers: "",
init: function(e) {
$("body").append('
');
// $("nav ul li").hover(function() {
// $(".sub_header").addClass("active");
// }, function() {
// $(".sub_header").removeClass("active");
// })
// $(".must").hover(function() {
// $(".sub_header").addClass("active");
// }, function() {
// $(".sub_header").removeClass("active");
// })
$('#nav-icon2').click(function() {
$(this).toggleClass('open');
$("nav").toggleClass("active");
$(".mob_nav").toggleClass("active");
if($(this).hasClass("open")){
$("header").addClass("active")
}
});
$(".mob_nav ul li .two-leval a").click(function(){
$('#nav-icon2').removeClass("open")
$('nav').removeClass("active")
$('.mob_nav').removeClass("active")
setTimeout(function(){
shutime.scrollToPos(100);
},500)
})
$(window).scroll(function() {
var scrollTop = $(window).scrollTop();
if (scrollTop > 0) {
$("header").addClass("active")
} else {
$("header").removeClass("active")
}
});
var wow = new WOW({
boxClass: 'wow',
animateClass: 'animated',
offset: 100,
mobile: true,
live: true
}).init();
$(".search_btn").click(function(){
$(".search_box").addClass("active");
})
$(".s_close").click(function(){
$(".search_box").removeClass("active");
})
$(".lazy").lazyload({effect: "fadeIn"});
$("header nav ul li .list a").click(function() {
setTimeout(function(){
shutime.scrollToPos(100);
},100)
// $(".sub_header").removeClass("active");
})
// $(".sub_header ul li").hover(function(){
// if($(this).index() == 0){
// return;
// }
// $(".m_pic img").eq($(this).index() - 1).addClass("active").siblings().removeClass("active");
// })
$('.search_box .row input').bind('keypress', function (event) {
if (event.keyCode == "13") {
if ($('.search_box .row input').val() == "") return;
window.open("/search.html#keywords=" + $('.search_box .row input').val());
}
});
$(".search_box .row .s_btn").click(function () {
if ($('.search_box .row input').val() == "") return;
window.open("/search.html#keywords=" + $('.search_box .row input').val());
})
$(".mob_nav ul li .one-level").click(function(){
if($(this).parent().hasClass("active")){
$(this).parent().removeClass("active");
}else{
$(".mob_nav ul li").removeClass("active");
$(this).parent().addClass("active");
}
})
},
common_scroll: function() {
const pageContainer = document.querySelector("#main-content-wrap");
const scroller = new LocomotiveScroll({
el: pageContainer,
smooth: true,
tablet: {
breakpoint: 0
}
});
scroller.on("scroll", function(ins) {
if (ins.scroll.y > 0) {
$("header").addClass("active");
} else {
$("header").removeClass("active");
}
console.log(ins.scroll.y)
});
},
scrollText:function(){
$(window).scroll(function () {
var scrollTop = $(window).scrollTop();
$(".a_img").css({"-webkit-transform":"rotate("+scrollTop / 3+"deg)"});
$(".marquee_box").css({"-webkit-transform":"translateX(-"+scrollTop / 4+"px)"});
});
},
index: function() {
var options = {
useEasing: true,
useGrouping: true,
separator: '',
decimal: '.',
prefix: '',
suffix: ''
};
var zxrs = new CountUp("zxrs", 0, 100000, 0, 2.5, options);
var fwrs = new CountUp("fwrs", 0, 500000, 0, 2.5, options);
var qbxy = new CountUp("qbxy", 0, 150, 0, 2.5, options);
var qqxy = new CountUp("qqxy", 0, 500, 0, 2.5, options);
var tskc = new CountUp("tskc", 0, 100, 0, 2.5, options);
var bannerSwiper = new Swiper(".banner-swiper", {
speed: 1000,
autoplay: {
delay: 5000,
stopOnLastSlide: false,
disableOnInteraction: true,
},
pagination: {
el: ".banner-swiper .swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".banner-swiper .swiper-button-next",
prevEl: ".banner-swiper .swiper-button-prev",
},
grabCursor: true,
effect: "creative",
creativeEffect: {
prev: {
shadow: true,
translate: ["-20%", 0, -1],
},
next: {
translate: ["100%", 0, 0],
},
},
});
var state = true;
var index = 0;
$('body').bind('mousewheel', function (event, delta) {
if (state == false) return;
if (delta > 0) { // 涓
state = false;
index--;
if(index < 0){
index = 0;
}else{
$(".box").removeClass("active");
}
bannerEffect(index);
} else { // 涓
state = false;
index ++;
if(index > 5){
index = 5
}else{
$(".box").removeClass("active");
}
bannerEffect(index);
}
});
$(".menu_bar").addClass("active")
var startY = 0;
document.addEventListener("touchstart",function(e){
startY = e.changedTouches[0].pageY;
},false);
document.addEventListener("touchend",function(e){
var endY = e.changedTouches[0].pageY;
var changeVal = endY - startY;
console.log(changeVal)
if(changeVal > 20){
state = false;
index--;
if(index < 0){
index = 0;
}else{
$(".box").removeClass("active");
}
bannerEffect(index);
}else if(changeVal < -20){//鍚戜笅婊
state = false;
index ++;
if(index > 5){
index = 5
}else{
$(".box").removeClass("active");
}
bannerEffect(index);
}
},false);
function bannerEffect(id){
index = id;
if(index == 2){
$("#bg").addClass("active")
}else{
$("#bg").removeClass("active")
}
if(index == 3){
setTimeout(function(){
zxrs.start();
fwrs.start();
qbxy.start();
qqxy.start();
tskc.start();
},2000)
}
if(index == 4){
$(".con_bg .bgs").addClass("active");
}else{
$(".con_bg .bgs").removeClass("active");
}
if(index == 5){
$(".sbox").addClass("active");
}else{
$(".sbox").removeClass("active");
}
if(index == 0){
$("header").removeClass("active");
}else{
$("header").addClass("active");
}
$(".menu_bar a").eq(index).addClass("active").siblings().removeClass("active");
if(index == 0 || index == 2 || index == 3){
$(".menu_bar").addClass("active")
}else{
$(".menu_bar").removeClass("active")
}
setTimeout(function(){
state = true;
$(".box").eq(index).addClass("active");
},1000)
}
$(".box5 .left .v_dot").click(function(){
shutime.videoList($(this).attr("data-url"));
})
$(".menu_bar a").click(function(){
if(index == $(this).index()) return;
$(".box").removeClass("active");
bannerEffect($(this).index());
$(this).addClass("active").siblings().removeClass("active");
})
// $(".box2 .ball").click(function(){
// $(this).addClass("active").siblings().removeClass("active");
// $(".contrl img").eq($(this).index() - 1).addClass("active").siblings().removeClass("active");
// })
var m_no = 0;
var m_total = $(".box2 .ball").length;
var htTime = setInterval(moveRight, 5000);
$(".box2 .ball").hover(function() {
clearInterval(htTime);
m_no = $(this).index() - 1;
effectBaLL(m_no);
}, function() {
htTime = setInterval(moveRight, 5000);
})
function moveRight() {
m_no = ++m_no > m_total - 1 ? 0 : m_no;
effectBaLL(m_no)
}
function effectBaLL(id){
$(".box2 .ball").eq(id).addClass("active").siblings().removeClass("active");
$(".contrl img").eq(id).addClass("active").siblings().removeClass("active");
}
if($(window).width()>900){
var scene = document.getElementById('box2');
var parallax = new Parallax(scene);
}
},
tlVideo:function(){
$(".pager").addClass("go");
$(".subBanner").addClass("active");
$(".news_r.vo ul li").click(function(){
shutime.videoList($(this).attr("data-url"));
})
shutime.page();
},
title: function() {
$(".subTitle").each(function(i) {
var splitone = new SplitText($(this).find("b"), {
type: 'chars, words',
charsClass: 'chars',
linesClass: 'lines'
});
});
},
message:function(){
$(".lida_nav a").click(function(){
$(this).addClass("active").siblings().removeClass("active");
$(".lida_warp .warp_box").eq($(this).index()).addClass("active").siblings().removeClass("active");
})
// 閫夋嫨鍖垮悕
_niming = "涓嶅尶鍚?;
var _type = '寤夋磥涓炬姤';
$('#complaints').change(function (e) {
_type = $(this).val()
})
$(".wishBtn").click(function(){
$(this).toggleClass("active");
if ($(this).hasClass("active")) {
$('#customer').prop("disabled", true)
_niming = "鍖垮悕";
} else {
$('#customer').prop("disabled", false)
_niming = "涓嶅尶鍚?;
}
})
//涓婁紶
_files = document.getElementById('file');
filesUrl = '';
filesName = '';
_files.addEventListener("change", function (e) {
// console.log(e)
var node = e.srcElement || e.target;
var fileName = node.files[0];
if (fileName.size >= 2097152) {
shutime.toast("璇蜂笂浼犲皬浜?mb鐨勬枃浠?, false);
return
}
var formData = new FormData();
formData.append("file", fileName);
console.log(fileName)
$.ajax({
type: 'post',
processData: false,
contentType: false,
data: formData,
url: '/word.html',
dataType: 'json',
success: function (data) {
if (data.code != '200') {
shutime.toast(data.message, false);
} else {
filesUrl = data.data.url;
filesName = data.data.original;
shutime.toast(data.message, true);
}
},
error: function (e) {
console.log(e)
}
})
});
// 涓婁紶鍐呭
$('.submit_msg').click(function (e) {
if ($(this).hasClass("active")) return;
$(this).addClass("active");
console.log("filesName:"+filesName)
console.log(filesName != "")
console.log("============")
console.log($('#mes').val() != "")
if (($('#customer').val() == '') && (_niming == "涓嶅尶鍚?)) {
shutime.toast("璇峰~鍐欏鍚?, false);
$('.submit_msg').removeClass("active");
return;
}else if ($('#tel').val() == "") {
shutime.toast("璇峰~鍐欒仈绯荤數璇?, false);
$('.submit_msg').removeClass("active");
return;
} else if (!shutime.regPhone($('#tel').val())) {
shutime.toast("璇峰~鍐欐纭殑鑱旂郴鐢佃瘽", false);
$('.submit_msg').removeClass("active");
return;
} else if ($('#email').val() == "") {
shutime.toast("璇峰~鍐欓偖绠?, false);
$('.submit_msg').removeClass("active");
return;
} else if (!shutime.regEmail($('#email').val())) {
shutime.toast("璇峰~鍐欐纭偖绠?, false);
$('.submit_msg').removeClass("active");
return;
} else if ($('#address').val() == "") {
shutime.toast("璇峰~鍐欏湴鍧€", false);
$('.submit_msg').removeClass("active");
return;
} else if ($('#mes').val() != "" && filesName != "") {
shutime.toast("璇峰~鍐欏唴瀹规垨涓婁紶闄勪欢", false);
$('.submit_msg').removeClass("active");
return;
} else {
console.log(filesUrl);
var _mz = $('#customer').val()
if(_niming == "鍖垮悕"){
_mz = "鍖垮悕"
}
$('.submit_msg').addClass("active");
$.post("/apiform.html",{
field_1: _niming,
field_2: _type,
name: _mz,
phone: $('#tel').val(),
email: $('#email').val(),
field_3:shutime.getcity(),
address:$('#address').val(),
content: $('#mes').val(),
file: filesUrl,
"_csrf-frontend":$("#csrf").val()
},function(data){
if (data.code == "200") {
shutime.toast("鎻愪氦鎴愬姛", true);
}else{
shutime.toast(data.message, false);
$('.submit_msg').removeClass("active");
}
})
}
})
// 鏌ヨ杩涘害
$(".jd_submit").click(function(){
if ($('.userTel').val() == "") {
shutime.toast("璇峰~鍐欐偍鐨勬墜鏈哄彿鐮?, false);
return;
} else if (!shutime.regPhone($('.userTel').val())) {
shutime.toast("璇峰~鍐欐纭殑鎵嬫満鍙风爜", false);
return;
} else {
$.get("/apilist.html",{phone: $('.userTel').val()},function(data){
if (data.code == 200) {
$(".jd_row").addClass("active");
$(".re-li-second").removeClass("active");
var list = data.data.list;
$(".re-lis").html("");
for(var i = 0; i < list.length; i++){
$(".re-lis").append(''+(i+1)+'
'+list[i].time+'
'+list[i].status+'
')
}
}else{
shutime.toast(data.message, false);
}
})
}
})
},
star:function(){
var topArr = [];
var navHeight = 0;
var beforeIndex = 0;
var nowIndex = 0;
var winHeight = $(window).height();
var navbox = $(".star_left");
var container = $(".star_right");
var start = 0;
var end = 0;
var endOffset = 100;
function asideInit() {
getPara();
asideNavTb();
progressBar();
}
$(window).scroll(function () {
asideNavTb();
progressBar();
});
function getPara() {
$(".star_right ul li").each(function (index, item) {
var top = $(this).offset().top;
topArr[index] = top;
});
navHeight = 76;
winHeight = $(window).height();
start = container['offset']().top - winHeight / 2;
end = container['offset']().top + container['height']() - winHeight / 2 - navbox['height']() - endOffset;
}
function asideNavTb() {
for (var i = 0; i < topArr.length; i++) {
if ($(window).scrollTop() > topArr[i] - $(window).height() / 3) {
nowIndex = i;
// console.log(nowIndex);
}
}
if (nowIndex != beforeIndex) {
beforeIndex = nowIndex;
$(".star_left ul li").eq(nowIndex).addClass("active").siblings().removeClass("active");
$(".star_right ul li").eq(nowIndex).addClass("active").siblings().removeClass("active");
}
};
function progressBar(){
var totalHeight = $("body").height() - $(window).height();
var now = $(window).scrollTop();
var progress = (parseFloat(now/totalHeight)*100).toFixed(2) + "%";
$(".star_left .line span").height(progress);
}
var html,html2;
// $('.aList>ul').html(html);
// 閫夋嫨鐪佷唤
$(".tianli_map .list p").click(function(){
$(".tianli_map").removeClass("active");
getSchool($(this).text())
})
getSchool("鍥涘窛");
function getSchool(words){
$(".sfbt").html(words);
$.get("/apischool.html",{keywords:words},function(data){
if(data.code == 200){
console.log(data)
html = template('leftlist', data);
html2 = template('rightlist', data);
$('.star_left ul').html(html);
$('.star_right ul').html(html2);
$(".star_left ul li").eq(0).addClass("active");
$(".star_right ul li").eq(0).addClass("active");
setTimeout(function(){
asideInit();
},100)
}else{
shutime.toast(data.message, false);
}
})
}
$(".morePrince").click(function(e){
window.event? window.event.cancelBubble = true : e.stopPropagation();
$(".tianli_map").addClass("active")
})
$(document).click(function(e){
var e = e || window.event; //娴忚鍣ㄥ吋瀹规€
var elem = e.target || e.srcElement;
while (elem) { //寰幆鍒ゆ柇鑷宠窡鑺傜偣锛岄槻姝㈢偣鍑荤殑鏄痙iv#test瀛愬厓绱
if (elem.id && elem.id == 'tlmap') {
return;
}
elem = elem.parentNode;
}
$(".tianli_map").removeClass("active")
})
var m_no = 0;
var m_total = $(".earth_map ul>li").length;
var htTime = setInterval(moveRight,5000);
$(".earth_map ul li").eq(0).addClass("active");
$(".next").click(function(){
moveRight();
})
$(".prev").click(function(){
moveLeft();
})
function moveRight(){
m_no=++m_no>m_total-1?0:m_no;
showAnimate(m_no)
}
function moveLeft(){
m_no=--m_no<0?m_total-1:m_no;
showAnimate(m_no)
}
function showAnimate(no){
$(".earth_map ul li").eq(no).addClass("active").siblings().removeClass("active");
}
$('.date_picker').date_input();
var _sf = '鍥涘窛';
$('#complaints').change(function (e) {
_sf = $(this).val()
})
// 涓婁紶鍐呭
$('.orders_btn').click(function (e) {
if ($(this).hasClass("active")) return;
$(this).addClass("active");
if (($('.yname').val() == '')) {
shutime.toast("璇峰~鍐欏鍚?, false);
$('.orders_btn').removeClass("active");
return;
}else if ($('.ytel').val() == "") {
shutime.toast("璇峰~鍐欒仈绯荤數璇?, false);
$('.orders_btn').removeClass("active");
return;
} else if (!shutime.regPhone($('.ytel').val())) {
shutime.toast("璇峰~鍐欐纭殑鑱旂郴鐢佃瘽", false);
$('.orders_btn').removeClass("active");
return;
} else if ($('.yschool').val() == "") {
shutime.toast("璇峰~鍐欐潵璁垮鏍?, false);
$('.orders_btn').removeClass("active");
return;
} else if ($('.date_picker').val() == "") {
shutime.toast("璇峰~鍐欐潵璁挎棩鏈?, false);
$('.orders_btn').removeClass("active");
return;
} else {
$('.orders_btn').addClass("active");
$.post("/apiapply.html",{
name: $('.yname').val(),
phone: $('.ytel').val(),
school:$(".yschool").val(),
address:_sf,
content: $('.ymsg').val(),
time: $(".date_picker").val(),
"_csrf-frontend":$("#csrf").val()
},function(data){
if (data.code == "200") {
shutime.toast("鎻愪氦鎴愬姛", true);
}else{
shutime.toast(data.message, false);
$('.orders_btn').removeClass("active");
}
})
}
})
setTimeout(function(){
shutime.scrollToPos(100);
},1000)
},
getcity:function(city){
var value = [];
var objs = $("input[class='currentValue']");
for (var i = 0; i < objs.size(); i++) {
value.push(objs.eq(i).val());
}
// alert(value.join(','));
return(value.join(','))
},
network: function() {
$(".dot_list ul li").click(function() {
$(".lightBox").addClass("active")
})
$(".net_close").click(function() {
$(".lightBox").removeClass("active")
})
},
/**
*鍏憡淇℃伅鍒囨崲
*
* 鏃犻渶浼犲弬
*/
notice: function() {
var m_no = 0;
var m_total = $(".noticeList ul>li").length;
var htTime = setInterval(moveRight, 5000);
$(".noticeList").hover(function() {
clearInterval(htTime);
}, function() {
htTime = setInterval(moveRight, 5000);
})
$(".noticeBox .next").click(function() {
moveRight();
})
$(".noticeBox .prev").click(function() {
moveLeft();
})
setInterval(function() {
moveRight();
}, 5000)
function moveRight() {
m_no = ++m_no > m_total - 1 ? 0 : m_no;
$(".noticeList ul>li:first").stop().animate({
marginTop: "-60px"
}, 400, function() {
$(this).detach().appendTo($(".noticeList ul")).css("margin-top", "0px")
});
}
function moveLeft() {
m_no = --m_no < 0 ? m_total - 1 : m_no;
$(".noticeList ul li:last").stop().css("margin-top", "-60px").detach().prependTo($(
".noticeList ul")).animate({
marginTop: "0px"
})
}
$(".searchText").focus(function() {
if ($(this).val() == this.defaultValue) {
$(this).val("")
$(".searchInput").addClass("blur");
}
})
},
about: function() {
new Swiper(".socialSwiper", {
slidesPerView: 3,
spaceBetween: 30,
centeredSlides: true,
loop:true,
pagination: {
el: ".socialSwiper .swiper-pagination",
clickable: true,
},
breakpoints: {
320: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?20
slidesPerView: 1.2,
spaceBetween: 10
},
768: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?68
slidesPerView: 3,
spaceBetween: 20
},
}
});
const parent = document.getElementById('wall');
const parallax = new Parallax(parent, {
invertX: true,
invertY: true,
limitX:10,
limitY:5,
});
var m_no = 0;
var m_total = $(".tz_word p").length;
var htTime = setInterval(moveRight, 5000);
$(".tz_word p").hover(function() {
clearInterval(htTime);
m_no = $(this).index();
effectWord(m_no);
}, function() {
htTime = setInterval(moveRight, 5000);
})
function moveRight() {
m_no = ++m_no > m_total - 1 ? 0 : m_no;
effectWord(m_no)
}
function effectWord(id){
$(".tz_word p").eq(id).addClass("active").siblings().removeClass("active");
$(".tz_info .des").eq(id).addClass("active").siblings().removeClass("active");
}
$(".stu_thum .dot .p").hover(function(){
$(this).addClass("active").siblings().removeClass("active");
$(".stu_thum .thums img").eq($(this).index()).addClass("active").siblings().removeClass("active");
$(".stu_info .sib").eq($(this).index()).addClass("active").siblings().removeClass("active");
})
var stu_no = 0;
$(".stu_next").click(function(){
stu_no = ++stu_no > 3 ? 0 : stu_no;
stuEffect(stu_no)
})
$(".stu_prev").click(function(){
stu_no = --stu_no < 0 ? 3 : stu_no;
stuEffect(stu_no)
})
function stuEffect(id){
$(".stu_thum .dot .p").eq(id).addClass("active").siblings().removeClass("active");
$(".stu_thum .thums img").eq(id).addClass("active").siblings().removeClass("active");
$(".stu_info .sib").eq(id).addClass("active").siblings().removeClass("active");
}
var rellax = new Rellax('.rellax');
shutime.scrollText();
$(".lida_nav a").hover(function(){
$(this).addClass("active").siblings().removeClass("active");
$(".lida_infos img").eq($(this).index()).addClass("active").siblings().removeClass("active");
})
shutime.scrollToPos(100);
var stuSwiper = new Swiper(".studentSwiper", {
slidesPerView: 1.5,
spaceBetween: 10,
centeredSlides: true,
pagination: {
el: ".studentSwiper .swiper-pagination",
type: "progressbar",
},
});
stuSwiper.slideTo(4)
},
contact: function() {
},
product: function() {
var rellax = new Rellax('.rellax');
$(".pbox a").click(function() {
$(this).addClass("active").siblings().removeClass("active");
setTimeout(function() {
shutime.scrollToPos(50);
}, 10)
})
shutime.scrollToPos(50);
},
videoList: function() {
var myVideo = document.getElementById("video");
$(".videoList ul li").click(function() {
myVideo.setAttribute("src", $(this).attr("data-url"));
$(".lightBox").addClass("active");
myVideo.play();
})
$(".videoCloseBtn").click(function() {
$(".lightBox").removeClass("active");
myVideo.pause();
})
},
/**
*閲囩敤swiper鐨刦ade鍒囨崲
*
* 鏃犻渶浼犲弬
* 鍏煎绉诲姩绔
*
*/
swiperFade: function() {
new Swiper('.swiper-container.swiperNomal', {
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
spaceBetween: 30,
loop: true,
effect: 'fade',
speed: 500,
pagination: {
el: '.swiper-pagination.dot',
clickable: true
},
navigation: {
nextEl: '.btnBox .next',
prevEl: '.btnBox .prev',
},
});
},
/**
*閲囩敤swiper鐨刡anner鍒囨崲
*
* 鏃犻渶浼犲弬
* 鍏煎绉诲姩绔
*
*/
swiperBanner: function() {
var interleaveOffset = 0.5;
var swiperOptions = {
loop: true,
speed: 1000,
autoplay: true,
grabCursor: true,
watchSlidesProgress: true,
mousewheelControl: true,
keyboardControl: true,
navigation: {
nextEl: ".swiper-button-next.next",
prevEl: ".swiper-button-prev.prev"
},
pagination: {
el: '.swiper-pagination.bannerDot',
},
on: {
progress: function() {
var swiper = this;
for (var i = 0; i < swiper.slides.length; i++) {
var slideProgress = swiper.slides[i].progress;
var innerOffset = swiper.width * interleaveOffset;
var innerTranslate = slideProgress * innerOffset;
swiper.slides[i].querySelector(".slide-inner").style.transform =
"translate3d(" + innerTranslate + "px, 0, 0)";
}
},
touchStart: function() {
var swiper = this;
for (var i = 0; i < swiper.slides.length; i++) {
swiper.slides[i].style.transition = "";
}
},
slideChange: function() {
$('.jgs a').eq(this.activeIndex - 1).addClass("active").siblings().removeClass(
"active");
},
setTransition: function(speed) {
var swiper = this;
for (var i = 0; i < swiper.slides.length; i++) {
swiper.slides[i].style.transition = speed + "ms";
swiper.slides[i].querySelector(".slide-inner").style.transition =
speed + "ms";
}
}
}
};
var swiper = new Swiper(".swiper-container.swiperBanner", swiperOptions);
},
/**
*鍥炲埌椤堕儴
*
* 鏃犻渶浼犲弬
* 鍏煎绉诲姩绔
*
*/
backTop: function() {
$(".backTop").click(function() {
$('body,html').animate({
scrollTop: 0
}, 500);
})
},
/**
*姘寸汗鍔ㄦ晥
*
* 鏃犻渶浼犲弬
* 鍏煎绉诲姩绔
*
*/
wave: function() {
var unit = 100,
canvas, context, canvas2, context2,
height, width, xAxis, yAxis,
draw;
function init() {
canvas = document.getElementById("sineCanvas");
canvas.width = document.documentElement.clientWidth;
canvas.height = 150;
context = canvas.getContext("2d");
height = canvas.height;
width = canvas.width;
xAxis = Math.floor(height / 2);
yAxis = 0;
draw();
}
function draw() {
context.clearRect(0, 0, width, height);
drawWave('rgba(255,255,255,.3)', 1, 3, 0);
draw.seconds = draw.seconds + .009;
draw.t = draw.seconds * Math.PI;
setTimeout(draw, 35);
};
draw.seconds = 0;
draw.t = 0;
function drawWave(color, alpha, zoom, delay) {
context.fillStyle = color;
context.globalAlpha = alpha;
context.beginPath();
drawSine(draw.t / 0.5, zoom, delay);
context.lineTo(width + 10, height);
context.lineTo(0, height);
context.closePath()
context.fill();
context.lineWidth = 2;
context.strokeStyle = "#ffffff";
context.stroke();
}
function drawSine(t, zoom, delay) {
var x = t;
var y = Math.sin(x) / zoom;
context.moveTo(yAxis, unit * y + xAxis);
for (i = yAxis; i <= width + 10; i += 10) {
x = t + (-yAxis + i) / unit / zoom;
y = Math.sin(x - delay) / 3;
context.lineTo(i, unit * y + xAxis);
}
}
init();
},
map: function() {
var map = new BMap.Map("map");
var point = new BMap.Point(103.496958, 29.599326);
map.centerAndZoom(point, 16);
var top_left_control = new BMap.ScaleControl({
anchor: BMAP_ANCHOR_TOP_LEFT
})
var top_left_navigation = new BMap.NavigationControl();
var pt = new BMap.Point(103.496958, 29.599326);
var myIcon = new BMap.Icon("./assets/images/common/mapIcon.png", new BMap.Size(60, 60));
var marker2 = new BMap.Marker(pt, {
icon: myIcon
});
map.addOverlay(marker2);
map.addControl(top_left_control);
map.addControl(top_left_navigation);
},
/**
*鏂伴椈鍒楄〃鍒嗛〉
*
* 鏃犻渶浼犲弬
* 鍏煎绉诲姩绔
*
*/
page: function() {
var total = Math.ceil($("#page").attr("data-total") / $("#page").attr("data-size"));
var curPage = $("#page").attr("data-page");
var pageSize = $("#page").attr("data-size");
var url = $("#page").attr("data-cat");
new Paging('page', {
nowPage: Number(curPage), // 褰撳墠椤电爜
pageNum: total, // 鎬婚〉鐮
buttonNum: pageSize, //瑕佸睍绀虹殑椤电爜鏁伴噺
canJump: 0, // 鏄惁鑳借烦杞€?=涓嶆樉绀猴紙榛樿锛夛紝1=鏄剧ず
showOne: 1, //鍙湁涓€椤垫椂锛屾槸鍚︽樉绀恒€?=涓嶆樉绀?1=鏄剧ず锛堥粯璁わ級
callback: function(num) { //鍥炶皟鍑芥暟
window.location.href = url + num + ".html"
}
})
},
/**
*鏂伴椈鍒楄〃鍒嗛〉
*
* @sucess 鎴愬姛|澶辫触
* 鍏煎绉诲姩绔
*
*/
toast: function(msg,sucess) {
$(".toast").addClass("active").find("span").html(msg);
if (!sucess) {
$(".toast").addClass("warning");
} else {
$(".toast").addClass("success");
}
setTimeout(function() {
$(".toast").removeClass("active")
$(".toast").removeClass("warning")
$(".toast").removeClass("success");
}, 3500)
},
/**
*閲囩敤swiper鐨刡anner鍒囨崲
*
* url:瑙嗛鎾斁璺緞
* 鍏煎绉诲姩绔
*
*/
videoList: function(url) {
var myVideo = document.getElementById("video");
myVideo.setAttribute("src", url);
$(".vlightBox").addClass("active");
myVideo.play();
$(".pro_close").click(function() {
$(".vlightBox").removeClass("active");
myVideo.pause();
})
},
/**
*瀹氫綅鍒版煇涓厓绱犱綅缃
*
* @y:鍋忕Щ鐨勯珮搴
*/
scrollToPos: function(_y) {
var hash = window.location.hash;
var pos = hash.substring(hash.indexOf('#') + 1);
if (pos != '') getPos(pos);
console.log(pos)
console.log(pos.substring(1))
function getPos(ele) {
$(".product_nav a").eq(Number(ele.substring(1)) - 1).addClass("active").siblings().removeClass(
"active");
$('html,body').animate({
scrollTop: $("." + ele + "").offset().top - _y
}, 600);
// $("html,body").animate({scrollTop: $("." + ele + "").offset().top - _y}, 800, "easeOutQuart", function() {})
}
},
/**
*楠岃瘉鎵嬫満鍙风爜
*
* @phone:鎵嬫満鍙风爜
* @return {姝g‘锛歵rue,閿欒锛歠alse}
*
*/
regPhone: function(phone) {
reg = /^(13|15|17|18|19|14)[0-9]{9}$/;
return reg.test(phone);
},
/**
*楠岃瘉韬唤璇佸彿鐮
*
* @phone:韬唤璇佸彿鐮
* @return {姝g‘锛歵rue,閿欒锛歠alse}
*
*/
regID: function(IDcard) {
reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
return reg.test(IDcard);
},
/**
*楠岃瘉閭鍙风爜
*
* @Email:韬唤璇佸彿鐮
* @return {姝g‘锛歵rue,閿欒锛歠alse}
*
*/
regEmail: function(Email) {
reg = /^\w+\@+[0-9a-zA-Z]+\.(com|com.cn|edu|hk|cn|net)$/;
return reg.test(Email);
},
/**
*楠岃瘉鏄惁鏄腑鏂
*
* @name:鏂囧瓧
* @return {姝g‘锛歵rue,閿欒锛歠alse}
*
*/
regZh: function(name) {
reg = /^[\u4E00-\u9FA5A-Za-z]+$/;
return reg.test(name);
},
/**
*楠岃瘉绾暟瀛
*
* @number:鏁板瓧
* @return {姝g‘锛歵rue,閿欒锛歠alse}
*
*/
regNumber: function(number) {
reg = /^[0-9]*$/;
return reg.test(number);
},
/**
*鑾峰彇鏁版嵁
*
* @param {String} url 浼犲叆鐨勬暟鎹帴鍙
* @param {Object} para 浼犲叆鐨勫弬鏁
* @param {Object} callback 杩斿洖
*/
getDataForApi: function(type, url, para, callback) {
$.ajax({
type: type,
data: para,
url: window.location.protocol + '//' + window.location.host + url,
dataType: 'json',
success: function(data) {
callback(data)
},
error: function(e) {
console.log(e, "鏁版嵁鍔犺浇閿欒")
}
})
},
}
shutime.init();