fix: 侧栏仅展示服务端visible_page_ids,无权限不显示商家订单
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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 = '18';
|
||||
const MENU_SESSION_VERSION = '19';
|
||||
const DEFAULT_CLUB_ID = 'xq';
|
||||
|
||||
let menuAccessInflight = null;
|
||||
@@ -196,13 +196,7 @@ function pageAllowedByCodes(pageId, codes) {
|
||||
export function getEffectiveVisiblePaths(access = null) {
|
||||
const a = access || getMenuAccess();
|
||||
const paths = a?.visible_paths;
|
||||
if (Array.isArray(paths) && paths.length > 0) {
|
||||
return paths;
|
||||
}
|
||||
if (Array.isArray(a?.visible_page_ids) && a.visible_page_ids.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return pathsFromPermissionCodes(a?.permission_codes || []);
|
||||
return Array.isArray(paths) ? paths : [];
|
||||
}
|
||||
|
||||
export function hasPermCode(access, ...codes) {
|
||||
@@ -215,22 +209,10 @@ export function canShowMenuPage(pageId) {
|
||||
const access = getMenuAccess();
|
||||
if (!access) return false;
|
||||
const ids = access?.visible_page_ids;
|
||||
if (Array.isArray(ids) && ids.length > 0) {
|
||||
if (ids.includes(pageId)) return true;
|
||||
const children = KEFU_MENU_PARENT_IDS[pageId];
|
||||
return children ? children.some((id) => ids.includes(id)) : false;
|
||||
}
|
||||
const paths = access?.visible_paths;
|
||||
if (Array.isArray(paths) && paths.length > 0) {
|
||||
const row = KEFU_MENU_ROWS.find((r) => r.page_id === pageId);
|
||||
if (row?.path && paths.includes(row.path)) return true;
|
||||
}
|
||||
if (Array.isArray(ids) && ids.length === 0) return false;
|
||||
const row = KEFU_MENU_ROWS.find((r) => r.page_id === pageId);
|
||||
if (row?.perm_codes?.length) {
|
||||
return hasPermCode(access, ...row.perm_codes);
|
||||
}
|
||||
return false;
|
||||
if (!Array.isArray(ids) || ids.length === 0) return false;
|
||||
if (ids.includes(pageId)) return true;
|
||||
const children = KEFU_MENU_PARENT_IDS[pageId];
|
||||
return children ? children.some((id) => ids.includes(id)) : false;
|
||||
}
|
||||
|
||||
export function getFirstVisiblePath() {
|
||||
|
||||
@@ -260,6 +260,7 @@ const fetchOrders = async () => {
|
||||
}
|
||||
} else if (res.code === 403) {
|
||||
hasPermission.value = false
|
||||
ElMessage.warning(res.msg || '当前俱乐部无商家订单权限')
|
||||
} else {
|
||||
ElMessage.error(res.msg || '获取订单列表失败')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user