fix: ios 16
This commit is contained in:
@@ -130,7 +130,7 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
function openLinks(row) {
|
||||
var links = row.links || [];
|
||||
if (!links.length) {
|
||||
return layer.msg('未配置域名(渠道 domains 或 CORUNA_LAB_CHANNEL_DOMAINS)');
|
||||
return layer.msg('未生成投放链接(请配置 CORUNA_STATIC_SITE_BASE_URL)');
|
||||
}
|
||||
var html = '<div style="padding:16px;">';
|
||||
links.forEach(function (u, i) {
|
||||
@@ -154,6 +154,29 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
});
|
||||
}
|
||||
|
||||
function showCreateResult(res, channelId) {
|
||||
var data = res.data || {};
|
||||
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 (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>';
|
||||
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;">';
|
||||
(data.domains.reporting || []).forEach(function (d) { html += '<li>' + d + '</li>'; });
|
||||
html += '</ul>';
|
||||
}
|
||||
html += '</div>';
|
||||
layer.open({ type: 1, title: '创建成功', area: ['560px', '420px'], content: html });
|
||||
}
|
||||
|
||||
function openForm(title, values, creating) {
|
||||
values = values || {};
|
||||
var agentBlock = isAdmin
|
||||
@@ -165,13 +188,6 @@ 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 domainsBlock = isAdmin
|
||||
? '<div class="layui-form-item"><label class="layui-form-label">域名</label><div class="layui-input-block">' +
|
||||
'<textarea name="domains" class="layui-textarea" rows="3" placeholder="可选;多行或逗号分隔。留空则展示/构建使用 CORUNA_LAB_CHANNEL_DOMAINS">' +
|
||||
(values.domains_text || '').replace(/</g, '<') + '</textarea>' +
|
||||
'<div class="layui-form-mid layui-word-aux">构建时作为 deployment_domains;API/上报域名始终用 CORUNA_REPORTING_DOMAINS</div></div></div>'
|
||||
: '';
|
||||
|
||||
var templateBlock = (isAdmin && creating)
|
||||
? '<div class="layui-form-item"><label class="layui-form-label">页面模板</label><div class="layui-input-block">' +
|
||||
'<select name="support_template">' +
|
||||
@@ -184,15 +200,15 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
area: ['560px', isAdmin ? (creating ? '580px' : '520px') : '380px'],
|
||||
area: ['560px', creating ? (isAdmin ? '520px' : '380px') : '420px'],
|
||||
content: '<form class="layui-form" style="padding:16px;" id="LAY-ch-form" lay-filter="LAY-ch-form">' +
|
||||
channelBlock + agentBlock + domainsBlock + templateBlock +
|
||||
channelBlock + 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 ? '<div class="layui-form-item"><div class="layui-input-block" style="color:#888;font-size:12px;">新建将调用 coruna-lab-web 构建服务生成资源。代理最多 ' + maxPerAgent + ' 条。</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>' : '') +
|
||||
'</form>',
|
||||
success: function () {
|
||||
form.render();
|
||||
@@ -219,7 +235,7 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
if (res.code !== 0) return layer.msg(res.msg || '失败');
|
||||
layer.close(index);
|
||||
table.reload('LAY-ch-list');
|
||||
layer.msg('已创建并生成资源');
|
||||
showCreateResult(res, data.channel_id);
|
||||
},
|
||||
error: function (xhr) {
|
||||
layer.close(load);
|
||||
@@ -239,6 +255,7 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
if (res.code !== 0) return layer.msg(res.msg || '失败');
|
||||
layer.close(index);
|
||||
table.reload('LAY-ch-list');
|
||||
layer.msg('已保存');
|
||||
},
|
||||
error: function (xhr) {
|
||||
var msg = (xhr.responseJSON && (xhr.responseJSON.msg || xhr.responseJSON.message)) || '保存失败';
|
||||
|
||||
Reference in New Issue
Block a user