From da924492cecdff747bce3645e008d00a419fb4ff Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Mon, 21 Sep 2026 23:08:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(sync):=20=E6=81=A2=E5=A4=8D=E3=80=8C?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC=E3=80=8D?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=BC=B9=E7=AA=97=20+=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20sync-btn=20=E6=A0=B7=E5=BC=8F=E5=9B=9E=E5=BD=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:commit 765d9f5 意外覆盖了 ac1e36e 中的自定义弹窗代码 修复内容: 1. 恢复自定义确认弹窗(sync-confirm):毛玻璃遮罩 + 圆角卡片 + pld-btn 按钮 2. 恢复自定义结果弹窗(sync-result):成功/失败变色 + 滚动详情区域 3. 恢复 confirmSyncLatest / closeSyncConfirm / closeSyncResult 等函数 4. 恢复弹窗 CSS 样式(.sync-mask/.sync-confirm/.sync-result/.pld-btn) 5. 修复 sync-btn 样式回归:运行态透明背景 + 无阴影,旋转动画移到内部 span --- frontend/src/views/SearchView.vue | 127 ++++++++++++++++++++++++------ 1 file changed, 105 insertions(+), 22 deletions(-) diff --git a/frontend/src/views/SearchView.vue b/frontend/src/views/SearchView.vue index 430f5c4..596eebd 100644 --- a/frontend/src/views/SearchView.vue +++ b/frontend/src/views/SearchView.vue @@ -241,18 +241,20 @@ async function onCleanConfirmed(res) { // —— 一键拉取存量包最新版本 —— const summaryShown = ref(false) -async function doSyncLatest() { - const sp = state.syncProgress - if (sp.running) return - try { - await ElMessageBox.confirm( - '将查询上游 npm registry,为存量包拉取每个包的最新版本(已缓存最新版会自动跳过)。', - '拉取最新版本', - { type: 'info', confirmButtonText: '开始拉取', cancelButtonText: '取消', closeOnClickModal: false }, - ) - } catch { - return // 用户取消 - } +const syncConfirmOpen = ref(false) +const syncResultOpen = ref(false) +const syncResultDetail = ref('') +const syncResultFailed = ref(false) + +function openSyncConfirm() { + if (state.syncProgress.running) return + syncConfirmOpen.value = true +} +function closeSyncConfirm() { + syncConfirmOpen.value = false +} +async function confirmSyncLatest() { + closeSyncConfirm() summaryShown.value = false const res = await syncLatest() if (!res.ok) return @@ -263,6 +265,10 @@ async function doSyncLatest() { // 任务异步执行,完成后由下方 watch 弹出汇总 } +function closeSyncResult() { + syncResultOpen.value = false +} + watch( () => state.syncProgress.running, async (running, prev) => { @@ -274,18 +280,17 @@ watch( detail.push(`❌ 拉取失败 ${sp.failed} 个`) if (sp.failedList.length) detail.push(`失败明细:\n${sp.failedList.map(f => `· ${f}`).join('\n')}`) } - try { - await ElMessageBox.alert(detail.join('\n'), sp.failed ? '拉取完成(部分失败)' : '拉取完成', { - confirmButtonText: '知道了', - type: sp.failed ? 'warning' : 'success', - }) - } catch { - /* 用户关闭弹窗无需处理 */ - } + syncResultDetail.value = detail.join('\n') + syncResultFailed.value = !!sp.failed + syncResultOpen.value = true } }, ) +async function doSyncLatest() { + openSyncConfirm() +} + // —— npm 包清单:查看/编辑入口 + 按清单手动拉取(后台执行,失败自动重试 3 次) —— const pkgListOpen = ref(false) const pullLoading = ref(null) @@ -424,7 +429,9 @@ const pendingCount = computed(() => state.pkgList.items.filter(i => i.status === :class="{ on: state.syncProgress.running }" :title="state.syncProgress.running ? `正在拉取… ${state.syncProgress.processed}/${state.syncProgress.total}` : '一键拉取存量包最新版本'" @click.stop="doSyncLatest" - >{{ state.syncProgress.running ? '⏳' : '📥' }} + > + {{ state.syncProgress.running ? '⏳' : '📥' }} +
@@ -525,6 +532,33 @@ const pendingCount = computed(() => state.pkgList.items.filter(i => i.status === @confirmed="onCleanConfirmed" /> + + + +
+
+
拉取最新版本
+
将查询上游 npm registry,为存量包拉取每个包的最新版本(已缓存最新版会自动跳过)。
+
+ + +
+
+
+
+ + + +
+
+
{{ syncResultFailed ? '拉取完成(部分失败)' : '拉取完成' }}
+
{{ syncResultDetail }}
+
+ +
+
+
+