diff --git a/desktop-client/src/App.vue b/desktop-client/src/App.vue index c48dfaf..1c5735e 100644 --- a/desktop-client/src/App.vue +++ b/desktop-client/src/App.vue @@ -151,6 +151,11 @@ const contextMenu = reactive({ y: 0, item: null as FileItem | null, }); +const shareDeleteDialog = reactive({ + visible: false, + loading: false, + share: null as ShareItem | null, +}); const dropState = reactive({ active: false, uploading: false, @@ -1073,9 +1078,20 @@ async function createDirectLinkForItem(current: FileItem, silent = false) { throw new Error(String(response.data?.message || "创建直链失败")); } +function requestDeleteShare(share: ShareItem) { + if (shareDeleteDialog.loading) return; + shareDeleteDialog.share = share; + shareDeleteDialog.visible = true; +} + +function closeDeleteShareDialog(force = false) { + if (shareDeleteDialog.loading && !force) return; + shareDeleteDialog.visible = false; + shareDeleteDialog.loading = false; + shareDeleteDialog.share = null; +} + async function deleteShare(share: ShareItem) { - const confirmed = window.confirm(`确认删除分享 ${share.share_code} 吗?`); - if (!confirmed) return; const response = await invokeBridge("api_delete_share", { baseUrl: appConfig.baseUrl, shareId: share.id, @@ -1083,9 +1099,27 @@ async function deleteShare(share: ShareItem) { if (response.ok && response.data?.success) { showToast("分享已删除", "success"); await loadShares(true); - return; + return true; } showToast(response.data?.message || "删除分享失败", "error"); + return false; +} + +async function confirmDeleteShare() { + const share = shareDeleteDialog.share; + if (!share || shareDeleteDialog.loading) return; + + shareDeleteDialog.loading = true; + try { + const ok = await deleteShare(share); + if (ok) { + closeDeleteShareDialog(true); + return; + } + shareDeleteDialog.loading = false; + } catch { + shareDeleteDialog.loading = false; + } } async function copyShareLink(share: ShareItem) { @@ -1955,7 +1989,7 @@ onBeforeUnmount(() => {
- +
@@ -2197,6 +2231,22 @@ onBeforeUnmount(() => { +
+
+

确认删除分享

+

+ 确认删除分享码 {{ shareDeleteDialog.share?.share_code || "-" }} 吗? + 删除后外链将立即失效。 +

+
+ + +
+
+
+
{{ toast.message }}
@@ -3163,6 +3213,46 @@ select:focus { margin: 6px 4px; } +.confirm-mask { + position: fixed; + inset: 0; + z-index: 1200; + background: rgba(20, 33, 54, 0.42); + display: grid; + place-items: center; + padding: 20px; +} + +.confirm-card { + width: min(460px, 100%); + border-radius: 14px; + background: #fff; + border: 1px solid #d7e2f0; + box-shadow: 0 16px 36px rgba(30, 52, 88, 0.2); + padding: 18px; + display: grid; + gap: 10px; +} + +.confirm-card h4 { + margin: 0; + font-size: 16px; + color: #203043; +} + +.confirm-card p { + margin: 0; + color: #4f6784; + line-height: 1.6; + font-size: 13px; +} + +.confirm-actions { + display: flex; + justify-content: flex-end; + gap: 8px; +} + .detail-panel h3 { margin: 0; font-size: 16px;