feat(mcp): MCP 密钥管理后台(CURD 重组 Base/App,密钥仅创建时明文展示)

This commit is contained in:
augushong
2026-08-16 20:55:02 +08:00
parent 15a6f2d841
commit 918d1d4dd5
15 changed files with 593 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
$(function(){
// add 成功响应的 data 携带一次性明文密钥secret_key
// 用独立 layer.alert 展示 + 复制按钮,替代默认的"成功提示后直接关窗"流程。
ua.listen(null, function (res) {
var secretKey = res.data && res.data.secret_key ? res.data.secret_key : '';
if (secretKey) {
var html = ''
+ '密钥已创建,<span style="color:#e74c3c;font-weight:bold;">仅展示一次,请立即复制保存</span>'
+ '<br><br>'
+ '<span style="user-select:all;word-break:break-all;font-family:monospace;font-size:14px;background:#f2f2f2;padding:8px 12px;display:inline-block;max-width:100%;">' + secretKey + '</span>'
+ '&nbsp;&nbsp;<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" data-toggle="copy-text" data-clipboard-text="' + secretKey + '"><i class="fa fa-copy"></i> 复制</button>'
+ '<br><br>'
+ '<span style="color:#999;">关闭后将无法再次查看明文,遗失只能删除后重建。</span>';
layer.alert(html, {
title: '密钥创建成功',
icon: 1,
area: ['520px', 'auto'],
success: function (layero) {
// 弹层内绑定复制按钮ClipboardJS
ua.api.copyText(layero);
}
}, function (index) {
layer.close(index);
// 关闭密钥弹窗后再走默认的关窗/刷新流程
if (ua.checkMobile()) {
location.href = ua.url(init.indexUrl);
} else {
ua.api.closeCurrentOpen({ refreshTable: true });
}
});
return false;
}
// 兜底:无 secret_key 时走默认成功流程
ua.msg.success(res.msg || '保存成功', function () {
if (ua.checkMobile()) {
location.href = ua.url(init.indexUrl);
} else {
ua.api.closeCurrentOpen({ refreshTable: true });
}
});
return false;
});
})