feat(dashboard): 筛号器新增点击号码屏蔽功能
号码网格支持点击切换屏蔽状态,与其他筛选条件叠加生效,重置按钮清除手动屏蔽
This commit is contained in:
@@ -799,54 +799,69 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
content: html,
|
content: html,
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
success: function (layero, index) {
|
success: function (layero, index) {
|
||||||
|
// 手动屏蔽的号码列表
|
||||||
|
var blockedNums = [];
|
||||||
|
|
||||||
// 渲染号码网格
|
// 渲染号码网格
|
||||||
Controller.api.renderNumberFilterGrid(layero);
|
Controller.api.renderNumberFilterGrid(layero);
|
||||||
|
|
||||||
|
// 号码点击屏蔽
|
||||||
|
$('#nf-numbers', layero).on('click', '.nf-number', function () {
|
||||||
|
var num = parseInt($(this).data('num'));
|
||||||
|
var idx = blockedNums.indexOf(num);
|
||||||
|
if (idx === -1) {
|
||||||
|
blockedNums.push(num);
|
||||||
|
} else {
|
||||||
|
blockedNums.splice(idx, 1);
|
||||||
|
}
|
||||||
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
|
});
|
||||||
|
|
||||||
// 新增尾号
|
// 新增尾号
|
||||||
$('.btn-nf-add-tail', layero).on('click', function () {
|
$('.btn-nf-add-tail', layero).on('click', function () {
|
||||||
Controller.api.addTailRow(layero, 0);
|
Controller.api.addTailRow(layero, 0);
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 尾号输入 & 删除事件委托
|
// 尾号输入 & 删除事件委托
|
||||||
$('#nf-tail-list', layero).on('input change', '.nf-tail-select', function () {
|
$('#nf-tail-list', layero).on('input change', '.nf-tail-select', function () {
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
$('#nf-tail-list', layero).on('click', '.nf-tail-del', function () {
|
$('#nf-tail-list', layero).on('click', '.nf-tail-del', function () {
|
||||||
$(this).closest('.nf-tail-row').remove();
|
$(this).closest('.nf-tail-row').remove();
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 生肖按钮点击
|
// 生肖按钮点击
|
||||||
$('.nf-zodiac', layero).on('click', function () {
|
$('.nf-zodiac', layero).on('click', function () {
|
||||||
var $btn = $(this);
|
var $btn = $(this);
|
||||||
$btn.toggleClass('btn-default').toggleClass('btn-gray');
|
$btn.toggleClass('btn-default').toggleClass('btn-gray');
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 波色按钮点击
|
// 波色按钮点击
|
||||||
$('.nf-color-btn', layero).on('click', function () {
|
$('.nf-color-btn', layero).on('click', function () {
|
||||||
var $btn = $(this);
|
var $btn = $(this);
|
||||||
$btn.toggleClass('btn-default').toggleClass('btn-gray');
|
$btn.toggleClass('btn-default').toggleClass('btn-gray');
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 单双按钮点击
|
// 单双按钮点击
|
||||||
$('.nf-parity', layero).on('click', function () {
|
$('.nf-parity', layero).on('click', function () {
|
||||||
var $btn = $(this);
|
var $btn = $(this);
|
||||||
$btn.toggleClass('btn-default').toggleClass('btn-gray');
|
$btn.toggleClass('btn-default').toggleClass('btn-gray');
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 新增区间
|
// 新增区间
|
||||||
$('.btn-nf-add-range', layero).on('click', function () {
|
$('.btn-nf-add-range', layero).on('click', function () {
|
||||||
Controller.api.addRangeRow(layero, 1, 49, 'include');
|
Controller.api.addRangeRow(layero, 1, 49, 'include');
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 区间输入 & 删除事件委托
|
// 区间输入 & 删除事件委托
|
||||||
$('#nf-range-list', layero).on('input change', '.nf-range-min, .nf-range-max', function () {
|
$('#nf-range-list', layero).on('input change', '.nf-range-min, .nf-range-max', function () {
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
$('#nf-range-list', layero).on('click', '.nf-range-mode', function () {
|
$('#nf-range-list', layero).on('click', '.nf-range-mode', function () {
|
||||||
var $btn = $(this);
|
var $btn = $(this);
|
||||||
@@ -855,21 +870,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
} else {
|
} else {
|
||||||
$btn.removeClass('btn-default').addClass('btn-info');
|
$btn.removeClass('btn-default').addClass('btn-info');
|
||||||
}
|
}
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
$('#nf-range-list', layero).on('click', '.nf-range-del', function () {
|
$('#nf-range-list', layero).on('click', '.nf-range-del', function () {
|
||||||
$(this).closest('.nf-range-row').remove();
|
$(this).closest('.nf-range-row').remove();
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重置按钮
|
// 重置按钮
|
||||||
$('.btn-nf-reset', layero).on('click', function () {
|
$('.btn-nf-reset', layero).on('click', function () {
|
||||||
|
blockedNums = [];
|
||||||
$('#nf-tail-list', layero).html('');
|
$('#nf-tail-list', layero).html('');
|
||||||
$('.nf-zodiac', layero).removeClass('btn-gray').addClass('btn-default');
|
$('.nf-zodiac', layero).removeClass('btn-gray').addClass('btn-default');
|
||||||
$('.nf-color-btn', layero).removeClass('btn-gray').addClass('btn-default');
|
$('.nf-color-btn', layero).removeClass('btn-gray').addClass('btn-default');
|
||||||
$('.nf-parity', layero).removeClass('btn-gray').addClass('btn-default');
|
$('.nf-parity', layero).removeClass('btn-gray').addClass('btn-default');
|
||||||
$('#nf-range-list', layero).html('');
|
$('#nf-range-list', layero).html('');
|
||||||
Controller.api.applyNumberFilters(layero);
|
Controller.api.applyNumberFilters(layero, blockedNums);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -922,7 +938,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
if (colorRaw.indexOf('红') !== -1) colorLabel = '红';
|
if (colorRaw.indexOf('红') !== -1) colorLabel = '红';
|
||||||
else if (colorRaw.indexOf('蓝') !== -1) colorLabel = '蓝';
|
else if (colorRaw.indexOf('蓝') !== -1) colorLabel = '蓝';
|
||||||
else if (colorRaw.indexOf('绿') !== -1) colorLabel = '绿';
|
else if (colorRaw.indexOf('绿') !== -1) colorLabel = '绿';
|
||||||
html += '<div class="nf-number" data-num="' + num + '" data-color="' + colorLabel + '" data-animal="' + animal + '" data-tail="' + (num % 10) + '" data-parity="' + (num % 2 === 1 ? '单' : '双') + '" style="text-align:center;background:#f9f9f9;padding:6px 4px;border-radius:6px;min-width:60px;transition:opacity 0.2s;">' +
|
html += '<div class="nf-number" data-num="' + num + '" data-color="' + colorLabel + '" data-animal="' + animal + '" data-tail="' + (num % 10) + '" data-parity="' + (num % 2 === 1 ? '单' : '双') + '" style="text-align:center;background:#f9f9f9;padding:6px 4px;border-radius:6px;min-width:60px;transition:opacity 0.2s;cursor:pointer;" title="点击屏蔽/恢复">' +
|
||||||
'<span style="display:inline-block;width:36px;height:36px;line-height:36px;text-align:center;border-radius:50%;color:#fff;background-color:' + colorHex + ';font-weight:bold;">' + num + '</span>' +
|
'<span style="display:inline-block;width:36px;height:36px;line-height:36px;text-align:center;border-radius:50%;color:#fff;background-color:' + colorHex + ';font-weight:bold;">' + num + '</span>' +
|
||||||
'<div style="font-size:10px;color:#666;line-height:1.2;">' + animal + '</div>' +
|
'<div style="font-size:10px;color:#666;line-height:1.2;">' + animal + '</div>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
@@ -932,8 +948,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用筛号器过滤条件
|
* 应用筛号器过滤条件
|
||||||
|
* @param {object} layero Layer弹窗对象
|
||||||
|
* @param {Array} blockedNums 手动屏蔽的号码列表
|
||||||
*/
|
*/
|
||||||
applyNumberFilters: function (layero) {
|
applyNumberFilters: function (layero, blockedNums) {
|
||||||
|
blockedNums = blockedNums || [];
|
||||||
// 收集所有选中的尾号
|
// 收集所有选中的尾号
|
||||||
var excludedTails = [];
|
var excludedTails = [];
|
||||||
$('.nf-tail-select', layero).each(function () {
|
$('.nf-tail-select', layero).each(function () {
|
||||||
@@ -1026,6 +1045,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
if (excludedColors.indexOf(color) !== -1) {
|
if (excludedColors.indexOf(color) !== -1) {
|
||||||
hidden = true;
|
hidden = true;
|
||||||
}
|
}
|
||||||
|
// 手动屏蔽的号码
|
||||||
|
if (blockedNums.indexOf(num) !== -1) {
|
||||||
|
hidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
$num.css('opacity', '0.25').css('filter', 'grayscale(100%)');
|
$num.css('opacity', '0.25').css('filter', 'grayscale(100%)');
|
||||||
|
|||||||
Reference in New Issue
Block a user