var defaultclassification = ""; //默认分类ID var modelId = -1; let query = {}; //URL参数 Array.prototype.myForEach = function myForEach(callback, context) { context = context || window; if (Array.prototype.forEach) { // 调用forEach方法,不做任何处理 this.forEach(callback, context); return; } } window.onload = function() { classificationList(); //左侧分类 } let new_name_date = []; //获取分类列表 function classificationList() { let getList = new AJAX_OBJ(AgencyAddress + "ConsultingContext/getSelection", getSuccess, onUrlError); getList.getRequestData(); function getSuccess(xmlHttp) { let res = eval('(' + xmlHttp.responseText + ')'); if (res.resultCode === "00000000") { if(res.data.length != 0){ res.data.myForEach(function(item, index, arr) { new_name_date.push(item.consultingId); }); var html = ""; for (var i = 0; i < res.data.length; i++) { if (i == 0) { defaultclassification = res.data[i].consultingId; } html += '
' + res.data[i].consultingName + '
'; } $(".left_center").html(html); if (cookieHandler.get("CenterList") == undefined || cookieHandler.get("CenterList") == null) { contextList(0); //右侧分类对应内容 } else { contextList(cookieHandler.get("CenterList")); //右侧分类对应内容 } }else{ let rightml = '
暂无数据
'; $('.list_main_right').html(rightml); } } else { Dreamer.error(res.resultMsg); } } } function read(value, index, contextConsultingId) { window.location.href = "../html/InforDetails.html?userId=" + value + '&new_userid=' + contextConsultingId +'&time=' + new Date().getTime(); } function contextList(value, name, index) { $(".left_center").children("div").eq(index).attr("class", "cen_ter_true"); if (modelId >= 0) { $(".left_center").children("div").eq(modelId).attr("class", "cen_ter"); } //默认刚进入页面第一个加背景颜色 if (value == 0 || value == new_name_date[0]) { $(".left_center div").get(0).style.background = "#999999"; } else if (index != undefined || index != "undefined" || index != 0) { $(".left_center div").get(0).style.background = "rgba(229, 229, 229, 1)"; } new_name_date.myForEach(function(item, index, arr) { if (item == value) { $(".left_center").children("div").eq(index).attr("class", "cen_ter_true"); } else { $(".left_center").children("div").eq(index).attr("class", "cen_ter"); } }); modelId = index; if (value == 0) { //默认显示导航第一个内容 let getList = new AJAX_OBJ(AgencyAddress + "ConsultingContext/getList?pageRows=1000&contextConsultingId=" + defaultclassification, getSuccess, onUrlError); getList.getRequestData(); function getSuccess(xmlHttp) { let res = eval('(' + xmlHttp.responseText + ')'); if (res.resultCode === "00000000") { var html = ""; if(res.data.pageDataList.length != 0){ for (var i = 0; i < res.data.pageDataList.length; i++) { if (i == 0) { html += '
' + '
' + '
标题名称: ' + res.data.pageDataList[i] .contextTitle + '
' + '
发布时间: ' + res.data.pageDataList[i] .contextCreationTime + '
' + '
' + '
' + '' + '
'; } else { html += '
' + '
' + '
标题名称: ' + res.data.pageDataList[i] .contextTitle + '
' + '
发布时间: ' + res.data.pageDataList[i] .contextCreationTime + '
' + '
' + '
' + '' + '
'; } } $(".list_main_right").html(html); }else{ let rightml = '
暂无数据
'; $('.list_main_right').html(rightml); } } else { Dreamer.error(res.resultMsg); } } } else { let getList = new AJAX_OBJ(AgencyAddress + "ConsultingContext/getList?pageRows=1000&contextConsultingId=" + value, getSuccess, onUrlError); getList.getRequestData(); function getSuccess(xmlHttp) { let res = eval('(' + xmlHttp.responseText + ')'); if (res.resultCode === "00000000") { var html = ""; if(res.data.pageDataList.length != 0){ for (var i = 0; i < res.data.pageDataList.length; i++) { if (i == 0) { html += '
' + '
' + '
标题名称: ' + res.data.pageDataList[i] .contextTitle + '
' + '
发布时间: ' + res.data.pageDataList[i] .contextCreationTime + '
' + '
' + '
' + '' + '
'; } else { html += '
' + '
' + '
标题名称: ' + res.data.pageDataList[i] .contextTitle + '
' + '
发布时间: ' + res.data.pageDataList[i] .contextCreationTime + '
' + '
' + '
' + '' + '
'; } } $(".list_main_right").html(html); }else{ let rightml = '
暂无数据
'; $('.list_main_right').html(rightml); } } else { Dreamer.error(res.resultMsg); } } } } $("#new_top").bind("click", function() { document.documentElement.scrollTop = document.body.scrollTop = 0 });