refactor(js): 复制成功toast文案收敛为toastCopied统一口径

This commit is contained in:
萝卜
2026-03-17 17:37:25 +08:00
parent 5a72d89e6f
commit c245d872ca
2 changed files with 36 additions and 2 deletions

View File

@@ -594,6 +594,20 @@
return toast('error', text, 9000);
}
// 复制反馈文案统一口径(更像后台系统的短反馈,不塞超长 URL
function toastCopied(label, detail) {
var l = String(label || '').trim();
var d = String(detail || '').trim();
var msg = '已复制';
if (l) {
msg += l;
}
if (d) {
msg += '' + d;
}
return toastSuccess(msg);
}
// 通用:按钮短暂反馈(已复制/复制失败)并自动恢复
// 说明:用于复制 run_id / 复制治理链接,避免两套口径漂移。
function tempButtonFeedback(btn, ok, origAttr) {
@@ -638,7 +652,7 @@
copyToClipboard(runId).then(function(){
markCopiedRunId(true);
// 成功反馈优先 toast若 toast 不可用也无需 alert按钮已提供“已复制”短反馈
toastSuccess('已复制 run_id' + runId);
toastCopied('run_id', runId);
}).catch(function(){
markCopiedRunId(false);
if (toastError('复制失败,请手动复制 run_id' + runId)) {
@@ -679,7 +693,7 @@
copyToClipboard(abs).then(function(){
markCopied(btn, true);
// 成功反馈优先 toast若 toast 不可用也无需 alert按钮已提供“已复制”短反馈
toastSuccess('已复制' + label + '链接');
toastCopied(label + '链接', '');
}).catch(function(){
markCopied(btn, false);
if (toastError('复制失败,请手动复制' + label + '链接')) {