424 lines
14 KiB
JavaScript

/*
* @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 BrandLayout from '@/views/brand/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/userCenter',
// name: 'userCenter',
// component: () => import('@/views/userCenter/shoppingCart.vue'),
// hidden: true,
// },
{
path: '/sub-operation-service/userCenter',
name: 'userCenter',
// component: Layout,
redirect: '/sub-operation-service/userCenter',
meta: { title: '个人中心' },
children: [
{
path: '/sub-operation-service/userCenter',
component: () => import('@/views/userCenter/shoppingCart.vue'),
name: 'shoppingCart',
meta: { title: '我的购物车' },
},
{
path: '/sub-operation-service/sureOrder',
component: () => import('@/views/userCenter/sureOrder.vue'),
name: 'sureOrder',
meta: { title: '结算' },
},
{
path: '/sub-operation-service/orderSuccess',
component: () => import('@/views/userCenter/orderSuccess.vue'),
name: 'orderSuccess',
meta: { title: '提交订单' },
},
{
path: '/sub-operation-service/paySuccess',
component: () => import('@/views/userCenter/paySuccess.vue'),
name: 'paySuccess',
meta: { title: '支付成功' },
},
{
path: '/sub-operation-service/userOrders',
component: () => import('@/views/userCenter/userOrders.vue'),
name: 'userOrders',
meta: { title: '我的订单' },
},
{
path: '/sub-operation-service/userLands',
component: () => import('@/views/userCenter/userLands.vue'),
name: 'userLands',
meta: { title: '我的土地' },
},
{
path: '/sub-operation-service/mySource',
component: () => import('@/views/userCenter/mySource.vue'),
name: 'mySource',
meta: { title: '我的溯源' },
},
{
path: '/sub-operation-service/myFinance',
component: () => import('@/views/userCenter/myFinance.vue'),
name: 'myFinance',
meta: { title: '我的金融' },
},
{
path: '/sub-operation-service/myBrand',
component: () => import('@/views/userCenter/myBrand.vue'),
name: 'myBrand',
meta: { title: '我的品牌' },
},
],
},
{
path: '/sub-operation-service',
name: 'layout',
component: Layout,
redirect: '/sub-operation-service/smartFarm',
meta: { title: '运营服务' },
children: [
{
path: '/sub-operation-service/home',
component: () => import('@/views/home/index.vue'),
name: 'home',
meta: { title: '首页' },
},
{
path: '/sub-operation-service/dashboard',
component: () => import('@/views/dashboard/index.vue'),
name: 'dashboard',
meta: { title: '综合看板' },
},
],
},
{
path: '/sub-operation-service/smartFarm',
name: 'smartFarm',
component: Layout,
redirect: '/sub-operation-service/smartFarm/main',
meta: { title: '智慧种植' },
children: [
{
path: '/sub-operation-service/smartFarm/main',
component: () => import('@/views/smartFarm/index.vue'),
name: 'smartFarmMain',
meta: { title: '智慧种植首页' },
},
{
path: '/sub-operation-service/smartFarm/fieldInspection',
component: () => import('@/views/smartFarm/inspection/fieldInspection.vue'),
name: 'fieldInspection',
meta: { title: '田间监测' },
},
{
path: '/sub-operation-service/smartFarm/waterInspection',
component: () => import('@/views/smartFarm/inspection/waterInspection.vue'),
name: 'waterInspection',
meta: { title: '水质监测' },
},
{
path: '/sub-operation-service/smartFarm/bugInspection',
component: () => import('@/views/smartFarm/inspection/bugInspection.vue'),
name: 'bugInspection',
meta: { title: '病虫害监测' },
},
{
path: '/sub-operation-service/smartFarm/envInspection',
component: () => import('@/views/smartFarm/inspection/envInspection.vue'),
name: 'envInspection',
meta: { title: '环境监测' },
},
{
path: '/sub-operation-service/smartFarm/intelligentFertilizer',
component: () => import('@/views/smartFarm/inspection/intelligentFertilizer.vue'),
name: 'intelligentFertilizer',
meta: { title: '智能配肥' },
},
{
path: '/sub-operation-service/smartFarm/IntelligentIrrigation',
component: () => import('@/views/smartFarm/inspection/IntelligentIrrigation.vue'),
name: 'IntelligentIrrigation',
meta: { title: '智能灌溉' },
},
{
path: '/sub-operation-service/smartFarm/IntelligentSeedSoaking',
component: () => import('@/views/smartFarm/inspection/IntelligentSeedSoaking.vue'),
name: 'IntelligentSeedSoaking',
meta: { title: '智能浸种' },
},
{
path: '/sub-operation-service/smartFarm/growSeedlings',
component: () => import('@/views/smartFarm/manageControl/growSeedlings.vue'),
name: 'growSeedlings',
meta: { title: '一体育苗' },
},
{
path: '/sub-operation-service/smartFarm/pestPrevention',
component: () => import('@/views/smartFarm/manageControl/pestPrevention.vue'),
name: 'pestPrevention',
meta: { title: '病虫害防治' },
},
{
path: '/sub-operation-service/smartFarm/irrigationSystem',
component: () => import('@/views/smartFarm/manageControl/irrigationSystem.vue'),
name: 'irrigationSystem',
meta: { title: '喷灌滴灌' },
},
{
path: '/sub-operation-service/smartFarm/drainageControl',
component: () => import('@/views/smartFarm/manageControl/drainageControl.vue'),
name: 'drainageControl',
meta: { title: '排集水控制' },
},
{
path: '/sub-operation-service/smartFarm/openCurtain',
component: () => import('@/views/smartFarm/manageControl/openCurtain.vue'),
name: 'openCurtain',
meta: { title: '开窗卷帘' },
},
],
},
{
path: '/sub-operation-service/ruralFinance',
name: 'ruralFinance',
component: Layout,
redirect: '/sub-operation-service/ruralFinance/index',
meta: { title: '涉农金融' },
children: [
{
path: '/sub-operation-service/ruralFinance/index',
component: () => import('@/views/ruralFinance/index.vue'),
name: 'ruralFinanceMain',
meta: { title: '涉农金融首页' },
},
],
},
{
path: '/sub-operation-service/packaging',
name: 'packaging',
component: Layout,
redirect: '/sub-operation-service/packaging/sorting',
meta: { title: '分拣包装' },
children: [
{
path: '/sub-operation-service/packaging/sorting',
component: () => import('@/views/packaging/sorting.vue'),
name: 'sortingMain',
meta: { title: '分拣首页' },
},
{
path: '/sub-operation-service/packaging/index',
component: () => import('@/views/packaging/index.vue'),
name: 'packagingMain',
meta: { title: '包装首页' },
},
{
path: '/sub-operation-service/packaging/details',
component: () => import('@/views/packaging/details.vue'),
name: 'detailsMain',
meta: { title: '详情页' },
},
],
},
{
path: '/sub-operation-service/warehouseLogistics',
name: 'warehouseLogistics',
component: Layout,
redirect: '/sub-operation-service/warehouse',
meta: { title: '仓储物流' },
children: [
{
path: '/sub-operation-service/warehouse',
component: () => import('@/views/warehouseLogistics/warehouse/index.vue'),
name: 'warehouseMain',
meta: { title: '仓储首页' },
},
{
path: '/sub-operation-service/warehouse-detail',
component: () => import('@/views/warehouseLogistics/warehouse/detail.vue'),
name: 'warehouse-detail',
meta: { title: '仓储详情' },
},
{
path: '/sub-operation-service/logistics',
component: () => import('@/views/warehouseLogistics/logistics/index.vue'),
name: 'logistics-list',
meta: { title: '物流首页' },
},
],
},
{
path: '/sub-operation-service/brand',
name: 'brand',
component: Layout,
redirect: '/sub-operation-service/brand/apply', // 默认页
meta: { title: '公共品牌' },
children: [
{
path: '',
component: BrandLayout,
redirect: '/sub-operation-service/brand/apply',
children: [
{
path: 'apply',
name: 'brandApplyList',
component: () => import('@/views/brand/components/ApplyList.vue'),
meta: { title: '使用申请' },
},
{
path: 'brandApplyDetail',
name: 'brandApplyDetail',
component: () => import('@/views/brand/components/ApplyDetail.vue'),
meta: { title: '产品申请' },
},
{
path: 'auth/record',
name: 'brandAuth',
component: () => import('@/views/brand/components/Auth.vue'),
meta: { title: '授权记录' },
},
{
path: 'auth/system',
name: 'brandSystem',
component: () => import('@/views/brand/components/BrandSystem.vue'),
meta: { title: '品牌制度' },
},
{
path: 'monitor',
name: 'brandMonitor',
component: () => import('@/views/brand/components/Monitor.vue'),
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' },
},
],
},
],
},
// ...demo,
];
/**
* @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;