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.
364 lines
12 KiB
364 lines
12 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.islicode = decodeURI(query.islicode);
|
|
let data = JSON.parse(localStorage.getItem("data"));
|
|
let sourceData = JSON.parse(data[0].source_data)
|
|
let targetData = []
|
|
let tableType = []
|
|
let disable = true
|
|
let new_linkcode = [];
|
|
data.myForEach(function (item, index, arr) {
|
|
if (tableType.indexOf(JSON.parse(item.target_data).serviceType) == -1) {
|
|
tableType.push(JSON.parse(item.target_data).serviceType);
|
|
targetData.push([]);
|
|
new_linkcode.push([]);
|
|
}
|
|
targetData[tableType.indexOf(JSON.parse(item.target_data).serviceType)].push(JSON.parse(item.target_data));
|
|
new_linkcode[tableType.indexOf(JSON.parse(item.target_data).serviceType)].push(item.linkcode);
|
|
});
|
|
|
|
let listQuerys = {
|
|
goods_isli: query.islicode, // 委托数据委托关联编码
|
|
use_years: 99, // 购买使用年限
|
|
user_isli: cookieHandler.get("isliCode") // 用户isli编码
|
|
};
|
|
|
|
function collection(data) {
|
|
if (data == "1") {
|
|
return "完好";
|
|
} else if (data == "2") {
|
|
return "残破";
|
|
} else if (data == "3") {
|
|
return "残缺";
|
|
} else if (data == "4") {
|
|
return "霉变";
|
|
} else if (data == "5") {
|
|
return "皱褶";
|
|
} else if (data == "6") {
|
|
return "污渍";
|
|
} else if (data == "7") {
|
|
return "脱浆";
|
|
} else if (data == "8") {
|
|
return "脱线";
|
|
} else if (data == "9") {
|
|
return "生锈";
|
|
} else if (data == "10") {
|
|
return "褪色";
|
|
} else if (data == "11") {
|
|
return "焦脆";
|
|
} else {
|
|
return data
|
|
}
|
|
};
|
|
|
|
function carrier(data) {
|
|
if (data == "1") {
|
|
return "纸张";
|
|
} else if (data == "2") {
|
|
return "感光材料";
|
|
} else if (data == "3") {
|
|
return "磁带";
|
|
} else if (data == "4") {
|
|
return "光盘";
|
|
} else if (data == "5") {
|
|
return "移动终端";
|
|
} else if (data == "6") {
|
|
return "计算机";
|
|
} else if (data == "7") {
|
|
return "数字化数据";
|
|
} else if (data == "8") {
|
|
return "天然载体";
|
|
} else if (data == "9") {
|
|
return "器具载体";
|
|
} else if (data == "10") {
|
|
return "其它载体";
|
|
} else {
|
|
return data
|
|
}
|
|
};
|
|
|
|
function edition(data) {
|
|
if (data == "1") {
|
|
return "真迹";
|
|
} else if (data == "2") {
|
|
return "抄本";
|
|
} else if (data == "3") {
|
|
return "拓本";
|
|
} else if (data == "4") {
|
|
return "临摹";
|
|
} else if (data == "5") {
|
|
return "复制";
|
|
} else if (data == "6") {
|
|
return "复原";
|
|
} else if (data == "7") {
|
|
return "重建";
|
|
} else if (data == "8") {
|
|
return "原始录音";
|
|
} else if (data == "9") {
|
|
return "原始视频";
|
|
} else if (data == "10") {
|
|
return "刻录";
|
|
} else if (data == "11") {
|
|
return "原创";
|
|
} else {
|
|
return data
|
|
}
|
|
};
|
|
|
|
function isbaseId(data) {
|
|
if (data) {
|
|
let list = data.split(";");
|
|
let str = "";
|
|
list.myForEach(function (v, index, arr) {
|
|
if (v == "1") {
|
|
str += "标本库;";
|
|
} else if (v == "2") {
|
|
str += "基因库;";
|
|
} else if (v == "3") {
|
|
str += "素材库;";
|
|
}
|
|
});
|
|
if (str) {
|
|
return str.substr(0, str.length - 1);
|
|
} else {
|
|
return data;
|
|
}
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|
|
|
|
function filter(data) {
|
|
if (data) {
|
|
return data;
|
|
} else {
|
|
return "——";
|
|
}
|
|
};
|
|
|
|
function FileSize(data) {
|
|
if (data === 0) {
|
|
return "0 B";
|
|
}
|
|
var k = 1024;
|
|
var sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
|
i = Math.floor(Math.log(data) / Math.log(k));
|
|
return (data / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
|
|
};
|
|
// 函数节流
|
|
function debounce(fn) {
|
|
var timerId = null
|
|
return function () {
|
|
var arg = arguments[0] //获取事件
|
|
if (timerId) {
|
|
return
|
|
}
|
|
timerId = setTimeout(function () {
|
|
fn(arg) //事件传入函数
|
|
timerId = null
|
|
}, 1000)
|
|
}
|
|
}
|
|
|
|
function addCart() {
|
|
if (cookieHandler.get("normal_login_token")) {
|
|
if (cookieHandler.get("isliCode")) {
|
|
if (cookieHandler.get("userType") === "0") {
|
|
Dreamer.error("个人认证账号不能加入购物车!");
|
|
} else {
|
|
let postList = new AJAX_OBJ(AgencyAddress + "order/addShoppingCa?goods_isli=" + listQuerys.goods_isli +
|
|
"&user_isli=" + listQuerys.user_isli + "&use_years=" + listQuerys.use_years, successGood,
|
|
onUrlError);
|
|
postList.postRequestData();
|
|
|
|
function successGood(xmlHttp) {
|
|
let res = eval('(' + xmlHttp.responseText + ')');
|
|
if (res.resultCode === "00000000") {
|
|
Dreamer.success("添加购物车成功");
|
|
$("#addCart").text("已加入购物车")
|
|
} else {
|
|
Dreamer.error(res.resultMsg);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
Dreamer.error("账号未认证,请进行认证!");
|
|
setTimeout(function () {
|
|
window.location.href = 'MyCetification.html?time=' + new Date().getTime();
|
|
}, 1000);
|
|
}
|
|
} else {
|
|
Dreamer.error("请先登录");
|
|
setTimeout(function () {
|
|
window.location.href = 'login.html?time=' + new Date().getTime();
|
|
}, 1000)
|
|
}
|
|
}
|
|
|
|
let Client_date = {
|
|
entrustingPartyName: decodeURI(query.entrustingPartyName), //委托方名称
|
|
identityCode: query.identityCode, //身份认证编码
|
|
entrustSignNumber: 0, //委托标的数
|
|
orderNumber: 1 //订单总数
|
|
}
|
|
|
|
function employ() {
|
|
if (cookieHandler.get("normal_login_token")) {
|
|
if (cookieHandler.get("isliCode")) {
|
|
if (cookieHandler.get("userType") === "0") {
|
|
Dreamer.error("个人认证账号不能申请使用!");
|
|
} else {
|
|
if (query.type_status == 1 || query.type_status == 5) {
|
|
if (disable) {
|
|
disable = false
|
|
$(".pingCart > div:nth-child(2)").css("background-color", "#5a1d1d")
|
|
var closeMsg = Dreamer.loading("正在申请使用,请稍等!");
|
|
let postList = new AJAX_OBJ(AgencyAddress + "order/createOrder?goods_isli=" + listQuerys
|
|
.goods_isli + "&is_car=2&user_isli=" + listQuerys.user_isli + "&use_years=" + listQuerys
|
|
.use_years, successGood, onUrlError);
|
|
postList.postRequestData();
|
|
|
|
function successGood(xmlHttp) {
|
|
let res = eval('(' + xmlHttp.responseText + ')');
|
|
if (res.resultCode === "00000000") {
|
|
addClient(Client_date);
|
|
setTimeout(function () {
|
|
$(location).prop('href', './BuyOrder.html?time=' + new Date().getTime());
|
|
}, 3000)
|
|
} else {
|
|
disable = true
|
|
closeMsg();
|
|
Dreamer.error(res.resultMsg);
|
|
$(".pingCart > div:nth-child(2)").css("background-color", "#842911")
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (query.type_status == 5) {
|
|
Dreamer.warning(query.title_Name + "正在委托中,无法购买");
|
|
} else {
|
|
Dreamer.warning(query.title_Name + "无法购买");
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
Dreamer.error("账号未认证,请进行认证!");
|
|
setTimeout(function () {
|
|
window.location.href = 'MyCetification.html?time=' + new Date().getTime();
|
|
}, 1000)
|
|
}
|
|
} else {
|
|
Dreamer.error("请先登录");
|
|
setTimeout(function () {
|
|
window.location.href = 'login.html?time=' + new Date().getTime();
|
|
}, 1000)
|
|
}
|
|
}
|
|
// 初始化
|
|
$(document).ready(function () {
|
|
$(".pingCart").hide(); //隐藏div
|
|
if(Client_date.entrustingPartyName != "北京玖扬博文文化发展有限公司"){
|
|
$("#addCart").show();//显示div
|
|
$("#employ").show();//显示div
|
|
}else{
|
|
$("#employ").hide();//隐藏div
|
|
$("#addCart").css("margin-right","168px");
|
|
$("#addCart").show();//显示div
|
|
}
|
|
$(".coll-title").text("名称:" + filter(sourceData.titleName))
|
|
$(".coll-item")[0].innerText = "其他标识符:" + filter(sourceData.otherIdentifiers)
|
|
$(".coll-item")[1].innerText = "标识符:" + filter(sourceData.isliCode)
|
|
$(".coll-item")[2].innerText = "类型:" + filter(sourceData.collectionType)
|
|
$(".coll-item")[3].innerText = "服务类型:" + filter(sourceData.serviceType)
|
|
$(".coll-item")[4].innerText = "分类:" + filter(sourceData.classification)
|
|
$(".coll-item")[5].innerText = "贡献者:" + filter(sourceData.contributors)
|
|
$(".coll-item")[6].innerText = "著作权人:" + filter(sourceData.copyrightOwner)
|
|
$(".coll-item")[7].innerText = "载体:" + filter(carrier(sourceData.carrier))
|
|
$(".coll-item")[8].innerText = "登记者:" + filter(sourceData.registrant)
|
|
$(".coll-item")[9].innerText = "登记日期:" + filter(sourceData.registerDate)
|
|
$(".coll-item")[10].innerText = "所属/收藏机构:" + filter(sourceData.repositoryName)
|
|
$(".coll-item")[11].innerText = "尺寸:" + filter(sourceData.dimensions)
|
|
$(".coll-item")[12].innerText = "组件数量:" + filter(sourceData.quantity)
|
|
$(".coll-item")[13].innerText = "标签:" + filter(sourceData.label)
|
|
$(".coll-item")[14].innerText = "描述:" + filter(sourceData.description)
|
|
$(".coll-item")[15].innerText = "哈希值:" + filter(sourceData.md5Val)
|
|
$(".coll-item")[16].innerText = "入库标识:" + filter(isbaseId(sourceData.databaseId))
|
|
$(".coll-item")[17].innerText = "版本:" + filter(edition(sourceData.edition))
|
|
$(".coll-item")[18].innerText = "现况:" + filter(collection(sourceData.collectionCondition))
|
|
$(".coll-item")[19].innerText = "封面:" + filter(sourceData.cover)
|
|
$(".title").text(query.goods_type == "1" ? "文化资源数据" : "文化数字内容")
|
|
$(".title2").text(query.goods_type == "1" ? "文化资源数据-关联资源" : "文化数字内容-关联资源")
|
|
let str = "";
|
|
targetData.myForEach(function (item, id, arr) {
|
|
str += '<div class="details">' + tableType[id] +
|
|
'</div><table class="table_box"><tr><td>资源名称</td><td>ISLI标志码</td><td>ISLI关联编码</td><td>大小</td><td>格式</td><td>时间</td></tr>'
|
|
item.myForEach(function (i, index, arr) {
|
|
str += '<tr><td>' + i.titleName +
|
|
'</td><td>' + i.isliCode +
|
|
'</td><td>' + new_linkcode[id][index] +
|
|
// '</td><td>' + query.user_islicode +
|
|
'</td><td>' + FileSize(i.metadataFileSize) +
|
|
'</td><td>' + i.metadataFileFormat +
|
|
'</td><td>' + i.registerDate.split(" ")[0].split("-").join("-") +
|
|
'</td></tr>'
|
|
})
|
|
str += '</table>'
|
|
});
|
|
$("#resources").html(str);
|
|
if (cookieHandler.get("normal_login_token")) {
|
|
if (cookieHandler.get("isliCode")) {
|
|
searchOrder();
|
|
$(".pingCart").show(); //显示div
|
|
}
|
|
}
|
|
$("#addCart").click(debounce(addCart))
|
|
$("#employ").click(debounce(employ))
|
|
})
|
|
|
|
function searchOrder() {
|
|
let data = {
|
|
user_isli: cookieHandler.get("isliCode"),
|
|
user_role: '1',
|
|
order_status: ""
|
|
}
|
|
let OrderList = new AJAX_OBJ(AgencyAddress + 'order/queryRrder?user_isli=' + data.user_isli + '&user_role=' + data.user_role + '&order_status=' + data.order_status, succesOrder, onUrlError);
|
|
OrderList.postRequestData();
|
|
}
|
|
|
|
function succesOrder(xmlHttp) {
|
|
let res = eval('(' + xmlHttp.responseText + ')');
|
|
if (res.resultCode === "00000000") {
|
|
for (i = 0; i < res.data.length; i++) {
|
|
for (j = 0; j < res.data[i].order_detail.length; j++) {
|
|
if (res.data[i].order_detail[j].goods_islicode == query.islicode) {
|
|
if (cookieHandler.get("userType") === "1" || cookieHandler.get("userType") === "2") {
|
|
$("#addCart").hide(); //隐藏div
|
|
$('#employ').css({ "pointer-events": "none", "background-color": "#AAAAAA" });
|
|
$("#employ").text("已申请");
|
|
} else {
|
|
$(".pingCart").hide(); //隐藏div
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|