/********************************************
|
* 前台展示 - 地图服务 *
|
*******************************************/
|
|
//控制器: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 jsonb = data.result;
|
if(jsonb.length < 5) {
|
$("#fwph").css("height","275px");
|
}
|
var len = jsonb.length > 5?5:jsonb.length;
|
for (var i = 0; i < len; i++) {
|
var num = i+1;
|
var tit = htmlEncodeByRegExp(jsonb[i].fulltitle);
|
if (i == 0) {
|
html += "<li>" +
|
"<a title='" + tit + "' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" +
|
" <img src=\"/image/ZiYuanZhongXin/New/num1.png\" /> " +
|
"<span>" + tit + "</span>" +
|
"</a>" +
|
"</li>";
|
continue;
|
}
|
if (i == 1) {
|
html += "<li>" +
|
"<a title='" + tit + "' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" +
|
"<img src=\"/image/ZiYuanZhongXin/New/num2.png\" /> " +
|
"<span>" + jsonb[i].fulltitle + "</span>" +
|
"</a>" +
|
"</li>";
|
continue;
|
}
|
if (i == 2) {
|
html += "<li>" +
|
"<a title='" + tit + "' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" +
|
"<img src=\"/image/ZiYuanZhongXin/New/num3.png\" /> " +
|
"<span>" + jsonb[i].fulltitle + "</span>" +
|
"</a>" +
|
"</li>";
|
continue;
|
}
|
else {
|
html += "<li>" +
|
"<a title='" + tit + "' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" +
|
"<span style='color: grey;display: inline-block;width: 41px;height: 17px;line-height: 17px;text-align: center;font-size: 16px;'>" + num + "</span>" +
|
"<span> " + jsonb[i].fulltitle + "</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 = data.result;
|
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 < 7) {
|
$("#zxzy").css("height","385px");
|
}
|
var len = jsonb.length > 7?7:jsonb.length;
|
for (var i = 0; i < len; i++) {
|
var tit = htmlEncodeByRegExp(jsonb[i].fulltitle);
|
html += "<li>" +
|
"<div>" +
|
"<a title='" + tit + "' onclick=\"OpenZiYuan('" + jsonb[i].resourceid + "')\">" + tit + "</a>" +
|
" <span style=\"color: #868686;float: right;\">" + jsonb[i].pubdate + "</span>" +
|
"</div>" +
|
"</li>";
|
}
|
$("#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 = data.result;
|
if(jsona.length < 5) {
|
$(".mtree").css("height","275px");
|
}
|
var len = jsona.length > 5?5:jsona.length;
|
for(var i=0;i<len;i++) {
|
var tit = htmlEncodeByRegExp(jsona[i].fulltitle);
|
html += "<li>" +
|
// "<a title=\"" + jsona[i].fulltitle + "\" style=\"vertical-align: middle;\" href=\"#\"></a>" +
|
"<a title=\"" + tit + "\" style=\"font-size: 13px;cursor: pointer;\" onclick=\"OpenZiYuan('" + jsona[i].resourceid + "')\" >" +
|
"<img style=\"padding-right: 5px; vertical-align: text-bottom;\" src=\"/image/ZiYuanZhongXin/New/shoucangicon.png\" />" + tit +
|
"</a>" +
|
" </li>";
|
}
|
$(".mtree").append(html);
|
},
|
error: function(e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
//F5.资源使用情况
|
function ZiYuanShiYongQingKuang() {
|
var ziyuan = echarts.init(document.getElementById("divziyuantongji"));
|
option = {
|
title : {
|
text: '资源使用情况',
|
x: 43,
|
y: 33,
|
textStyle:{
|
fontSize: 20,
|
fontWeight:"bold",
|
color: "#4777FF"
|
}
|
},
|
color: ['#C1D2FF', '#82A4FE'],
|
tooltip: {
|
trigger: 'axis'
|
},
|
legend: {
|
data: ['浏览次数', '收藏次数'],
|
show:true,
|
x:'right',
|
padding: [40,50,0,0],
|
},
|
grid: {
|
borderWidth: 0,
|
width:520,
|
y:100,
|
},
|
xAxis: [
|
{
|
type: 'category',
|
data: eval('(' + BianMu + ')'),
|
axisLabel:{
|
textStyle: {
|
fontSize: 14,
|
color:'#bfbfbf'
|
},
|
}
|
}
|
],
|
yAxis: [
|
{
|
type: 'value',
|
axisLabel:{
|
textStyle: {
|
fontSize: 14,
|
color:'#bfbfbf'
|
},
|
}
|
}
|
],
|
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 = data.result;
|
var html = "<li>热门搜索:</li>";
|
|
var num = 0;
|
for (var i = 0; i < list.length; i++) {
|
// num += list[i].keyword.replace(/[^\x00-\xff]/g, 'xx').length;
|
// num += list[i].keyword.length;
|
// if(num > 50) break;
|
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) + "&isDiTuwu=1");
|
// }
|
} else if (way == 1) {
|
var keyword = $(obj).attr("title");
|
window.open("/res/ziyuanmulu/index?Menu=ZYZX&menuId=08&Message=" + encodeURIComponent(keyword) + "&isDiTuwu=1");
|
}
|
}
|
|
//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 = data.result;
|
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=\"YWJC_Img\" style=\"margin: 13.4px 0px 13.4px 0px !important;\" onclick=\""+onclick+"\">"
|
+ "<div style=\"margin: 0px auto; text-align: center;\">";
|
html += "<img class=\"img\" src=\"" + jsonb[i].imgurl + "\" />";
|
html += "<div class=\"txt\" style=\"float:left;margin-left: 2px;width: 96%; height: 25px; overflow: hidden; cursor: pointer;\">"
|
+ "<i style='margin-top: 12px;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: "100px"}, 400,function(){
|
$(this).find("i").show();
|
});
|
$(this).find(".txt h3").stop().animate({marginTop: "10px"}, 400);
|
},
|
function () {
|
$(this).find(".txt").stop().animate({height: "25px"}, 400);
|
$(this).find(".txt h3").stop().animate({marginTop: "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 = sqzy.result;
|
if(jsonzy.length < 7) {
|
$("#sqzy").css("height","385px");
|
}
|
var len = jsonzy.length > 7?7:jsonzy.length;
|
for (var i = 0; i < len; i++) {
|
if(jsonzy.length==0){
|
break;
|
}
|
var tit = htmlEncodeByRegExp(jsonzy[i].fulltitle);
|
html += "<div class=\"sqzy\">";
|
if (jsonzy[i].auditresult == "0") {
|
html += "<a title='" + tit + "' style=\"color: black; cursor: pointer;transition: 0.3s;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img class='fimg' src=\"/image/ZiYuanZhongXin/New/wodeshenqing_icon.png\" />" + tit + " </a>" +
|
" <img onclick='showApplyInfo(" + jsonzy[i].appid + ")' class='limg' src=\"/image/ZiYuanZhongXin/New/weipifu.png\" />";
|
} else if (jsonzy[i].auditresult == "1") {
|
html += "<a title='" + tit + "' style=\"color: black; cursor: pointer;transition: 0.3s;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img class='fimg' src=\"/image/ZiYuanZhongXin/New/wodeshenqing_icon.png\" />" + tit + " </a>" +
|
" <img class='limg' onclick='showApplyInfo(" + jsonzy[i].appid + ")' src=\"/image/ZiYuanZhongXin/New/yitongguo.png\" />";
|
} else if (jsonzy[i].auditresult == "2") {
|
html += "<a title='" + tit + "' style=\"color: black; cursor: pointer;transition: 0.3s;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img class='fimg' src=\"/image/ZiYuanZhongXin/New/wodeshenqing_icon.png\" />" + tit + " </a>" +
|
" <img class='limg' onclick='showApplyInfo(" + jsonzy[i].appid + ")' src=\"/image/ZiYuanZhongXin/New/weitongguo.png\" />";
|
} else if (jsonzy[i].auditresult == "null" ||jsonzy[i].auditresult == null) {
|
html += "<a title='" + tit + "' style=\"color: black; cursor: pointer;\" onclick=\"OpenZiYuan('" + jsonzy[i].resourceid + "')\">" +
|
"<img class='fimg' src=\"/image/ZiYuanZhongXin/New/wodeshenqing_icon.png\" />" + tit + " </a>" +
|
" <img class='limg' onclick='showApplyInfo(+jsonzy[i].appid+)' src=\"/image/ZiYuanZhongXin/New/weipifu.png\" />";
|
}
|
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=4&page=1':('/res/ditufuwu/getMainInfoRecommends?isDiTuFuwu=false&limit=4&page='+num));
|
$.ajax({
|
url: url,
|
type: 'get',
|
success: function (data) {
|
var html = "";
|
var jsonb = data.result;
|
for (var i = 0; i < (jsonb.length>6?6: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>";
|
html += "<a title='" + jsonb[i].title + "' style=\"color: black;\" onclick=\""+onclick+"\">"
|
html += "<img src='/image/ZiYuanZhongXin/New/zytj_icon.png'>";
|
html += getTypeName(jsonb[i].resourceclass);
|
html += jsonb[i].title+"</a>";
|
html += "</li>";
|
}
|
$("#rrzy").html(html);
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
function getTypeName(name) {
|
var typeName = "";
|
var html = "";
|
if(name == "JKFW") {
|
typeName = "接口";
|
html = "<span class='label label-danger'>接口</span>";
|
}
|
if(name == "SJWJ") {
|
typeName = "文件";
|
html = "<span class='label label-default'>数据</span>"
|
}
|
if(name == "SJKB") {
|
typeName = "库表";
|
html = "<span class='label label-primary'>库表</span>"
|
}
|
if(name == "YWJC") {
|
typeName = "集成";
|
html = "<span class='label label-info'>集成</span>"
|
}
|
if(name == "KJ_JCDT") {
|
typeName = "地图";
|
html = "<span class='label label-success'>底图</span>"
|
}
|
if(name == "KJ_ZTDT") {
|
typeName = "专题";
|
html = "<span class='label label-pink'>专题</span>"
|
}
|
if(name == "KJ_KJFX") {
|
typeName = "空间";
|
html = "<span class='label label-warning'>空间</span>"
|
}
|
if(name == "KJ_SWFW") {
|
typeName = "三维";
|
html = "<span class='label label-primary'>三维</span>"
|
}
|
if(name == "KJ_YWTC") {
|
typeName = "业务";
|
html = "<span class='label label-danger'>业务</span>"
|
}
|
|
return html;
|
}
|