Skip to content

Commit

Permalink
对菜单做分类,改为二级菜单;路由也改二级;添加openKeys保持菜单展开状态;修改vue文件的位置
Browse files Browse the repository at this point in the history
  • Loading branch information
pdsong committed Aug 29, 2024
1 parent 486015a commit c2566d1
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 92 deletions.
63 changes: 42 additions & 21 deletions admin/src/components/the-sider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,47 @@
<coffee-outlined/>关于
</router-link>
</a-menu-item>
<a-menu-item key="/batch/job">
<router-link to="/batch/job">
<coffee-outlined/>任务管理
</router-link>
</a-menu-item>
<a-menu-item key="/station">
<router-link to="/station">
<coffee-outlined/>车站管理
</router-link>
</a-menu-item>
<a-menu-item key="/train">
<router-link to="/train">
<coffee-outlined/>火车管理
</router-link>
</a-menu-item>
<a-menu-item key="/train-station">
<router-link to="/train-station">
<coffee-outlined/>火车车站管理
</router-link>
</a-menu-item>
<a-sub-menu key="batch">
<template #title>
<span>
<UnorderedListOutlined />
跑批管理
</span>
</template>
<a-menu-item key="/batch/job">
<router-link to="/batch/job">
<coffee-outlined/>任务管理
</router-link>
</a-menu-item>

</a-sub-menu>

<a-sub-menu key="base">
<template #title>
<span>
<UnorderedListOutlined />
基础数据
</span>
</template>
<a-menu-item key="/base/station">
<router-link to="/base/station">
<coffee-outlined/>车站管理
</router-link>
</a-menu-item>
<a-menu-item key="/base/train">
<router-link to="/base/train">
<coffee-outlined/>火车管理
</router-link>
</a-menu-item>
<a-menu-item key="/base/train-station">
<router-link to="/base/train-station">
<coffee-outlined/>火车车站管理
</router-link>
</a-menu-item>

</a-sub-menu>


<!-- 原来是子menu里a-menu-item形式 现在改成了直接a-menu-item-->
<!-- <a-sub-menu key="sub1">-->
<!-- <template #title>-->
Expand Down Expand Up @@ -94,7 +115,7 @@ export default defineComponent({
return {
selectedKeys ,
openKeys: ref(['sub1'])
openKeys: ref(['batch','base'])
};
}
});
Expand Down
151 changes: 81 additions & 70 deletions admin/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,95 @@
import { createRouter, createWebHistory } from 'vue-router'
import {createRouter, createWebHistory} from 'vue-router'

const routes = [{
path: '/',
component: () => import('../views/main.vue'),
children: [{
path: 'welcome',
component: () => import('../views/main/welcome.vue'),
}, {
path: 'about',
component: () => import('../views/main/about.vue'),
}, {
path: 'station',
component: () => import('../views/main/station.vue'),
path: '/',
component: () => import('../views/main.vue'),
children: [{
path: 'welcome',
component: () => import('../views/main/welcome.vue'),
}, {
path: 'about',
component: () => import('../views/main/about.vue'),
}, {
path: 'base',
children: [
{
path: 'station',
component: () => import('../views/main/base/station.vue'),

}, {
path: 'train',
component: () => import('../views/main/train.vue'),
}, {
path: 'train',
component: () => import('../views/main/base/train.vue'),

}, {
path: 'train-station',
component: () => import('../views/main/train-station.vue'),
}, {
path: 'train-station',
component: () => import('../views/main/base/train-station.vue'),

},{
path: 'batch/job',
name: 'batch/job',
component: () => import('../views/main/job.vue'),
},
]
},

},
//
// {
// path: 'business/',
// children: [{
// path: 'sk-token',
// component: () => import('../views/main/business/sk-token.vue'),
// }, {
// path: 'confirm-order',
// component: () => import('../views/main/business/confirm-order.vue'),
// }, {
// path: 'daily-train',
// component: () => import('../views/main/business/daily-train.vue'),
// }, {
// path: 'daily-train-station',
// component: () => import('../views/main/business/daily-train-station.vue'),
// }, {
// path: 'daily-train-carriage',
// component: () => import('../views/main/business/daily-train-carriage.vue'),
// }, {
// path: 'daily-train-seat',
// component: () => import('../views/main/business/daily-train-seat.vue'),
// }, {
// path: 'daily-train-ticket',
// component: () => import('../views/main/business/daily-train-ticket.vue'),
// }]
// },
//
// {
// path: 'batch/',
// children: [{
// path: 'job',
// component: () => import('../views/main/batch/job.vue')
// }]
// },
//
// {
// path: 'member/',
// children: [{
// path: 'ticket',
// component: () => import('../views/main/member/ticket.vue')
// }]
// }
{
path: "batch/",
children: [
{
path: 'job',
component: () => import('../views/main/batch/job.vue'),
}
]
},

]
//
// {
// path: 'business/',
// children: [{
// path: 'sk-token',
// component: () => import('../views/main/business/sk-token.vue'),
// }, {
// path: 'confirm-order',
// component: () => import('../views/main/business/confirm-order.vue'),
// }, {
// path: 'daily-train',
// component: () => import('../views/main/business/daily-train.vue'),
// }, {
// path: 'daily-train-station',
// component: () => import('../views/main/business/daily-train-station.vue'),
// }, {
// path: 'daily-train-carriage',
// component: () => import('../views/main/business/daily-train-carriage.vue'),
// }, {
// path: 'daily-train-seat',
// component: () => import('../views/main/business/daily-train-seat.vue'),
// }, {
// path: 'daily-train-ticket',
// component: () => import('../views/main/business/daily-train-ticket.vue'),
// }]
// },
//
// {
// path: 'batch/',
// children: [{
// path: 'job',
// component: () => import('../views/main/batch/job.vue')
// }]
// },
//
// {
// path: 'member/',
// children: [{
// path: 'ticket',
// component: () => import('../views/main/member/ticket.vue')
// }]
// }

]
}, {
path: '',
redirect: '/welcome'
path: '',
redirect: '/welcome'
}];

const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
history: createWebHistory(process.env.BASE_URL),
routes
})

export default router
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { defineComponent, ref, onMounted, watch } from 'vue';
import {notification} from "ant-design-vue";
import axios from "axios";
import {pinyin} from "pinyin-pro";
import StationSelectView from "@/components/station-select";
import StationSelectView from "@/components/station-select.vue";
export default defineComponent({
name: "train-view",
components: {StationSelectView},
Expand Down
File renamed without changes.

0 comments on commit c2566d1

Please sign in to comment.