feat(batch): 批次页治理入口增加复制链接按钮
This commit is contained in:
@@ -546,6 +546,36 @@
|
||||
});
|
||||
}
|
||||
|
||||
function toastSuccess(text) {
|
||||
try {
|
||||
var container = qs('[data-role="toast-container"]');
|
||||
if (!container) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var t = document.createElement('div');
|
||||
t.className = 'toast toast-success';
|
||||
t.setAttribute('role', 'status');
|
||||
|
||||
var c = document.createElement('div');
|
||||
c.className = 'toast-content';
|
||||
c.textContent = String(text || '');
|
||||
|
||||
t.appendChild(c);
|
||||
container.appendChild(t);
|
||||
|
||||
setTimeout(function () {
|
||||
try {
|
||||
container.removeChild(t);
|
||||
} catch (e) {}
|
||||
}, 2500);
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 批次页:一键复制 run_id(渐进增强)
|
||||
(function(){
|
||||
var btn = qs('[data-action="copy-run-id"][data-run-id]');
|
||||
@@ -554,25 +584,9 @@
|
||||
btn.addEventListener('click', function(){
|
||||
var runId = btn.getAttribute('data-run-id') || '';
|
||||
copyToClipboard(runId).then(function(){
|
||||
// 复用 toast 容器(若不存在则降级 alert)
|
||||
try {
|
||||
var container = qs('[data-role="toast-container"]');
|
||||
if(container){
|
||||
var t = document.createElement('div');
|
||||
t.className = 'toast toast-success';
|
||||
t.setAttribute('role','status');
|
||||
var c = document.createElement('div');
|
||||
c.className = 'toast-content';
|
||||
c.textContent = '已复制 run_id:' + runId;
|
||||
t.appendChild(c);
|
||||
container.appendChild(t);
|
||||
setTimeout(function(){
|
||||
try{ container.removeChild(t);}catch(e){}
|
||||
}, 2500);
|
||||
return;
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
if (toastSuccess('已复制 run_id:' + runId)) {
|
||||
return;
|
||||
}
|
||||
try { window.alert('已复制 run_id:' + runId); } catch (e) {}
|
||||
}).catch(function(){
|
||||
try { window.alert('复制失败,请手动复制 run_id:' + runId); } catch (e) {}
|
||||
@@ -580,6 +594,26 @@
|
||||
});
|
||||
})();
|
||||
|
||||
// 批次页:一键复制治理集合链接(例如:本批次失败 / 按Top原因)
|
||||
(function(){
|
||||
var btns = document.querySelectorAll('[data-action="copy-link"][data-href]');
|
||||
if(!btns || btns.length === 0){return;}
|
||||
|
||||
btns.forEach(function(btn){
|
||||
btn.addEventListener('click', function(){
|
||||
var href = btn.getAttribute('data-href') || '';
|
||||
copyToClipboard(href).then(function(){
|
||||
if (toastSuccess('已复制链接')) {
|
||||
return;
|
||||
}
|
||||
try { window.alert('已复制链接'); } catch (e) {}
|
||||
}).catch(function(){
|
||||
try { window.alert('复制失败,请手动复制链接'); } catch (e) {}
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
// 续费缺订阅治理:订单详情页“绑定订阅ID”输入框,小交互增强:
|
||||
// - 输入后按 Enter 直接提交
|
||||
// - 自动聚焦,减少点击
|
||||
|
||||
Reference in New Issue
Block a user