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