2023年3月29日 更改登录后跳转的页面,增加简单的页面逻辑(测试页面)

This commit is contained in:
bai 2023-03-29 09:18:25 +08:00
parent 182c360831
commit 2f9f179e07
5 changed files with 93 additions and 2 deletions

View File

@ -2,7 +2,9 @@ export enum PageEnum {
// basic login path
BASE_LOGIN = '/login',
// basic home path
BASE_HOME = '/dashboard/analysis',
BASE_HOME = '/site/index',
// 门户首页
BASE_SITE_HOME = '/site/index',
// error page path
ERROR_PAGE = '/exception',
// error log page path

View File

@ -6,6 +6,11 @@ import { mainOutRoutes } from './mainOut';
import { PageEnum } from '/@/enums/pageEnum';
import { t } from '/@/hooks/web/useI18n';
import NoTokenSiteRoute from './modules/site/site';
// import NoTokenSiteRoute from './modules/site.ts';
// const NoTokenSiteRoute = import.meta.glob('./modules/site/site.ts', { eager: true });
const modules = import.meta.glob('./modules/**/*.ts', { eager: true });
const routeModuleList: AppRouteModule[] = [];
@ -65,5 +70,20 @@ export const TokenLoginRoute: AppRouteRecordRaw = {
},
};
console.log('NoTokenSiteRoute =>', NoTokenSiteRoute, modules, Oauth2LoginRoute);
/**
*
*/
// export const NoTokenSiteRoute: AppRouteRecordRaw = site;
// Basic routing without permission
export const basicRoutes = [LoginRoute, RootRoute, ...mainOutRoutes, REDIRECT_ROUTE, PAGE_NOT_FOUND_ROUTE, TokenLoginRoute, Oauth2LoginRoute];
export const basicRoutes = [
LoginRoute,
RootRoute,
...mainOutRoutes,
REDIRECT_ROUTE,
PAGE_NOT_FOUND_ROUTE,
TokenLoginRoute,
Oauth2LoginRoute,
NoTokenSiteRoute,
];

View File

@ -0,0 +1,38 @@
import type { AppRouteModule } from '/@/router/types';
// import { LAYOUT } from '/@/router/constant';
import { t } from '/@/hooks/web/useI18n';
const site: AppRouteModule = {
path: '/site',
name: 'site',
component: () => import('/@/layouts/page/index.vue'),
redirect: '/site/index',
meta: {
orderNo: 10,
icon: 'ion:grid-outline',
title: t('routes.dashboard.dashboard'),
},
children: [
{
path: 'index',
name: 'siteIndex',
component: () => import('/@/views/site/index.vue'),
meta: {
// affix: true,
title: t('routes.dashboard.analysis'),
},
},
{
path: 'index2',
name: 'siteIndex2',
component: () => import('/@/views/site/index2.vue'),
meta: {
// affix: true,
title: t('routes.dashboard.analysis'),
},
},
],
};
export default site;

15
src/views/site/index.vue Normal file
View File

@ -0,0 +1,15 @@
<template>
<div>
{{ state }}
<a-button type="error" @click="() => state.count++">点击+1</a-button>
<a-button type="error" @click="() => i++">点击+1</a-button>
<RouterLink to="/site/index2">跳转到子页</RouterLink>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
const state = ref({ count: 0 });
const i = ref(1);
</script>

16
src/views/site/index2.vue Normal file
View File

@ -0,0 +1,16 @@
<template>
<div>
{{ state }}
<a-button type="error" @click="() => state.count++">点击+1</a-button>
{{ i }}
<a-button type="error" @click="() => i++">点击+1</a-button>
<RouterLink to="/site/index">跳回到主页</RouterLink>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
const state = ref({ count: 0 });
const i = ref(1);
</script>