feat: xxbb
This commit is contained in:
@@ -70,7 +70,13 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
|
||||
var cols = [
|
||||
{ field: 'id', title: 'ID', width: 70, sort: true },
|
||||
{ field: 'channel_id', title: '渠道 ID', minWidth: 260, sort: true },
|
||||
{ field: 'channel_id', title: '渠道 ID', minWidth: 220, sort: true },
|
||||
{ field: 'builder_type', title: '类型', width: 80, templet: function (d) {
|
||||
return d.builder_type === 'new' ? '新版' : '旧版';
|
||||
}},
|
||||
{ field: 'channel_name', title: 'channel_name', width: 120, templet: function (d) {
|
||||
return d.channel_name || '—';
|
||||
}},
|
||||
];
|
||||
if (isAdmin) {
|
||||
cols.push({ field: 'agent_username', title: '代理', width: 120 });
|
||||
@@ -168,14 +174,23 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
var links = data.links || [];
|
||||
var html = '<div style="padding:16px;line-height:1.6;font-size:13px;">';
|
||||
html += '<div style="margin-bottom:10px;"><b>渠道</b> ' + channelId + '</div>';
|
||||
if (data.builder_type === 'new' && data.channel_name) {
|
||||
html += '<div style="margin-bottom:8px;"><b>channel_name</b> <code>' + data.channel_name + '</code></div>';
|
||||
}
|
||||
if (data.weifile_path || data.support_path) {
|
||||
html += '<div style="margin-bottom:10px;"><b>落地页</b> <code>' +
|
||||
(data.weifile_path || data.support_path).replace(/</g, '<') + '</code></div>';
|
||||
}
|
||||
if (links.length) {
|
||||
html += '<div style="margin-bottom:6px;"><b>投放链接</b></div>';
|
||||
links.forEach(function (u) {
|
||||
html += '<div style="word-break:break-all;margin-bottom:6px;"><code>' + u.replace(/</g, '<') + '</code></div>';
|
||||
});
|
||||
}
|
||||
if (data.seeds_initialized && data.domains) {
|
||||
html += '<div style="margin:12px 0 6px;"><b>首次 DGA 域名(请去注册/绑源站)</b></div>';
|
||||
if (data.domains && ((data.domains.deployment || []).length || (data.domains.reporting || []).length)) {
|
||||
html += '<div style="margin:12px 0 6px;"><b>' +
|
||||
(data.seeds_initialized ? '首次 DGA 域名(请去注册/绑源站)' : 'DGA 域名') +
|
||||
'</b></div>';
|
||||
html += '<div><b>Deployment</b></div><ul style="margin:4px 0 8px 18px;">';
|
||||
(data.domains.deployment || []).forEach(function (d) { html += '<li>' + d + '</li>'; });
|
||||
html += '</ul><div><b>Reporting</b></div><ul style="margin:4px 0 0 18px;">';
|
||||
@@ -197,8 +212,17 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
'<button type="button" class="layui-btn layui-btn-primary" id="LAY-ch-rand" style="margin-left:6px;">随机</button></div></div>'
|
||||
: '<div class="layui-form-item"><label class="layui-form-label">渠道 ID</label><div class="layui-input-block"><input class="layui-input" readonly value="' + (values.channel_id || '') + '"></div></div>';
|
||||
|
||||
var typeBlock = (isAdmin && creating)
|
||||
? '<div class="layui-form-item"><label class="layui-form-label">类型</label><div class="layui-input-block">' +
|
||||
'<select name="builder_type" lay-filter="LAY-ch-builder-type">' +
|
||||
'<option value="old"' + ((values.builder_type || 'old') === 'old' ? ' selected' : '') + '>旧版</option>' +
|
||||
'<option value="new"' + (values.builder_type === 'new' ? ' selected' : '') + '>新版</option>' +
|
||||
'</select>' +
|
||||
'<div class="layui-form-mid layui-word-aux">旧版=channel-builder(/web/id/support.html);新版=channel-builder-new(/source/{name}/index.html)</div></div></div>'
|
||||
: '';
|
||||
|
||||
var templateBlock = (isAdmin && creating)
|
||||
? '<div class="layui-form-item"><label class="layui-form-label">页面模板</label><div class="layui-input-block">' +
|
||||
? '<div class="layui-form-item" id="LAY-ch-template-item"><label class="layui-form-label">页面模板</label><div class="layui-input-block">' +
|
||||
'<select name="support_template">' +
|
||||
'<option value="test"' + ((values.support_template || 'test') === 'test' ? ' selected' : '') + '>test(含 HUD 进度页)</option>' +
|
||||
'<option value="blank"' + (values.support_template === 'blank' ? ' selected' : '') + '>blank(空白页)</option>' +
|
||||
@@ -209,18 +233,25 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
area: ['560px', creating ? (isAdmin ? '520px' : '380px') : '420px'],
|
||||
area: ['560px', creating ? (isAdmin ? '580px' : '380px') : '420px'],
|
||||
content: '<form class="layui-form" style="padding:16px;" id="LAY-ch-form" lay-filter="LAY-ch-form">' +
|
||||
channelBlock + agentBlock + templateBlock +
|
||||
channelBlock + typeBlock + agentBlock + templateBlock +
|
||||
'<div class="layui-form-item"><label class="layui-form-label">备注</label><div class="layui-input-block">' +
|
||||
'<input name="remark" class="layui-input" value="' + (values.remark || '').replace(/"/g, '"') + '"></div></div>' +
|
||||
'<div class="layui-form-item"><label class="layui-form-label">状态</label><div class="layui-input-block">' +
|
||||
'<input type="checkbox" name="status_switch" lay-skin="switch" lay-text="启用|禁用" ' + ((values.status == null || values.status == 1) ? 'checked' : '') + '>' +
|
||||
'</div></div>' +
|
||||
(creating && isAdmin ? '<div class="layui-form-item"><div class="layui-input-block" style="color:#888;font-size:12px;">新建将调用 channel-builder 生成 public/web 资源。代理最多 ' + maxPerAgent + ' 条。</div></div>' : '') +
|
||||
(creating && isAdmin ? '<div class="layui-form-item"><div class="layui-input-block" style="color:#888;font-size:12px;">新建将调用对应 builder 生成静态资源。代理最多 ' + maxPerAgent + ' 条。</div></div>' : '') +
|
||||
'</form>',
|
||||
success: function () {
|
||||
form.render();
|
||||
function syncTemplateVisibility() {
|
||||
var type = $('#LAY-ch-form select[name=builder_type]').val() || 'old';
|
||||
if (type === 'new') $('#LAY-ch-template-item').hide();
|
||||
else $('#LAY-ch-template-item').show();
|
||||
}
|
||||
syncTemplateVisibility();
|
||||
form.on('select(LAY-ch-builder-type)', function () { syncTemplateVisibility(); });
|
||||
$('#LAY-ch-rand').on('click', function () {
|
||||
$.getJSON(@json(route('admin.channels.randomId')), function (res) {
|
||||
if (res.code === 0) $('#LAY-ch-form input[name=channel_id]').val(res.data.channel_id);
|
||||
@@ -287,7 +318,10 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
if (obj.event === 'edit') openForm('编辑渠道链接', obj.data, false);
|
||||
if (obj.event === 'links') openLinks(obj.data);
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('删除后将移除数据库记录与 web/' + obj.data.channel_id + ' 资源,确认?', function (idx) {
|
||||
var pathHint = obj.data.builder_type === 'new' && obj.data.channel_name
|
||||
? ('source/' + obj.data.channel_name + '/index.html')
|
||||
: ('web/' + obj.data.channel_id);
|
||||
layer.confirm('删除后将移除数据库记录与 ' + pathHint + ' 资源,确认?', function (idx) {
|
||||
$.ajax({
|
||||
url: @json(url('/admin/channels')) + '/' + obj.data.id,
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user