@@ -324,7 +324,7 @@ const router = createRouter({
|
||||
|
||||
/** 详情页等子路由:父模块在 visible_paths 中即允许访问 */
|
||||
function isRouteAllowed(path, visiblePaths) {
|
||||
if (!visiblePaths?.length) return true
|
||||
if (!visiblePaths?.length) return false
|
||||
if (visiblePaths.some((p) => p && (path === p || path.startsWith(`${p}/`)))) {
|
||||
return true
|
||||
}
|
||||
@@ -372,12 +372,16 @@ router.beforeEach(async (to, from, next) => {
|
||||
|
||||
const access = getMenuAccess()
|
||||
|
||||
if (!isMenuSessionFresh()) {
|
||||
if (to.path === '/welcome') {
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
if (to.path === '/welcome') {
|
||||
if (!access || !isMenuSessionFresh()) {
|
||||
if (to.path !== '/welcome') {
|
||||
next('/welcome')
|
||||
return
|
||||
}
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ const CLUB_SCOPE_KEY = 'admin_club_scope';
|
||||
const CLUB_CONTEXT_KEY = 'admin_club_context';
|
||||
const MENU_ACCESS_KEY = 'kefu_menu_access';
|
||||
const MENU_SESSION_KEY = 'kefu_menu_session_v';
|
||||
const MENU_SESSION_VERSION = '12';
|
||||
const MENU_SESSION_VERSION = '13';
|
||||
const DEFAULT_CLUB_ID = 'xq';
|
||||
|
||||
let menuAccessInflight = null;
|
||||
@@ -41,6 +41,8 @@ export function mergeServerClubContext(serverCtx) {
|
||||
}
|
||||
} else if (prevScope === 'all' && serverCtx.is_group_admin) {
|
||||
scopeKey = 'all';
|
||||
} else if (!allowedIds.has(clubId) && allowedIds.size > 0) {
|
||||
clubId = serverCtx.club_id || [...allowedIds][0] || DEFAULT_CLUB_ID;
|
||||
}
|
||||
|
||||
const merged = {
|
||||
@@ -102,8 +104,7 @@ export function isMenuSessionFresh() {
|
||||
}
|
||||
|
||||
export function shouldShowAllMenus(access) {
|
||||
if (!isMenuSessionFresh()) return true;
|
||||
if (!access) return true;
|
||||
if (!access) return false;
|
||||
if (Array.isArray(access.visible_page_ids) && access.visible_page_ids.length > 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -113,7 +114,7 @@ export function shouldShowAllMenus(access) {
|
||||
if (Array.isArray(access.permission_codes) && access.permission_codes.length > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** ??? kefu_menu_definitions ???visible_paths ???? permission_codes ?? */
|
||||
|
||||
@@ -526,10 +526,11 @@ const clubRoleBlocks = computed(() => {
|
||||
})
|
||||
|
||||
const visibleClubRoleBlocks = computed(() => {
|
||||
if (canManageClubAssignments.value) {
|
||||
return clubRoleBlocks.value
|
||||
}
|
||||
return clubRoleBlocks.value.filter((b) => canManageRolesForClub(b.club_id))
|
||||
return clubRoleBlocks.value.filter((b) => {
|
||||
const cid = b.club_id || ''
|
||||
if (canManageClubAssignments.value) return true
|
||||
return manageableClubIds.value.includes(cid)
|
||||
})
|
||||
})
|
||||
|
||||
// 添加用户弹窗
|
||||
|
||||
Reference in New Issue
Block a user