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.
 
 
 
 
 
 

279 lines
10 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<!--#include file="/widget/head.html"-->
<script>
</script>
</head>
<body class="layui-body " >
<div id="wrapper">
<!-- Navigation -->
<!--#include file="/widget/nav.html"-->
<div id="page-wrapper" class="layadmin-tabsbody-item layui-show layui-fluid layui-row layui-col-space15" lay-filter="mform">
<div class="layui-card">
<div class="layui-card-header">
<h2>角色查询</h2>
</div>
<div class="row">
<div class="container" style="margin-left: 10px">
<div class="col-md-1" style="width:40px;">
<p style="font-size: 18px;line-height: 35px;float: right">Uid:</p>
</div>
<div class="col-md-4" style="width:200px;">
<input type="text" class=" layui-input" id="uid" placeholder="Enter Uid">
</div>
<div class="col-md-1">
<button type="button" class="layui-btn" id="sele">立刻查询</button>
</div>
</div>
</div>
<div class="row table-responsive" id="form" style="width: 100%">
<div style="width:100%;">
<div style="width: 320px; height:700px;overflow:hidden;font-size: 14px;float:left;">
<table class="table table-striped table-bordered table-hover inline" id="rolebase_table">
</table>
</div>
<div style="width: 1100px;height:100%; overflow:hidden;float:left;margin-left:15px;">
<table class="table table-striped table-bordered table-hover inline" id="hero_table">
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!--#include file="/widget/tail.html"-->
<script type="text/javascript">
function getDuration(second) {
var days = Math.floor(second / 86400);
var hours = Math.floor((second % 86400) / 3600);
var minutes = Math.floor(((second % 86400) % 3600) / 60);
var seconds = Math.floor(((second % 86400) % 3600) % 60);
var duration = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
return duration;
}
var herolist;
var HerosData;
layui.form.render('checkbox');
//英雄筛选条件
var where = {
arrxj: [],
issz: -1,
zz: []
};
function getrace(id) {
switch (Number(id)) {
// 1.人族 2.神族 3.妖族 4.宙神 5.虚空
case 1:
return "人族";
case 2:
return "神族";
case 3:
return "妖族";
case 4:
return "宙神";
case 5:
return "虚空";
default:
return "";
}
}
function UPhero_table() {
var _HerosData = HerosData.filter(f => 1 == 1);
//不是全部星级
if (where.arrxj.length != 0 && where.arrxj.findIndex(f => f == 0) == -1) {
_HerosData = HerosData.filter(f => where.arrxj.findIndex(x => x == f.Star) != -1);
}
//不是全部阵容
if (where.zz.length != 0 && where.zz.findIndex(f => f == 0) == -1) {
_HerosData = HerosData.filter(f => where.zz.findIndex(x => x == f.heroraceid) != -1);
}
//是否上阵
if (where.issz != -1) {
_HerosData = HerosData.filter(f => f.IsJoinBattle == where.issz);
}
inihero_table(_HerosData);
}
layui.form.on('checkbox(xj)', function (data) {
var checked = $(data.elem).prop("checked");
if (data.value == 0 && checked) {
$("input[data-xj]").prop("checked", false);
}
else if (data.value != 0 && checked) {
$("input[lay-filter='xj'][value=0]").prop("checked", false);
}
layui.form.render('checkbox');
where.arrxj = [];
$("input[data-xj]:checked").each(function (i, e) {//
where.arrxj.push(Number($(e).val()));
});
UPhero_table();
});
layui.form.on('checkbox(zz)', function (data) {
var checked = $(data.elem).prop("checked");
if (data.value == 0 && checked) {
$("input[data-zz]").prop("checked", false);
}
else if (data.value != 0 && checked) {
$("input[lay-filter='zz'][value=0]").prop("checked", false);
}
layui.form.render('checkbox');
where.zz = [];
$("input[data-zz]:checked").each(function (i, e) {//
where.zz.push(Number($(e).val()));
});
UPhero_table();
});
layui.form.on('checkbox(sz)', function (data) {
if ($("input[data-sz][value=0]:checked").length == 1 &&
$("input[data-sz][value=1]:checked").length == 1) {
where.issz = -1;
} else {
if ($("input[data-sz][value=0]:checked").length == 1) {
where.issz = 0;
} else if ($("input[data-sz][value=1]:checked").length == 1) {
where.issz = 1;
} else {
where.issz = -1;
}
}
UPhero_table();
})
var herotable;
function inihero_table(mdata) {
mdata.forEach(function (d) {
var hero = herolist.find(f => f.id == d.DescId);
d.heroname = hero.name;
d.heroraceid = hero.race;
d.herorace = getrace(hero.race);
});
console.info(mdata);
herotable = layui.table.render({
elem: '#hero_table',
page: true,
limit: 20,
data: mdata,
width: 1300,
height: 900,
autoSort: true,
initSort: {
field: 'Star'
, type: 'desc'
},
cols: [[
{ field: 'DescId', title: '英雄<br/>ID', sort: true, width: 60 }
, { field: 'heroname', title: '英雄<br/>名称', sort: true, width: 100 }
, { field: 'herorace', title: '英雄<br/>种族', sort: true, width: 70 }
, { field: 'Level', title: '等级', sort: true, width: 80 }
, { field: 'Star', title: '星级', sort: true, width: 80 }
, { field: 'Exp', title: '经验', sort: true, width: 80 }
, { field: 'HeroTalent', title: 'HeroTalent', sort: true, width: 80 }
, { field: 'TalentSteps', title: 'TalentSteps', sort: true, width: 80 }
, { field: 'IsJoinBattle', title: '是否<br/>上阵', sort: true, width: 100 }
, { field: 'HeroPower', title: '战力', sort: true, width: 80 }
, { field: 'RaceIconLevel', title: 'RaceIconLevel', sort: true, width: 80 }
, { field: 'WeaponId', title: '武器<br/>ID', sort: true, width: 80 }
, { field: 'WeaponLevel', title: '武器<br/>等级', sort: true, width: 80 }
, { field: 'PowerChangeSeq', title: 'PowerChangeSeq', sort: true, width: 80 }
, { field: 'ArtifactSerialNum', title: 'ArtifactSerialNum', sort: true, width: 80 }
, { field: 'TempWeaponLevel', title: 'TempWeaponLevel', sort: true, width: 80 }
]]
});
}
function paserolebase(d) {
d.LastLoginTime = Page.formatDate(d.LastLoginTime);
d.CreateTime = Page.formatDate(d.CreateTime);
d.OnlineTime = getDuration(d.OnlineTime);
}
$("#sele").click(function () {
var uidtext = $("#uid").val();
$.ajax({
type: "GET",
url: Page.SvrIp+"/api/select_role",
data: {
uid: uidtext,
token: cookie.get("token")
},
dataType: "json",
beforeSend: function () {
layer.load(1, { shade: [0.8, '#393D49']});
},
complete: function () {
layer.closeAll('loading');
},
success: function (d) {
//d.HerosData = JSON.parse(d.HerosData);
console.info(d);
//d["HerosDataList"] = eval('(' + d["HerosDataList"] + ')');
if(d.code==-1){
layer.msg(d.msg);
return;
}
d["RoleBase"] = eval('(' + d["RoleBase"] + ')');
d["Bag"] = eval('(' + d["Bag"] + ')');
debugger
paserolebase(d.RoleBase);
var rolebase_html = "";
for (var i in d.RoleBase) {
rolebase_html += `<tr><th>${i}</th><th>${d.RoleBase[i]}</th></tr>`;
}
$("#rolebase_table").html(rolebase_html);
//d.HerosData = eval('(' + d.HerosData + ')');
}
});
});
$(function () {
$.get(Page.SvrIp+"/api/select_heros",
{
token: cookie.get("token")
},
function (d) {
herolist =d.data;
}
);
});
</script>
<script src="../js/coupon.js"></script>
</body>
</html>