var originaldata = {
currentpage: 1,
totalpage: 0,
count: 0,
locationcode: null,
sw: 0,
};
window.addeventlistener('load', requestdata(originaldata));
// * 请求数据
function requestdata(data) {
$.post('https://webservice.dahe.cn/hnzc/tj-list', { pagesize: 4, pagenumber: data.currentpage, locationcode: data.locationcode }, function (data) {
if (data.result == 200) {
if (data.obj.pagenumber == 1) {
(originaldata.count = data.obj.totalrow), (originaldata.totalpage = data.obj.totalpage);
}
renderhtml(data.obj.datas);
$('#pagecount').text(data.obj.totalpage);
}
});
$('.paging_num').val(data.currentpage)
}
function requestouterhenandata(data){
$.post('https://webservice.dahe.cn/hnzc/tj-list', { pagesize: 4, pagenumber: data.currentpage, locationcode: data.locationcode, sw: 1 }, function (data) {
if (data.result == 200) {
if (data.obj.pagenumber == 1) {
(originaldata.count = data.obj.totalrow), (originaldata.totalpage = data.obj.totalpage);
}
renderhtml(data.obj.datas);
$('#pagecount').text(data.obj.totalpage);
}
});
$('.paging_num').val(data.currentpage)
}
// * 渲染html
function renderhtml(data) {
localstorage.setitem('tjlist', json.stringify(data));
var html = '';
for (var i = 0; i < data.length; i++) {
var debt_principalandinterest = ((parseint(data[i].debt_principal) + parseint(data[i].debt_interest )) / 10000).tofixed(2);
// var debt_principal = data[i].debt_principal / 10000
html +=
'
' +
'' +
'' +
'';
}
$('#content').html(html);
}
// * 跳转首页
function tofirstpage(data) {
if(data.currentpage == 1) {
return;
} else {
data.currentpage = 1
requestdata(data);
}
}
$('#firstpage').click(function () {
tofirstpage(originaldata);
});
// * 跳转上一页
function toprevpage(data) {
if (data.currentpage == 1) {
return;
} else {
data.currentpage = data.currentpage - 1;
requestdata(data);
}
}
$('#previouspage').click(function () {
toprevpage(originaldata);
});
// * 跳转下一页
function tonextpage(data) {
if (data.currentpage == data.totalpage) {
return;
} else {
data.currentpage = data.currentpage + 1;
requestdata(data);
}
}
$('#nextpage').click(function () {
tonextpage(originaldata);
});
// * 跳转最后一页
function tolastpage(data) {
data.currentpage = originaldata.totalpage;
requestdata(data);
}
$('#lastpage').click(function () {
tolastpage(originaldata);
});
// * 直接跳转
function toinputpage(data) {
var pagingnum = $('.paging_num').val();
data.currentpage = parseint(pagingnum);
requestdata(data);
}
$('#jumppage').click(function () {
toinputpage(originaldata);
});
// * 判断地理位置后调取相应数据
//判断当前栏目
$(function () {
echarts.registermap('henan', henanjson); //hennanjson名称取自henan.js里的var henanjson变量名
var dom = document.getelementbyid('map_area');
//得到echarts的实例对象
var mychart = echarts.init(dom);
//关键是配置项
var option = {
series: [
{
name: '河南地图',
layoutcenter: ['48%', '49%'],
layoutsize: '100%',
//series[i]-map:系列列表。每个系列通过 type 决定自己的图表类型,此处是地图类型
type: 'map',
//这里是'china',及因为js中注册的名字,如果是上海市,则该出需pname 指的是'shanghai'
maptype: 'henan',
//地图区域的多边形 图形样式,有 normal 和 emphasis 两个状态
itemstyle: {
//normal 是图形在默认状态下的样式;
normal: {
show: true,
areacolor: '#bad0e2',
bordercolor: '#fcfcfc',
borderwidth: '1',
},
//emphasis 是图形在高亮状态下的样式,比如在鼠标悬浮或者图例联动高亮时。
emphasis: {
show: true,
areacolor: '#0b66b2',
},
},
//图形上的文本标签,可用于说明图形的一些数据信息
label: {
normal: {
show: true,
color: '#fff',
},
emphasis: {
show: true,
color: '#fff',
},
},
},
],
title: {
text: '',
},
};
//使用刚指定的配置项和数据显示图表。
mychart.setoption(option);
//定义全省各地市的数组
var outerhenancity = [110000,120000,130000,140000,150000,210000,220000,230000,310000,320000,330000,340000,350000,360000,370000,420000,430000,440000,450000,460000,500000,510000,520000,530000,540000,610000,620000,630000,640000,650000,710000,810000,820000,990000]
var city = ['410100', '410200', '410300', '410400', '410500', '410600', '410700', '410800', '410900', '411000', '411100', '411200', '411300', '411400', '411500', '411600', '411700', '410881'];
var citytext = ['郑州', '开封', '洛阳', '平顶山', '安阳', '鹤壁', '新乡', '焦作', '濮阳', '许昌', '漯河', '三门峡', '南阳', '商丘', '信阳', '周口', '驻马店', '济源'];
mychart.on('click', function (param) {
for (var i = 0; i < citytext.length; i++) {
if (param.name == citytext[i]) {
originaldata.locationcode = city[i];
originaldata.currentpage = 1;
originaldata.totalpage = 0;
originaldata.count = 0;
requestdata(originaldata)
}
}
});
$('#promotion_outside').click(function () {
originaldata.locationcode = '110000,120000,130000,140000,150000,210000,220000,230000,310000,320000,330000,340000,350000,360000,370000,420000,430000,440000,450000,460000,500000,510000,520000,530000,540000,610000,620000,630000,640000,650000,710000,810000,820000,990000';
// 北京,天津,河北,山西,内蒙古,辽宁,吉林,黑龙江,上海,江苏,浙江,安徽,福建,江西,山东,湖北,湖南,广东,广西,海南,重庆,四川,贵州,云南,西藏,陕西,甘肃,青海,宁夏,新疆,台湾,香港,澳门,海外
originaldata.currentpage = 1;
originaldata.totalpage = 0;
originaldata.count = 0;
requestouterhenandata(originaldata)
});
$('#promotion_inside').click(function () {
originaldata.locationcode = 410000;
originaldata.currentpage = 1;
originaldata.totalpage = 0;
originaldata.count = 0;
requestdata(originaldata);
});
});