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.
 
 
 
 
 
 

211 lines
7.0 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="../js/template-web.js"></script>
<style>
.col-md-4, .col-md-1 {
display: inline !important;
float: left;
}
.inline {
display: inline !important;
}
.layui-table-cell {
text-align: center;
height: auto;
}
</style>
<!--#include file="/widget/head.html"-->
</head>
<body class="layui-body">
<div id="wrapper" class="row layui-card layui-panel">
<!-- Navigation -->
<!--#include file="/widget/nav.html"-->
<div id="page-wrapper" class="layui-form" lay-filter="mform">
<div class="layui-card" id="card-page-wrapper">
<div class="row">
<div class="container" style="margin-left: 10px">
<div class="col-md-3" style="width:100px;">
<p style="font-size: 18px;line-height: 35px;float: right">添加人:</p>
</div>
<div class="col-md-4" style="width:200px;">
<input type="text" class="layui-input" id="uid" placeholder="请输入添加人">
</div>
<div class="col-md-1">
<button type="button" class="layui-btn" id="sele">查询</button>
</div>
<div class="col-md-1">
<button type="button" class=" layui-btn" id="costItemDiv">添加配置</button>
</div>
</div>
</div>
<div class="row table-responsive" id="form" style="width: 100%">
<table class="table table-striped table-bordered table-hover inline" id="hero_table">
</table>
<div id="test1"></div>
</div>
</div>
</div>
</div>
<!--#include file="/widget/tail.html"-->
<script id="btn" type="text/template">
<input type="button" class="layui-btn layui-btn-xs" value="编辑" onclick="opennotice({{d.id}})" />
<input type="button" class="layui-btn layui-btn-xs" value="删除" onclick="deletePreset({{ d.id}})" />
</script>
<script type="text/javascript">
var itemlist;
$("#sele").click(function () {
Select_data(1, 120, 1);
});
$("#costItemDiv").click(function(){
opennotice(0)
});
function opennotice(id) {
debugger
let title = "扣除道具";
layer.open({
content: `/pages/EditPreset.html?id=${id}`,
type: 2,
title: title,
area: ['1000px', '700px'],
success: function(layero, index){
// 获取弹窗中的iframe元素
var iframe = layero.find('iframe')[0];
// 向iframe传递数据
iframe.contentWindow.postMessage({data: id}, '*');
}
});
}
function deletePreset(id){
if (confirm("确定删除吗?")) {
$.get(Page.SvrIp+"/api/delete_preset", {
token: cookie.get("token"),
id: id
}, function (data) {
console.dir(data)
location.reload();
});
}
}
function ini_page(data) {
layui.laypage.render({
elem: 'test1',
count: data.count,
limits: [10, 20, 30, 40, 50, 80, 100],
limit: 100,
layout: ["count", "prev", "page", "next", "limit", "skip"],
jump: function (obj, first) {
if (!first) {
Select_data(obj.curr, obj.limit, 0);
}
}
});
}
function inihero_table(data, limit) {
m_limit = limit;
console.info(data);
herotable = layui.table.render({
elem: '#hero_table',
page: false,
data: data,
width: 1300,
height: 1100,
autoSort: true,
limit: limit,
cols: [[
{ field: 'id', title: 'id', sort: true, width: 100 },
{ field: 'items', title: '道具', sort: true, width: 220,templet:
function (d){
let text='';
var items=d.items.split("#");
for (var i=0; i<items.length; i++) {
var item=items[i];
let it=item.split("|");
text += `类型 :${it[0]} | ID :${it[1]} |数量 :${it[2]} </br>`;
}
return text
}
},
{ field: 'realms', title: '区服', sort: true, width: 180 ,templet:function (d){
if(d.realms==""){
return "全服开启"
}
return d.realms;
}},
{ field: 'start_time', title: '开始时间', sort: true, width: 180 },
{ field: 'end_time', title: '结束时间', sort: true, width: 180 },
{ field: 'account', title: '添加人', sort: true, width: 120 },
{ field: 'status', title: '状态', sort: true, width: 120 },
{ field: '*', title: '编辑', width: 170, templet: "#btn" }
]]
});
}
function Select_data(page, limit, first) {
$.ajax({
type: "GET",
url: Page.SvrIp + "/api/select_preset",
data: {
page: page,
limit: limit,
token: cookie.get("token"),
},
dataType: "json",
beforeSend: function () {
layer.load(1, { shade: [0.8, '#393D49'] });
},
complete: function () {
layer.closeAll('loading');
},
success: function (d) {
console.dir(d);
exchange_data =d.data; //JSON.parse(d.data);
inihero_table(exchange_data, limit);
if (first === 1) {
ini_page(d);
}
}
});
}
$(function () {
initPage('初始化玩家配置');
Select_data(1, 120, 1);
});
</script>
<script src="../js/coupon.js"></script>
</body>
</html>