/******************************************** * 前台展示 - 资源中心 * *******************************************/ //------------------------------------------ //F1.页面初始化 //F2.访问排行 //F3.最新资源 //F4.我的收藏夹 //F5.资源使用情况 //F6.初始化热门搜索关键字 //F7.热门搜索 //F8.搜索功能 //F9.我的申请资源 //F10.推荐资源 //F11.图表 //F12.我的申请详情 //F13 换一批(0定向推送1资源推荐) //------------------------------------------ //F1.页面初始化 $(function () { $('.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'); //F2.访问排行 FangWenPaiHang(); //F3.最新资源 ZuiXinZiYuan(); //F4.我的收藏夹 WoDeShouCangJia(); //F5.我的足迹 WoDeZuJi(); //F6.初始化热门搜索关键字 initHotSearch(); //F9.我的申请资源 WoDeShenQing(); //F10.我的推荐资源 TuiJianZiYuan(0,0); //F11.图表 initEchaerts(); //F14 资源推荐 ZiYuanRecommend(0,0); }); //F2.访问排行 function FangWenPaiHang() { $.ajax({ url: '/res/resActionRecord/selectFangWenPaiHang', type: 'get', success: function (data) { var html = ""; var jsonb = eval('(' + data + ')'); if (jsonb.length < 10) { $("#fwph").css("height", "400px"); } for (var i = 0; i < jsonb.length; i++) { if (i == 0) { html += "
  • " + "" + "   " + "" + jsonb[i].title + "" + "" + "
  • "; continue; } if (i == 1) { html += "
  • " + "" + "  " + "" + jsonb[i].title + "" + "" + "
  • "; continue; } if (i == 2) { html += "
  • " + "" + "  " + "" + jsonb[i].title + "" + "" + "
  • "; continue; } if (i == 9) { html += "
  • " + "" + "" + jsonb[i].title + "" + "" + "
  • "; continue; } else { html += "
  • " + "" + "" + jsonb[i].title + "" + "" + "
  • "; } } $("#fwph").append(html); }, error: function (e) { // alert(e.message); } }); } //F3.最新资源 function ZuiXinZiYuan() { $.ajax({ url: '/res/ZiYuan/getAllOrderByTime', 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 < 10) { $("#zxzy").css("height", "463px"); } for (var i = 0; i < jsonb.length; i++) { if (8 != i) { if (jsonb[i].pubdate == newday) { html += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } else { html += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } } if (i == 8) { if (jsonb[i].pubdate == newday) { html += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } else { html += "
  • " + "
    " + "" + jsonb[i].title + "
    " + " " + jsonb[i].pubdate + "" + "
    " + "
  • "; } } } $("#zxzy").append(html); }, error: function (e) { // alert(e.message); } }); } //F4.我的收藏夹 function WoDeShouCangJia() { $.ajax({ // url: '/res/ditufuwu/getTopListWDSCJ', url: '/res/resActionRecord/selectByActiontype', type: 'post', dataType: 'json', data: {'actiontype': '收藏'}, success: function (data) { var html = ""; // var jsona = eval('(' + data + ')'); var jsona = data.result; if (jsona.length < 10) { $(".mtree").css("height", "400px"); } for (var i = 0; i < jsona.length; i++) { if (9 != i) { html += "
  • " + "" + "" + "" + jsona[i].title + "" + "
  • "; } if (i == 9) { html += "
  • " + "" + "" + "" + jsona[i].title + "" + "
  • "; } } $(".mtree").append(html); }, error: function (e) { // alert(e.message); } }); } //F5.我的足迹 function WoDeZuJi() { $.ajax({ url: '/res/resActionRecord/selectByActiontype', type: 'post', dataType: 'json', data: {'actiontype': '浏览'}, success: function (result) { var html = ""; // var json = eval('(' + result + ')'); var json = result.result; for (var i = 0; i < json.length; i++) { if (json.length - 1 != i) { html += "
  • " + "" + "" + json[i].title + "" + "  " + json[i].finaltime + "" + "
  • "; } if (json.length - 1 == i) { html += "
  • " + "" + "" + json[i].title + "" + "  " + json[i].finaltime + "" + "
  • "; } } $(".zuji").append(html); }, error: function (e) { // alert(e.message); } }); } //F6.初始化热门搜索关键字 function initHotSearch() { $.ajax({ url: '/res/getTopHotSearch', type: 'get', success: function (data) { if (data != "") { var list = data.result; 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.热门搜索 function HotSearch(e) { var keyword = $(e).attr("title"); window.open("/res/ziyuanmulu/index?Menu=ZYZX&menuId=08&Message=" + encodeURIComponent(keyword), "_black"); } //F8.搜索功能 function Search() { var key = document.getElementById("guanjianziSeach").value; if (key != "") { $.ajax({ url: 'Search',//TuiJianZiYuan type: 'post', data: {"key": key}, success: function (data) { } }); window.open("/res/ziyuanmulu/index?Menu=ZYZX&menuId=08&Message=" + encodeURIComponent(key), "_black"); } } //F9.我的申请资源 function WoDeShenQing() { $.ajax({ url: '/res/resApplyRecommend/shenQingZiYuan', type: 'get', success: function (sqzy) { var html = ""; var jsonzy = sqzy.result; if (jsonzy.length < 10) { $("#sqzy").css("height", "463px"); } for (var i = 0; i < jsonzy.length; i++) { if (jsonzy.length == 0) { break; } if (9 != 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 (i == 9) { 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.我的推荐资源(0默认1换一批,) function TuiJianZiYuan(type,num) { var url = (type == 0 ?'/res/ZiYuan/getTopRecommend?isDiTuFuwu=false':('/res/ditufuwu/getTuiJianZiYuanByIndex?isDiTuFuwu=false&limit=3&page='+num)); $.ajax({ url: url, type: 'get', success: function (data) { var html = ""; // var r = decodeURIComponent(data); var jsonb = eval('('+ data +')'); // if (jsonb.length < 3) { // $("#divtuijianziyuan").css("height", "398.5px"); // } for (var i = 0; i < (jsonb.length>3?3:jsonb.length); i++) { var description = decodeURIComponent(jsonb[i].description); var fulldescription = decodeURIComponent(jsonb[i].fulldescription); html += "
  • " + "
    "; html += ""; html += "
    " + "

    " + jsonb[i].title + "

    " + "

           " + description + "

    " + "
    " + "
    " + "
  • "; } $("#tjzy").html(html); var width = $(".YWJC_Img").width(); 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); }); }, error: function (e) { // alert(e.message); } }); } //F11.图表 function initEchaerts() { var divzylx = document.getElementById("zylx"); var divzyly = document.getElementById("zyly"); var divzyml = document.getElementById("zyml"); var zylx = echarts.init(divzylx); var zyly = echarts.init(divzyly); var zyml = echarts.init(divzyml); var zylxoption = { title: { text: '资源类型统计', x: 'center' }, tooltip: { trigger: 'item', formatter: "{a}
    {b} : {c} ({d}%)" }, color: ['#85CFFF', '#DD71D4', '#FF7D53', '#6496EF', '#31CF32'], calculable: true, series: [ { name: '资源类型', type: 'pie', radius: '50%', center: ['50%', '60%'], data: resourceclassSeries } ] }; zylx.setOption(zylxoption); var zylyoption = { title: { text: '资源来源统计', x: 'center' }, tooltip: { trigger: 'axis' }, calculable: true, xAxis: [ { type: 'category', axisLabel: { interval: 0, rotate: 30 }, data: DataSourceLegends, splitLine: { show: true } } ], yAxis: [ { type: 'value', splitLine: { show: true } } ], series: [ { name: '资源数量', type: 'bar', barWidth: 10, data: DataSourceSeries, itemStyle: { normal: { color: '#5AB3EF', label: { show: true, position: 'top' } } } } ] }; zyly.setOption(zylyoption); var zymloption = { title: { text: '资源目录统计', x: 'center' }, tooltip: { trigger: 'axis' }, grid: { borderWidth: 0, }, calculable: false, xAxis: [ { type: 'category', axisLabel: { interval: 0, rotate: 40 }, boundaryGap: false, data: MuLuLegends, splitLine: { show: false } } ], yAxis: [ { type: 'value', axisLabel: { formatter: '{value}' }, splitLine: { show: true } } ], series: [ { name: '资源数量', type: 'line', data: MuLuSeries, itemStyle: { normal: { label: {show: true}, color: '#FF7D53' } }, }, ] }; zyml.setOption(zymloption); } //F12.我的申请详情 function showApplyInfo(appid) { var url = "/res/resApplyRecommend/applyRecommendInfo?appid="+appid; // winPro.openFullwin(url, "查看资源申请", "yes"); openFullWindow(url, "查看资源申请"); } //F13 换一批(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; } TuiJianZiYuan(1,indexp); indexp++; }else { totalIndex = (totalrNum % 3) > 0 ? (totalrNum / 3) + 1 : (totalrNum / 3); if(indexr > totalIndex){ indexr = 1; } ZiYuanRecommend(1,indexr); indexr++; } } //F14 资源推荐 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); html += "
  • " + "
    "; html += ""; html += "
    " + "

    " + jsonb[i].title + "

    " + "

           " + description + "

    " + "
    " + "
    " + "
  • "; } $("#rrzy").html(html); var width = $(".YWJC_Img").width(); 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); }); }, error: function (e) { // alert(e.message); } }); }