fix(菜单): 切换无任何权限项目时重置顶部菜单

This commit is contained in:
baiqi 2024-07-23 13:47:19 +08:00 committed by 刘瑞斌
parent ee7b31d7e2
commit 5253ae532b
4 changed files with 9 additions and 12 deletions

View File

@ -1,12 +1,12 @@
<template> <template>
<a-menu <a-menu
v-show="appStore.topMenus.length > 0" v-show="appStore.getTopMenus.length > 0"
v-model:selected-keys="activeMenus" v-model:selected-keys="activeMenus"
class="bg-transparent" class="bg-transparent"
mode="horizontal" mode="horizontal"
@menu-item-click="menuClickHandler" @menu-item-click="menuClickHandler"
> >
<a-menu-item v-for="menu of appStore.topMenus" :key="(menu.name as string)" @click="jumpPath(menu.name)"> <a-menu-item v-for="menu of appStore.getTopMenus" :key="(menu.name as string)" @click="jumpPath(menu.name)">
{{ t(menu.meta?.locale || '') }} {{ t(menu.meta?.locale || '') }}
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
@ -99,7 +99,6 @@
appStore.setTopMenus(filterMenuTopRouter); appStore.setTopMenus(filterMenuTopRouter);
setCurrentTopMenu(name as string); setCurrentTopMenu(name as string);
return; return;
} }
} }

View File

@ -253,12 +253,7 @@
projectId: value as string, projectId: value as string,
userId: userStore.id || '', userId: userStore.id || '',
}); });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
await userStore.checkIsLogin(true); await userStore.checkIsLogin(true);
appStore.hideLoading();
router.replace({ router.replace({
name: getFirstRouteNameByPermission(router.getRoutes()), name: getFirstRouteNameByPermission(router.getRoutes()),
query: { query: {
@ -266,6 +261,11 @@
pId: value as string, pId: value as string,
}, },
}); });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
appStore.hideLoading();
} }
} }

View File

@ -44,7 +44,7 @@
prompt: 'consent', prompt: 'consent',
}, },
async (loginResult) => { async (loginResult) => {
const { redirectUrl, authCode, state } = loginResult; const { authCode } = loginResult;
const dingCallback = getDingCallback(authCode); const dingCallback = getDingCallback(authCode);
userStore.qrCodeLogin(await dingCallback); userStore.qrCodeLogin(await dingCallback);
setLongType('DING_TALK'); setLongType('DING_TALK');
@ -76,9 +76,8 @@
// 使code // 使code
}, },
(errorMsg) => { (errorMsg) => {
Message.error(`errorMsg of errorCbk: ${errorMsg}`);
// ,使toast // ,使toast
console.error(`errorMsg of errorCbk: ${errorMsg}`); Message.error(`errorMsg of errorCbk: ${errorMsg}`);
} }
); );
}; };

View File

@ -77,7 +77,6 @@
}, },
onLoginFail(err: WWLoginErrorResp) { onLoginFail(err: WWLoginErrorResp) {
Message.error(`errorMsg of errorCbk: ${err.errMsg}`); Message.error(`errorMsg of errorCbk: ${err.errMsg}`);
console.log(err);
}, },
}); });
}; };