From 9b46e5c76bde7ac8f8d2f59018ffe4b19c3aad59 Mon Sep 17 00:00:00 2001 From: hashbro Date: Mon, 5 Oct 2026 06:43:05 +0800 Subject: [PATCH] feat: app --- .../views/admin/channels/index.blade.php | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/resources/views/admin/channels/index.blade.php b/resources/views/admin/channels/index.blade.php index a8ff6fb..01b0c8e 100644 --- a/resources/views/admin/channels/index.blade.php +++ b/resources/views/admin/channels/index.blade.php @@ -208,16 +208,16 @@ layui.use(['table', 'form', 'layer'], function () { '' : ''; - // Channel ID block: App=auto UUID (readonly); old=auto 32-hex (readonly); new=X.Y.ZZ input + // Channel ID block: App=UUID (blank=auto); old=32-hex (blank=auto); new=X.Y.ZZ input var isOld = values.builder_type === 'old'; var channelBlock = creating ? (isApp ? '
' + - '' + + '' + '
' : (isOld ? '
' + - '' + + '' + '
' : '
' + '' + @@ -262,7 +262,7 @@ layui.use(['table', 'form', 'layer'], function () { if (res.code === 0) $('#LAY-ch-form input[name=channel_id]').val(res.data.channel_id); }); }); - // Auto-generate UUID when switching to App; 32-hex when switching to Old + // Update channel ID input hints when switching builder type (blank = auto-generate) form.on('select(LAY-ch-builder-type)', function (data) { var v = data.value; var isAppNow = v === 'app'; @@ -271,21 +271,11 @@ layui.use(['table', 'form', 'layer'], function () { $('.LAY-ch-new-only').toggle(!isAppNow); // template shown for new + old var idInput = $('#LAY-ch-id-input'); if (isAppNow) { - idInput.attr('readonly', true).attr('maxlength', '').attr('placeholder', '自动生成 UUID'); - if (!idInput.val()) { - $.getJSON(@json(route('admin.channels.randomId')) + '?builder_type=app', function (res) { - if (res.code === 0) idInput.val(res.data.channel_id); - }); - } + idInput.attr('maxlength', '').attr('placeholder', '留空自动生成 UUID'); } else if (isOldNow) { - idInput.attr('readonly', true).attr('maxlength', '').attr('placeholder', '自动生成 32 位 hex'); - if (!idInput.val()) { - $.getJSON(@json(route('admin.channels.randomId')) + '?builder_type=old', function (res) { - if (res.code === 0) idInput.val(res.data.channel_id); - }); - } + idInput.attr('maxlength', '').attr('placeholder', '留空自动生成 32 位 hex'); } else { - idInput.removeAttr('readonly').attr('maxlength', '6').attr('placeholder', '例如 A.B.C1 或 3.1.07').val(''); + idInput.attr('maxlength', '6').attr('placeholder', '例如 A.B.C1 或 3.1.07').val(''); } }); }, @@ -310,7 +300,7 @@ layui.use(['table', 'form', 'layer'], function () { CorunaFilterOptions.apply(form); } table.reload('LAY-ch-list'); - showCreateResult(res, data.channel_id); + showCreateResult(res, data.channel_id || (res.data && res.data.channel_id) || ''); }, error: function (xhr) { layer.close(load);