605 lines
25 KiB
HTML
605 lines
25 KiB
HTML
|
|
<title>VIP等级配置</title>
|
|
|
|
<div class="layui-card layadmin-header">
|
|
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
|
<a lay-href="">主页</a>
|
|
<a><cite>游戏管理</cite></a>
|
|
<a><cite>VIP等级配置</cite></a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-fluid">
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
<div class="layui-bg-gray" style="padding:12px 16px;margin-bottom:12px;line-height:24px;">
|
|
<strong>VIP经验计算规则:</strong>
|
|
VIP经验 = 实际现金充值金额 × 10 + VIP经验包经验。
|
|
金币、钻石余额、象棋或捕鱼输赢以及“累计充值金币”均不参与VIP经验计算。
|
|
</div>
|
|
<table id="table-vip" lay-filter="table-vip"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/html" id="toolbar-vip">
|
|
<div class="layui-btn-container">
|
|
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-filter="init-vip"><i class="layui-icon layui-icon-refresh"></i> 初始化配置</button>
|
|
<button class="layui-btn layui-btn-sm" lay-filter="save-vip"><i class="layui-icon layui-icon-ok"></i> 保存配置</button>
|
|
<button class="layui-btn layui-btn-sm layui-btn-warm" lay-filter="reload-vip"><i class="layui-icon layui-icon-refresh"></i> 刷新</button>
|
|
<button class="layui-btn layui-btn-sm" lay-filter="add-vip">添加VIP等级</button>
|
|
<button class="layui-btn layui-btn-sm layui-btn-normal" onclick="saveSection('VipLevelConfigs')"><i class="layui-icon layui-icon-export"></i> 保存到初始化文件</button>
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/html" id="vip-bar">
|
|
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
|
<a class="layui-btn layui-btn-xs" lay-event="gift">礼包</a>
|
|
<a class="layui-btn layui-btn-xs" lay-event="daily">每日</a>
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
|
</script>
|
|
|
|
<script type="text/html" id="gift-dialog-tpl">
|
|
<div class="gift-container">
|
|
<div class="gift-left">
|
|
<div class="gift-toolbar">
|
|
<button class="layui-btn layui-btn-sm" id="btn-add-gift"><i class="layui-icon layui-icon-add-1"></i> 新增</button>
|
|
<button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete-gift"><i class="layui-icon layui-icon-delete"></i> 删除</button>
|
|
</div>
|
|
<div class="gift-table-wrap">
|
|
<table id="table-gift-list"></table>
|
|
</div>
|
|
</div>
|
|
<div class="gift-right">
|
|
<h4>礼包项详情</h4>
|
|
<div class="layui-form" id="gift-form">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">类型</label>
|
|
<div class="layui-input-block">
|
|
<select name="giftType" id="giftType" lay-filter="giftType">
|
|
<option value="1">金币</option>
|
|
<option value="2">钻石</option>
|
|
<option value="3">道具</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">数量</label>
|
|
<div class="layui-input-block">
|
|
<input type="number" name="giftCount" id="giftCount" class="layui-input" placeholder="请输入数量">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">随机</label>
|
|
<div class="layui-input-block">
|
|
<input type="checkbox" name="giftIsRandom" lay-skin="switch" lay-text="是|否" id="giftIsRandom">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">最小值</label>
|
|
<div class="layui-input-block">
|
|
<input type="number" name="giftMinCount" id="giftMinCount" class="layui-input" placeholder="最小值">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">最大值</label>
|
|
<div class="layui-input-block">
|
|
<input type="number" name="giftMaxCount" id="giftMaxCount" class="layui-input" placeholder="最大值">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item gift-prop-select" style="display:none;">
|
|
<label class="layui-form-label">道具编号</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="giftProductNumber" id="giftProductNumber" class="layui-input" placeholder="输入道具编号">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item" style="margin-top:20px;">
|
|
<button class="layui-btn layui-btn-normal" id="btn-save-gift" style="width:100%;">保存</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</script>
|
|
|
|
<script>
|
|
layui.use(['admin', 'table', 'form', 'layer'], function () {
|
|
var $ = layui.$,
|
|
admin = layui.admin,
|
|
table = layui.table,
|
|
form = layui.form,
|
|
layer = layui.layer,
|
|
setter = layui.setter;
|
|
|
|
var gameConfig = null;
|
|
var propList = [];
|
|
var currentVipIndex = -1;
|
|
var currentGiftIndex = -1;
|
|
var currentGiftType = 'gift';
|
|
var currentDialogData = null;
|
|
|
|
function getPropName(number) {
|
|
var prop = propList.find(function(p) { return p.number === number; });
|
|
return prop ? prop.number + ' - ' + prop.name : number || '';
|
|
}
|
|
|
|
function getOid(data) {
|
|
return data.otherId || data.OtherId || '';
|
|
}
|
|
|
|
function getType(data) {
|
|
return data.type || data.Type || 1;
|
|
}
|
|
|
|
function enrichProduct(gift) {
|
|
var oid = getOid(gift);
|
|
if (getType(gift) === 3 && oid) {
|
|
var prop = propList.find(function(p) { return p.number === oid; });
|
|
gift.product = prop ? { number: prop.number, name: prop.name } : { number: oid, name: '' };
|
|
} else {
|
|
gift.product = null;
|
|
}
|
|
return gift;
|
|
}
|
|
|
|
function enrichGiftList(list) {
|
|
if (list) list.forEach(enrichProduct);
|
|
}
|
|
|
|
setTimeout(function() {
|
|
if (window.parent && window.parent.$ && window.parent.layer) {
|
|
window.parent.$('.layui-layer-shade').remove();
|
|
window.parent.layer.closeAll();
|
|
}
|
|
$('.layui-layer-shade').remove();
|
|
layer.closeAll();
|
|
}, 100);
|
|
|
|
function loadConfig() {
|
|
admin.req({
|
|
method: "get",
|
|
url: setter.baseurl + "adminapi/GameConfig",
|
|
done: function (res) {
|
|
if (res.code === 0 && res.data) {
|
|
gameConfig = res.data;
|
|
propList = gameConfig.propConfig || [];
|
|
renderTable();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function renderTable() {
|
|
table.render({
|
|
elem: '#table-vip',
|
|
data: gameConfig ? (gameConfig.vipLevelConfigs || []) : [],
|
|
cols: [[
|
|
{ type: 'numbers', title: '序号', width: 60 },
|
|
{ field: "level", title: "等级", width: 80 },
|
|
{ field: "expMin", title: "经验下限", width: 100 },
|
|
{ field: "expMax", title: "经验上限", width: 100 },
|
|
{ field: "signInAdd", title: "签到加成", width: 100 },
|
|
{ field: "remark", title: "备注", minWidth: 150 },
|
|
{ field: "giftList", title: "礼包", width: 80, templet: function(d) {
|
|
return (d.giftList && d.giftList.length) ? d.giftList.length + '项' : '无';
|
|
}},
|
|
{ field: "dailyGift", title: "每日", width: 80, templet: function(d) {
|
|
return (d.dailyGift && d.dailyGift.length) ? d.dailyGift.length + '项' : '无';
|
|
}},
|
|
{ title: "操作", width: 250, fixed: 'right', toolbar: '#vip-bar' }
|
|
]],
|
|
toolbar: '#toolbar-vip',
|
|
defaultToolbar: ['filter', 'exports', 'print']
|
|
});
|
|
}
|
|
|
|
function initConfig() {
|
|
layer.confirm('确定要初始化全部配置数据吗?此操作将清空现有数据!', function(idx) {
|
|
layer.close(idx);
|
|
admin.req({
|
|
method: "get",
|
|
url: setter.baseurl + "adminapi/GameConfig/InitSection/VipLevelConfigs",
|
|
done: function (res) {
|
|
if (res.code === 0 || res.code === 200) {
|
|
layer.msg('初始化成功');
|
|
loadConfig();
|
|
} else {
|
|
layer.msg(res.info || '初始化失败');
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
layer.msg(res.info || '初始化失败');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
$(document).on('click', '[lay-filter="init-vip"]', function() {
|
|
if (window.parent && window.parent.$ && window.parent.layer) {
|
|
window.parent.$('.layui-layer-shade').remove();
|
|
window.parent.layer.closeAll();
|
|
}
|
|
initConfig();
|
|
});
|
|
|
|
$(document).on('click', '[lay-filter="reload-vip"]', function() {
|
|
loadConfig();
|
|
layer.msg('刷新成功');
|
|
});
|
|
|
|
$(document).on('click', '[lay-filter="save-vip"]', function() {
|
|
if (window.parent && window.parent.$ && window.parent.layer) {
|
|
window.parent.$('.layui-layer-shade').remove();
|
|
window.parent.layer.closeAll();
|
|
}
|
|
(gameConfig.vipLevelConfigs || []).forEach(function(v) {
|
|
enrichGiftList(v.giftList);
|
|
enrichGiftList(v.dailyGift);
|
|
});
|
|
admin.req({
|
|
method: "post",
|
|
contentType: "application/json;charset=UTF-8",
|
|
url: setter.baseurl + "adminapi/GameConfig/UpdateVipLevel",
|
|
data: JSON.stringify(gameConfig.vipLevelConfigs || []),
|
|
done: function (res) {
|
|
if (res.code === 0 || res.code === 200) {
|
|
layer.msg('保存成功');
|
|
loadConfig();
|
|
} else {
|
|
layer.msg(res.info || '保存失败');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
table.on('tool(table-vip)', function(obj) {
|
|
var data = obj.data;
|
|
var trIndex = gameConfig.vipLevelConfigs.findIndex(function(x) { return x.level === data.level; });
|
|
var originalData = trIndex > -1 ? gameConfig.vipLevelConfigs[trIndex] : data;
|
|
|
|
if (obj.event === 'del') {
|
|
layer.confirm('确定删除该配置吗?', function(idx) {
|
|
if (trIndex > -1) gameConfig.vipLevelConfigs.splice(trIndex, 1);
|
|
obj.del();
|
|
layer.close(idx);
|
|
});
|
|
} else if (obj.event === 'edit') {
|
|
showEditDialog(originalData, false, trIndex);
|
|
} else if (obj.event === 'gift') {
|
|
currentVipIndex = trIndex;
|
|
currentGiftType = 'gift';
|
|
showGiftDialog(originalData, '等级礼包');
|
|
} else if (obj.event === 'daily') {
|
|
currentVipIndex = trIndex;
|
|
currentGiftType = 'daily';
|
|
showGiftDialog(originalData, '每日礼包');
|
|
}
|
|
});
|
|
|
|
function showAddDialog() {
|
|
if (!gameConfig.vipLevelConfigs) gameConfig.vipLevelConfigs = [];
|
|
var newData = {
|
|
level: (gameConfig.vipLevelConfigs || []).length + 1,
|
|
expMin: 0,
|
|
expMax: 0,
|
|
signInAdd: 0,
|
|
remark: '',
|
|
giftList: [],
|
|
dailyGift: []
|
|
};
|
|
showEditDialog(newData, true);
|
|
}
|
|
|
|
$(document).on('click', '[lay-filter="add-vip"]', function() {
|
|
showAddDialog();
|
|
});
|
|
|
|
function showEditDialog(data, isAdd, rowIndex) {
|
|
var dialogTitle = isAdd ? '添加VIP等级' : '编辑VIP等级';
|
|
var index = isAdd ? -1 : rowIndex;
|
|
var html = '<div style="padding:20px;">' +
|
|
'<form class="layui-form">' +
|
|
'<div class="layui-form-item">' +
|
|
'<label class="layui-form-label">等级</label>' +
|
|
'<div class="layui-input-block">' +
|
|
'<input type="number" name="level" value="' + (data.level || 0) + '" class="layui-input">' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'<div class="layui-form-item">' +
|
|
'<label class="layui-form-label">经验下限</label>' +
|
|
'<div class="layui-input-block">' +
|
|
'<input type="number" name="expMin" value="' + (data.expMin || 0) + '" class="layui-input">' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'<div class="layui-form-item">' +
|
|
'<label class="layui-form-label">经验上限</label>' +
|
|
'<div class="layui-input-block">' +
|
|
'<input type="number" name="expMax" value="' + (data.expMax || 0) + '" class="layui-input">' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'<div class="layui-form-item">' +
|
|
'<label class="layui-form-label">签到加成</label>' +
|
|
'<div class="layui-input-block">' +
|
|
'<input type="number" name="signInAdd" value="' + (data.signInAdd || 0) + '" class="layui-input">' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'<div class="layui-form-item">' +
|
|
'<label class="layui-form-label">备注</label>' +
|
|
'<div class="layui-input-block">' +
|
|
'<input type="text" name="remark" value="' + (data.remark || '') + '" class="layui-input">' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'</form>' +
|
|
'</div>';
|
|
|
|
layer.open({
|
|
type: 1,
|
|
title: dialogTitle,
|
|
area: ['550px', '450px'],
|
|
content: html,
|
|
btn: ['保存', '取消'],
|
|
shadeClose: true,
|
|
success: function(layero) {
|
|
form.render();
|
|
},
|
|
yes: function(idx, layero) {
|
|
if (isAdd) {
|
|
var newItem = {
|
|
level: parseInt(layero.find('input[name="level"]').val()) || 0,
|
|
expMin: parseInt(layero.find('input[name="expMin"]').val()) || 0,
|
|
expMax: parseInt(layero.find('input[name="expMax"]').val()) || 0,
|
|
signInAdd: parseFloat(layero.find('input[name="signInAdd"]').val()) || 0,
|
|
remark: layero.find('input[name="remark"]').val(),
|
|
giftList: [],
|
|
dailyGift: []
|
|
};
|
|
gameConfig.vipLevelConfigs.unshift(newItem);
|
|
} else if (index > -1) {
|
|
// Layui 返回的是行数据副本,必须明确写回原配置数组。
|
|
var original = gameConfig.vipLevelConfigs[index];
|
|
original.level = parseInt(layero.find('input[name="level"]').val()) || 0;
|
|
original.expMin = parseInt(layero.find('input[name="expMin"]').val()) || 0;
|
|
original.expMax = parseInt(layero.find('input[name="expMax"]').val()) || 0;
|
|
original.signInAdd = parseFloat(layero.find('input[name="signInAdd"]').val()) || 0;
|
|
original.remark = layero.find('input[name="remark"]').val();
|
|
}
|
|
layer.close(idx);
|
|
table.reload('table-vip', {
|
|
data: gameConfig.vipLevelConfigs
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function showGiftDialog(data, title) {
|
|
currentDialogData = data;
|
|
currentGiftIndex = -1;
|
|
|
|
var dialogContent = $('#gift-dialog-tpl').html();
|
|
|
|
layer.open({
|
|
type: 1,
|
|
title: 'VIP' + data.level + ' - ' + title,
|
|
area: ['1000px', '620px'],
|
|
content: dialogContent,
|
|
shadeClose: true,
|
|
success: function(layero) {
|
|
form.render();
|
|
|
|
renderGiftTable(layero);
|
|
|
|
layero.find('#btn-add-gift').on('click', function() {
|
|
addGiftItem(layero);
|
|
});
|
|
|
|
layero.find('#btn-delete-gift').on('click', function() {
|
|
deleteGiftItem(layero);
|
|
});
|
|
|
|
layero.find('#btn-save-gift').on('click', function() {
|
|
saveGiftItem(layero);
|
|
});
|
|
|
|
form.on('select(giftType)', function(obj) {
|
|
if (obj.value === '3') {
|
|
layero.find('.gift-prop-select').show();
|
|
} else {
|
|
layero.find('.gift-prop-select').hide();
|
|
}
|
|
layero.find('#giftCount').val(0);
|
|
layero.find('#giftIsRandom')[0].checked = false;
|
|
form.render('checkbox');
|
|
});
|
|
|
|
layero.find('#giftCount').on('input', function() {
|
|
layero.find('#giftIsRandom')[0].checked = false;
|
|
layero.find('#giftIsRandom').prop('checked', false);
|
|
form.render('checkbox');
|
|
});
|
|
|
|
layero.on('click', '#giftIsRandom + .layui-form-switch', function() {
|
|
var checkbox = layero.find('#giftIsRandom')[0];
|
|
setTimeout(function() {
|
|
if (checkbox.checked) {
|
|
layero.find('#giftCount').val(0);
|
|
}
|
|
}, 10);
|
|
});
|
|
|
|
form.on('switch(giftIsRandom)', function(data) {
|
|
if (data.elem.checked) {
|
|
layero.find('#giftCount').val(0);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function getGiftList() {
|
|
if (!currentDialogData) return [];
|
|
if (currentGiftType === 'gift') {
|
|
return currentDialogData.giftList || (currentDialogData.giftList = []);
|
|
} else {
|
|
return currentDialogData.dailyGift || (currentDialogData.dailyGift = []);
|
|
}
|
|
}
|
|
|
|
function addGiftItem(layero) {
|
|
var list = getGiftList();
|
|
list.push({ type: 1, count: 100, isRandom: false, minCount: 0, maxCount: 0, otherId: '' });
|
|
currentGiftIndex = list.length - 1;
|
|
renderGiftTable(layero, currentGiftIndex);
|
|
loadFormData(list[list.length - 1], layero);
|
|
}
|
|
|
|
function deleteGiftItem(layero) {
|
|
if (currentGiftIndex < 0) {
|
|
return layer.msg('请先选择要删除的项');
|
|
}
|
|
var list = getGiftList();
|
|
if (list.length > currentGiftIndex) {
|
|
list.splice(currentGiftIndex, 1);
|
|
currentGiftIndex = -1;
|
|
clearForm(layero);
|
|
renderGiftTable(layero, -1);
|
|
}
|
|
}
|
|
|
|
function saveGiftItem(layero) {
|
|
if (currentGiftIndex < 0) {
|
|
return layer.msg('请先选择要编辑的项');
|
|
}
|
|
var list = getGiftList();
|
|
var giftType = parseInt(layero.find('#giftType').val()) || 1;
|
|
var otherId = $.trim(layero.find('#giftProductNumber').val() || '');
|
|
if (giftType === 3 && !propList.some(function(p) { return String(p.number) === otherId; })) {
|
|
return layer.msg('请输入道具表中存在的道具编号');
|
|
}
|
|
list[currentGiftIndex] = {
|
|
type: giftType,
|
|
count: parseInt(layero.find('#giftCount').val()) || 0,
|
|
isRandom: layero.find('#giftIsRandom')[0].checked,
|
|
minCount: parseInt(layero.find('#giftMinCount').val()) || 0,
|
|
maxCount: parseInt(layero.find('#giftMaxCount').val()) || 0,
|
|
otherId: giftType === 3 ? otherId : ''
|
|
};
|
|
renderGiftTable(layero, currentGiftIndex);
|
|
(gameConfig.vipLevelConfigs || []).forEach(function(v) {
|
|
enrichGiftList(v.giftList);
|
|
enrichGiftList(v.dailyGift);
|
|
});
|
|
var saveButton = layero.find('#btn-save-gift');
|
|
if (saveButton.prop('disabled')) return;
|
|
saveButton.prop('disabled', true).addClass('layui-btn-disabled');
|
|
admin.req({
|
|
method: 'post',
|
|
contentType: 'application/json;charset=UTF-8',
|
|
url: setter.baseurl + 'adminapi/GameConfig/UpdateVipLevel',
|
|
data: JSON.stringify(gameConfig.vipLevelConfigs || []),
|
|
done: function(res) {
|
|
saveButton.prop('disabled', false).removeClass('layui-btn-disabled');
|
|
layer.msg(res.code === 0 || res.code === 200 ? '保存成功' : (res.info || '保存失败,请重试'));
|
|
},
|
|
error: function() {
|
|
saveButton.prop('disabled', false).removeClass('layui-btn-disabled');
|
|
layer.msg('保存请求失败,请重试');
|
|
}
|
|
});
|
|
}
|
|
|
|
function clearForm(layero) {
|
|
layero.find('#giftType').val('1');
|
|
layero.find('#giftCount').val('0');
|
|
layero.find('#giftIsRandom')[0].checked = false;
|
|
layero.find('#giftMinCount').val('0');
|
|
layero.find('#giftMaxCount').val('0');
|
|
layero.find('#giftProductNumber').val('');
|
|
layero.find('.gift-prop-select').hide();
|
|
form.render('checkbox');
|
|
form.render('select');
|
|
}
|
|
|
|
function loadFormData(data, layero) {
|
|
layero.find('#giftType').val(getType(data));
|
|
layero.find('#giftCount').val(data.count || data.Count || 0);
|
|
layero.find('#giftIsRandom')[0].checked = data.isRandom || data.IsRandom || false;
|
|
layero.find('#giftMinCount').val(data.minCount || data.MinCount || 0);
|
|
layero.find('#giftMaxCount').val(data.maxCount || data.MaxCount || 0);
|
|
layero.find('#giftProductNumber').val(getOid(data));
|
|
|
|
if (getType(data) === 3) {
|
|
layero.find('.gift-prop-select').show();
|
|
} else {
|
|
layero.find('.gift-prop-select').hide();
|
|
}
|
|
form.render('checkbox');
|
|
form.render();
|
|
}
|
|
|
|
function renderGiftTable(layero, selectIndex) {
|
|
var list = getGiftList();
|
|
if (typeof selectIndex !== 'number') selectIndex = list.length > 0 ? 0 : -1;
|
|
|
|
layero.find('.layui-table-view').remove();
|
|
|
|
table.render({
|
|
elem: layero.find('#table-gift-list'),
|
|
data: list,
|
|
page: false,
|
|
height: 380,
|
|
cols: [[
|
|
{ type: 'numbers', title: '序号', width: 60 },
|
|
{ field: "type", title: "类型", width: 80, templet: function(d) {
|
|
var map = {1: '金币', 2: '钻石', 3: '道具'};
|
|
return map[d.type] || '金币';
|
|
}},
|
|
{ field: "count", title: "数量", width: 80 },
|
|
{ field: "minCount", title: "最小值", width: 80 },
|
|
{ field: "maxCount", title: "最大值", width: 80 },
|
|
{ field: "isRandom", title: "随机", width: 70, templet: function(d) {
|
|
return d.isRandom ? '是' : '否';
|
|
}},
|
|
{ field: "otherId", title: "道具编号", minWidth: 150, templet: function(d) {
|
|
return getType(d) === 3 ? getPropName(getOid(d)) : '';
|
|
}}
|
|
]],
|
|
done: function() {
|
|
if (list.length > 0 && selectIndex < 0) {
|
|
selectIndex = 0;
|
|
}
|
|
if (selectIndex >= 0 && selectIndex < list.length) {
|
|
currentGiftIndex = selectIndex;
|
|
loadFormData(list[selectIndex], layero);
|
|
layero.find('.layui-table-view tr[data-index="' + selectIndex + '"]').addClass('layui-table-click');
|
|
}
|
|
layero.find('.layui-table-view').off('click', 'tr[data-index]').on('click', 'tr[data-index]', function() {
|
|
var index = parseInt($(this).attr('data-index'));
|
|
if (index >= 0 && index < list.length) {
|
|
currentGiftIndex = index;
|
|
layero.find('.layui-table-view tr[data-index]').removeClass('layui-table-click');
|
|
$(this).addClass('layui-table-click');
|
|
loadFormData(list[index], layero);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
window.saveSection=function(n){layui.admin.req({method:'get',url:(layui.setter.baseurl||'/')+'adminapi/GameConfig/SaveSection/'+n,done:function(r){layui.layer.msg(r.info||(r.code===0?'保存成功':'保存失败'))}})}
|
|
|
|
loadConfig();
|
|
});
|
|
</script>
|
|
|
|
<style>
|
|
.gift-container { display: flex; height: 480px; padding: 10px; }
|
|
.gift-left { flex: 1; margin-right: 15px; }
|
|
.gift-table-wrap { height: 400px; overflow: auto; }
|
|
.gift-right { width: 280px; border-left: 1px solid #e6e6e6; padding-left: 15px; }
|
|
.gift-right h4 { margin-bottom: 15px; color: #333; font-size: 16px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
|
|
.gift-toolbar { margin-bottom: 10px; }
|
|
.gift-toolbar .layui-btn { margin-right: 5px; }
|
|
.gift-right .layui-form-item { margin-bottom: 12px; }
|
|
.gift-right .layui-form-label { padding: 9px 0; width: 60px; }
|
|
.gift-right .layui-input-block { margin-left: 70px; }
|
|
</style>
|