var dtLang = {
"sProcessing": "处理中...",
"lengthMenu": '显示 项结果',
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
}
,
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
};
var askListROHead = "
序号 | 资源 | 卖方 | 价格 |
";
var askListROTail = "
";
var fillAskListRO = function(data) {
var html = askListROHead;
var lines = data;
for (var i = 0; i < lines.length; i++) {
html += "";
html += (i + 1);
html += " | ";
html += lines[i].item;
html += " | ";
html += lines[i].seller;
html += " | ";
html += lines[i].price;
html += " |
";
}
html += askListROTail;
$("#askListRODiv").html(html);
$("#askListROTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
searching: false,
paging: true,
pageLength: 5,
order: [[0, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 30) {
return "" + data.substring(0, 30) + " ...";
} else {
return data;
}
}
},
{
"targets": 2,
"render": function(data, type, row, meta) {
return "" + data.substring(0, 5) + " ";
}
}
]
}
);
};
var bidListAllHead = "序号 | 资源 | 买方 | 价格 |
";
var bidListAllTail = "
";
var fillBidListAll = function(data) {
var html = bidListAllHead;
var lines = data;
for (var i = 0; i < lines.length; i++) {
html += "";
html += (i + 1);
html += " | ";
html += lines[i].item;
html += " | ";
html += lines[i].bidder;
html += " | ";
html += lines[i].price;
html += " |
";
}
html += bidListAllTail;
$("#bidListAllDiv").html(html);
$("#bidListAllTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
searching: false,
paging: true,
pageLength: 5,
order: [[0, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 30) {
return "" + data.substring(0, 30) + " ...";
} else {
return data;
}
}
},
{
"targets": 2,
"render": function(data, type, row, meta) {
return "" + data.substring(0, 5) + " ";
}
}
]
}
);
};
var finalListOwnerHead = "序号 | 资源 | 卖方 | 卖方价格 | 买方 | 买方价格 | 已使用 | 使用结果 |
";
var finalListOwnerTail = "
";
var fillFinalListOwner = function(data) {
var html = finalListOwnerHead;
var lines = data;
for (var i = 0; i < lines.length; i++) {
html += "";
html += (i + 1);
html += " | ";
html += lines[i].item;
html += " | ";
html += lines[i].seller;
html += " | ";
html += lines[i].sellerPrice;
html += " | ";
html += lines[i].bidder;
html += " | ";
html += lines[i].bidderPrice;
html += " | ";
html += lines[i].used;
html += " | ";
html += lines[i].result;
html += " |
";
}
html += finalListOwnerTail;
$("#finalListOwnerDiv").html(html);
$("#finalListOwnerDiv").off("click", "tr").on(
"click",
"tr",
function(event) {
var pos = ($(this).closest("tr").find("td").eq(0)
.text() - 1) / 1;
if (pos != undefined) {
alert(global.finalListOwner[pos].item);
}
}
);
$("#finalListOwnerTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
searching: false,
paging: true,
pageLength: 5,
order: [[0, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 20) {
return "" + data.substring(0, 20) + " ...";
} else {
return data;
}
}
},
{
"targets": 2,
"render": function(data, type, row, meta) {
return "" + data.substring(0, 5) + " ";
}
},
{
"targets": 4,
"render": function(data, type, row, meta) {
return "" + data.substring(0, 5) + " ";
}
},
{
"targets": 6,
"render": function(data, type, row, meta) {
if (data == "true") {
return "是";
} else {
return "否";
}
}
}
]
}
);
};
var askListRWHead = "序号 | 资源 | 卖方 | 卖方价格 | 出价 | 操作 |
";
var askListRWTail = "
";
var fillAskListRW = function(data) {
var html = askListRWHead;
var lines = data;
for (var i = 0; i < lines.length; i++) {
html += "";
html += (i + 1);
html += " | ";
html += lines[i].item;
html += " | ";
html += lines[i].seller;
html += " | ";
html += lines[i].price;
html += " | ";
html += "";
html += " | ";
html += "";
html += " |
";
}
html += askListRWTail;
$("#askListRWDiv").html(html);
$("#askListRWDiv").off("click", ":button").on(
"click",
":button",
function(event) {
var bidArg = {
};
var pos = ($(this).closest("tr").find("td").eq(0)
.text() - 1) / 1;
bidArg.item = global.askListRW[pos].item;
bidArg.price = $("#priceInput"+pos)[0].value;
if (bidArg.price/1!=bidArg.price || bidArg.price/1<=0){
alert("价格必须是大于0的整数");
return;
}
executeCurrentContract("bid",JSON.stringify(bidArg),function(data){
alert("竞标资源:"+data.result);
flushAllUserData();
});
}
);
$("#askListRWTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
searching: false,
paging: true,
pageLength: 5,
order: [[0, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 30) {
return "" + data.substring(0, 30) + " ...";
} else {
return data;
}
}
},
{
"targets": 2,
"render": function(data, type, row, meta) {
if (data != "Anonymous") {
return "" + data.substring(0, 5) + " ";;
} else {
return data;
}
}
}
]
}
);
};
var bidListPrivateHead = "序号 | 资源 | 买方 | 价格 |
";
var bidListPrivateTail = "
";
var fillBidListPrivate = function(data) {
var html = bidListPrivateHead;
var lines = data;
for (var i = 0; i < lines.length; i++) {
html += "";
html += (i + 1);
html += " | ";
html += lines[i].item;
html += " | ";
html += lines[i].bidder;
html += " | ";
html += lines[i].price;
html += " |
";
}
html += bidListPrivateTail;
$("#bidListPrivateDiv").html(html);
$("#bidListPrivateTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
searching: false,
paging: true,
pageLength: 5,
order: [[0, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 30) {
return "" + data.substring(0, 30) + " ...";
} else {
return data;
}
}
},
{
"targets": 2,
"render": function(data, type, row, meta) {
return "" + data.substring(0, 5) + " ";
}
}
]
}
);
};
var finalListPrivateHead = "序号 | 资源 | 卖方 | 卖方价格 | 买方 | 买方价格 | 已使用 | 使用结果 | 操作 |
";
var finalListPrivateTail = "
";
var fillFinalListPrivate = function(data) {
var html = finalListPrivateHead;
var lines = data;
for (var i = 0; i < lines.length; i++) {
html += "";
html += (i + 1);
html += " | ";
html += lines[i].item;
html += " | ";
html += lines[i].seller;
html += " | ";
html += lines[i].sellerPrice;
html += " | ";
html += lines[i].bidder;
html += " | ";
html += lines[i].bidderPrice;
html += " | ";
html += lines[i].used;
html += " | ";
html += lines[i].result;
html += " | ";
html += "";
html += " |
";
}
html += finalListPrivateTail;
$("#finalListPrivateDiv").html(html);
$("#finalListPrivateDiv").off("click", ":button").on(
"click",
":button",
function(event) {
var execArg = {
};
var pos = ($(this).closest("tr").find("td").eq(0)
.text() - 1) / 1;
execArg.item = global.finalListPrivate[pos].item;
executeCurrentContract("execute",JSON.stringify(execArg),function(data){
alert("使用资源:"+data.result);
flushAllUserData();
});
}
);
$("#finalListPrivateTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
searching: false,
paging: true,
pageLength: 5,
order: [[0, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 20) {
return "" + data.substring(0, 20) + " ...";
} else {
return data;
}
}
},
{
"targets": 2,
"render": function(data, type, row, meta) {
if (data != "Anonymous") {
return "" + data.substring(0, 5) + " ";;
} else {
return data;
}
}
},
{
"targets": 4,
"render": function(data, type, row, meta) {
if (data != "Anonymous") {
return "" + data.substring(0, 5) + " ";;
} else {
return data;
}
}
},
{
"targets": 6,
"render": function(data, type, row, meta) {
if (data == "true") {
return "是";
} else {
return "否";
}
}
}
]
}
);
};