silk-road's picture
Upload 53 files
3b8d454 verified
$(function(){
tabFlagMap["shop"] = false;
tabFuncMap.shop = function(){
var index = 1;
$.each(shopoddsdata,function(key,map){
var gate = gatetable[map.ID];
if(gate){
var tr = $("<tr align='center'></tr>");
$("#shopTable tbody").append(tr);
var shopItemTd = $("<td style='text-align:right;'></td>");
var shopPriceTd = $("<td style='text-align:left;'></td>");
var shopName = $("<td><span style='color:brown;font-size:2rem;'>"+gate.NAME+"</span></td>").append("<span style='display:none;'>"+gate.PY+"</span>");
var ticket = gate["门票"];
var ticketRefresh = gate["刷新票"];
var discover = gate["发现"];
var unlock = gate["解锁"];
if(discover > 0) {
shopName.append("<br>发现:").append(findMapTips(discover));
}
if(unlock > 0) {
shopName.append("<br>解锁:").append(findMapTips(unlock));
}
if(ticket > 0) {
shopName.append("<br>门票:").append(findMapTips(ticket));
}
if(ticketRefresh > 0) {
shopName.append("<br>刷新票:").append(findMapTips(ticketRefresh));
}
tr.append($("<td>"+map.INDEX+"</td>"));
tr.append(shopName);
tr.append(shopItemTd);
tr.append(shopPriceTd);
for(var i=1;i<=10;i++){
var shopOdds = map["商品"+i];
var shopItem = shopitemdata[map["商品"+i].split(":")[0]];
var shopItemDiv = $("<div></div>");//需要空白占位
shopItemTd.append(shopItemDiv);
var shopPriceDiv = $("<div></div>");//需要空白占位
shopPriceTd.append(shopPriceDiv);
shadow(shopItemDiv,shopPriceDiv);
if(shopOdds){
if(shopItem){
//区分是道具还是随机数据
if(shopItem['道具ID']>0){
var item = findMapTips(shopItem['道具ID']);
shopItemDiv.append(item);
if(item.html() == ""){
shopItemDiv.append("商品数据缺失:"+map["商品"+i]);
}
}else{
var item = shopItem.NAME;
shopItemDiv.append(item);
}
//区分是金钱购买还是道具换购
if(shopItem["货币类型"] == "0"){
var price = shopItem["价格"];
if(price< 10000){
}else if(price < 100000000){
price = price / 10000;
price += "万";
}else{
price = price / 100000000;
price += "亿";
}
shopPriceDiv.append("&nbsp;=&nbsp;<span><img src='../images/BagIcon.png' width='18'>"+price+"</span>");
}else{
var item = findMapTips(shopItem["货币类型"]).prepend("&nbsp;=&nbsp;");
shopPriceDiv.append(item.append(" × "+shopItem["价格"]).append(""));
if(item.html() == ""){
shopPriceDiv.append("货币数据缺失:"+map["商品"+i]);
}
}
}
}
}
}
});
/*shopTable*/
$('#shopTable').dataTable( {
"pagingType": "full_numbers",
"language": {
"lengthMenu": "每页 _MENU_ 条记录",
"zeroRecords": "没有找到商品,一定是你没充值VIP!",
"info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
"infoEmpty": "空荡荡的没有商品",
"infoFiltered": "(从 _MAX_ 条商品过滤)",
"search": "搜索(可用<font color='red'>商店名称</font>首字母):",
"paginate": {
"first": "首页<font color=red>(W)</font>",
"last": "末页<font color=red>(S)</font>",
"next": "下一页<font color=red>(D)</font>",
"previous": "上一页<font color=red>(A)</font>"
},
},
// 默认按照索引排序,且隐藏索引列
"order": [[ 0, "asc" ]],
"columnDefs": [
{
"targets": [ 0 ],
"visible": false,
"searchable": false
},
]
});
$('#shopTable th:nth(0)').css("text-align","center");
$('#shopTable th:nth(1)').css("text-align","right");
$('#shopTable th:nth(2)').css("text-align","left");
}
});
//悬停阴影
function shadow(item,price){
//
item.mouseenter(function(){
item.css("background-color","#E6E6E6");
price.css("background-color","#E6E6E6");
});
item.mouseleave(function(){
item.css("background-color","");
price.css("background-color","");
});
//
price.mouseenter(function(){
item.css("background-color","#E6E6E6");
price.css("background-color","#E6E6E6");
});
price.mouseleave(function(){
item.css("background-color","");
price.css("background-color","");
});
}