var ip = window.location.protocol+"//www.suzhou.gov.cn";
$(function(){
if($(".js-tab-has").length>0){
jQuery(".js-tab-has").slide({titCell: ".hd li.hs",mainCell: ".bd",delayTime: 0,triggerTime: 0,targetCell: ".more a"});
}
// setTimeout(function(){
// $(".header-wrapper").addClass("header-column").removeClass("header-index");
// }, 3000)
//easybtn鍒囨崲鏁堟灉
$(".easyBtn dl").hover(function(){
$(this).addClass("on");
$(this).find("dd").show();
},function(){
$(this).removeClass("on");
$(this).find("dd").hide();
});
$("#easyBtnToggle").click(function(e){
$(".easyBtn").toggleClass("easyBtnPackUp");
if($(".easyBtn").hasClass("easyBtnPackUp")){
$(this).find("i").addClass('zk');
}else{
$(this).find("i").removeClass('zk');
}
e.stopPropagation();
});
$("#quickPanel").click(function(e){
e.stopPropagation();
});
//easybtn榧犳爣缁忚繃鏁堟灉 end
var isOlder = $('body').hasClass('older');
swiperTpxw('.xwzx-tpxw');
swiperTpxw('.syzt-links');
swiperZt('.xwzx-zt',isOlder ? 4 : 5);
swiperZt('.zwgk-zfxxgk',isOlder ? 3 : 4);
swiperTpxw('.zwgk-zcjd');
swiperZt('.zwgk-zdly',3,2);
swiperZt('.bsfw-bslink', isOlder ? 3 : 4);
swiperZindex("#ftzbSwiper");
// swiperZindex("#zfhfspzbSwiper");
swiperZt('.home-ztzl', isOlder ? 3 : 4);
// body.older
var target = document.querySelector('body');
// 鍒涘缓瑙傚療鑰呭璞
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if(mutation.target.className == "older"){
swiperZt('.xwzx-zt', 4, '', 'older');
swiperZt('.zwgk-zfxxgk', 3, '', 'older');
swiperZt('.bsfw-bslink', 3, '', 'older');
swiperZt('.home-ztzl', 3, '', 'older');
}
});
});
// 浼犲叆鐩爣鑺傜偣鍜岃瀵熼€夐」
observer.observe(target,{attributes: true});
isZjz("#yjzjList");
isZjz("#wsdcList");
// 鍥藉姟闄㈣闂
//getGwynews();
// 甯傛斂搴滃強鍔炲叕瀹ゆ枃浠
getSzfjbgswj();
// 鍏紬鐩戠潱
getGzjd();
// 鑻忓窞绠€璁
getSzjx();
// 鐑偣鍏虫敞鍜屾渶鏂板彂甯
getRdgz();
})
// 鐑偣鍏虫敞鍜屾渶鏂板彂甯
function getRdgz(){
$.ajax({
url: ip+'/szinf/interfacesWebRdgz/loadData?websiteId=d1a6129dfff94475b389f8da120deb79',
type: "post",
dataType: 'json',
data: {},
success: function (data) {
if (data && data.code == 0) {
var data = data.data;
handleRdgzData(1,data);
handleRdgzData(2,data);
}
}
});
}
// 1-鐑偣鍏虫敞 2-鏈€鏂板彂甯
function handleRdgzData(type,data){
var lisHtml = "";
if(type == 1){
var today = new Date();
$('#home-rdgz-date').text(
today.getFullYear() +
'骞? +
Number(today.getMonth() + 1) +
'鏈? +
today.getDate() +
'鏃?
);
$(".home-rdgz").hover(function () {
$(".home-rdgz dd").stop().animate({
width: '400px'
}, 500);
$(".home-rdgz dd .box").fadeIn('500');
},
function () {
$(".home-rdgz dd").stop().animate({
width: '0px'
}, 500);
$(".home-rdgz dd .box").fadeOut('500');
}
);
}
if (data.length > 0) {
$.each(data, function (index, item) {
if(type == 1){
lisHtml += '
銆? + item.CHANNEL_NAME + '銆慄/em>' + item.TITLE + ''
}else{
if(index<7){
var time = item.PUBLISHED_TIME_FORMAT;
lisHtml += '' + item.TITLE + '\
'+ time.substring(8,10) +''+ time.substring(0,7) +'';
}
}
});
} else {
lisHtml = "鏆傛棤鏁版嵁";
}
if(type == 1) $('#data-home-rdgz').html(lisHtml);
if(type == 2) {
$('#zxfbList').html(lisHtml)
};
}
// 鑻忓窞绠€璁
function getSzjx(){
$.ajax({
type: "GET",
dataType: "JSON",
url: ip+'/szinf/interface/getXwzx_mrkx',
data: {
// date: date
},
success: function(res) {
if (res.data && res.ret == 1) {
var htmlData='', miniData='';
var data = res.data;
for (var i = 0; i < data.length; i++) {
var memo = data[i].memo.replace(/<[^>]+>/g, ''); //鍘婚櫎html鏍囩
miniData += "" + memo.substring(0, 70) + (memo.length > 70 ? '...' : '') + ""
}
for (var i = 0; i ]+>/g, ''); //鍘婚櫎html鏍囩
// htmlData += "" + data[i].sub_title_origin+ ""
htmlData += "" + data[i].sub_title_origin+ ""
}
$("#sypc-szjx-date").text(data[0].published_date);
$("#sypc-szjx-sypclist").html(miniData);
$("#sypc-szjx-list").html(htmlData);
// var htmlData='';
// var data = res.data;
// var data2 = res.parseList;
// for (var i = 1; i < 3; i++) {
// var memo = data2[i].memo.replace(/<[^>]+>/g, ''); //鍘婚櫎html鏍囩
// htmlData += "" + data2[i].memo +"
";
// }
// $("#sypc-szjx-list").html(htmlData+'');
// $("#sypc-szjx-sypclist li").html(data[0].memo);
// $("#sypc-szjx-date").html(data[0].published_date);
}
}
});
}
//甯傛斂搴滃強鍔炲叕瀹ゆ枃浠
function getSzfjbgswj(){
$.ajax({
type: "POST",
dataType: "JSON",
//url: '/szinf/getNewxxgkInfo/?deptcode=11320500014150827B&num=6',
url: ip+'/szinf/getSzfileInfoRedis/?deptcode=11320500014150827B&num=5',
success: function(res) {
if(res && res.retCode == 0){
var data = res.infolist;
var htm = "";
$.each(data,function(index,item){
htm += "" + item.title + "\
"+ item.time +"";
})
$("#szfjbgswjNews").html(htm);
}
}
});
}
// 鍏紬鐩戠潱
function getGzjd(){
if($("#gzjdList").length > 0){
$.post(ip+'/consultfront/common/gzjdCommonlist', {
currpage: 1,
check: 'do',
pagesize: 6,
}).then( function(res) {
var data = res.infolist;
var str = '';
$.each(data, function(index, item) {
var stateClass = item.consult_state == "宸插洖澶? ? '' : "whf";
var link = '/szsrmzf/hd_gzjd/gzjd.shtml#/gzjd/content?id=' + item.gid
str += ''+ item.consult_title +'\
'+ item.consult_type +'\
'+ item.consult_state +'\
'+ item.consult_date +'';
})
$("#gzjdList").html(str);
})
}
}
// 鍒ゆ柇 鎰忚寰侀泦鍜岀綉涓婅皟鏌ユ槸寰侀泦涓繕鏄凡缁撴潫
function isZjz($box){
$($box+" li").each(function(){
var endTime = new Date( $.trim($(this).find('.jssj').text()) );
var nowTime = new Date( new Date().format('yyyy-MM-dd') );
if(endTime.getTime() < nowTime.getTime()){
$(this).find('.tag').text("宸茬粨鏉?).removeClass('ing').show();
}else{
$(this).find('.tag').text("寰侀泦涓?).addClass('ing').show();
}
})
}
function swiperTpxw($box){
if(isie9(true)){
var slide = new Swiper( $box +' .swiper-container', {
pagination: $box+ ' .swiper-pagination',
loop: true,
autoplay: 5000,
grabCursor: true,
paginationClickable: true,
onFirstInit: function(swiper){
}
});
$($box +' .swiper-nav.prev').on('click', function (e) {
e.preventDefault();
slide.swipePrev();
});
$($box +' .swiper-nav.next').on('click', function (e) {
e.preventDefault();
slide.swipeNext();
});
}else{
var slide = new Swiper($box +' .swiper-container', {
observer: true, //寮€鍚姩鎬佹鏌ュ櫒锛岀洃娴媠wiper鍜宻lide
observeParents: true, //鐩戞祴Swiper 鐨勭/鐖跺厓绱
loop: true,
autoplay: {
delay :"5000",
disableOnInteraction: false,
stopOnLastSlide:false
},
grabCursor: true,
pagination: {
el: $box +' .swiper-pagination',
clickable: true,
},
navigation: {
prevEl: $box +' .swiper-nav.prev',
nextEl: $box +' .swiper-nav.next',
},
});
}
}
function swiperZt($box, perview, Percolumn, type) {
if(isie9(true)){
var zt = new Swiper($box + ' .swiper-container', {
pagination: $box +' .swiper-pagination',
autoplay: 5000,
paginationClickable: true,
slidesPerView: perview,
loop: true,
grabCursor: true
});
$($box + ' .swiper-nav.prev').on('click', function (e) {
e.preventDefault();
zt.swipePrev();
return false;
});
$($box + ' .swiper-nav.next').on('click', function (e) {
e.preventDefault();
zt.swipeNext();
return false;
});
}else{
var breakpoints = {//褰撳睆骞曞搴﹀皬浜庣瓑浜?**
1199: { slidesPerView: 3 },
1080: { slidesPerView: 3 },
991: { slidesPerView: 2 },
640: { slidesPerView: 1 },
0: { slidesPerView: 1 },
}
var autoplay = {
delay :"5000",
disableOnInteraction: false,
stopOnLastSlide:false
}
if($box == '.bsfw-bslink' || $box == '.xwzx-zt'){
autoplay = false
}
if($box == '.zwgk-zdly'){
breakpoints = {//褰撳睆骞曞搴﹀皬浜庣瓑浜?**
1199: { slidesPerView: 6 },
1080: { slidesPerView: 5 },
991: { slidesPerView: 4 },
640: { slidesPerView: 3 },
380: { slidesPerView: 2 },
0: { slidesPerView: 1 }
}
}
if(type && type == 'older'){
breakpoints = {//褰撳睆骞曞搴﹀皬浜庣瓑浜?**
1199: { slidesPerView: 2 },
640: { slidesPerView: 1 },
0: { slidesPerView: 1 },
}
}
var zt = new Swiper($box + ' .swiper-container', {
observer: true, //寮€鍚姩鎬佹鏌ュ櫒锛岀洃娴媠wiper鍜宻lide
observeParents: true, //鐩戞祴Swiper 鐨勭/鐖跺厓绱
loop: true,
grabCursor: true,
autoplay: autoplay,
pagination: {
el: $box + ' .swiper-pagination',
clickable: true,
},
navigation: {
prevEl: $box + ' .swiper-nav.prev',
nextEl: $box + ' .swiper-nav.next',
},
slidesPerView: perview,
slidesPerColumn: Percolumn,
breakpoints: breakpoints,
})
if(type && type == 'older'){
$($box+' .swiper-container').hide();
$($box+' .swiper-container').show();
}
// if(!_this.isie9() && window.matchMedia('(max-width: 991px)').matches && box == '.ywxt'){
// zt.destroy(false);
// }
}
}
function swiperZindex($box){
var mySwiper = new Swiper($box, {
observer: true, //寮€鍚姩鎬佹鏌ュ櫒锛岀洃娴媠wiper鍜宻lide
observeParents: true, //鐩戞祴Swiper 鐨勭/鐖跺厓绱
watchSlidesProgress: true,
slidesPerView: 'auto',
centeredSlides: true,
loop: true,
loopedSlides: 3,
autoplay:{
delay :"60000",
disableOnInteraction: false,
stopOnLastSlide:false
},
navigation: {
prevEl: $box + ' .swiper-nav.prev',
nextEl: $box + ' .swiper-nav.next',
},
pagination: {
el: $box +' .swiper-pagination',
//clickable :true,
},
on: {
progress: function(progress) {
for (i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i);
var slideProgress = this.slides[i].progress;
modify = 1;
if (Math.abs(slideProgress) > 1) {
modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
}
translate = slideProgress * modify * 260 + 'px';
scale = 1 - Math.abs(slideProgress) / 5;
zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
slide.transform('translateX(' + translate + ') scale(' + scale + ')');
slide.css('zIndex', zIndex);
// slide.css('opacity', .5);
// if (Math.abs(slideProgress) > 3) {
// slide.css('opacity', 0);
// }
}
},
setTransition: function(transition) {
for (var i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i)
slide.transition(transition);
}
}
}
})
}
//function getGwynews(){
// console.log()
// $.ajax({
// url : window.location.protocol+'//www.gov.cn/pushinfo/v150203/pushinfo.jsonp',
// dataType : "jsonp",
// jsonp : "pushInfoJsonpCallBack",
// jsonpCallback:"pushInfoJsonpCallBack",
// success : function(data) {
// $.each(data,function(i,json){
// if(i>=6){
// return false;
// }
// var str1= json.pubDate;
// str1=str1.substr(0,10);
// var title = json.title;
// if(title.length>43){
// title=title.substr(0,42)+"...";
// }
// $("#gwynews").append(""+title+""+str1+"");
// })
// },
// error:function(){
//
// }
// });
//}
// 鍒ゆ柇鏄惁IE9
isie9();
function isie9(flag){
var isIe9 = false;
if(flag){
if(navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE",""))<10){
isIe9 = true;
}
return isIe9;
}else{
var ua = navigator.userAgent.toLocaleLowerCase();
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
var browserVersion = ua.match(/msie ([\d.]+)/) != null ? ua.match(/msie ([\d.]+)/)[1] : ua.match(/rv:([\d.]+)/)[1];
var $htm = document.getElementsByTagName('html')[0];
var ishasIe = hasClass ($htm, 'ie');
if(!ishasIe){
$htm.className += ' ie';
}
if(parseInt(browserVersion)<10){
var ishasLt10 = hasClass ($htm, 'ie9');
if(!ishasLt10){
$htm.className += ' ie9';
}
}
}
}
}
function hasClass (ele, className) {
var reg = new RegExp('(^|\\s)' + className + '(\\s|$)')
return reg.test(ele.className)
}
//杞崲鏃ユ湡鏍煎紡
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
//姘旇薄棰勮
$(function() {
var weatherList
$.get('/u3/interfacesWeather/loadWarn').done(function(res) {
if (res.code !== '0' || res.data.length == 0) return
$('#weather-warning').show()
weatherList = res.data[0]
var weatherStr = ''
$.each(weatherList, function(index, weather) {
var item = weather
if (item)
weatherStr +=
'\
\
'
})
$('.wetherList')
.append(weatherStr)
.on('click', 'li', function() {
setModal($(this).index() - 1)
})
$('.ww-myImgicons').slide({
mainCell: '.bd ul',
autoPage: true,
effect: 'leftLoop',
autoPlay: true,
vis: 1,
trigger: 'click',
})
})
function setModal(index) {
var content = weatherList[index]
$('.ww-title').html(
'' +
content.province +
'' +
content.city +
'' +
content.warningTips +
''
)
$('.ww-caption').html(
'\
\
\
闃插尽鎸囧崡
\
' +
content.defense +
'
\
\
'
)
$('#ww-myModal').show()
}
})