";
if (type == 0) {
for (var i = 0; i < galleryModel.img.length; i++) {
html += " ";
}
} else {
for (var i = 0; i < galleryModel.video.length; i++) {
html += " ";
}
}
html += "
";
html += "
";
html += "
";
html += " ";
html += "
";
$("body").append(html);
var galleryThumbs = new Swiper('.gallery-thumbs', {
spaceBetween: 10,
slidesPerView: 7,
freeMode: true,
centeredSlides: false,
watchSlidesVisibility: true,
watchSlidesProgress: true,
pagination: {
el: '.swiper-pagination',
type: 'progressbar'
},
breakpoints: {
1440: {
slidesPerView: 5
},
1366: {
slidesPerView: 4
},
1024: {
slidesPerView: 3
},
640: {
slidesPerView: 2
},
320: {
slidesPerView: 1
}
}
});
var galleryTop = new Swiper('.gallery-top', {
spaceBetween: 10,
initialSlide: index || 0,
navigation: {
nextEl: '.layui-layer-viewGroup .viewGroup-main .next-btn,.viewGroup-select-list .next-btn',
prevEl: '.layui-layer-viewGroup .viewGroup-main .last-btn,.viewGroup-select-list .last-btn'
},
thumbs: {
swiper: galleryThumbs
},
on: {
slideChange: function () {
$(".viewGroup-select-bar span").removeClass("bg-skyblue");
$(".viewGroup-select-bar span:lt(" + (this.activeIndex + 1) + ")").addClass("bg-skyblue");
var activeIndex = this.activeIndex;
$(".swiper-slide video").each(function (i) {
if (i == activeIndex) {
$(this)[0].play();
} else {
$(this)[0].pause();
}
});
}
}
});
if (type == 1) {
$(".swiper-slide-active video")[0].play();
}
$(".layui-layer-viewGroup .viewGroup-footer .viewGroup-nav .viewGroup-nav-item").on("click", function () {
var _swiper_slide = "";
var __item = "";
var _span = "";
if ($(this).index() == 0) {//图片
for (var i = 0; i < galleryModel.img.length; i++) {
_swiper_slide += " ";
__item += "
";
_span += " ";
}
} else {//视频
for (var i = 0; i < galleryModel.video.length; i++) {
_swiper_slide += " ";
__item += "
";
_span += " ";
}
}
$(".gallery-top .swiper-wrapper").html(_swiper_slide);
$(".gallery-thumbs .swiper-wrapper").html(__item);
$(".viewGroup-select-bar").html(_span);
galleryThumbs.update();
galleryTop.update();
$(this).addClass("bg-skyblue").siblings().removeClass("bg-skyblue");
if ($(this).index() == 1) {
$(".swiper-slide-active video")[0].play();
}
});
}
/*
* urlHelper
*/
var urlHelper = {
getQueryString: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(decodeURIComponent(r[2])); return null;
}
};
/*
* CookieHelper
*/
var cookieHelper = {
//获取Cookie
get: function (name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(name + "=")
if (c_start != -1) {
c_start = c_start + name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) c_end = document.cookie.length
return unescape(decodeURIComponent(document.cookie.substring(c_start, c_end)))
}
}
return "";
},
//获取所有Cookie
getAll: function () {
var cookies = document.cookie.split(/;\s/g);
var cookieObj = {};
cookies.forEach(function (item) {
var key = item.split('=')[0];
cookieObj[key] = item.split('=')[1];
});
return cookieObj;
},
//设置Cookie
set: function (name, value, minutes) {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (minutes || 480) * 60 * 1000);
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + expdate.toGMTString() + ";path=/";
},
//删除Cookie
remove: function (name) {
cookieHelper.set(name, "", -1);
},
//删除所有Cookie
removeAll: function () {
var keys = Object.keys(cookieHelper.getAll());
keys.forEach(function (item) {
cookieHelper.remove(item);
});
}
};
try {
//axios.defaults.baseURL = 'https://api.hstd.com';
//axios.defaults.baseURL = 'http://localhost:9000';
axios.defaults.baseURL = 'https://hstd.com/serv';
} catch (e) {
}