import '../../css/bootstrap.less';
import 'bootstrap/dist/js/bootstrap.js';
import '../../css/public.css';
import '../../css/main_banner.css';
import '../../js/public.js';
import '../../js/main_banner.js';
import '../../css/thinkTank/policyList.css';
import {
provinceList
} from '../../js/NewDicProvinceList';
$(function(){
//数据处理
var theKeyword,pageSize,Province;
var thePageNo = 1,
thePageLength = 1,
pageSize = 6;
function loadDate(pageNo) {
$.ajax({
method: "get",
dataType: "json",
//url: globalConfig.context + "/portal/financial/search",
data: {
pageNo: pageNo || 1,
pageSize: pageSize,
keyword: theKeyword,
provinceId: Province != 999 ? Province : undefined
},
success: function (data) {
var theArr = [];
var pages=data.data.totalCount%6;
var paget=data.data.totalCount/6;
var page=1;
if(data.data.totalCount<6||data.data.totalCount==null){
page=1
}else{
page=pages=0?paget:Math.floor(paget)+1;
}
if (data.data && data.data.list) {
for (let i = 0; i < data.data.list.length; i++) {
let thisdata = data.data.list[i];
theArr.push([
'
',
'
',
'' + thisdata.companyName + '
',
'MORE+',
'',
].join(''));
};
};
$('.invest_right ul').empty();
$('.invest_right ul').append(theArr.join(''));
$('.totalCount').html("共 "+ page +" 页 " + data.data.totalCount + " 条数据");
thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
var pageArr = [],
firstNo = 1,
endNo = 5;
if (thePageNo > 3) {
firstNo = thePageNo - 2;
endNo = Math.min((Number(thePageNo) + 2), thePageLength);
} else {
endNo = Math.min(thePageLength, 5);
};
for (let i = firstNo; i <= endNo; i++) {
if (i == thePageNo) {
pageArr.push(
'' + i + ''
);
} else {
pageArr.push(
'' + i + ''
);
}
};
$('.pageNumber').remove();
$('.pagePre').after(pageArr.join(''));
},
});
}
if (window.location.search) {
let theUrl = window.location.search
theKeyword = theUrl.substring(1, theUrl.length);
theKeyword = decodeURIComponent(theKeyword);
$('#search_on input').val(theKeyword);
var search_city=$('#selt').value;
Province=search_city
};
loadDate();
//点击分页
$('.pagination').on('click', 'li', function (e) {
$(this).addClass('active').siblings().removeClass('active')
e.preventDefault();
thePageNo=$(this).val();
if (this.className === 'pagePre') {
if (thePageNo > 1) {
thePageNo = 1;
loadDate(thePageNo);
}
} else if (this.className === 'pageNext') {
if (thePageNo < thePageLength) {
thePageNo = thePageLength;
loadDate(thePageNo);
}
} else {
var nextPageNo = $(this).children()[0].text;
if (thePageNo != nextPageNo) {
$(this).siblings("li").removeClass("active");
$(this).addClass("active");
thePageNo = nextPageNo;
loadDate(thePageNo);
};
};
});
//链接详情
$('.invest_imglist ul').on('click', 'li', function () {
var theId = $(this).value;
window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + theId );
})
//搜索城市下拉
var addlength=provinceList.length;
var soption='';
for(var i=0;i"+provinceList[i].name+"";
};
$('#selt').html(soption);
//导航城市添加
var industryListArr = [],
industryChildrenArr = [];
industryListArr.push(['',
'',
'不限',
'',
'',
].join(''));
provinceList.map(function (item) {
industryListArr.push(['',
'',
item.name,
'',
'',
].join(''));
});
if (industryListArr && industryListArr.length) {
$('#industryList').append(industryListArr.join(''));
};
//点击城市时
$('#industryList li').click(function () {
var theValue = this.value;
$(this).siblings("li").removeClass("active");
$(this).addClass("active");
Province=theValue;
loadDate();
})
//搜索时
$('#btn_search').click(function(e){
e.preventDefault();
var sel= $('.select select').val();
var val_inp=$('#search_on input').val();
Province=sel;
theKeyword=val_inp;
loadDate();
})
})