mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 04:29:20 +08:00
feat: 超管账户切换
This commit is contained in:
@@ -20,6 +20,7 @@ import { openWindow } from '@vben/utils';
|
||||
import { $t } from '#/locales';
|
||||
import { useAuthStore } from '#/store';
|
||||
import LoginForm from '#/views/_core/authentication/login.vue';
|
||||
import SwitchAccountModal from '#/components/SwitchAccountModal.vue';
|
||||
|
||||
const notifications = ref<NotificationItem[]>([
|
||||
{
|
||||
@@ -60,35 +61,55 @@ const showDot = computed(() =>
|
||||
notifications.value.some((item) => !item.isRead),
|
||||
);
|
||||
|
||||
const menus = computed(() => [
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(VBEN_DOC_URL, {
|
||||
target: '_blank',
|
||||
});
|
||||
// 切换账户模态框引用
|
||||
const switchAccountModalRef = ref();
|
||||
|
||||
const menus = computed(() => {
|
||||
const menuItems = [];
|
||||
|
||||
// 只有超级管理员才显示切换账户功能
|
||||
if (accessStore.userRole === 'super') {
|
||||
menuItems.push({
|
||||
handler: () => {
|
||||
switchAccountModalRef.value?.open();
|
||||
},
|
||||
icon: MdiGithub, // 临时使用现有图标
|
||||
text: '切换账户',
|
||||
});
|
||||
}
|
||||
|
||||
menuItems.push(
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(VBEN_DOC_URL, {
|
||||
target: '_blank',
|
||||
});
|
||||
},
|
||||
icon: BookOpenText,
|
||||
text: $t('ui.widgets.document'),
|
||||
},
|
||||
icon: BookOpenText,
|
||||
text: $t('ui.widgets.document'),
|
||||
},
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(VBEN_GITHUB_URL, {
|
||||
target: '_blank',
|
||||
});
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(VBEN_GITHUB_URL, {
|
||||
target: '_blank',
|
||||
});
|
||||
},
|
||||
icon: MdiGithub,
|
||||
text: 'GitHub',
|
||||
},
|
||||
icon: MdiGithub,
|
||||
text: 'GitHub',
|
||||
},
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(`${VBEN_GITHUB_URL}/issues`, {
|
||||
target: '_blank',
|
||||
});
|
||||
},
|
||||
icon: CircleHelp,
|
||||
text: $t('ui.widgets.qa'),
|
||||
},
|
||||
]);
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(`${VBEN_GITHUB_URL}/issues`, {
|
||||
target: '_blank',
|
||||
});
|
||||
},
|
||||
icon: CircleHelp,
|
||||
text: $t('ui.widgets.qa'),
|
||||
}
|
||||
);
|
||||
|
||||
return menuItems;
|
||||
});
|
||||
|
||||
const avatar = computed(() => {
|
||||
return userStore.userInfo?.avatar ?? preferences.app.defaultAvatar;
|
||||
@@ -154,4 +175,7 @@ watch(
|
||||
<LockScreen :avatar @to-login="handleLogout" />
|
||||
</template>
|
||||
</BasicLayout>
|
||||
|
||||
<!-- 切换账户模态框 -->
|
||||
<SwitchAccountModal ref="switchAccountModalRef" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user