feat: add useradmin role -运营管理员权限,支持管理用户/订单/风控等

This commit is contained in:
root
2026-05-11 15:11:10 +00:00
parent 3d7e7b78cf
commit 18c3a8b3ad
6 changed files with 14 additions and 7 deletions
+2 -2
View File
@@ -765,8 +765,8 @@ router.beforeEach((to, _from, next) => {
return
}
// Check admin requirement
if (requiresAdmin && !authStore.isAdmin) {
// Check admin requirement (requires admin role, not useradmin)
if (requiresAdmin && !authStore.isSuperAdmin) {
// User is authenticated but not admin, redirect to user dashboard
next('/dashboard')
return
+5
View File
@@ -87,6 +87,10 @@ export const useAuthStore = defineStore('auth', () => {
})
const isAdmin = computed(() => {
return user.value?.role === 'admin' || user.value?.role === 'useradmin'
})
const isSuperAdmin = computed(() => {
return user.value?.role === 'admin'
})
@@ -476,6 +480,7 @@ export const useAuthStore = defineStore('auth', () => {
// Computed
isAuthenticated,
isAdmin,
isSuperAdmin,
isSimpleMode,
hasPendingAuthSession,