[内网]文化云交易前端H5
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

148 lines
5.3 KiB

var defaultclassification = ""; //默认分类ID
var modelId = -1;
//在DOM树加载完成之后(DOM树加载完不代表全部资源加载完,例如图片,音频和视频等还没加载)就会执行,简写成$(function(){});
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
}
});
}
query.new_Name = decodeURI(query.new_Name);
let new_name_date = [];
$(document).ready(function() {
classificationList(); //左侧分类
});
//获取分类列表
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") {
if(res.data.pageDataList.length != 0){
let prostr = '';
let leftList = res.data.pageDataList;
leftList.myForEach(function(item, index, arr) {
new_name_date.push(item.classId);
if (index == 0) {
defaultclassification = item.className;
defaulid = item.classId;
}
prostr += '<div class="cen_ter" onclick="contextList(\'' + item.className + '\',\'' + item
.classId + '\',\'' + index + '\')">' + item.className + '</div>';
// prostr += '<div class="cen_ter" id="cen_ter'+index+'">' + item.className + '</div>';
});
// leftList.forEach((item, index) => {
// if (index == 0) {
// defaultclassification = item.className;
// }
// prostr += '<div class="cen_ter" onclick="contextList(\'' + item.className +
// '\')">' + item.className + '</div>';
// // prostr += '<div class="cen_ter" id="cen_ter'+index+'">' + item.className + '</div>';
// })
$('.left_center').html(prostr);
// $(".cen_ter").click((data)=>{
// console.log($("#"+data.target.id).text())
// })
if (query.new_Name == undefined || query.new_Name == null || query.new_Name == "undefined") {
contextList(defaultclassification, defaulid);
} else {
contextList(query.new_Name, query.classId);
}
}else{
let rightml = '<div class="rigtcenter"><div>暂无数据</div></div>';
$('.list_main_right').html(rightml);
}
} else {
Dreamer.error(res.resultMsg);
}
};
}
//点击左侧分类
function contextList(value, classid, 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 (classid == 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 == classid) {
$(".left_center").children("div").eq(index).attr("class", "cen_ter_true");
} else {
$(".left_center").children("div").eq(index).attr("class", "cen_ter");
}
});
modelId = index;
let postList = new AJAX_OBJ(AgencyAddress + "business/guide/queryTittles?busguideBelongClass=" + encodeURI(value),
queryTittles, onUrlError);
postList.postRequestData();
function queryTittles(xmlHttp) {
let res = eval('(' + xmlHttp.responseText + ')');
if (res.resultCode === "00000000") {
let rigreally = '';
res.data.myForEach(function(item, index, arr) {
rigreally += '<div class="context-list">' +
'<div class="context-header">' +
'<div class="context-head-children"><strong>标题名称:</strong>' + item
.busguideTitle + '</div>' +
'<div class="context-head-children"><strong>发布时间:</strong>' + item
.busguideTime + '</div>' + '</div>' +
'<div class="context-button"><input class="btn btn-default btn_read" type="button" onclick="detilsList(\'' +
item.nameId + '\',\'' + classid + '\')" value="阅读全文"/></div>' +
'</div>'
});
// res.data.forEach((item, index) => {
// rigreally += '<div class="context-list">' +
// '<div class="context-header">' +
// '<div class="context-head-children"><strong>标题名称:</strong>' + item
// .busguideTitle + '</div>' +
// '<div class="context-head-children"><strong>发布时间:</strong>' + item
// .busguideTime + '</div>' + '</div>' +
// '<div class="context-button"><input class="btn btn-default btn_read" type="button" onclick="detilsList(\'' +
// item.nameId + '\')" value="阅读全文"/></div>' +
// '</div>'
// })
$('.list_main_right').html(rigreally);
} else {
let rightml = '<div class="rigtcenter"><div>暂无数据</div></div>';
$('.list_main_right').html(rightml);
}
};
}
function detilsList(value, classid) {
location.href = "SinGuideDetails.html?new_nameId=" + value + '&classid=' + classid + '&time=' + new Date().getTime();
}