后台界面:更新签到页面 sign.html;version 提升至 2.11.9
This commit is contained in:
@@ -92,6 +92,7 @@
|
|||||||
var activityConfig = null;
|
var activityConfig = null;
|
||||||
var propList = [];
|
var propList = [];
|
||||||
var typeMap = { 1: '金币', 2: '钻石', 3: '道具' };
|
var typeMap = { 1: '金币', 2: '钻石', 3: '道具' };
|
||||||
|
var propTypeNames = { 1: '炮台', 2: '翅膀', 3: '炮塔碎片', 4: '翅膀碎片', 5: '战神', 6: '战神碎片', 7: '刮刮卡', 8: '改名卡', 9: '大喇叭', 10: '技能', 11: '召唤卡', 12: 'VipExp', 13: '鱼雷' };
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (window.parent && window.parent.$ && window.parent.layer) {
|
if (window.parent && window.parent.$ && window.parent.layer) {
|
||||||
@@ -425,23 +426,25 @@
|
|||||||
|
|
||||||
function showGiftEdit(dayLayero, giftList, index, isAdd) {
|
function showGiftEdit(dayLayero, giftList, index, isAdd) {
|
||||||
var g = isAdd ? { type: 1, count: 0, otherId: '' } : giftList[index];
|
var g = isAdd ? { type: 1, count: 0, otherId: '' } : giftList[index];
|
||||||
var propOpts = '<option value="">请选择道具</option>';
|
|
||||||
propList.forEach(function (p) {
|
|
||||||
propOpts += '<option value="' + p.number + '">' + p.number + ' - ' + p.name + '</option>';
|
|
||||||
});
|
|
||||||
|
|
||||||
var html = '<div style="padding:15px;">' +
|
var html = '<div style="padding:15px;">' +
|
||||||
'<form class="layui-form">' +
|
'<form class="layui-form">' +
|
||||||
'<div class="layui-form-item">' +
|
'<div class="layui-form-item">' +
|
||||||
'<label class="layui-form-label">类型</label>' +
|
'<label class="layui-form-label">奖励类型</label>' +
|
||||||
'<div class="layui-input-block">' +
|
'<div class="layui-input-block">' +
|
||||||
'<select id="giftType"><option value="1">金币</option><option value="2">钻石</option><option value="3">道具</option></select>' +
|
'<select id="giftType"><option value="1">金币</option><option value="2">钻石</option><option value="3">道具</option></select>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="layui-form-item gift-prop-item">' +
|
'<div class="layui-form-item gift-prop-type-item">' +
|
||||||
'<label class="layui-form-label">道具</label>' +
|
'<label class="layui-form-label">道具类型</label>' +
|
||||||
'<div class="layui-input-block">' +
|
'<div class="layui-input-block">' +
|
||||||
'<select id="giftProp" lay-search>' + propOpts + '</select>' +
|
'<select id="giftPropType"><option value="">请选择道具类型</option></select>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="layui-form-item gift-prop-item">' +
|
||||||
|
'<label class="layui-form-label">具体道具</label>' +
|
||||||
|
'<div class="layui-input-block">' +
|
||||||
|
'<select id="giftProp" lay-search><option value="">请选择道具</option></select>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="layui-form-item">' +
|
'<div class="layui-form-item">' +
|
||||||
@@ -456,22 +459,38 @@
|
|||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: isAdd ? '新增奖励' : '编辑奖励',
|
title: isAdd ? '新增奖励' : '编辑奖励',
|
||||||
area: ['460px', '360px'],
|
area: ['480px', '420px'],
|
||||||
content: html,
|
content: html,
|
||||||
btn: ['确定', '取消'],
|
btn: ['确定', '取消'],
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
success: function (l) {
|
success: function (l) {
|
||||||
l.find('#giftType').val(g.type || 1);
|
l.find('#giftType').val(g.type || 1);
|
||||||
l.find('#giftProp').val(g.otherId || '');
|
|
||||||
|
// 编辑已有道具奖励时,定位其所属道具类型
|
||||||
|
var initPropType = 0;
|
||||||
|
if ((g.type || 1) === 3 && g.otherId) {
|
||||||
|
var p = propList.find(function (x) { return String(x.number) === String(g.otherId); });
|
||||||
|
if (p) initPropType = p.type;
|
||||||
|
}
|
||||||
|
populatePropTypes(l, initPropType);
|
||||||
|
populateProps(l, initPropType, g.otherId || '');
|
||||||
|
|
||||||
form.render('select');
|
form.render('select');
|
||||||
toggleGiftProp(l);
|
toggleGiftProp(l);
|
||||||
l.find('#giftType').on('change', function () { toggleGiftProp(l); });
|
l.find('#giftType').on('change', function () { toggleGiftProp(l); });
|
||||||
|
l.find('#giftPropType').on('change', function () {
|
||||||
|
populateProps(l, parseInt($(this).val()) || 0, '');
|
||||||
|
form.render('select');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
yes: function (idx, l) {
|
yes: function (idx, l) {
|
||||||
var t = parseInt(l.find('#giftType').val()) || 1;
|
var t = parseInt(l.find('#giftType').val()) || 1;
|
||||||
var c = parseInt(l.find('#giftCount').val()) || 0;
|
var c = parseInt(l.find('#giftCount').val()) || 0;
|
||||||
var oid = t === 3 ? (l.find('#giftProp').val() || '') : '';
|
var oid = '';
|
||||||
if (t === 3 && !oid) { layer.msg('请选择道具'); return; }
|
if (t === 3) {
|
||||||
|
oid = l.find('#giftProp').val() || '';
|
||||||
|
if (!oid) { layer.msg('请选择具体道具'); return; }
|
||||||
|
}
|
||||||
var item = { type: t, count: c, otherId: oid };
|
var item = { type: t, count: c, otherId: oid };
|
||||||
if (isAdd) giftList.push(item); else giftList[index] = item;
|
if (isAdd) giftList.push(item); else giftList[index] = item;
|
||||||
layer.close(idx);
|
layer.close(idx);
|
||||||
@@ -480,9 +499,36 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 填充“道具类型”下拉(仅列出道具表中实际存在的类型)
|
||||||
|
function populatePropTypes(l, selectedType) {
|
||||||
|
var usedTypes = [];
|
||||||
|
propList.forEach(function (p) {
|
||||||
|
if (p.type && usedTypes.indexOf(p.type) < 0) usedTypes.push(p.type);
|
||||||
|
});
|
||||||
|
usedTypes.sort(function (a, b) { return a - b; });
|
||||||
|
var opts = '<option value="">请选择道具类型</option>';
|
||||||
|
usedTypes.forEach(function (t) {
|
||||||
|
opts += '<option value="' + t + '">' + (propTypeNames[t] || ('类型' + t)) + '</option>';
|
||||||
|
});
|
||||||
|
l.find('#giftPropType').html(opts);
|
||||||
|
if (selectedType) l.find('#giftPropType').val(selectedType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按所选“道具类型”填充“具体道具”下拉
|
||||||
|
function populateProps(l, propType, selectedNumber) {
|
||||||
|
var opts = '<option value="">请选择道具</option>';
|
||||||
|
if (propType) {
|
||||||
|
propList.filter(function (p) { return p.type === propType; }).forEach(function (p) {
|
||||||
|
opts += '<option value="' + p.number + '">' + p.number + ' - ' + p.name + '</option>';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
l.find('#giftProp').html(opts);
|
||||||
|
if (selectedNumber) l.find('#giftProp').val(selectedNumber);
|
||||||
|
}
|
||||||
|
|
||||||
function toggleGiftProp(l) {
|
function toggleGiftProp(l) {
|
||||||
var isProp = (parseInt(l.find('#giftType').val()) || 1) === 3;
|
var isProp = (parseInt(l.find('#giftType').val()) || 1) === 3;
|
||||||
l.find('.gift-prop-item').toggle(isProp);
|
l.find('.gift-prop-item, .gift-prop-type-item').toggle(isProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.saveAct = function (n) { layui.admin.req({ method: 'get', url: (layui.setter.baseurl || '/') + 'adminapi/ActivityConfig/SaveSection/' + n, done: function (r) { layui.layer.msg(r.info || (r.code === 0 ? '保存成功' : '保存失败')) } }) }
|
window.saveAct = function (n) { layui.admin.req({ method: 'get', url: (layui.setter.baseurl || '/') + 'adminapi/ActivityConfig/SaveSection/' + n, done: function (r) { layui.layer.msg(r.info || (r.code === 0 ? '保存成功' : '保存失败')) } }) }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<script>
|
<script>
|
||||||
layui.config({
|
layui.config({
|
||||||
base: './dist/' //指定 layuiAdmin 项目路径
|
base: './dist/' //指定 layuiAdmin 项目路径
|
||||||
, version: '2.11.8'
|
, version: '2.11.9'
|
||||||
}).use('index', function () {
|
}).use('index', function () {
|
||||||
var layer = layui.layer, admin = layui.admin;
|
var layer = layui.layer, admin = layui.admin;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user