You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.5 KiB

7 months ago
import { log } from '/nerv-lib/util';
import { appConfigStore } from '/nerv-lib/saas/store/modules/app-config';
let modules = import.meta.globEager('/src/router/**/*.ts');
const modulesOP = import.meta.globEager('/src/router-op/**/*.ts');
console.log("hahahah33333333333333333333333333")
6 months ago
console.log(modules);
7 months ago
const modulesCloud = import.meta.globEager('/src/router-cloud/**/*.ts');
import { appConfig } from '/@/config/app.config.ts';
if (__APP_INFO__.platform?.toLowerCase() === 'op') {
// log.info('The operating platform is op.');
modules = modulesOP;
} else if (__APP_INFO__.platform?.toLowerCase() === 'cloud') {
// log.info('The operating platform is cloud.');
modules = modulesCloud;
} else {
// appConfig = initAppConfig;
}
// const test = appConfigStore();
// console.log(test);
const routes: any[] = [];
Object.keys(modules).forEach((key) => {
const mod = modules[key].default || {};
const modList = Array.isArray(mod) ? [...mod] : [mod];
if (modList[0].children && !modList[0].component) {
if (appConfig['customApplication'] && appConfig['customApplication'] === 'v2') {
modList[0].component = () => import('/nerv-lib/saas/view/system/customApplication.vue');
} else {
modList[0].component = () => import('/nerv-lib/saas/view/system/application.vue');//hx-ai-intelligent项目下的首页
7 months ago
}
}
modList[0].path && routes.push(...modList);
});
export { routes };
export const LoginRoute = {
path: '/login',
name: 'login',
component: appConfig.customLogin
? appConfig.customLogin
: () => import('/nerv-lib/saas/view/system/login.vue'),
meta: {
title: '登录',
},
};
export const Error403Route = {
path: '/403',
name: 'error403',
component: () => import('/nerv-lib/saas/view/service/error-403.vue'),
};
export const updatePassWord = {
path: '/updatePassWord',
name: 'UpdatePassWord',
component: appConfig.customUpdatePwd
? appConfig.customUpdatePwd
: () => import('/nerv-lib/saas/view/service/updatePassWord.vue'),
};
export const DefaultRoute = {
path: '/:pathMatch(.*)',
name: 'default',
redirect: { name: 'root' },
};
const outControlPageName: any[] = [];
Object.keys(modules).forEach((key) => {
const mod = modules[key].default || {};
if (mod.name && mod.outContrl) {
outControlPageName.push(mod.name);
}
});
export const WHITE_NAME_LIST = [
Error403Route.name,
updatePassWord.name,
LoginRoute.name,
...outControlPageName,
];
export const ALLRoute = [LoginRoute, DefaultRoute, updatePassWord, Error403Route, ...routes];