mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
44 lines
2.1 KiB
PHP
44 lines
2.1 KiB
PHP
$(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>'
|
||
+ ' <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;
|
||
});
|
||
})
|