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.
312 lines
9.2 KiB
312 lines
9.2 KiB
// 数据类型过滤
|
|
function fstype(data) {
|
|
if (data == "") {
|
|
return "全部"
|
|
} else if (data == 1) {
|
|
return "文化资源数据"
|
|
} else if (data == 2) {
|
|
return "文化数字内容"
|
|
}
|
|
};
|
|
|
|
function fsword(data) {
|
|
if (data == "") {
|
|
return "全部"
|
|
} else if (data == 1) {
|
|
return "转让"
|
|
} else if (data == 2) {
|
|
return "授权"
|
|
}
|
|
};
|
|
|
|
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.authorization = decodeURI(query.authorization);
|
|
query.record_type = decodeURI(query.record_type);
|
|
query.entrust_name = decodeURI(query.entrust_name);
|
|
query.entrust_user_name = decodeURI(query.entrust_user_name);
|
|
|
|
// authorization: '', //授权方式(转让,授权)
|
|
// entrust_name: '', //委托数据名称(关键字模糊搜索)
|
|
// entrust_time: '', //委托时间(10位时间戳)
|
|
// entrust_user_name:entrust_name //委托方名称(关键字模糊搜索)
|
|
// goods_islicode: '', //委托数据委托关联编码
|
|
// order: '', //desc:降序;asc:升序
|
|
// order_type: '', //排序;createtime:时间;price:价格;
|
|
// pay_type: '', //付费类型(付费,免费)
|
|
// record_type: record_type //数据类型(文化资源数据,文化数字内容)
|
|
let listQuery = {};
|
|
let listNum = null;
|
|
|
|
if (query) {
|
|
listQuery = {
|
|
pay_type: 2, // 付费类型 1:免费;2:付费
|
|
authorization: query.authorization, //授权方式(1:转让;2:授权)
|
|
record_type: query.record_type, // 数据类型
|
|
entrust_name: query.entrust_name, // 委托数据名称
|
|
entrust_user_name: query.entrust_user_name, // 委托方名称
|
|
source_type: "",
|
|
order_type: "createtime", //排序 createtime:时间;price:价格
|
|
order: "desc", //desc:降序;asc:升序
|
|
goods_status: 1,
|
|
page: 1,
|
|
limit: 8
|
|
};
|
|
|
|
let typeName = fstype(query.record_type);
|
|
$(".btn1").removeClass("current");
|
|
if (typeName == "全部") {
|
|
$($(".btn1")[0]).addClass("current");
|
|
} else if (typeName == "文化资源数据") {
|
|
$($(".btn1")[1]).addClass("current");
|
|
} else if (typeName == "文化数字内容") {
|
|
$($(".btn1")[2]).addClass("current");
|
|
}
|
|
let wordName = fsword(query.authorization);
|
|
$(".btn").removeClass("activbtn");
|
|
if (wordName == "全部") {
|
|
$($(".btn")[0]).addClass("activbtn");
|
|
} else if (wordName == "转让") {
|
|
$($(".btn")[1]).addClass("activbtn");
|
|
} else if (wordName == "授权") {
|
|
$($(".btn")[2]).addClass("activbtn");
|
|
}
|
|
//input框数据回显
|
|
$('.ipt').val(query.entrust_user_name);
|
|
//input框数据回显 关键词
|
|
$('.iptword').val(query.entrust_name);
|
|
} else {
|
|
listQuery = {
|
|
pay_type: 2, // 付费类型 1:免费;2:付费
|
|
authorization: "", //授权方式(1:转让;2:授权
|
|
record_type: "", // 数据类型
|
|
entrust_name: "", // 委托数据名称
|
|
entrust_user_name: "", // 委托方名称
|
|
source_type: "",
|
|
order_type: "createtime", //排序 createtime:时间;price:价格
|
|
order: "desc", //desc:降序;asc:升序
|
|
goods_status: 1,
|
|
page: 1,
|
|
limit: 8
|
|
};
|
|
}
|
|
|
|
window.onload = function() {
|
|
if (localStorage.getItem("listNum") == null) {
|
|
listQuery.page = 1
|
|
} else {
|
|
listQuery.page = localStorage.getItem("listNum");
|
|
localStorage.removeItem("listNum");
|
|
}
|
|
getListMsg(listQuery);
|
|
}
|
|
|
|
let listData = []; // 列表源数据
|
|
let totalData = []; // 列表分页数据
|
|
|
|
// 分页对象
|
|
let paging = {
|
|
pageNum: 1, // 当前页面
|
|
totalNum: 1, // 总页码
|
|
totalList: 0, // 记录总数量
|
|
pageRows: 8, // 每页条数
|
|
pageSizes: [8, 16, 32], // 每页显示个数选择器的选项设置
|
|
callback: function(num, pageRows) { //回调函数
|
|
if (paging.pageRows === pageRows) {
|
|
listNum = num
|
|
listQuery.page = num
|
|
listQuery.limit = pageRows
|
|
getListMsg(listQuery)
|
|
} else {
|
|
listQuery.page = 1
|
|
listQuery.limit = pageRows
|
|
getListMsg(listQuery)
|
|
}
|
|
}
|
|
};
|
|
|
|
//委托数据查询接口
|
|
function getListMsg(data) {
|
|
var ajaxSearchGoods = new AJAX_OBJ(AgencyAddress + "order/searchGoods", entrustSearchGoods, onUrlError);
|
|
ajaxSearchGoods.postRequestData(JSON.stringify(data));
|
|
}
|
|
|
|
function entrustSearchGoods(xmlHttp) {
|
|
var 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);
|
|
}
|
|
}
|
|
|
|
let img_url = "";
|
|
let newimg_url = "";
|
|
//封面图设置
|
|
function good_headerimg(data) {
|
|
var myPix = new Array("../images/180-180.jpg", "../images/180-180-2.jpg", "../images/180-180-3.jpg",
|
|
"../images/180-180-3.jpg");
|
|
var randomNum = Math.floor((Math.random() * myPix.length));
|
|
img_url = "";
|
|
if (data) {
|
|
let reg = RegExp(/data:image\/.*;base64,/);
|
|
if (reg.test(data)) { //判断图片数据是base64吗
|
|
img_url = '<img src=' + data + ' alt="">'
|
|
} else {
|
|
img_url = '<img src=' + pathURL + '' + encodeURIComponent(data) + ' alt="">'
|
|
}
|
|
} else {
|
|
newimg_url = myPix[randomNum];
|
|
img_url = '<img src=' + myPix[randomNum] + ' alt="">'
|
|
}
|
|
}
|
|
|
|
// 渲染列表
|
|
function render(data) {
|
|
let prostr = '';
|
|
if (data.length) {
|
|
data.myForEach(function(item, index, arr) {
|
|
good_headerimg(item.goods_image);
|
|
if (item.goods_entrust == 1) {
|
|
item.goods_entrust = "转让"
|
|
} else if (item.goods_entrust == 2) {
|
|
item.goods_entrust = "授权"
|
|
}
|
|
let createStr = item.createtime.split(" ")[0].split("-").join("/");
|
|
prostr += '<div class="main_mook" onclick="detils(\'' + item.goods_islicode + '\',\'' + item
|
|
.goods_type + '\',\'' + item.username + '\',\'' + newimg_url + '\')">' +
|
|
'<div class="mook_head" >' +
|
|
img_url +
|
|
'<div class="tig_head">' + createStr + '</div>' +
|
|
'<div class="tig_bottom">' + '<div class="tig_botm1">' + item.goods_name + '</div>' +
|
|
'<div style="color: red;">' + (item.username == "中国数字文化集团有限公司" || item.username ==
|
|
"国家图书馆出版社有限公司" || item.username == "深圳国夏文化数字科技有限公司" ? "可议价" : "¥" + item.price) + '</div>' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'<div class="mook_men">' +
|
|
'<p>' + '委托关联编码:' + item.goods_islicode + '</p>' +
|
|
'<p>' + '交易类型:' + item.goods_entrust + '</p>' +
|
|
'<p>' + '委托方:' + item.username + '</p>' +
|
|
// '<p>' + '交易保证金::' + "¥" + item.price + '</p>' +
|
|
'<div class="bor">' + '</div>' +
|
|
'<div class="men_bott">' +
|
|
'<div class="men_name" title="' + item.username + '">' + item.username + '</div>' +
|
|
'<div style="color:#AC0000; overflow: hidden;white-space: nowrap; text-overflow: ellipsis;" title="' +
|
|
'加入购物车' + '">' + '加入购物车' + '</div>' +
|
|
'</div>' + '</div>' + '</div>'
|
|
});
|
|
} else {
|
|
prostr =
|
|
'<div style="width: 100%;height: 275px;display: flex;align-items: center;justify-content: center;font-size: 28px;color: #c0c4cf;">暂无数据</div>'
|
|
}
|
|
$("#main_cent").html(prostr);
|
|
};
|
|
|
|
|
|
// 数据类型过滤
|
|
function filters(data) {
|
|
if (data === "全部") {
|
|
return ""
|
|
} else if (data === "文化资源数据") {
|
|
return 1
|
|
} else if (data === "文化数字内容") {
|
|
return 2
|
|
}
|
|
};
|
|
|
|
|
|
function filtype(data) {
|
|
if (data === "全部") {
|
|
return ""
|
|
} else if (data == "转让") {
|
|
return 1
|
|
} else if (data == "授权") {
|
|
return 2
|
|
}
|
|
};
|
|
|
|
let Publicdate = {
|
|
retrievalPage: "数据超市-标的列表"
|
|
}
|
|
//数据类型切换数据
|
|
$(".btn1").click(function() {
|
|
$(this).addClass("current");
|
|
$(this).siblings().removeClass("current");
|
|
listQuery.record_type = filters($('.current').val());
|
|
listQuery.page = 1;
|
|
getListMsg(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
});
|
|
|
|
//标签切换1:转让;2:授权
|
|
$(".btn").click(function() {
|
|
$(this).addClass("activbtn");
|
|
$(this).siblings().removeClass("activbtn");
|
|
listQuery.authorization = filtype($('.activbtn').val());
|
|
listQuery.page = 1;
|
|
getListMsg(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
});
|
|
|
|
$('.ipt').bind('keypress', function(event) {
|
|
if (event.keyCode == "13") {
|
|
listQuery.entrust_user_name = $('.ipt').val();
|
|
listQuery.page = 1;
|
|
getListMsg(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
}
|
|
});
|
|
|
|
$('.iptword').bind('keypress', function(event) {
|
|
if (event.keyCode == "13") {
|
|
listQuery.entrust_name = $('.iptword').val();
|
|
listQuery.page = 1;
|
|
getListMsg(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
}
|
|
});
|
|
|
|
//搜索点击按钮
|
|
$('.btn3').bind('click', function() {
|
|
listQuery.entrust_user_name = $('.ipt').val();
|
|
listQuery.entrust_name = $('.iptword').val();
|
|
listQuery.page = 1
|
|
getListMsg(listQuery);
|
|
//检索信息数据
|
|
RetrieveURL(Publicdate);
|
|
});
|
|
|
|
//进入详情
|
|
function detils(list_isli, type, username, img) {
|
|
localStorage.setItem("listNum", listNum);
|
|
location.href = "superDetails.html?list_isli=" + list_isli + '&goods_type=' + type + '&img=' + img + '&username=' +
|
|
username + '&time=' + new Date().getTime();
|
|
}
|
|
|