/* * @Description: router * @Author: zenghua.wang * @Date: 2023-06-20 11:48:41 * @LastEditors: zenghua.wang * @LastEditTime: 2025-04-07 17:24:45 */ import { createRouter, createWebHistory } from 'vue-router'; import Layout from '@/layouts/index.vue'; import Views from '@/layouts/Views.vue'; import userCentre from '@/layouts/userCentre.vue'; export const constantRoutes = [ { path: '/sub-operation-service/404', name: '404', component: () => import('@/views/error/404.vue'), hidden: true, }, { path: '/sub-operation-service/403', name: '403', component: () => import('@/views/error/403.vue'), hidden: true, }, { path: '/sub-operation-service', name: 'layout', component: Layout, redirect: '/sub-operation-service/home', meta: { title: '首页' }, children: [ { path: '/sub-operation-service/home', component: () => import('@/views/home/index.vue'), name: 'home', meta: { title: '首页' }, }, ], }, { path: '/sub-operation-service/ecommerce', name: 'ecommerce', component: Layout, redirect: '/sub-operation-service/ecommerce-agricultural', meta: { title: '电商交易' }, children: [ { path: '/ecommerce', component: Views, redirect: '/sub-operation-service/ecommerce-agricultural', name: 'agriculturalParent', meta: { title: '农资交易' }, children: [ { path: '/sub-operation-service/ecommerce-agricultural', component: () => import('@/views/ecommerce/index.vue'), name: 'agricultural', meta: { title: '农资交易' }, }, { path: '/sub-operation-service/ecommerce-agriculturalDetail', component: () => import('@/views/ecommerce/agriculturalDetail.vue'), name: 'agriculturalDetail', meta: { title: '农资详情' }, }, { path: '/sub-operation-service/ecommerce-sourceCodeDetail', component: () => import('@/views/ecommerce/sourceCodeDetail.vue'), name: 'sourceCodeDetail', meta: { title: '溯源详情' }, }, ], }, { path: '/sub-operation-service/purchaser', component: Views, redirect: '/sub-operation-service/ecommerce-purchaser', name: 'purchaserParent', meta: { title: '采购商服务' }, children: [ { path: '/sub-operation-service/ecommerce-purchaser', component: () => import('@/views/ecommerce/purchaser.vue'), name: 'purchaser', meta: { title: '采购商服务' }, }, { path: '/sub-operation-service/ecommerce-purchaserDetail', component: () => import('@/views/ecommerce/purchaserDetail.vue'), name: 'purchaserDetail', meta: { title: '采购详情' }, }, ], }, { path: '/sub-operation-service/ecommerce-supplier', component: () => import('@/views/ecommerce/supplier.vue'), name: 'supplier', meta: { title: '供应商服务' }, }, { path: '/sub-operation-service/ecommerce-land', component: Views, redirect: '/sub-operation-service/ecommerce-land', name: 'landParent', meta: { title: '土地交易' }, children: [ { path: '/sub-operation-service/ecommerce-land', component: () => import('@/views/ecommerce/land.vue'), name: 'land', meta: { title: '土地交易' }, }, { path: '/sub-operation-service/ecommerce-landDetail', component: () => import('@/views/ecommerce/landDetail.vue'), name: 'landDetail', meta: { title: '土地详情' }, }, ], }, ], }, { path: '/sub-operation-service/userCenter', name: 'userCentre', component: userCentre, redirect: '/sub-operation-service/userCenter-shoppingCart', meta: { title: '个人中心' }, children: [ { path: '/sub-operation-service/userCenter-shoppingCart', component: () => import('@/views/userCenter/shoppingCart.vue'), name: 'ShoppingCar', meta: { title: '我的购物车' }, }, { path: '/sub-operation-service/userCenter-userOrders', component: () => import('@/views/userCenter/userOrders.vue'), name: 'userOrders', meta: { title: '我的订单' }, }, { path: '/sub-operation-service/userCenter-userLands', component: () => import('@/views/userCenter/userLands.vue'), name: 'userLands', meta: { title: '我的土地' }, }, ], }, ]; /** * @Title notFoundRouter(找不到路由) */ export const notFoundRouter = { path: '/sub-operation-service/:pathMatch(.*)', name: 'notFound', redirect: '/sub-operation-service/404', }; const router = createRouter({ history: createWebHistory(), // history routes: constantRoutes, }); export default router;