let query = {}; //URL参数 let scr = $(location).prop('href').split("?")[1]; Array.prototype.myForEach = function myForEach(callback, context) { context = context || window; if (Array.prototype.forEach) { // 调用forEach方法,不做任何处理 this.forEach(callback, context); return; } } if (scr) { scr = scr.split("&").join("=").split("=") scr.myForEach(function (item, index, arr) { if (index % 2 === 0) { query[item] = "" } else { query[scr[index - 1]] = item } }); // scr.forEach((item, index) => { // if (index % 2 === 0) { // query[item] = "" // } else { // query[scr[index - 1]] = item // } // }); } query.new_nameId = decodeURI(query.new_nameId); let new_name_date = []; $(document).ready(function () { classificationList(); //左侧分类 // classifDetilsList(query.new_nameId); }); //获取分类列表 function classificationList() { let data = { "status": 1, "pageIndex": 1, "pageOrder": "field1;field2:1", "pageRows": 1000000, } let postList = new AJAX_OBJ(AgencyAddress + "business/guide/queryList", BusinessGuide, onUrlError); postList.postRequestData(JSON.stringify(data)); function BusinessGuide(xmlHttp) { let res = eval('(' + xmlHttp.responseText + ')'); if (res.resultCode === "00000000") { let prostr = ''; let leftList = res.data.pageDataList; leftList.myForEach(function (item, index, arr) { new_name_date.push(item.classId); prostr += '
' + item.className + '
'; }); // leftList.forEach((item, index) => { // prostr += '
' + item.className + '
'; // }) $('.left_center').html(prostr); classifDetilsList(query.new_nameId); } else { Dreamer.error(res.resultMsg); } }; } //获取详情数据 function classifDetilsList(urlData) { new_name_date.myForEach(function (item, index, arr) { if (item == query.classid) { $(".left_center").children("div").eq(index).attr("class", "cen_ter_true"); } else { $(".left_center").children("div").eq(index).attr("class", "cen_ter"); } }); let postList = new AJAX_OBJ(AgencyAddress + "business/guide/queryTittleContent?nameId=" + urlData, queryTittleContent, onUrlError); postList.postRequestData(); function queryTittleContent(xmlHttp) { let res = eval('(' + xmlHttp.responseText + ')'); if (res.resultCode === "00000000") { var html = '
' + '
' + res.data.busguideTitle + '
' + '
' + res.data.busguideContent + '
'; $(".list_main_right").html(html); } else { Dreamer.error(res.resultMsg); } }; } //点击左侧跳转回业务指南列表页面 function contextList(value, classId) { location.href = "SinGuideList.html?new_Name=" + value + '&classId=' + classId + '&time=' + new Date().getTime(); }