修复:后台注册审核接口与退出流程

This commit is contained in:
2026-10-10 16:08:46 +08:00
parent 297af45fea
commit e7de04717a
14 changed files with 292 additions and 68 deletions
@@ -230,6 +230,7 @@ import { usePermission } from '@/utils/permission'
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
import { completeAdminLogout } from '@/utils/admin-logout'
import { useAdminViewport } from '@/composables/useAdminViewport'
import { adminNavigationItems, findAdminNavigationItemByPath, type AdminNavIconKey } from '@/config/admin-navigation'
import { BRAND_CONFIG } from '@/config/brand'
@@ -413,23 +414,8 @@ const handleLogout = () => {
cancelText: '取消',
onOk: async () => {
await runWithGlobalLoading(async () => {
try {
await adminAuthApi.logout()
} catch (error) {
console.error('退出失败:', error)
} finally {
localStorage.removeItem('adminAccessToken')
localStorage.removeItem('adminRefreshToken')
localStorage.removeItem('adminUserInfo')
localStorage.removeItem('accessToken')
localStorage.removeItem('refreshToken')
localStorage.removeItem('userInfo')
sessionStorage.removeItem('adminAccessToken')
sessionStorage.removeItem('accessToken')
clearPermissions()
message.success('已退出登录')
window.location.href = '/admin/login'
}
await completeAdminLogout(router)
message.success('已退出登录')
})
}
})
@@ -89,6 +89,7 @@ import { adminAuthApi } from '@/api/admin'
import { usePermission } from '@/utils/permission'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
import { completeAdminLogout } from '@/utils/admin-logout'
import {
getAdminCurrentShopName,
getAdminRoleLabel,
@@ -102,7 +103,7 @@ import {
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { userPermissions, loadUserPermissions, clearPermissions } = usePermission()
const { userPermissions, loadUserPermissions } = usePermission()
/** userInfo is a reactive state variable used by the template and event handlers. */
const userInfo = ref(loadCachedAdminUserInfo())
@@ -188,20 +189,8 @@ const handleLogout = () => {
cancelText: '取消',
onOk: async () => {
await runWithGlobalLoading(async () => {
try {
await adminAuthApi.logout()
} catch (error) {
console.error('退出失败:', error)
} finally {
localStorage.removeItem('adminAccessToken')
localStorage.removeItem('adminRefreshToken')
localStorage.removeItem('adminUserInfo')
localStorage.removeItem('userPermissions')
sessionStorage.removeItem('adminAccessToken')
clearPermissions()
message.success('已退出登录')
window.location.href = '/admin/login'
}
await completeAdminLogout(router)
message.success('已退出登录')
})
}
})
@@ -2,7 +2,13 @@
<div class="registration-page">
<a-page-header title="工作台注册审核" sub-title="审核店长注册申请" />
<a-card :bordered="false">
<a-table :columns="columns" :data-source="applications" :loading="loading" row-key="id">
<a-table
:columns="columns"
:data-source="applications"
:loading="loading"
:scroll="{ x: 'max-content' }"
row-key="id"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'roleType'">{{ record.roleType === 'MANAGER' ? '店长' : '店员' }}</template>
<template v-else-if="column.key === 'status'">{{ statusLabel(record.status) }}</template>
@@ -68,7 +68,7 @@ describe('web theme governance', () => {
it('keeps frontend and backend platform overview permission allowlists aligned', () => {
const frontend = readSource('utils/platform-admin-permissions.ts')
const backend = readFileSync(join(coreRoot, 'com', 'xiaowang', 'fingertipdesigner', 'core', 'modules', 'security', 'support', 'PermissionCatalog.java'), 'utf-8')
const backend = readFileSync(join(coreRoot, 'com', 'xiaowang', 'jacyucloudsalon', 'core', 'modules', 'security', 'support', 'PermissionCatalog.java'), 'utf-8')
expect(backend).toContain('"security:audit:view"')
expect(frontend).toContain("'security:audit:view'")