feat: add local fallback for S3 writes

This commit is contained in:
237899745
2026-07-25 16:29:05 +08:00
parent 63744c6d2f
commit 0fe3d4ce8e
11 changed files with 169 additions and 58 deletions

View File

@@ -8,6 +8,8 @@ const auth = useAuthStore()
const router = useRouter()
const isLoggedIn = computed(() => auth.isLoggedIn)
const consoleRoute = computed(() => (auth.user?.role === 'admin' ? '/admin' : '/dashboard'))
const consoleLabel = computed(() => (auth.user?.role === 'admin' ? '管理后台' : '控制台'))
function logout() {
auth.logout()
@@ -35,10 +37,10 @@ function logout() {
<div class="flex items-center gap-3">
<template v-if="isLoggedIn">
<RouterLink
to="/dashboard"
:to="consoleRoute"
class="rounded-md border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-700 hover:bg-slate-50"
>
控制台
{{ consoleLabel }}
</RouterLink>
<button
type="button"

View File

@@ -81,7 +81,7 @@ export function createAppRouter(pinia: Pinia) {
}
if ((to.name === 'login' || to.name === 'register') && auth.isLoggedIn) {
return { name: 'dashboard' }
return { name: auth.user?.role === 'admin' ? 'admin' : 'dashboard' }
}
if (to.meta?.requiresAdmin && auth.user?.role !== 'admin') {