var defaultclassification = ""; //默认分类ID // 截取url中的参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null } // 传递userId if (GetQueryString("userId") != null && GetQueryString("userId").toString().length > 1) { var userId = GetQueryString("userId"); } if (GetQueryString("new_userid") != null && GetQueryString("new_userid").toString().length > 1) { var new_userid = GetQueryString("new_userid"); } 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") { var html = ""; res.data.myForEach(function (item, index, arr) { new_name_date.push(item.consultingId); }); 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); contextList(userId, new_userid); //右侧分类对应内容 } else { Dreamer.error(res.resultMsg); } } } function read(value) { window.location.href = "../html/InfoCenterList.html?time=" + new Date().getTime(); cookieHandler.set("CenterList", value); } function contextList(value, new_userid) { new_name_date.myForEach(function (item, index, arr) { if (item == new_userid) { $(".left_center").children("div").eq(index).attr("class", "cen_ter_true"); } else { $(".left_center").children("div").eq(index).attr("class", "cen_ter"); } }); if (value != null && value != "" && value != undefined) { let getList = new AJAX_OBJ(AgencyAddress + "ConsultingContext/getInfo?contextId=" + value, getSuccess, onUrlError); getList.getRequestData(); function getSuccess(xmlHttp) { let res = eval('(' + xmlHttp.responseText + ')'); if (res.resultCode === "00000000") { var title = res.data.contextTitle; if (title == null || title == "" || title == undefined) { title = "无标题信息"; } var html = '
' + '
' + title + '
' + '
' + res.data.context + '
'; $(".list_main_right").html(html); } else { Dreamer.error(res.resultMsg); } } } else { Dreamer.error("获取信息失败!!!!"); setTimeout(function () { window.location.href = 'InfoCenterList.html?time=' + new Date().getTime(); }, 1000) } }