feat: 个人中心(基础框架)

This commit is contained in:
dap 2024-09-02 15:13:17 +08:00
parent 568705b9ab
commit 6d19560863
7 changed files with 154 additions and 68 deletions

View File

@ -1,9 +1,10 @@
<script lang="ts" setup>
import { computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants';
import { BookOpenText, CircleHelp, MdiGithub } from '@vben/icons';
import { BookOpenText, CircleHelp, MdiGithub, ProfileIcon } from '@vben/icons';
import {
BasicLayout,
LockScreen,
@ -24,6 +25,7 @@ import { useAuthStore, useNotifyStore } from '#/store';
const userStore = useUserStore();
const authStore = useAuthStore();
const accessStore = useAccessStore();
const router = useRouter();
const menus = computed(() => [
{
@ -35,6 +37,13 @@ const menus = computed(() => [
icon: BookOpenText,
text: $t('widgets.document'),
},
{
handler: () => {
router.push('/profile');
},
icon: ProfileIcon,
text: $t('widgets.profile'),
},
{
handler: () => {
openWindow(VBEN_GITHUB_URL, {

View File

@ -14,76 +14,11 @@ import { getAllMenusApi, type Menu } from '#/api';
import { BasicLayout, IFrameView } from '#/layouts';
import { $t } from '#/locales';
import { localMenuList } from './routes/local';
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
const NotFoundComponent = () => import('#/views/_core/fallback/not-found.vue');
/**
*
*/
const localMenuList: RouteRecordStringComponent[] = [
{
component: 'BasicLayout',
meta: {
order: -1,
title: 'page.dashboard.title',
},
name: 'Dashboard',
path: '/',
redirect: '/analytics',
children: [
{
name: 'Analytics',
path: '/analytics',
component: '/dashboard/analytics/index',
meta: {
affixTab: true,
title: 'page.dashboard.analytics',
},
},
{
name: 'Workspace',
path: '/workspace',
component: '/dashboard/workspace/index',
meta: {
title: 'page.dashboard.workspace',
},
},
{
name: 'VbenDocument',
path: '/vben-admin/document',
component: 'IFrameView',
meta: {
icon: 'lucide:book-open-text',
iframeSrc: 'https://dapdap.top',
keepAlive: true,
title: $t('page.vben.document'),
},
},
],
},
{
component: 'BasicLayout',
meta: {
hideChildrenInMenu: true,
icon: 'lucide:copyright',
order: 9999,
title: $t('page.vben.about'),
},
name: 'About',
path: '/about',
children: [
{
component: '/_core/about/index',
meta: {
title: $t('page.vben.about'),
},
name: 'VbenAbout',
path: '/vben-admin/about',
},
],
},
];
async function generateAccess(options: GenerateMenuAndRoutesOptions) {
const pageMap: ComponentRecordType = import.meta.glob('../views/**/*.vue');

View File

@ -0,0 +1,102 @@
import type { RouteRecordStringComponent } from '@vben/types';
import { $t } from '@vben/locales';
/**
*
*/
/**
*
*/
const profileRoute: RouteRecordStringComponent[] = [
{
component: 'BasicLayout',
meta: {
hideChildrenInMenu: true,
hideInMenu: true,
title: $t('widgets.profile'),
},
name: 'Profile',
path: '',
children: [
{
component: '/_core/profile/index',
meta: {
icon: 'mingcute:profile-line',
title: $t('widgets.profile'),
},
name: 'ProfileIndex',
path: '/profile',
},
],
},
];
/**
*
*/
export const localMenuList: RouteRecordStringComponent[] = [
{
component: 'BasicLayout',
meta: {
order: -1,
title: 'page.dashboard.title',
},
name: 'Dashboard',
path: '/',
redirect: '/analytics',
children: [
{
name: 'Analytics',
path: '/analytics',
component: '/dashboard/analytics/index',
meta: {
affixTab: true,
title: 'page.dashboard.analytics',
},
},
{
name: 'Workspace',
path: '/workspace',
component: '/dashboard/workspace/index',
meta: {
title: 'page.dashboard.workspace',
},
},
{
name: 'VbenDocument',
path: '/vben-admin/document',
component: 'IFrameView',
meta: {
icon: 'lucide:book-open-text',
iframeSrc: 'https://dapdap.top',
keepAlive: true,
title: $t('page.vben.document'),
},
},
],
},
{
component: 'BasicLayout',
meta: {
hideChildrenInMenu: true,
icon: 'lucide:copyright',
order: 9999,
title: $t('page.vben.about'),
},
name: 'About',
path: '/about',
children: [
{
component: '/_core/about/index',
meta: {
title: $t('page.vben.about'),
},
name: 'VbenAbout',
path: '/vben-admin/about',
},
],
},
...profileRoute,
];

View File

@ -0,0 +1,36 @@
<script setup lang="ts">
import { ref } from 'vue';
import { Page } from '@vben/common-ui';
import { Card } from 'ant-design-vue';
const currentActiveKey = ref('tab1');
const tabList = [
{
key: 'tab1',
tab: 'tab1',
},
{
key: 'tab2',
tab: 'tab2',
},
];
</script>
<template>
<Page>
<Card
:active-tab-key="currentActiveKey"
:tab-list="tabList"
@tab-change="
(key) => {
currentActiveKey = key;
}
"
>
dsadsa
</Card>
</Page>
</template>

View File

@ -21,3 +21,5 @@ export const CommandLineIcon = createIconifyIcon(
export const MemoryIcon = createIconifyIcon('la:memory');
export const GiteeIcon = createIconifyIcon('simple-icons:gitee');
// 个人中心
export const ProfileIcon = createIconifyIcon('mingcute:profile-line');

View File

@ -61,6 +61,7 @@
},
"widgets": {
"document": "Document",
"profile": "Profile",
"qa": "Q&A",
"setting": "Settings",
"logoutTip": "Do you want to logout?",

View File

@ -61,6 +61,7 @@
},
"widgets": {
"document": "文档",
"profile": "个人中心",
"qa": "问题 & 帮助",
"setting": "设置",
"logoutTip": "是否退出登录?",