This commit is contained in:
2025-03-10 19:01:21 +08:00
parent 94644d0601
commit 31a2667f8b
28 changed files with 1370 additions and 57 deletions

View File

@@ -0,0 +1,15 @@
import routesMap from "./routes-map.js";
const generateRouter = (routes) => {
return routes.map(v => ({
path: v.path,
name: v.name,
component: routesMap[v.component],
children: v.children && v.children.length > 0 && [
{path: '', redirect: `/home/${v.name}/${v.children[0].name}`},
...generateRouter(v.children)
],
}))
}
export default generateRouter;

View File

@@ -1,6 +1,7 @@
import {createRouter, createWebHashHistory} from 'vue-router';
import routes from "./routes.js";
import {useUserStore} from "../pinia/UserStore/index.js";
import {useSystemStore} from "../pinia/SystemStore/index.js";
const router = createRouter({
history: createWebHashHistory(),
@@ -9,6 +10,7 @@ const router = createRouter({
router.beforeEach((to, from, next) => {
const {isLogin} = useUserStore();
const SystemStore = useSystemStore();
if (!isLogin && !to.path.includes('loginSYS')) {
next({ path: '/loginSYS' });

View File

@@ -1,27 +0,0 @@
// const merchant = [
// {
// path: '/task-center',
// name: 'task-center',
// title: '任务中心',
// icon: '',
// component: () => import('../pages/merchant/pages/task-center/index.vue'),
// children: [
// {
// path: '/reward-mission',
// name: 'reward-mission',
// title: '悬赏任务',
// icon: '',
// component: () => import('../pages/merchant/pages/task-center/reward-mission.vue'),
// },
// {
// path: '/appointed-task',
// name: 'appointed-task',
// title: '任务指派',
// icon: '',
// component: () => import('../pages/merchant/pages/task-center/appointed-task.vue'),
// }
// ]
// },
// ]
//
// export default merchant;

View File

@@ -1,7 +1,7 @@
const routesMap = {
'task-center': import('../pages/merchant/pages/task-center/index.vue'),
'reward-mission': import('../pages/merchant/pages/task-center/reward-mission.vue'),
'appointed-task': import('../pages/merchant/pages/task-center/appointed-task.vue'),
'task-center': () => import('../pages/merchant/pages/task-center/index.vue'),
'reward-mission': () => import('../pages/merchant/pages/task-center/reward-mission.vue'),
'appointed-task': () => import('../pages/merchant/pages/task-center/appointed-task.vue'),
};
export default routesMap;

View File

@@ -1,3 +1,5 @@
import routesMap from "./routes-map.js";
const routes = [
{
path: '/',
@@ -7,6 +9,7 @@ const routes = [
path: '/home',
name: 'home',
component: () => import('../pages/layout/index.vue'),
children: [],
},
{
path: '/loginSYS',