修改登录进来后页面路由
This commit is contained in:
@@ -26,9 +26,9 @@ VITE_APP_SNAILJOB_ADMIN='http://192.168.1.215/snail-job'
|
||||
|
||||
VITE_APP_PORT=5174
|
||||
|
||||
# 登录成功跳转地址(/index → 统计汇总首页)
|
||||
# 登录成功跳转地址(统计汇总首页)
|
||||
# VITE_LOGIN_BACK_URL = '/equipment/WaterDevice'
|
||||
VITE_LOGIN_BACK_URL='/index'
|
||||
VITE_LOGIN_BACK_URL='/statistics/statistics-summary'
|
||||
|
||||
# 地图类型 天地图 WGS84 高德地图 GCJ02, 高德地图 需要在高德地图官网申请key
|
||||
VITE_APP_MAP_TYPE='WGS84'
|
||||
|
||||
@@ -18,9 +18,9 @@ VITE_APP_SNAILJOB_ADMIN='/snail-job'
|
||||
# VITE_APP_BASE_API = 'https://wuyeapi.bugtc.com'
|
||||
VITE_APP_BASE_API='https://wuyeapi.ckdzkj.com'
|
||||
#VITE_APP_BASE_API='http://192.168.1.198'
|
||||
# 登录成功跳转地址(/index → 统计汇总首页)
|
||||
# 登录成功跳转地址(统计汇总首页)
|
||||
# VITE_LOGIN_BACK_URL = '/equipment/WaterDevice'
|
||||
VITE_LOGIN_BACK_URL='/index'
|
||||
VITE_LOGIN_BACK_URL='/statistics/statistics-summary'
|
||||
|
||||
# 地图类型 天地图 WGS84 高德地图 GCJ02, 高德地图 需要在高德地图官网申请key
|
||||
VITE_APP_MAP_TYPE='GCJ02'
|
||||
|
||||
@@ -82,7 +82,7 @@ const isAffix = (tag: RouteLocationNormalized) => {
|
||||
};
|
||||
const isFirstView = () => {
|
||||
try {
|
||||
return selectedTag.value.fullPath === '/index' || selectedTag.value.fullPath === visitedViews.value[1].fullPath;
|
||||
return selectedTag.value.fullPath === '/statistics/statistics-summary' || selectedTag.value.fullPath === visitedViews.value[1].fullPath;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ router.beforeEach(async (to, from) => {
|
||||
isDynamicRoutesAdded = true;
|
||||
|
||||
// 动态路由已构建完成,重新触发本次导航
|
||||
// 登录后不再强制进入小区选择页,直接进入目标页(默认走 '/' 的 redirect → 工作台 /index)
|
||||
// 登录后不再强制进入小区选择页,直接进入目标页(默认走 '/' 的 redirect → /statistics/statistics-summary)
|
||||
// 这里replace仅在首次加载路由时执行;后续菜单切换不会走到这里
|
||||
return { ...to, replace: true };
|
||||
}
|
||||
|
||||
@@ -78,17 +78,14 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '',
|
||||
component: Layout,
|
||||
// redirect: '/index',
|
||||
redirect: import.meta.env.VITE_LOGIN_BACK_URL,
|
||||
// redirect: '/equipment/WaterDevice',
|
||||
children: [
|
||||
// {
|
||||
// path: '/index',
|
||||
// component: () => import('@/views/workbench/index2.vue'),
|
||||
// name: 'Index',
|
||||
// // hidden: true,
|
||||
// meta: { title: '工作台', icon: 'dashboard', affix: true }
|
||||
// }
|
||||
// 旧首页地址兼容:/index 重定向到统计汇总
|
||||
{
|
||||
path: '/index',
|
||||
redirect: '/statistics/statistics-summary',
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -96,9 +93,9 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
const homeRoute = constantRoutes.find((item) => item.path === '');
|
||||
homeRoute?.children?.push({
|
||||
path: '/index',
|
||||
path: '/statistics/statistics-summary',
|
||||
component: () => import('@/views/system/statistics-summary/index.vue'),
|
||||
name: 'Index',
|
||||
name: 'StatisticsSummaryHome',
|
||||
hidden: true,
|
||||
meta: { title: '统计汇总', icon: 'dashboard', affix: true }
|
||||
});
|
||||
|
||||
@@ -112,7 +112,7 @@ const handleLogin = () => {
|
||||
// 调用action的登录方法
|
||||
const [err] = await to(userStore.login(loginForm.value));
|
||||
if (!err) {
|
||||
// 登录后进入统计汇总页(/index,小区由后端默认,无需选择)
|
||||
// 登录后进入统计汇总页(/statistics/statistics-summary,小区由后端默认,无需选择)
|
||||
await router.push(import.meta.env.VITE_LOGIN_BACK_URL || '/');
|
||||
loading.value = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user