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.
214 lines
6.6 KiB
214 lines
6.6 KiB
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.record_type = decodeURI(query.record_type);
|
|
|
|
//浏览器后退箭头刷新页面
|
|
if(window.name != "noReload"){
|
|
window.name = "noReload";
|
|
location.reload();
|
|
} else {
|
|
window.name = "";
|
|
}
|
|
|
|
let listNewNum = null;
|
|
|
|
let listQuery = {
|
|
pay_type: 1, // 付费类型
|
|
goods_status: 1, // 委托状态
|
|
record_type: "", // 数据类型
|
|
entrust_name: "", // 委托数据名称
|
|
entrust_user_name: "", // 委托方名称
|
|
page: 1, // 页码
|
|
limit: 8, // 单页数据量
|
|
};
|
|
// 分页对象
|
|
let paging = {
|
|
pageNum: 1, // 当前页面
|
|
totalNum: 1, // 总页码
|
|
totalList: 0, // 记录总数量
|
|
pageRows: 8, // 每页条数
|
|
pageSizes: [8, 16, 32], // 每页显示个数选择器的选项设置
|
|
callback: function(num, pageRows) { //回调函数
|
|
if (paging.pageRows === pageRows) {
|
|
listNewNum = num
|
|
listQuery.page = num
|
|
listQuery.limit = pageRows
|
|
searchGoods(listQuery)
|
|
} else {
|
|
listQuery.page = 1
|
|
listQuery.limit = pageRows
|
|
searchGoods(listQuery)
|
|
}
|
|
}
|
|
};
|
|
// 委托数据查询接口
|
|
function searchGoods(data) {
|
|
let postList = new AJAX_OBJ(AgencyAddress + "order/searchGoods", successGood, onUrlError);
|
|
postList.postRequestData(JSON.stringify(data));
|
|
|
|
function successGood(xmlHttp) {
|
|
let res = eval('(' + xmlHttp.responseText + ')');
|
|
if (res.resultCode === "00000000") {
|
|
render(res.data.data);
|
|
paging.pageNum = res.data.current_page
|
|
paging.pageRows = res.data.per_page;
|
|
paging.totalNum = res.data.last_page;
|
|
paging.totalList = res.data.total;
|
|
// 渲染分页
|
|
$("#page").paging(paging);
|
|
} else {
|
|
Dreamer.error(res.resultMsg);
|
|
}
|
|
};
|
|
};
|
|
//进入公共数据详情
|
|
function detilss(list_isli, type, img,username) {
|
|
localStorage.setItem("listNewNum", listNewNum);
|
|
$(location).prop('href', './PublicDetails.html?list_isli=' + list_isli + '&goods_type=' + type + '&img=' + img + '&username=' + username +'&time=' + new Date().getTime())
|
|
};
|
|
// 渲染列表
|
|
function render(data) {
|
|
let mainstr = ''
|
|
if (data.length) {
|
|
data.myForEach(function(item, index, arr) {
|
|
let createStr = item.createtime.split(" ")[0].split("-").join("/")
|
|
let charges = item.charges_type == 1 ? "免费" : "付费"
|
|
let goodsEntrust = item.goods_entrust == 1 ? "转让" : "授权"
|
|
let img_html = good_img(item.goods_image)
|
|
mainstr += '<div class="main-cent-item" onclick="detilss(\'' + item.goods_islicode + '\',\'' + item
|
|
.goods_type + '\',\'' + goods_image_url + '\',\'' + item.username + '\')"><div class="item-top">' + img_html +
|
|
'<div class="item-date">' + createStr +
|
|
'</div><div class="item-img"><div>' + item.goods_name +
|
|
'</div><div>' + charges +
|
|
'</div></div></div><div class="item-bottom"><div class="item-text">委托关联编码:<a class="isli-text" title="' +
|
|
item.goods_islicode + '">' + item.goods_islicode +
|
|
'</a></div><div class="item-text">交易类型:' + goodsEntrust +
|
|
'</div><div class="item-text">委托方:' + item.username +
|
|
'</div><div class="item-cart"><div title="' + item.username + '">' + item.username +
|
|
'</div><div title="' + '加入购物车' + '">加入购物车</div></div></div></div>'
|
|
});
|
|
} else {
|
|
mainstr =
|
|
'<div style="width: 100%;height: 275px;display: flex;align-items: center;justify-content: center;font-size: 28px;color: #c0c4cf;">暂无数据</div>'
|
|
}
|
|
$('.main-cent').html(mainstr)
|
|
if (data.length) {
|
|
data.myForEach(function(item, index, arr) {
|
|
let Index = index + 1
|
|
if (Index % 4 !== 0) {
|
|
$(".main-cent-item:nth-child(" + Index + ")").css("margin-right", "20px")
|
|
}
|
|
if (index >= data.length - 4) {
|
|
$(".main-cent-item:nth-child(" + Index + ")").css("margin-bottom", "0")
|
|
}
|
|
});
|
|
// data.forEach((item, index) => {
|
|
// let Index = index + 1
|
|
// if (Index % 4 !== 0) {
|
|
// $(".main-cent-item:nth-child(" + Index + ")").css("margin-right", "20px")
|
|
// }
|
|
// if (index >= data.length - 4) {
|
|
// $(".main-cent-item:nth-child(" + Index + ")").css("margin-bottom", "0")
|
|
// }
|
|
// });
|
|
}
|
|
};
|
|
// 数据类型过滤
|
|
function filters(data) {
|
|
if (data === "全部") {
|
|
return ""
|
|
} else if (data === "文化资源数据") {
|
|
return 1
|
|
} else if (data === "文化数字内容") {
|
|
return 2
|
|
}
|
|
};
|
|
let Publicdate = {
|
|
retrievalPage: "公共数据专区"
|
|
}
|
|
// 初始化
|
|
$(document).ready(function() {
|
|
if (localStorage.getItem("listNewNum") == null) {
|
|
listQuery.page = 1
|
|
}else{
|
|
listQuery.page = localStorage.getItem("listNewNum");
|
|
localStorage.removeItem("listNewNum");
|
|
}
|
|
jQuery.each(jQuery('.type-tab'), function(index, item) {
|
|
if (item.innerText === query.record_type) {
|
|
$(".type-tab").removeClass("type-item")
|
|
item.className = "type-tab type-item"
|
|
listQuery.record_type = filters(item.innerText)
|
|
}
|
|
});
|
|
// $(".type-tab").each((index, item) => {
|
|
// if (item.innerText === query.record_type) {
|
|
// $(".type-tab").removeClass("type-item")
|
|
// item.className = "type-tab type-item"
|
|
// listQuery.record_type = filters(item.innerText)
|
|
// }
|
|
// });
|
|
// 初始化列表渲染
|
|
searchGoods(listQuery);
|
|
// 文化数据类别检索
|
|
$(".type-tab").bind("click", function(data) {
|
|
$(".type-tab").removeClass("type-item")
|
|
data.target.className = "type-tab type-item"
|
|
listQuery.record_type = filters(data.target.innerText)
|
|
listQuery.page = 1
|
|
searchGoods(listQuery)
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
});
|
|
// 委托方名称检索
|
|
$("#entrustName").bind('change', function(data) {
|
|
listQuery.entrust_user_name = data.target.value
|
|
listQuery.page = 1
|
|
searchGoods(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
});
|
|
// $("#entrustName").change((data) => {
|
|
// listQuery.entrust_user_name = data.target.value
|
|
// listQuery.page = 1
|
|
// searchGoods(listQuery)
|
|
// });
|
|
// 关键词检索
|
|
$("#keyWord").bind('change', function(data) {
|
|
listQuery.entrust_name = data.target.value
|
|
listQuery.page = 1
|
|
searchGoods(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
});
|
|
// $("#keyWord").change((data) => {
|
|
// listQuery.entrust_name = data.target.value
|
|
// listQuery.page = 1
|
|
// searchGoods(listQuery)
|
|
// });
|
|
// 搜索
|
|
$(".search").bind("click", function() {
|
|
listQuery.page = 1
|
|
searchGoods(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
});
|
|
})
|
|
|