diff --git a/public/js/admin.js b/public/js/admin.js index a135e4a..27909b3 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -643,6 +643,9 @@ try { window.alert('已复制 run_id:' + runId); } catch (e) {} }).catch(function(){ markCopiedRunId(false); + if (toastError('复制失败,请手动复制 run_id:' + runId)) { + return; + } try { window.alert('复制失败,请手动复制 run_id:' + runId); } catch (e) {} }); }); @@ -684,6 +687,9 @@ try { window.alert('已复制' + label + '链接'); } catch (e) {} }).catch(function(){ markCopied(btn, false); + if (toastError('复制失败,请手动复制' + label + '链接')) { + return; + } try { window.alert('复制失败,请手动复制' + label + '链接'); } catch (e) {} }); }); diff --git a/tests/Feature/AdminJsCopyFailuresShouldUseToastErrorFirstTest.php b/tests/Feature/AdminJsCopyFailuresShouldUseToastErrorFirstTest.php new file mode 100644 index 0000000..6a13389 --- /dev/null +++ b/tests/Feature/AdminJsCopyFailuresShouldUseToastErrorFirstTest.php @@ -0,0 +1,20 @@ +assertIsString($js); + + // 复制失败时应优先 toastError(alert 作为降级) + $this->assertStringContainsString("toastError('复制失败", $js); + } +}