//设置页面显示
var isChangeViewPort=false;
function setViewport() {
$(window).resize(function() {
viewPortResize();
});
viewPortResize();
}
function viewPortResize() {
if(isChangeViewPort){
return;
}
isChangeViewPort=true;
$("#viewportDom").attr("content","width=device-width");
var width=$(window).width();
if(width>1024){
$("#viewportDom").attr("content","width=device-width,user-scalable=no");
}else{
$("#viewportDom").attr("content","width=750,user-scalable=no");
}
setTimeout(function () {
isChangeViewPort=false;
},100)
}
//首页轮播图
function setHomeSwiper() {
var swiper = new Swiper("#indexSwiper", {
autoplay:true,
pagination: {
el: "#indexSwiper .swiper-pagination",
},
});
$("#proSortList .item").hover(function(){
$("#proSortList .item").removeClass("on");
$(this).addClass("on");
},function(){
})
var swiper2 = new Swiper("#proInfoPart .swiper", {
pagination: {
el: "#proInfoPart .swiper-pagination",
},
});
//案例
$($("#caseInfoPart .tabs .item").get(0)).addClass("on");
$("#caseInfoPart .contents .list").hide();
$($("#caseInfoPart .contents .list").get(0)).show();
$("#caseInfoPart .tabs .item").hover(function(){
$("#caseInfoPart .tabs .item").removeClass("on");
$(this).addClass("on");
var index=$("#caseInfoPart .tabs .item").index(this);
$("#caseInfoPart .contents .list").hide();
$($("#caseInfoPart .contents .list").get(index)).show();
},function(){
})
//视频
$($("#videoPart .tabs .item").get(0)).addClass("on");
$("#videoPart .contents .list").hide();
$($("#videoPart .contents .list").get(0)).show();
//$("#videoPart .more a").attr("href",$($("#videoPart .tabs .item").get(0)).attr("url"));
$("#videoPart .tabs .item").hover(function(){
$("#videoPart .tabs .item").removeClass("on");
$(this).addClass("on");
var index=$("#videoPart .tabs .item").index(this);
$("#videoPart .contents .list").hide();
$($("#videoPart .contents .list").get(index)).show();
//$("#videoPart .more a").attr("href",$(this).attr("url"));
},function(){
})
//视频B
$($("#videoPartB .tabs .item").get(0)).addClass("on");
$("#videoPartB .contents .list").hide();
$($("#videoPartB .contents .list").get(0)).show();
$("#videoPartB .tabs .item").hover(function(){
$("#videoPartB .tabs .item").removeClass("on");
$(this).addClass("on");
var index=$("#videoPartB .tabs .item").index(this);
$("#videoPartB .contents .list").hide();
$($("#videoPartB .contents .list").get(index)).show();
},function(){
})
//资讯
$($("#zxPart .tabs .item").get(0)).addClass("on");
$("#zxPart .contents .list").hide();
$($("#zxPart .contents .list").get(0)).show();
$("#zxPart .more a").attr("href",$($("#zxPart .tabs .item").get(0)).attr("url"));
$("#zxPart .tabs .item").hover(function(){
$("#zxPart .tabs .item").removeClass("on");
$(this).addClass("on");
var index=$("#zxPart .tabs .item").index(this);
$("#zxPart .contents .list").hide();
$($("#zxPart .contents .list").get(index)).show();
$("#zxPart .more a").attr("href",$(this).attr("url"));
},function(){
})
}
//产品主体页
function setProSwiper() {
var swiper = new Swiper("#proInfoPart .swiper", {
slidesPerView: "auto",
spaceBetween:7,
navigation: {
nextEl: ".swiperbuttonnext",
prevEl: ".swiperbuttonprev",
},
});
}
//手机版顶部导航
function setPhoneTopNav(){
$("#topLogoLine .menu").click(function(){
if(this.className.indexOf("on")>-1){
$(this).removeClass("on");
$("#topLogoLine .nav").hide();
}else{
$(this).addClass("on");
$("#topLogoLine .nav").show();
}
})
$("#topLogoLine .nav .item").click(function(){
$("#topLogoLine .nav .item .morenav,#topLogoLine .nav .item .pxkcMore").hide();
$(this).find(".morenav").show();
$(this).find(".pxkcMore").show();
})
}
//滑动到底部加载更多
function gotoBottomShowMoreClass(){
this.url="";
this.contentDom="";
this.item=".item";
this.moreDom="";
this.pageSize=9;
this.isEnd=false;
this.bottomWz=0-(Math.floor($("#global-bottom").height())+Math.floor($("#global-copyright").height()));
this.page=2;
this.isLoad=false;
}
gotoBottomShowMoreClass.prototype.init=function(){
var _that=this;
if(_that.pageSize>$(_that.contentDom+" "+_that.item).length){
$(_that.moreDom).html("底部已加载完毕~");
return;
}
$(window).scroll(function() {
var scrollTop = $(window).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(window).height();
var positionValue = (scrollTop + windowHeight) - scrollHeight;
if (positionValue >= _that.bottomWz) {
if(_that.isEnd){
$(_that.moreDom).html("底部已加载完毕~");
return;
}
if(_that.isLoad){
return;
}
_that.isLoad=true;
var options = {
url:_that.url+"?page="+_that.page+"&rand="+Math.random(),
type: 'POST',
beforeSend: function (arr, myfrom, options) {
$(_that.moreDom).html("正在加载中~");
},
success: function (data, statusText) {
_that.page++;
_that.isLoad=false;
$(_that.contentDom).append(data);
var allNum=$(_that.contentDom+" "+_that.item).length;
if(allNum % _that.pageSize!=0){
_that.isEnd=true;
$(_that.moreDom).html("底部已加载完毕~");
}else{
_that.isEnd=false;
$(_that.moreDom).html("加载更多");
}
}
};
jQuery.ajax(options);
}
});
}
function gotoBottomShowMore(isUse,callback){
if(!isUse){
return;
}
$(function(){
$(window).scroll(function() {
var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
var positionValue = (scrollTop + windowHeight) - scrollHeight;
if (positionValue >= 50) {
callback();
}
});
});
}
function showverify(theObj,url) {
theObj.src=url+"?rand="+Math.random();
}
//表单验证
function ckForm(theForm) {
if(theForm.fullname.value==""){
alert("请输入您的姓名");
theForm.nickname.focus();
return false;
}
if(theForm.tel.value==""){
alert("请输入联系电话");
theForm.tel.focus();
return false;
}
const regex = /^1[3456789]\d{9}$/;
if (!regex.test(theForm.tel.value)){
alert("请输入您的手机号码");
theForm.tel.focus();
return false;
}
if(theForm.thecode.value==""){
alert("请输入验证码");
theForm.thecode.focus();
return false;
}
if(theForm.content.value==""){
alert("请输入留言内容");
theForm.content.focus();
return false;
}
return true;
}
//质保查询
function qualityFind(url,btnObj,yzmurl){
var thecodeObj=document.getElementById("thecode");
var theyzmObj=document.getElementById("theyzm");
var erroraObj=document.getElementById("errora");
var errorbObj=document.getElementById("errorb");
var errorcObj=document.getElementById("errorc");
$(erroraObj).hide();
$(errorbObj).hide();
$(errorcObj).hide();
if(thecodeObj.value==""){
$(erroraObj).show();
thecodeObj.focus();
return false;
}
if(theyzmObj.value==""){
$(errorbObj).show();
theyzmObj.focus();
return false;
}
$("#imgverify").attr("src",yzmurl+"?rand="+Math.random());
var options = {
url:url+"?rand="+Math.random(),
type: 'POST',
data:{
thecode:thecodeObj.value,
theyzm:theyzmObj.value
},
beforeSend: function (arr, myfrom, options) {
$(btnObj).html("正在处理");
},
success: function (data, statusText) {
$(btnObj).html("查 询");
if(data.state=="fail"){
$("#qualityRuselt").hide();
if(data.content.errorstate==1){
$(errorbObj).show();
return;
}
if(data.content.errorstate==2){
$(errorcObj).show();
return;
}
}else{
$("#qualityRuselt").show();
var theHtml=data.content.thecode+"
";
theHtml+="您输入的编号验证通过!
";
theHtml+="当前总查询 "+data.content.logList.length+" 人
";
for(var i=0;i";
htmla+=''+lista[i].cpxl+' | ';
htmla+=''+lista[i].cpbh+' | ';
htmla+=''+lista[i].thenum+' | ';
htmla+=''+lista[i].price+' | ';
htmla+=''+lista[i].zbsj+' | ';
htmla+=''+lista[i].sfth+' | ';
htmla+=''+lista[i].note+' | ';
htmla+="";
}
$("#infodata").html(htmla);
var listb=data.content.theRjJson;
var htmlc="";
for(var i=0;i";
htmlc+=''+listb[i].cpxl+' | ';
htmlc+=''+listb[i].cpbh+' | ';
htmlc+=''+listb[i].thenum+' | ';
htmlc+=''+listb[i].price+' | ';
htmlc+=''+listb[i].zbsj+' | ';
htmlc+=''+listb[i].mmssl+' | ';
htmlc+=''+listb[i].zhqx+' | ';
htmlc+=''+listb[i].note+' | ';
htmlc+="";
}
$("#infodata2").html(htmlc);
}
}
};
jQuery.ajax(options);
}
/*返回顶部*/
function setBackup(){
$(document).scroll(function(){
var top=$(this).scrollTop();
if(top>300){
$("#backtop").fadeIn();
}else{
$("#backtop").fadeOut();
}
})
$("#backtop").click(function(){
$("html,body").animate({ "scrollTop" : 0 }, 500);
});
}