Commit e52b0c3e by 张立顺

fix 逻辑修改

1 parent aca7c7f4
...@@ -81,12 +81,18 @@ function handleSpecialMenuFilter(menus, merchant) { ...@@ -81,12 +81,18 @@ function handleSpecialMenuFilter(menus, merchant) {
if (!config) { if (!config) {
return menus return menus
} }
console.log('config', config, merchant, location)
const { accountName, merchantName } = merchant || {} const { accountName, merchantName } = merchant || {}
// 检查是否满足特殊账号条件 // 检查是否满足特殊账号条件
const isSpecialAccount = accountName === config.accountName && merchantName === config.merchantName && location.pathname === config.pathname const isSpecialAccount = accountName === config.accountName && merchantName === config.merchantName && location.pathname === config.pathname
console.log(isSpecialAccount, Array.isArray(menus))
// console.log((isSpecialAccount = accountName === config.accountName && merchantName === config.merchantName && location.pathname === config.pathname))
if (isSpecialAccount && Array.isArray(menus)) { if (isSpecialAccount && Array.isArray(menus)) {
// 1. 过滤逻辑:只留下 label == "客户" 的菜单 // 1. 过滤逻辑:只留下 label == "客户" 的菜单(兼容 null/undefined)
const filteredMenus = menus.filter(item => item.label === config.keepLabel) const normalizedMenus = menus.filter(Boolean)
const filteredMenus = normalizedMenus.filter(item => item?.label === config.keepLabel)
// 如果过滤后为空,回退为原菜单,避免后续流程异常
if (!filteredMenus.length) return menus
// 2. 新增菜单 (TODO: 请根据实际菜单数据结构配置以下内容) // 2. 新增菜单 (TODO: 请根据实际菜单数据结构配置以下内容)
const findByLabel = (list, label) => { const findByLabel = (list, label) => {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!