/******************************************** * 前台展示 - 地图服务 * *******************************************/ //控制器: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 = "  "; } if (i == 9) { strBorder = "style='border: none;'"; } html += "
  • " + ""; html += strImg + "" + list[i].title + "
  • "; } $("#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 += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } else { html += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } } if(i == 7) { if (jsonb[i].pubdate == newday) { html += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } else { html += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } 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[i].title + "" + ""; } if(9 == i) { html += "
  • " + "" + "" + "" + jsona[i].title + "" + "
  • "; } } $(".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 = "
  • 热门搜索:
  • "; for (var i = 0; i < list.length; i++) { html += "
  • " + list[i].keyword + "
  • "; } $("#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 += "
  • " + "
    "; html += ""; html += "
    " + "" + "

    " + jsonb[i].title + "

    " + "

           " + description + "

    " + "
    " + "
    " + "
  • "; } $("#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 += "
    "; if (jsonzy[i].auditresult == "0") { html += "" + ""+ jsonzy[i].title + " " + " "; } else if (jsonzy[i].auditresult == "1") { html += "" + ""+ jsonzy[i].title + " " + " "; } else if (jsonzy[i].auditresult == "2") { html += "" + ""+ jsonzy[i].title + " " + " "; }else if (jsonzy[i].auditresult == "null") { html += "" + ""+ jsonzy[i].title + " " + " "; } html += "
    "; } if(7 == i){ html += "
    "; if (jsonzy[i].auditresult == "0") { html += "" + ""+ jsonzy[i].title + " " + " "; } else if (jsonzy[i].auditresult == "1") { html += "" + ""+ jsonzy[i].title + " " + " "; } else if (jsonzy[i].auditresult == "2") { html += "" + ""+ jsonzy[i].title + " " + " "; }else if (jsonzy[i].auditresult == "null") { html += "" + ""+ jsonzy[i].title + " " + " "; } html += "
    "; } } $("#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 += "
  • " + "
    "; html += ""; html += "
    " + "" + "

    " + jsonb[i].title + "

    " + "

           " + description + "

    " + "
    " + "
    " + "
  • "; } $("#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); } }); }