From cacae6cfc7bf156780860c2226551b140e3fda60 Mon Sep 17 00:00:00 2001 From: XingQue Date: Sun, 26 Jul 2026 02:21:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=860000?= =?UTF-8?q?01=E6=9C=AC=E5=9C=B0=E5=85=9C=E5=BA=95=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=94=A8=E6=88=B7/=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- src/utils/club-context.js | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/utils/club-context.js b/src/utils/club-context.js index f10fc85..75e3085 100644 --- a/src/utils/club-context.js +++ b/src/utils/club-context.js @@ -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 = '25'; +const MENU_SESSION_VERSION = '26'; const DEFAULT_CLUB_ID = 'xq'; let menuAccessInflight = null; @@ -142,6 +142,10 @@ const KEFU_MENU_ROWS = [ { page_id: 'withdraw.audit', parent_id: 'withdraw', path: '/withdraw/audit', sort_order: 61, perm_codes: ['005bb'] }, { page_id: 'withdraw.data', parent_id: 'withdraw', path: '/withdraw/data', sort_order: 63, perm_codes: ['005bb'] }, { page_id: 'withdraw.settings', parent_id: 'withdraw', path: '/withdraw/settings', sort_order: 64, perm_codes: ['5500a', '5500b', '5500c'] }, + // 管理员:超级管理 000001 可见(不靠 perm_codes) + { page_id: 'admin.role', parent_id: 'admin', path: '/admin/role', sort_order: 71, require_super: true }, + { page_id: 'admin.user', parent_id: 'admin', path: '/admin/user', sort_order: 74, require_super: true }, + { page_id: 'admin.operation-log', parent_id: 'admin', path: '/admin/operation-log', sort_order: 75, perm_codes: ['czrz666'] }, { page_id: 'punishment', parent_id: '', path: '/punishment', sort_order: 80, perm_codes: ['005aa', '66693a', '66693b', '66693c', '66694c', '99933abs'] }, { page_id: 'gongdan', parent_id: '', path: '/gongdan', sort_order: 81, perm_codes: ['gdck666', 'gdcl666'] }, { page_id: 'product.list', parent_id: 'product', path: '/product/list', sort_order: 91, perm_codes: ['2200a'] }, @@ -157,6 +161,9 @@ const KEFU_MENU_ROWS = [ { page_id: 'miniapp.leixing', parent_id: 'miniapp', path: '/miniapp/leixing', sort_order: 115, perm_codes: ['8080a'] }, { page_id: 'miniapp.kaohe-tags', parent_id: 'miniapp', path: '/miniapp/kaohe-tags', sort_order: 116, perm_codes: ['8080a'] }, { page_id: 'miniapp.dashou-exam', parent_id: 'miniapp', path: '/miniapp/dashou-exam', sort_order: 117, perm_codes: ['dsks666', '8080a'] }, + { page_id: 'miniapp.rank-reward', parent_id: 'miniapp', path: '/miniapp/rank-reward', sort_order: 118, perm_codes: ['phbj666', '8080a'] }, + { page_id: 'miniapp.recharge-copy', parent_id: 'miniapp', path: '/miniapp/recharge-copy', sort_order: 119, perm_codes: ['8080a'] }, + { page_id: 'miniapp.withdraw-settings', parent_id: 'miniapp', path: '/withdraw/settings', sort_order: 114, perm_codes: ['5500a', '5500b', '5500c'] }, { page_id: 'shop.list', parent_id: 'shop', path: '/shop/list', sort_order: 121, perm_codes: ['999a', '999b', '999c', '999d', '999e'] }, { page_id: 'shop.withdraw', parent_id: 'shop', path: '/shop/withdraw-apply', sort_order: 122, perm_codes: ['999a', '999b', '999c', '999d', '999e'] }, { page_id: 'shop.products', parent_id: 'shop', path: '/shop/products', sort_order: 123, perm_codes: ['999a', '999b', '999c', '999d', '999e'] }, @@ -173,7 +180,7 @@ const KEFU_MENU_PARENT_IDS = { withdraw: ['withdraw.audit', 'withdraw.data', 'withdraw.settings'], product: ['product.list', 'product.type-zone', 'product.turntable', 'product.data', 'product.fake-orders'], member: ['member.list', 'member.data'], - miniapp: ['miniapp.carousel', 'miniapp.assets', 'miniapp.popup', 'miniapp.leixing', 'miniapp.kaohe-tags', 'miniapp.dashou-exam', 'miniapp.withdraw-settings'], + miniapp: ['miniapp.carousel', 'miniapp.assets', 'miniapp.popup', 'miniapp.leixing', 'miniapp.kaohe-tags', 'miniapp.dashou-exam', 'miniapp.rank-reward', 'miniapp.recharge-copy', 'miniapp.withdraw-settings'], shop: ['shop.list', 'shop.withdraw', 'shop.products'], }; @@ -232,6 +239,17 @@ export function hasMerchantOrderPerm(access) { export function canShowMenuPage(pageId) { const access = getMenuAccess(); if (!access) return false; + const codes = access.permission_codes || []; + const hasSuper = !!access.is_super || codes.includes('000001'); + + // 本店超级管理:管理员分组 / 角色管理 / 后台用户(不依赖服务端是否漏 seed) + if ( + hasSuper && + (pageId === 'admin' || pageId === 'admin.role' || pageId === 'admin.user') + ) { + return true; + } + const ids = access?.visible_page_ids; if (Array.isArray(ids) && ids.length > 0) { if (ids.includes(pageId)) return true; @@ -240,13 +258,17 @@ export function canShowMenuPage(pageId) { // 兼容尚未 seed 的新菜单:本地已定义 + 用户有对应权限(或超管) const row = KEFU_MENU_ROWS.find((r) => r.page_id === pageId); if (!row) return false; - if (access.is_super) return true; - return pageAllowedByCodes(pageId, access.permission_codes || []); + if (access.is_super || hasSuper) { + if (row.require_super) return true; + } + return pageAllowedByCodes(pageId, codes); } - if (access.is_super || access.is_group_admin) { + if (access.is_super || access.is_group_admin || hasSuper) { + const row = KEFU_MENU_ROWS.find((r) => r.page_id === pageId); + if (row?.require_super && hasSuper) return true; return !!KEFU_MENU_ROWS.find((r) => r.page_id === pageId); } - return pageAllowedByCodes(pageId, access.permission_codes || []); + return pageAllowedByCodes(pageId, codes); } /** 写入菜单缓存,并同步服务端校正后的 effective_club_id */ @@ -374,6 +396,7 @@ export const JITUAN_API = { dashouList: '/jituan/houtai/kefuhqdslb', guanshiList: '/jituan/houtai/hthqgslb', shangjiaList: '/jituan/houtai/hqsjgllb', + shangjiaAdd: '/jituan/houtai/tjsj', zuzhangList: '/jituan/houtai/hthqzzlb', operationLog: '/jituan/houtai/hqczrz', withdrawGet: '/jituan/houtai/hthqtxpz', @@ -381,6 +404,8 @@ export const JITUAN_API = { lunboList: '/jituan/houtai/lunbo-list', lunboManage: '/jituan/houtai/lunbo-manage', gonggao: '/jituan/houtai/gonggao', + rechargePageCopyGet: '/jituan/houtai/recharge-page-copy/get', + rechargePageCopySave: '/jituan/houtai/recharge-page-copy/save', tupianList: '/jituan/houtai/tupian-list', tupianManage: '/jituan/houtai/tupian-manage', popupList: '/jituan/houtai/hthqtcxx',