/* * @Description: router * @Author: zenghua.wang * @Date: 2023-06-20 11:48:41 * @LastEditors: zenghua.wang * @LastEditTime: 2025-04-14 09:27:05 */ 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/ecommerce', 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: '农资交易', headerActive: 'ecommerce' }, children: [ { path: '/sub-operation-service/ecommerce-agricultural', component: () => import('@/views/ecommerce/index.vue'), name: 'agricultural', meta: { title: '农资交易', headerActive: 'ecommerce' }, }, { path: '/sub-operation-service/ecommerce-agriculturalDetail', component: () => import('@/views/ecommerce/agriculturalDetail.vue'), name: 'agriculturalDetail', meta: { title: '农资详情', headerActive: 'ecommerce' }, }, { path: '/sub-operation-service/ecommerce-sourceCodeDetail', component: () => import('@/views/ecommerce/sourceCodeDetail.vue'), name: 'sourceCodeDetail', meta: { title: '溯源详情', headerActive: 'ecommerce' }, }, ], }, { path: '/sub-operation-service/purchaser', component: Views, redirect: '/sub-operation-service/ecommerce-purchaser', name: 'purchaserParent', meta: { title: '采购商服务', headerActive: 'ecommerce' }, children: [ { path: '/sub-operation-service/ecommerce-purchaser', component: () => import('@/views/ecommerce/purchaser.vue'), name: 'purchaser', meta: { title: '采购商服务', headerActive: 'ecommerce' }, }, { path: '/sub-operation-service/ecommerce-purchaserDetail', component: () => import('@/views/ecommerce/purchaserDetail.vue'), name: 'purchaserDetail', meta: { title: '采购详情', headerActive: 'ecommerce' }, }, ], }, { path: '/sub-operation-service/ecommerce-supplier', component: () => import('@/views/ecommerce/supplier.vue'), name: 'supplier', meta: { title: '供应商服务', headerActive: 'ecommerce' }, }, { path: '/sub-operation-service/ecommerce-land', component: Views, redirect: '/sub-operation-service/ecommerce-land', name: 'landParent', meta: { title: '土地交易', headerActive: 'ecommerce' }, children: [ { path: '/sub-operation-service/ecommerce-land', component: () => import('@/views/ecommerce/land.vue'), name: 'land', meta: { title: '土地交易', headerActive: 'ecommerce' }, }, { path: '/sub-operation-service/ecommerce-landDetail', component: () => import('@/views/ecommerce/landDetail.vue'), name: 'landDetail', meta: { title: '土地详情', headerActive: 'ecommerce' }, }, ], }, ], }, { path: '/sub-operation-service/farmingService', name: 'farmingService', component: Layout, redirect: '/sub-operation-service/farmingServiceMain', meta: { title: '农事服务', headerActive: 'farmingService' }, children: [ { path: '/sub-operation-service/farmingServiceMain', component: () => import('@/views/farmingService/index.vue'), name: 'farmingServiceMain', meta: { title: '农资服务', headerActive: 'farmingService' }, children: [ { path: 'farmingConsult', component: () => import('@/views/farmingService/farmingConsult/index.vue'), name: 'farmingConsult', meta: { title: '农资服务', headerActive: 'farmingService' }, }, ], }, ], }, { 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-sureOrder', component: () => import('@/views/userCenter/sureOrder.vue'), name: 'sureOrder', meta: { title: '确认订单' }, }, { path: '/sub-operation-service/userCenter-orderSuccess', component: () => import('@/views/userCenter/orderSuccess.vue'), name: 'orderSuccess', meta: { title: '订单提交成功' }, }, { path: '/sub-operation-service/userCenter-paySuccess', component: () => import('@/views/userCenter/paySuccess.vue'), name: 'paySuccess', 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;