chore: basic router
parent
30f9f11bb7
commit
5c03ae9605
|
@ -224,5 +224,5 @@
|
|||
"vue.server.hybridMode": true,
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"oxc.enable": false,
|
||||
"cSpell.words": ["Yudao", "xingyu", "xingyuv"]
|
||||
"cSpell.words": ["Gitee", "xingyu", "xingyuv", "Yudao"]
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
import type { NotificationItem } from '@vben/layouts';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
||||
import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants';
|
||||
import { VBEN_DOC_URL } from '@vben/constants';
|
||||
import { useWatermark } from '@vben/hooks';
|
||||
import { BookOpenText, CircleHelp, MdiGithub } from '@vben/icons';
|
||||
import { BookOpenText, CircleHelp, Info, MdiGithub } from '@vben/icons';
|
||||
import {
|
||||
BasicLayout,
|
||||
LockScreen,
|
||||
|
@ -21,6 +22,8 @@ import { $t } from '#/locales';
|
|||
import { useAuthStore } from '#/store';
|
||||
import LoginForm from '#/views/_core/authentication/login.vue';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const notifications = ref<NotificationItem[]>([
|
||||
{
|
||||
avatar: 'https://avatar.vercel.sh/vercel.svg?text=VB',
|
||||
|
@ -61,6 +64,13 @@ const showDot = computed(() =>
|
|||
);
|
||||
|
||||
const menus = computed(() => [
|
||||
{
|
||||
handler: () => {
|
||||
router.push('/profile/index');
|
||||
},
|
||||
icon: Info,
|
||||
text: '个人中心',
|
||||
},
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(VBEN_DOC_URL, {
|
||||
|
@ -72,16 +82,16 @@ const menus = computed(() => [
|
|||
},
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(VBEN_GITHUB_URL, {
|
||||
openWindow('https://gitee.com/yudaocode/yudao-ui-admin-vben', {
|
||||
target: '_blank',
|
||||
});
|
||||
},
|
||||
icon: MdiGithub,
|
||||
text: 'GitHub',
|
||||
text: 'Gitee',
|
||||
},
|
||||
{
|
||||
handler: () => {
|
||||
openWindow(`${VBEN_GITHUB_URL}/issues`, {
|
||||
openWindow(`https://gitee.com/yudaocode/yudao-ui-admin-vben/issues`, {
|
||||
target: '_blank',
|
||||
});
|
||||
},
|
||||
|
@ -91,7 +101,7 @@ const menus = computed(() => [
|
|||
]);
|
||||
|
||||
const avatar = computed(() => {
|
||||
return userStore.userInfo?.avatar ?? preferences.app.defaultAvatar;
|
||||
return userStore.userInfo?.user.avatar ?? preferences.app.defaultAvatar;
|
||||
});
|
||||
|
||||
async function handleLogout() {
|
||||
|
@ -128,9 +138,8 @@ watch(
|
|||
<UserDropdown
|
||||
:avatar
|
||||
:menus
|
||||
:text="userStore.userInfo?.realName"
|
||||
description="ann.vben@gmail.com"
|
||||
tag-text="Pro"
|
||||
:text="userStore.userInfo?.user.nickname"
|
||||
tag-text="Admin"
|
||||
@logout="handleLogout"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -19,9 +19,9 @@ import { buildMenus } from './helper';
|
|||
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
|
||||
|
||||
/**
|
||||
* dashboard路由
|
||||
* base路由
|
||||
*/
|
||||
const dashboardMenus: RouteRecordStringComponent[] = [
|
||||
const baseMenus: RouteRecordStringComponent[] = [
|
||||
{
|
||||
component: 'BasicLayout',
|
||||
meta: {
|
||||
|
@ -38,6 +38,7 @@ const dashboardMenus: RouteRecordStringComponent[] = [
|
|||
component: '/dashboard/analytics/index',
|
||||
meta: {
|
||||
affixTab: true,
|
||||
icon: 'lucide:area-chart',
|
||||
title: 'page.dashboard.analytics',
|
||||
},
|
||||
},
|
||||
|
@ -46,9 +47,42 @@ const dashboardMenus: RouteRecordStringComponent[] = [
|
|||
path: '/workspace',
|
||||
component: '/dashboard/workspace/index',
|
||||
meta: {
|
||||
icon: 'carbon:workspace',
|
||||
title: 'page.dashboard.workspace',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'VbenAbout',
|
||||
path: '/about',
|
||||
component: '/_core/about/index.vue',
|
||||
meta: {
|
||||
icon: 'lucide:copyright',
|
||||
title: 'demos.vben.about',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
component: 'BasicLayout',
|
||||
meta: {
|
||||
icon: 'ant-design:user-outlined',
|
||||
order: -1,
|
||||
title: '个人中心',
|
||||
hideInMenu: true,
|
||||
},
|
||||
name: 'profile',
|
||||
path: '/profile',
|
||||
children: [
|
||||
{
|
||||
name: 'UserProfile',
|
||||
path: '/profile/index',
|
||||
component: '/_core/profile/profile.vue',
|
||||
meta: {
|
||||
icon: 'ant-design:user-outlined',
|
||||
title: '个人中心',
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -71,7 +105,7 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
|
|||
const userStore = useUserStore();
|
||||
const menus = userStore.userInfo?.menus;
|
||||
const routes = buildMenus(menus);
|
||||
const menuList = [...cloneDeep(dashboardMenus), ...routes];
|
||||
const menuList = [...cloneDeep(baseMenus), ...routes];
|
||||
return menuList;
|
||||
},
|
||||
// 可以指定没有权限跳转403页面
|
||||
|
|
|
@ -5,5 +5,9 @@ defineOptions({ name: 'About' });
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<About />
|
||||
<About
|
||||
description="基于 vben 最新版本,最新的 vue3 vite4 ant-design-vue 4.0 typescript 语法进行重构开发。"
|
||||
name="yudao-ui-admin-vben"
|
||||
title="yudao-ui-admin-vben"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
const name = ref('profile');
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
{{ name }}
|
||||
</div>
|
||||
</template>
|
Loading…
Reference in New Issue