diff --git a/apps/admin/src/router/index.ts b/apps/admin/src/router/index.ts index ae2b6d2..5dc7688 100644 --- a/apps/admin/src/router/index.ts +++ b/apps/admin/src/router/index.ts @@ -32,10 +32,15 @@ const router = createRouter({ routes, }) -router.beforeEach((to) => { +router.beforeEach(async (to) => { const authStore = useAuthStore() const isPublic = to.meta?.public === true + // 会话在 HttpOnly cookie 里:刷新后先经 /auth/me 恢复登录态,再判定是否放行 + if (!authStore.isLoggedIn && !isPublic) { + await authStore.ensureSessionChecked() + } + if (!authStore.isLoggedIn && !isPublic) { return { path: '/login', replace: true } } diff --git a/apps/admin/src/views/goods/components/GoodsEditDialog.vue b/apps/admin/src/views/goods/components/GoodsEditDialog.vue index 0303ee2..4136a37 100644 --- a/apps/admin/src/views/goods/components/GoodsEditDialog.vue +++ b/apps/admin/src/views/goods/components/GoodsEditDialog.vue @@ -264,20 +264,6 @@ async function saveMemberPrices(row: { id: string }) { } finally { memberPriceSaving.value = '' } } -async function resetMemberPrice(row: { id: string }, cell: any) { - memberPriceSaving.value = row.id - try { - await productFamiliesApi.deleteOverrides(editFamilyId.value, [ - { sizeId: cell.sizeId, colorId: cell.colorId, craft: cell.craft, logistics: cell.logistics }, - ]) - ElMessage.success('已恢复推导价') - await loadEditFamily() - emit('changed') - } catch (e: any) { - ElMessage.error(e?.response?.data?.message || '恢复失败') - } finally { memberPriceSaving.value = '' } -} - function initEditFamily(family: { familyId?: string; familyCode?: string | null } | null) { editFamilyId.value = family?.familyId ?? '' editFamilyCode.value = family?.familyCode ?? null @@ -610,7 +596,6 @@ async function handleDeleteGood() {