/********************************************
|
* 前台展示 - 地图服务 *
|
*******************************************/
|
|
//控制器:DiTuFuWuController
|
|
//------------------------------------------
|
//F1.页面初始化
|
//F2.访问排行
|
//F3.最新资源
|
//F4.我的收藏夹
|
//F5.资源使用情况
|
//F6.初始化热门搜索关键字
|
//F7.热门搜索
|
//F8.定向推送
|
//F9.我的申请
|
//F10 跳转地图
|
//F11 阻止事件冒泡
|
//F12 换一批(0定向推送1资源推荐)
|
//F13 资源推荐
|
//------------------------------------------
|
|
//F1.页面初始化
|
$(function() {
|
FangWenPaiHang(); //访问排行
|
ZuiXinZiYuan(); //最新资源
|
WoDeShouCangJia(); //我的收藏夹
|
ZiYuanShiYongQingKuang();
|
DirectionalPush(0,0);
|
WoDeShenQing()
|
$('.txt').css('width', $('.img').width() + 'px');
|
var width1 = ($('.YWJC_Img').width() - $('.img').width()) / 2;
|
$('.txt').css('left', width1 + 'px');
|
$('.noanimate').css('width', $('.img').width() + 'px');
|
var width1 = ($('.YWJC_Img').width() - $('.img').width()) / 2;
|
$('.noanimate').css('left', width1 + 'px');
|
var width = $(".YWJC_Img").width();
|
//var RowCount = $(".lanren").width() >= (width * 3) ? 3 : ($(".lanren").width() >= (width * 2) ? 2 : 1);
|
var margin_L_R = ($(".lanren").width() - width * 3) / 6;
|
$(".lanren ul li").css("margin-left", margin_L_R + "px");
|
$(".lanren ul li").css("margin-right", margin_L_R + "px");
|
$(".lanren ul li").hover(function () {
|
$(this).find(".txt").stop().animate({height: "170px"}, 400);
|
$(this).find(".txt h3").stop().animate({paddingTop: "30px"}, 400);
|
}, function () {
|
$(this).find(".txt").stop().animate({height: "40px"}, 400);
|
$(this).find(".txt h3").stop().animate({paddingTop: "0"}, 400);
|
});
|
ZiYuanShiYongQingKuang();
|
InitTopHotSearchKey();
|
ZiYuanRecommend(0,0);
|
});
|
|
//F2.访问排行
|
function FangWenPaiHang() {
|
$.ajax({
|
url: '/res/ditufuwu/getTopListFWPH',
|
type: 'get',
|
success: function(data) {
|
var html = "";
|
var list = eval('(' + data + ')');
|
if(list.length < 10) {
|
$("#fwph").css("height","400px");
|
}
|
for (var i = 0; i < list.length; i++) {
|
var strImg = "";
|
var strBorder = "";
|
if (i < 3) {
|
strImg = "<img src=\"/image/ZiYuanZhongXin/top" + (i + 1) + ".png\" /> ";
|
}
|
if (i == 9) {
|
strBorder = "style='border: none;'";
|
}
|
html += "<li " + strBorder + ">" + "<a title='"+list[i].fulltitle+"' onclick=\"OpenZiYuan('" + list[i].resourceid + "')\">";
|
html += strImg + "<span>" + list[i].title + "</span></a></li>";
|
}
|
$("#fwph").append(html);
|
|
},
|
error: function(e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
//F3.最新资源
|
function ZuiXinZiYuan() {
|
$.ajax({
|
url: '/res/ditufuwu/getTopListZXZY',
|
type: 'get',
|
success: function(data) {
|
var html = "";
|
var jsonb = eval('(' + data + ')');
|
var today = new Date();
|
var year = today.getFullYear() + "-";
|
var month = today.getMonth() + 1;
|
if(month <10) {
|
month = "0" + month;
|
}
|
var day = today.getDate();
|
if(day < 10 ){
|
day = "0" + day;
|
}
|
var newday = year + month + "-" + day;
|
if(jsonb.length < 8) {
|
$("#zxzy").css("height","376px");
|
}
|
for(var i = 0; i < jsonb.length; i++) {
|
if(7 != i) {
|
if (jsonb[i].pubdate == newday) {
|
html += "<li>" +
|
"<div>" +
|
"<a title='"+ jsonb[i].fulltitle +"' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" + jsonb[i].title + "</a><img src=\"/image/ZiYuanZhongXin/new.gif\" style=\"margin-left: 10px;margin-top: -7px;\" /><br />" +
|
" <span style=\"color: gray;\">" + jsonb[i].pubdate + "</span>" +
|
"</div>" +
|
"</li>";
|
}
|
else {
|
html += "<li>" +
|
"<div>" +
|
"<a title='"+ jsonb[i].fulltitle +"' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" + jsonb[i].title + "</a><br />" +
|
" <span style=\"color: gray;\">" + jsonb[i].pubdate + "</span>" +
|
"</div>" +
|
"</li>";
|
}
|
}
|
|
if(i == 7) {
|
if (jsonb[i].pubdate == newday) {
|
html += "<li style='border-bottom: none !important;'>" +
|
"<div>" +
|
"<a title='"+ jsonb[i].fulltitle +"' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" + jsonb[i].title + "</a><img src=\"/image/ZiYuanZhongXin/new.gif\" style=\"margin-left: 10px;margin-top: -7px;\" /><br />" +
|
" <span style=\"color: gray;\">" + jsonb[i].pubdate + "</span>" +
|
"</div>" +
|
"</li>";
|
}
|
else {
|
html += "<li style='border-bottom: none !important;'>" +
|
"<div>" +
|
"<a title='"+ jsonb[i].fulltitle +"' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" + jsonb[i].title + "</a><br />" +
|
" <span style=\"color: gray;\">" + jsonb[i].pubdate + "</span>" +
|
"</div>" +
|
"</li>";
|
}
|
break;
|
}
|
}
|
$("#zxzy").append(html);
|
},
|
error: function(e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
//F4.我的收藏夹
|
function WoDeShouCangJia() {
|
$.ajax({
|
url: '/res/ditufuwu/getTopListWDSCJ',
|
type: 'post',
|
dataType: 'text',
|
data: {'actiontype': '收藏'},
|
success: function(data) {
|
var html = "";
|
var jsona = eval('(' + data + ')');
|
if(jsona.length < 10) {
|
$(".mtree").css("height","400px");
|
}
|
for(var i=0;i<jsona.length;i++) {
|
if(9 != i) {
|
html += "<li style='border-bottom: 1px dashed #e3e3e3;'>" +
|
"<a title=\"" + jsona[i].fulltitle + "\" style=\"vertical-align: middle;\" href=\"#\"></a>" +
|
"<a title=\"" + jsona[i].fulltitle + "\" style=\" cursor: pointer;\" onclick=\"OpenZiYuan('"+jsona[i].resourceid+"')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/shoucangicon.png\" />" + jsona[i].title +
|
"</a>" +
|
"</li>";
|
}
|
if(9 == i) {
|
html += "<li style='border-bottom: none;'>" +
|
"<a title=\"" + jsona[i].fulltitle + "\" style=\"vertical-align: middle;\" href=\"#\"></a>" +
|
"<a title=\"" + jsona[i].fulltitle + "\" style=\" cursor: pointer;\" onclick=\"OpenZiYuan('" + jsona[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/shoucangicon.png\" />" + jsona[i].title +
|
"</a>" +
|
"</li>";
|
}
|
}
|
$(".mtree").append(html);
|
},
|
error: function(e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
//F5.资源使用情况
|
function ZiYuanShiYongQingKuang() {
|
var ziyuan = echarts.init(document.getElementById("divziyuantongji"));
|
option = {
|
color: ['#31C4CB', '#59B1F0'],
|
tooltip: {
|
trigger: 'axis'
|
},
|
legend: {
|
data: ['浏览次数', '收藏次数'],
|
x: '700px'
|
},
|
grid: {
|
borderWidth: 0,
|
},
|
xAxis: [
|
{
|
type: 'category',
|
axisLabel: {
|
interval:0,
|
rotate:40
|
},
|
data: eval('(' + BianMu + ')')
|
}
|
],
|
yAxis: [
|
{
|
type: 'value'
|
}
|
],
|
series: [
|
{
|
name: '浏览次数',
|
type: 'bar',
|
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
data: eval('(' + Liulan + ')')
|
},
|
{
|
name: '收藏次数',
|
type: 'bar',
|
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
data: eval('(' + ShouCang + ')')
|
}
|
]
|
};
|
ziyuan.setOption(option);
|
}
|
|
//F6.初始化热门搜索关键字
|
function InitTopHotSearchKey() {
|
$.ajax({
|
url: '/res/ditufuwu/getTopHotSearchKey',
|
type: 'get',
|
success: function (data) {
|
if (data != "") {
|
var list = eval('(' + data + ')');
|
var html = "<li>热门搜索:</li>";
|
for (var i = 0; i < list.length; i++) {
|
html += "<li onclick='HotSearch(1,this)' title='"+list[i].keyword+"' >" + list[i].keyword + "</li>";
|
}
|
$("#ReMenSouSuoBox").css("width",window.innerWidth);
|
$("#ReMenSouSuoBox ul").append(html);
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
//F7.热门搜索(way:0为输入搜索;1为热门关键字搜索)
|
function HotSearch(way, obj) {
|
if (way == 0) {
|
var searchKey = document.getElementById("txtSearchKey").value;
|
// if (searchKey != "") {
|
$.ajax({
|
url: '/res/ditufuwu/saveHotSearch',
|
type: 'post',
|
data: {"searchKey": searchKey},
|
success: function (data) {
|
}
|
});
|
window.open("/res/ziyuanmulu/index?Menu=ZYZX&menuId=08&Message=" + encodeURIComponent(searchKey));
|
// }
|
} else if (way == 1) {
|
var keyword = $(obj).attr("title");
|
window.open("/res/ziyuanmulu/index?Menu=ZYZX&menuId=08&Message=" + encodeURIComponent(keyword));
|
}
|
}
|
|
//F8.定向推送
|
function DirectionalPush(type,num) {
|
var url = (type == 0 ?'/res/ZiYuan/getTopRecommend?isDiTuFuwu=true':('/res/ditufuwu/getTuiJianZiYuanByIndex?isDiTuFuwu=true&limit=3&page='+num));
|
$.ajax({
|
url: url,
|
type: 'get',
|
success: function (data) {
|
var html = "";
|
var jsonb = eval('(' + data + ')');
|
for (var i = 0; i < (jsonb.length>3?3:jsonb.length); i++) {
|
var description = decodeURIComponent(jsonb[i].description);
|
var fulldescription = decodeURIComponent(jsonb[i].fulldescription);
|
var onclick = "";
|
if(jsonb[i].isquanxian == 1){
|
onclick = "showMap("+jsonb[i].resourceid+",'"+jsonb[i].resourceclass+"','"+jsonb[i].firstMapUrl+"')";
|
}else{
|
onclick = "OpenZiYuan('"+jsonb[i].resourceid+"')";
|
}
|
html += "<li class=\"col-sm-4\" style=\"margin: 13.4px 0px 13.4px 0px !important;\" onclick=\""+onclick+"\">"
|
+ "<div style=\"margin: 0px auto; text-align: center;\">";
|
html += "<img class=\"img\" style=\"width: 80%; height: 146px;\" src=\"" + jsonb[i].imgurl + "\" />";
|
html += "<div class=\"txt\" style=\"float:left;margin-left: 10%;width: 80%; height: 40px; overflow: hidden; cursor: pointer;\">"
|
+ "<i style='margin-top: 28px;float: right;margin-right: 5px;display: none;font-size:20px;' class=\"fa fa-exclamation-circle\" onclick=\"OpenOnlyZiYuan('" + jsonb[i].resourceid + "')\"></i>"
|
+ "<h3 style=\"padding-top: 0px;\">" + jsonb[i].title + "</h3>"
|
+ "<p title='"+fulldescription+"' style=\"text-align: left; padding-right: 10px; padding-left: 10px;\"> " + description + "</p>"
|
+ "</div>"
|
+ "</div>"
|
+ "</li>";
|
}
|
$("#tjzy").html(html);
|
var width = $(".YWJC_Img").width();
|
$(".lanren ul li").hover(function () {
|
$(this).find(".txt").stop().animate({height: "170px"}, 400,function(){
|
$(this).find("i").show();
|
});
|
$(this).find(".txt h3").stop().animate({paddingTop: "50px"}, 400);
|
},
|
function () {
|
$(this).find(".txt").stop().animate({height: "40px"}, 400);
|
$(this).find(".txt h3").stop().animate({paddingTop: "0"}, 400);
|
$(this).find("i").hide();
|
});
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
//F9.我的申请
|
function WoDeShenQing() {
|
//我的申请资源
|
$.ajax({
|
// url: '/res/resApplyRecommend/shenQingZiYuan',
|
url: '/res/ditufuwu/getTopWDZY/8',
|
type: 'get',
|
success: function (sqzy) {
|
var html = "";
|
var jsonzy = eval('(' + sqzy + ')');
|
if(jsonzy.length < 8) {
|
$("#sqzy").css("height","376px");
|
}
|
for (var i = 0; i < jsonzy.length; i++) {
|
if(jsonzy.length==0){
|
break;
|
}
|
if(7 != i) {
|
html += "<div class=\"sqzy\" style=\"padding: 13.3px 0px 13.3px 10px; font-size: 13px; border-bottom-color: rgb(225, 225, 225); border-bottom-width: 1px; border-bottom-style: dashed;\">";
|
if (jsonzy[i].auditresult == "0") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/weipifu.gif\" />";
|
} else if (jsonzy[i].auditresult == "1") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/yitongguo.gif\" />";
|
} else if (jsonzy[i].auditresult == "2") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/weitongguo.gif\" />";
|
}else if (jsonzy[i].auditresult == "null") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/weipifu.gif\" />";
|
}
|
html += "</div>";
|
}
|
if(7 == i){
|
html += "<div class=\"sqzy\" style=\"padding: 13.3px 0px 13.3px 10px; font-size: 13px; \">";
|
if (jsonzy[i].auditresult == "0") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/weipifu.gif\" />";
|
} else if (jsonzy[i].auditresult == "1") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/yitongguo.gif\" />";
|
} else if (jsonzy[i].auditresult == "2") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/weitongguo.gif\" />";
|
}else if (jsonzy[i].auditresult == "null") {
|
html += "<a title='"+ jsonzy[i].fulltitle +"' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/wodeshenqing_icon.png\" />"+ jsonzy[i].title + " </a>" +
|
" <img style=\"padding-top: 2px; padding-right: 5px; float: right;\" src=\"/image/ZiYuanZhongXin/weipifu.gif\" />";
|
}
|
html += "</div>";
|
}
|
}
|
$("#sqzy").append(html);
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
//F10 跳转地图
|
function showMap(resourceid,resourcetype,firsturl){
|
if (resourcetype == "KJ_JCDT" || resourcetype == "KJ_YWTC" || resourcetype == "KJ_ZTDT") {
|
var url = "";
|
if(firsturl != null && firsturl != ""){
|
url = firsturl;
|
}else{
|
url = gisPortal + "leafportal.html?resourceid=" + resourceid + "&uid=" + userId;
|
}
|
window.open(url);
|
}
|
else{
|
OpenZiYuan(resourceid);
|
}
|
}
|
|
//F11 阻止事件冒泡
|
function OpenOnlyZiYuan(ziyuanid){
|
event.stopPropagation();
|
OpenZiYuan(ziyuanid);
|
}
|
|
//F12 换一批(0定向推送1资源推荐)
|
var indexp = 2;
|
var indexr = 2;
|
function ChangeNext(type) {
|
var totalIndex = 0;
|
if(type == 0) {
|
totalIndex = (totalpNum % 3) > 0 ? (totalpNum / 3) + 1 : (totalpNum / 3);
|
if(indexp > totalIndex){
|
indexp = 1;
|
}
|
DirectionalPush(1,indexp);
|
indexp++;
|
}else {
|
totalIndex = (totalrNum % 3) > 0 ? (totalrNum / 3) + 1 : (totalrNum / 3);
|
if(indexr > totalIndex){
|
indexr = 1;
|
}
|
ZiYuanRecommend(1,indexr);
|
indexr++;
|
}
|
}
|
|
//F13 资源推荐
|
function ZiYuanRecommend(type,num) {
|
var url = (type == 0 ?'/res/ditufuwu/getMainInfoRecommends?isDiTuFuwu=false&limit=3&page=1':('/res/ditufuwu/getMainInfoRecommends?isDiTuFuwu=false&limit=3&page='+num));
|
$.ajax({
|
url: url,
|
type: 'get',
|
success: function (data) {
|
var html = "";
|
var jsonb = eval('(' + data + ')');
|
for (var i = 0; i < (jsonb.length>3?3:jsonb.length); i++) {
|
var description = decodeURIComponent(jsonb[i].description);
|
var fulldescription = decodeURIComponent(jsonb[i].fulldescription);
|
var onclick = "";
|
if(jsonb[i].isquanxian == 1){
|
onclick = "showMap("+jsonb[i].resourceid+",'"+jsonb[i].resourceclass+"','"+jsonb[i].firstMapUrl+"')";
|
}else{
|
onclick = "OpenZiYuan('"+jsonb[i].resourceid+"')";
|
}
|
html += "<li class=\"col-sm-4\" style=\"margin: 13.4px 0px 13.4px 0px !important\" onclick=\""+onclick+"\">"
|
+ "<div style=\"margin: 0px auto; text-align: center;\">";
|
html += "<img class=\"img\" style=\"width: 80%; height: 146px;\" src=\"" + jsonb[i].imgurl + "\" />";
|
html += "<div class=\"txt\" style=\"float:left;margin-left: 10%;width: 80%; height: 40px; overflow: hidden; cursor: pointer;\">"
|
+ "<i style='margin-top: 28px;float: right;margin-right: 5px;display: none;font-size:20px;' class=\"fa fa-exclamation-circle\" onclick=\"OpenOnlyZiYuan('" + jsonb[i].resourceid + "')\"></i>"
|
+ "<h3 style=\"padding-top: 0px;\">" + jsonb[i].title + "</h3>"
|
+ "<p title='"+fulldescription+"' style=\"text-align: left; padding-right: 10px; padding-left: 10px;\"> " + description + "</p>"
|
+ "</div>"
|
+ "</div>"
|
+ "</li>";
|
}
|
$("#rrzy").html(html);
|
var width = $(".YWJC_Img").width();
|
$(".lanren ul li").hover(function () {
|
$(this).find(".txt").stop().animate({height: "170px"}, 400,function(){
|
$(this).find("i").show();
|
});
|
$(this).find(".txt h3").stop().animate({paddingTop: "50px"}, 400);
|
},
|
function () {
|
$(this).find(".txt").stop().animate({height: "40px"}, 400);
|
$(this).find(".txt h3").stop().animate({paddingTop: "0"}, 400);
|
$(this).find("i").hide();
|
});
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|