| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006 |
- import Vue from 'vue'
- import VueRouter from 'vue-router'
- import Layout from '@/views/Layout.vue'
- import axios from 'axios'
- import { getEffectivePermissions, hasPermission, getRoleHomePage } from '@/utils/permissions'
- Vue.use(VueRouter)
- const routes = [
- {
- path: '/login',
- name: 'Login',
- component: () => import('@/views/Login.vue')
- },
- {
- path: '/403',
- name: 'Forbidden',
- component: { template: '<div style="text-align:center;padding:100px"><h1>403</h1><p>权限不足</p><router-link to="/">返回首页</router-link></div>' },
- meta: { title: '权限不足' }
- },
- {
- path: '/',
- component: Layout,
- redirect: '/dashboard',
- children: [
- {
- path: 'dashboard',
- name: 'Dashboard',
- component: () => import('@/views/Dashboard.vue'),
- meta: { title: '首页', perm: 'dashboard' }
- },
- {
- path: 'teacher-dashboard',
- name: 'TeacherDashboard',
- component: () => import('@/views/TeacherDashboard.vue'),
- meta: { title: '规划师首页', requiresTeacher: true, perm: 'dashboard' }
- },
- {
- path: 'admin/dashboard',
- name: 'AdminDashboard',
- component: () => import('@/views/admin/Dashboard'),
- meta: { title: '数据大屏', roles: ['admin'] }
- },
- // 家庭管理
- {
- path: 'families',
- name: 'Families',
- component: () => import('@/views/Families.vue'),
- meta: { title: '家庭列表', perm: 'family:list' }
- },
- {
- path: 'children',
- name: 'Children',
- component: () => import('@/views/Children.vue'),
- meta: { title: '孩子管理', perm: 'family:children' }
- },
- {
- path: 'points',
- name: 'Points',
- component: () => import('@/views/Points.vue'),
- meta: { title: '积分管理', perm: 'family:points' }
- },
- {
- path: 'points-log',
- name: 'PointsLog',
- component: () => import('@/views/admin/PointsLog.vue'),
- meta: { title: '积分记录', perm: 'family:points' }
- },
- {
- path: 'membership-center',
- name: 'MembershipCenter',
- component: () => import('@/views/admin/MembershipCenter.vue'),
- meta: { title: '会员中心', perm: 'config:member' }
- },
- // 方案中心
- {
- path: 'health-plan-manage',
- name: 'HealthPlanManage',
- component: () => import('@/views/admin/HealthPlanManage.vue'),
- meta: { title: '健康方案管理', perm: 'plan:health' }
- },
- {
- path: 'assessment-plan-manage',
- name: 'AssessmentPlanManage',
- component: () => import('@/views/admin/AssessmentPlanManage.vue'),
- meta: { title: '测评方案管理', perm: 'plan:assessment' }
- },
- // 任务管理
- {
- path: 'tasks',
- name: 'Tasks',
- component: () => import('@/views/Tasks.vue'),
- meta: { title: '任务列表', perm: 'task:list' }
- },
- {
- path: 'task-templates',
- name: 'TaskTemplates',
- component: () => import('@/views/TaskTemplates.vue'),
- meta: { title: '任务模板', perm: 'task:templates' }
- },
- {
- path: 'orchestration',
- name: 'OrchestrationFlow',
- component: () => import('@/views/orchestration/OrchestrationFlow.vue'),
- meta: { title: '编排流管理', perm: 'task:templates' }
- },
- {
- path: 'orchestration/edit/:id?',
- name: 'FlowEditor',
- component: () => import('@/views/orchestration/FlowEditor.vue'),
- meta: { title: '编排画布', perm: 'task:templates' }
- },
- {
- path: 'orchestration/execution/:id',
- name: 'ExecutionDetail',
- component: () => import('@/views/orchestration/ExecutionDetail.vue'),
- meta: { title: '执行详情', perm: 'task:templates' }
- },
- {
- path: 'growth-task',
- name: 'GrowthTaskManagement',
- component: () => import('@/views/admin/GrowthTaskManagement'),
- meta: { title: '成长任务管理', perm: 'task:list' }
- },
- // 奖励管理
- {
- path: 'rewards',
- name: 'Rewards',
- component: () => import('@/views/Rewards.vue'),
- meta: { title: '奖励列表', perm: 'family:rewards' }
- },
- {
- path: 'wishes',
- name: 'Wishes',
- component: () => import('@/views/Wishes.vue'),
- meta: { title: '心愿管理', perm: 'family:wishes' }
- },
- // 成长规划师管理
- {
- path: 'guide-packages',
- name: 'GuidePackages',
- component: () => import('@/views/GuidePackages.vue'),
- meta: { title: '成长规划师任务模板', requiresTeacher: true, perm: 'biz:packages' }
- },
- {
- path: 'guide-family-task',
- name: 'GuideFamilyTask',
- component: () => import('@/views/GuideFamilyTask.vue'),
- meta: { title: '家庭任务管理', requiresTeacher: true, perm: 'service:families' }
- },
- {
- path: 'teacher-consult',
- name: 'TeacherConsult',
- component: () => import('@/views/TeacherConsult.vue'),
- meta: { title: '家长咨询', requiresTeacher: true, perm: 'assessment:consult' }
- },
- {
- path: 'teacher-families',
- name: 'TeacherFamilies',
- component: () => import('@/views/teacher/TeacherFamilies.vue'),
- meta: { title: '我的家庭', requiresTeacher: true, perm: 'service:families' }
- },
- {
- path: 'teacher-team',
- name: 'TeacherTeam',
- component: () => import('@/views/teacher/TeacherTeam.vue'),
- meta: { title: '我的团队', requiresTeacher: true, perm: 'service:team' }
- },
- {
- path: 'teacher-packages',
- name: 'TeacherPackages',
- component: () => import('@/views/teacher/TeacherPackages.vue'),
- meta: { title: '任务模板管理', requiresTeacher: true, perm: 'biz:packages' }
- },
- {
- path: 'teacher-orders',
- name: 'TeacherOrders',
- component: () => import('@/views/teacher/TeacherOrders.vue'),
- meta: { title: '订单与佣金', requiresTeacher: true, perm: 'biz:orders' }
- },
- // 系统管理
- {
- path: 'users',
- name: 'Users',
- component: () => import('@/views/Users.vue'),
- meta: { title: '用户管理', perm: 'system:users' }
- },
- {
- path: 'review-center',
- name: 'ReviewCenter',
- component: () => import('@/views/admin/ReviewCenter.vue'),
- meta: { title: '审核中心', perm: 'audit' }
- },
- {
- path: 'butler-assignments',
- name: 'ButlerAssignments',
- component: () => import('@/views/admin/ButlerAssignments.vue'),
- meta: { title: '管家分配管理', perm: 'audit' }
- },
- {
- path: 'operation-logs',
- name: 'OperationLogs',
- component: () => import('@/views/OperationLogs.vue'),
- meta: { title: '操作日志', perm: 'system:logs' }
- },
- {
- path: 'menu-manage',
- name: 'MenuManage',
- component: () => import('@/views/admin/MenuManage.vue'),
- meta: { title: '菜单管理', perm: 'system:menu' }
- },
- // 服务角色申请审核已合并进审核中心,旧路由重定向
- {
- path: 'service-role-applications',
- name: 'ServiceRoleApplications',
- redirect: '/review-center?tab=vendor'
- },
- {
- path: 'teacher-messages',
- name: 'TeacherMessages',
- component: () => import('@/views/teacher/TeacherMessages.vue'),
- meta: { title: '消息中心', requiresTeacher: true, perm: 'messages' }
- },
- {
- path: 'teacher-assessment',
- name: 'TeacherAssessment',
- component: () => import('@/views/teacher/TeacherAssessment.vue'),
- meta: { title: 'DAN测评管理', requiresTeacher: true, perm: 'assessment:dan' }
- },
- {
- path: 'teacher-proxy-report',
- name: 'TeacherProxyReport',
- component: () => import('@/views/teacher/ProxyReport.vue'),
- meta: { title: '代上传报告', requiresTeacher: true, perm: 'health:reports' }
- },
- {
- path: 'teacher-health-plan-review',
- name: 'TeacherHealthPlanReview',
- component: () => import('@/views/teacher/HealthPlanReview.vue'),
- meta: { title: '健康方案审核', requiresTeacher: true, perm: 'health:plan:review' }
- },
- {
- path: 'assessment-admin',
- name: 'AssessmentAdmin',
- component: () => import('@/views/admin/Assessment.vue'),
- meta: { title: '测评管理', perm: 'assessment:dan' }
- },
- {
- path: 'assessment-assign',
- name: 'AssessmentAssign',
- component: () => import('@/views/admin/AssessmentAssign.vue'),
- meta: { title: '待分配规划师', perm: 'assessment:dan' }
- },
- {
- path: 'assessment-orders',
- name: 'AssessmentOrders',
- component: () => import('@/views/admin/AssessmentOrders.vue'),
- meta: { title: '测评订单', perm: 'assessment:dan' }
- },
- {
- path: 'dan-execution',
- name: 'DanExecution',
- component: () => import('@/views/admin/DanExecution.vue'),
- meta: { title: 'DAN服务执行', perm: 'assessment:dan' }
- },
- {
- path: 'dan-settlement',
- name: 'DanSettlement',
- component: () => import('@/views/admin/DanSettlement.vue'),
- meta: { title: 'DAN结算管理', perm: 'assessment:dan' }
- },
- {
- path: 'product-manage',
- name: 'ProductManage',
- component: () => import('@/views/admin/ProductManage.vue'),
- meta: { title: '商品管理', perm: 'commerce:products,commerce:self' }
- },
- {
- path: 'inventory',
- name: 'InventoryManage',
- component: () => import('@/views/admin/InventoryManage.vue'),
- meta: { title: '库存管理', perm: 'commerce:products' }
- },
- {
- path: 'inventory/inbound-create',
- name: 'InventoryInboundCreate',
- component: () => import('@/views/admin/InventoryInboundCreate.vue'),
- meta: { title: '创建入库单', perm: 'commerce:products' }
- },
- {
- path: 'product-edit',
- name: 'ProductEdit',
- component: () => import('@/views/admin/ProductEdit.vue'),
- meta: { title: '商品编辑', perm: 'commerce:products' }
- },
- {
- path: 'assessment-products',
- name: 'AssessmentProducts',
- component: () => import('@/views/admin/AssessmentProducts.vue'),
- meta: { title: '测评商品管理', perm: 'commerce:products' }
- },
- {
- path: 'assessment-plan-rules',
- name: 'AssessmentPlanRules',
- component: () => import('@/views/admin/AssessmentPlanRules.vue'),
- meta: { title: '方案生成规则', perm: 'plan:rules' }
- },
- {
- path: 'plan-management',
- name: 'PlanManagement',
- component: () => import('@/views/admin/PlanManagement.vue'),
- meta: { title: '方案管理', perm: 'plan:manage' }
- },
- {
- path: 'category-manage',
- name: 'CategoryManage',
- component: () => import('@/views/admin/CategoryManage.vue'),
- meta: { title: '商品分类', perm: 'commerce:category' }
- },
- {
- path: 'order-manage',
- name: 'OrderManage',
- component: () => import('@/views/admin/OrderManage.vue'),
- meta: { title: '订单管理', perm: 'commerce:orders' }
- },
- {
- path: 'pending-refund',
- name: 'PendingRefund',
- component: () => import('@/views/admin/PendingRefund.vue'),
- meta: { title: '待退款管理', perm: 'commerce:orders' }
- },
- {
- path: 'order-detail/:orderNo',
- name: 'OrderDetail',
- component: () => import('@/views/admin/OrderDetail.vue'),
- meta: { title: '订单详情', perm: 'commerce:orders' }
- },
- {
- path: 'sys-config',
- name: 'SysConfig',
- component: () => import('@/views/admin/SysConfig.vue'),
- meta: { title: '系统配置', perm: 'system:base' }
- },
- {
- path: 'guide-config',
- name: 'GuideConfig',
- component: () => import('@/views/admin/GuideConfig.vue'),
- meta: { title: '引导配置', perm: 'system:base' }
- },
- {
- path: 'guide-popup-config',
- name: 'GuidePopupConfig',
- component: () => import('@/views/admin/GuidePopupConfig.vue'),
- meta: { title: '引导弹窗配置', icon: 'el-icon-s-opportunity' }
- },
- {
- path: 'guide-popup-stats',
- name: 'GuidePopupStats',
- component: () => import('@/views/admin/GuidePopupStats.vue'),
- meta: { title: '引导弹窗数据', icon: 'el-icon-data-analysis' }
- },
- {
- path: 'menu-manage',
- name: 'MenuManage',
- component: () => import('@/views/admin/MenuManage.vue'),
- meta: { title: '菜单管理', perm: 'system:menu' }
- },
- {
- path: 'energy-sandbox',
- name: 'EnergySandbox',
- component: () => import('@/views/admin/EnergySandbox.vue'),
- meta: { title: '五维能量', perm: 'energy' }
- },
- {
- path: 'energy-rule',
- name: 'EnergyRuleManagement',
- component: () => import('@/views/admin/EnergyRuleManagement.vue'),
- meta: { title: '能量规则管理', perm: 'energy' }
- },
- {
- path: 'energy-behavior-config',
- name: 'EnergyBehaviorConfig',
- component: () => import('@/views/admin/EnergyBehaviorConfig.vue'),
- meta: { title: '能量行为配置', perm: 'energy' }
- },
- {
- path: 'challenge-score-config',
- name: 'ChallengeScoreConfig',
- component: () => import('@/views/admin/ChallengeScoreConfig.vue'),
- meta: { title: '挑战评分配置', perm: 'energy' }
- },
- // ========== 文章管理 ==========
- {
- path: 'article-categories',
- name: 'ArticleCategory',
- component: () => import('@/views/admin/ArticleCategory.vue'),
- meta: { title: '文章分类', perm: 'articles:categories' }
- },
- {
- path: 'article-manage',
- name: 'ArticleManage',
- component: () => import('@/views/admin/ArticleManage.vue'),
- meta: { title: '文章管理', perm: 'articles:manage' }
- },
- {
- path: 'article-edit',
- name: 'ArticleEdit',
- component: () => import('@/views/admin/ArticleEdit.vue'),
- meta: { title: '文章编辑', perm: 'articles:manage' }
- },
- {
- path: 'comment-review',
- name: 'CommentReview',
- component: () => import('@/views/admin/CommentReview.vue'),
- meta: { title: '评论审核', perm: 'articles:manage' }
- },
- {
- path: 'notice-manage',
- name: 'NoticeManage',
- component: () => import('@/views/admin/NoticeManage.vue'),
- meta: { title: '公告管理', perm: 'admin' }
- },
- {
- path: 'periodic-service-config',
- name: 'PeriodicServiceConfig',
- component: () => import('@/views/admin/PeriodicServiceConfig.vue'),
- meta: { title: '周期性服务配置', perm: 'admin' }
- },
- {
- path: 'knowledge-tags',
- name: 'KnowledgeTag',
- component: () => import('@/views/admin/KnowledgeTag.vue'),
- meta: { title: '知识标签', perm: 'articles:categories' }
- },
- {
- path: 'vector-knowledge',
- name: 'VectorKnowledgeBase',
- component: () => import('@/views/admin/VectorKnowledgeBase.vue'),
- meta: { title: '向量知识库', perm: 'knowledge:base' }
- },
- {
- path: 'virtual-goods-config',
- name: 'VirtualGoodsConfig',
- component: () => import('@/views/admin/VirtualGoodsConfig.vue'),
- meta: { title: '虚拟支付道具', perm: 'config:member' }
- },
- {
- path: 'gates',
- name: 'Gates',
- component: () => import('@/views/admin/gates.vue'),
- meta: { title: '关卡配置', perm: 'system:base' }
- },
- {
- path: 'system-prompt',
- name: 'SystemPromptManagement',
- component: () => import('@/views/admin/SystemPromptManagement.vue'),
- meta: { title: '系统提示词', perm: 'system:base' }
- },
- // ========== 佣金推荐系统 ==========
- {
- path: 'product-profit-rate',
- name: 'ProductProfitRate',
- component: () => import('@/views/admin/ProductProfitRate.vue'),
- meta: { title: '产品利润率', perm: 'commerce:profit-rate' }
- },
- {
- path: 'product-ppoint',
- name: 'ProductPpointManage',
- component: () => import('@/views/admin/ProductPpointManage.vue'),
- meta: { title: 'P点配置', perm: 'commerce:ppoint' }
- },
- {
- path: 'cf-value',
- name: 'CfValueManage',
- component: () => import('@/views/admin/CfValueManage.vue'),
- meta: { title: 'CF值管理', perm: 'finance:cf-value' }
- },
- {
- path: 'supply-system',
- name: 'SupplySystemList',
- component: () => import('@/views/admin/supply-system/List.vue'),
- meta: { title: '供应商体系', perm: 'system:supply' }
- },
- {
- path: 'supply-system/create',
- name: 'SupplySystemCreate',
- component: () => import('@/views/admin/supply-system/Form.vue'),
- meta: { title: '新建体系', perm: 'system:supply' }
- },
- {
- path: 'supply-system/:id',
- name: 'SupplySystemDetail',
- component: () => import('@/views/admin/supply-system/Detail.vue'),
- meta: { title: '体系详情', perm: 'system:supply' },
- props: true
- },
- {
- path: 'supplier-products',
- name: 'SupplierProducts',
- component: () => import('@/views/admin/SupplierProductManage.vue'),
- meta: { title: '商品管理', perm: 'commerce:product' }
- },
- {
- path: 'supply-system/:id/edit',
- name: 'SupplySystemEdit',
- component: () => import('@/views/admin/supply-system/Form.vue'),
- meta: { title: '编辑体系', perm: 'system:supply' },
- props: true
- },
- {
- path: 'supply-hierarchy/change-requests',
- name: 'SupplyHierarchyChangeRequests',
- component: () => import('@/views/admin/supply-hierarchy/ChangeRequest.vue'),
- meta: { title: '更换上级审核', perm: 'system:supply' }
- },
- // ========== 供应商管理 (supplier_admin) ==========
- {
- path: 'supply-manage',
- name: 'SupplyManage',
- component: () => import('@/views/admin/supply-manage/List.vue'),
- meta: { title: '供应商管理', perm: 'supply:manage' }
- },
- {
- path: 'supply-manage/create',
- name: 'SupplyManageCreate',
- component: () => import('@/views/admin/supply-manage/Form.vue'),
- meta: { title: '新增供应商', perm: 'supply:manage' }
- },
- {
- path: 'supply-manage/:id',
- name: 'SupplyManageDetail',
- component: () => import('@/views/admin/supply-manage/Detail.vue'),
- meta: { title: '供应商详情', perm: 'supply:manage' },
- props: true
- },
- {
- path: 'supply-manage/:id/edit',
- name: 'SupplyManageEdit',
- component: () => import('@/views/admin/supply-manage/Form.vue'),
- meta: { title: '编辑供应商', perm: 'supply:manage' },
- props: true
- },
- {
- path: 'zodiac-configs',
- name: 'ZodiacConfigs',
- component: () => import('@/views/admin/ZodiacConfigs.vue'),
- meta: { title: '星座配置', perm: 'config:dimension' }
- },
- {
- path: 'bazi-configs',
- name: 'BaziConfigs',
- component: () => import('@/views/admin/BaziConfigs.vue'),
- meta: { title: '八字配置', perm: 'config:dimension' }
- },
- {
- path: 'blood-type-configs',
- name: 'BloodTypeConfigs',
- component: () => import('@/views/admin/BloodTypeConfigs.vue'),
- meta: { title: '血型配置', perm: 'config:dimension' }
- },
- {
- path: 'innate-portrait-config',
- name: 'InnatePortraitConfig',
- component: () => import('@/views/admin/InnatePortraitConfig.vue'),
- meta: { title: '先天画像权重配置', perm: 'config:dimension' }
- },
- {
- path: 'numsoul-detail-config',
- name: 'NumSoulDetailConfig',
- component: () => import('@/views/admin/NumSoulDetailConfig.vue'),
- meta: { title: '数字能量配置', perm: 'config:dimension' }
- },
- // ========== 饮食管理 (admin) ==========
- {
- path: 'foods',
- name: 'Foods',
- component: () => import('@/views/admin/Foods.vue'),
- meta: { title: '食材管理', perm: 'diet:foods' }
- },
- {
- path: 'recipes',
- name: 'Recipes',
- component: () => import('@/views/admin/Recipes.vue'),
- meta: { title: '食谱管理', perm: 'diet:recipes' }
- },
-
- {
- path: 'my-families',
- name: 'MyFamilies',
- component: () => import('@/views/teacher/FamilyList.vue'),
- meta: { title: '我的家庭', perm: 'service:family' }
- },
- {
- path: 'growth-records',
- name: 'GrowthRecords',
- component: () => import('@/views/teacher/GrowthRecords.vue'),
- meta: { title: '成长记录', perm: 'growth:records' }
- },
- {
- path: 'growth-plans',
- name: 'GrowthPlans',
- component: () => import('@/views/teacher/GrowthPlans.vue'),
- meta: { title: '成长计划', perm: 'growth:plans' }
- },
- {
- path: 'health-indicators',
- name: 'HealthIndicators',
- component: () => import('@/views/nutritionist/HealthIndicators.vue'),
- meta: { title: '健康指标', perm: 'health:indicators' }
- },
- {
- path: 'health-checkins',
- name: 'HealthCheckinManage',
- component: () => import('@/views/admin/HealthCheckinManage.vue'),
- meta: { title: '健康打卡管理', perm: 'health:checkins' }
- },
- {
- path: 'emotion-alert',
- name: 'EmotionAlertManage',
- component: () => import('@/views/admin/EmotionAlertManage.vue'),
- meta: { title: '情绪告警管理', perm: 'health:checkins' }
- },
- {
- path: 'nutrition-mappings',
- name: 'NutritionMappings',
- component: () => import('@/views/nutritionist/NutritionMappings.vue'),
- meta: { title: '营养素映射管理', perm: 'health:mappings' }
- },
- {
- path: 'report-management',
- name: 'ReportManagement',
- component: () => import('@/views/admin/ReportManagement.vue'),
- meta: { title: '报告管理', perm: 'health:reports' }
- },
- {
- path: 'report-management/:id',
- name: 'HealthReportEdit',
- component: () => import('@/views/admin/HealthReportEdit.vue'),
- meta: { title: '报告详情/编辑', perm: 'health:reports' },
- props: true
- },
- {
- path: 'report-proxy-upload',
- name: 'ProxyReportUpload',
- component: () => import('@/views/admin/ProxyReportUpload.vue'),
- meta: { title: '代传报告', perm: 'health:reports' }
- },
- {
- path: 'report-parse-status',
- name: 'ReportParseStatus',
- component: () => import('@/views/admin/ReportParseStatus.vue'),
- meta: { title: '解析进度', perm: 'health:reports' }
- },
- {
- path: 'seasonal-foods',
- name: 'SeasonalFoods',
- component: () => import('@/views/admin/SeasonalFoods.vue'),
- meta: { title: '应季食材', perm: 'diet:foods' }
- },
- {
- path: 'activities',
- name: 'Activities',
- component: () => import('@/views/admin/Activities.vue'),
- meta: { title: '活动列表', perm: 'activity:list,activity:self' }
- },
- {
- path: 'activity-edit',
- name: 'ActivityEdit',
- component: () => import('@/views/admin/ActivityEdit.vue'),
- meta: { title: '活动编辑', perm: 'activity:list' }
- },
- {
- path: 'home-banner-manage',
- name: 'HomeBannerManage',
- component: () => import('@/views/admin/HomeBannerManage.vue'),
- meta: { title: '首页广告栏', perm: 'marketing:promotion' }
- },
- {
- path: 'survey-templates',
- name: 'SurveyTemplates',
- component: () => import('@/views/admin/SurveyTemplates.vue'),
- meta: { title: '调研模板管理', perm: 'admin:all' }
- },
- {
- path: 'problem-domain-manage',
- name: 'ProblemDomainManage',
- component: () => import('@/views/admin/ProblemDomainManage.vue'),
- meta: { title: '问题域管理', perm: 'admin:all' }
- },
- {
- path: 'notification-template-manage',
- name: 'NotificationTemplateManage',
- component: () => import('@/views/admin/NotificationTemplateManage.vue'),
- meta: { title: '通知模板管理', perm: 'admin:all' }
- },
- {
- // 旧版活动审核页已由审核中心统一承接
- path: 'activity-review',
- redirect: '/review-center?tab=activity'
- },
- {
- path: 'activity-registration-review',
- name: 'ActivityRegistrationReview',
- component: () => import('@/views/admin/ActivityRegistrationReview.vue'),
- meta: { title: '活动报名审核', perm: 'activity:review' }
- },
- {
- path: 'poster-template-manage',
- name: 'PosterTemplateManage',
- component: () => import('@/views/admin/PosterTemplateManage.vue'),
- meta: { title: '海报模板管理', perm: 'activity:poster_template' }
- },
- // ========== 维度配置 + 知识库管理 ==========
- {
- path: 'coupon',
- name: 'CouponManagement',
- component: () => import('@/views/admin/CouponManagement'),
- meta: { title: '优惠券管理', perm: 'marketing:coupon' }
- },
- {
- path: 'coupon-grant-log',
- name: 'CouponGrantLog',
- component: () => import('@/views/admin/CouponGrantLog.vue'),
- meta: { title: '发券记录', perm: 'marketing:coupon' }
- },
- {
- path: 'discount-rules',
- name: 'DiscountRuleManagement',
- component: () => import('@/views/admin/DiscountRuleManagement.vue'),
- meta: { title: '限时折扣管理', perm: 'marketing:discount' }
- },
- {
- path: 'recommendation-rules',
- name: 'RecommendationRules',
- component: () => import('@/views/admin/RecommendationRules.vue'),
- meta: { title: '商品推荐规则管理', perm: 'config:recommendation' }
- },
- {
- path: 'promotion',
- name: 'PromotionManagement',
- component: () => import('@/views/admin/PromotionManagement'),
- meta: { title: '推广管理', perm: 'marketing:promotion' }
- },
- {
- path: 'family-earnings',
- name: 'FamilyEarnings',
- component: () => import('@/views/admin/FamilyEarnings.vue'),
- meta: { title: '家庭收益管理', perm: 'marketing:promotion' }
- },
- {
- path: 'family-earnings-withdraw',
- name: 'FamilyEarningsWithdraw',
- component: () => import('@/views/admin/FamilyEarningsWithdraw.vue'),
- meta: { title: '家庭收益提现审核', perm: 'audit:withdraw' }
- },
- {
- path: 'dimension-config',
- name: 'DimensionConfig',
- component: () => import('@/views/admin/dimension'),
- meta: { title: '维度配置', perm: 'config:dimension' }
- },
- {
- path: 'knowledge-base',
- name: 'KnowledgeBase',
- component: () => import('@/views/admin/knowledge'),
- meta: { title: '知识库管理', perm: 'knowledge:base' }
- },
- {
- path: 'health-knowledge',
- name: 'HealthKnowledge',
- component: () => import('@/views/admin/health-knowledge'),
- meta: { title: '健康知识库管理', perm: 'knowledge:base' }
- },
- {
- path: 'knowledge-base/unified',
- name: 'UnifiedKnowledgeBase',
- component: () => import('@/views/admin/unified-knowledge.vue'),
- meta: { title: '统一知识库管理', perm: 'knowledge:base' }
- },
- // ========== 健康维度配置 ==========
- {
- path: 'health-norm-config',
- name: 'HealthNormConfig',
- component: () => import('@/views/admin/dimension-config'),
- meta: { title: '健康常模配置', perm: 'config:health' }
- },
- {
- path: 'health-data-source',
- name: 'HealthDataSource',
- component: () => import('@/views/admin/data-source-config'),
- meta: { title: '健康数据源配置', perm: 'config:health' }
- },
- {
- path: 'health-energy-config',
- name: 'HealthEnergyConfig',
- component: () => import('@/views/admin/HealthEnergyConfig'),
- meta: { title: '五维能量配置', perm: 'config:health' }
- },
- {
- path: 'energy-config',
- name: 'EnergyConfig',
- component: () => import('@/views/admin/energy-config/WuxingConfig'),
- meta: { title: '五行能量配置', perm: 'config:health' }
- },
- {
- path: 'indicators',
- name: 'IndicatorManage',
- component: () => import('@/views/admin/indicators'),
- meta: { title: '指标管理', perm: 'config:health' }
- },
- {
- path: 'indicator-correlations',
- name: 'IndicatorCorrelations',
- component: () => import('@/views/admin/IndicatorCorrelations.vue'),
- meta: { title: '指标关联配置', perm: 'config:health' }
- },
- {
- path: 'indicator-mappings',
- name: 'IndicatorMappings',
- component: () => import('@/views/admin/IndicatorMappings.vue'),
- meta: { title: '指标映射管理', perm: 'config:health' }
- },
- // ========== 虚拟服务商团队管理 ==========
- {
- path: 'virtual-teams',
- name: 'VirtualTeamList',
- component: () => import('@/views/admin/VirtualTeamList'),
- meta: { title: '虚拟团队管理', perm: 'system:base' }
- },
- {
- path: 'virtual-team-detail/:systemId',
- name: 'VirtualTeamDetail',
- component: () => import('@/views/admin/VirtualTeamDetail'),
- meta: { title: '团队成员管理', perm: 'system:base' },
- props: true
- },
- // ========== 电商供应商管理(已合并至供应商体系,路由指向 /supply-system)==========
- {
- path: 'ecom-supplier',
- redirect: '/admin/supply-system',
- name: 'EcomSupplierManage',
- meta: { title: '电商供应商管理', perm: 'system:supply', hidden: true }
- },
- {
- path: 'badge-manage',
- name: 'BadgeManage',
- component: () => import('@/views/admin/BadgeManage'),
- meta: { title: '勋章管理', perm: 'config:member' }
- },
- // ========== 报告指纹解析系统 ==========
- {
- path: 'report-types',
- name: 'ReportTypeManagement',
- component: () => import('@/views/admin/ReportTypeManagement.vue'),
- meta: { title: '报告类型管理', perm: 'config:report-parser' }
- },
- {
- path: 'report-parser-import',
- name: 'ReportParserImport',
- component: () => import('@/views/admin/ReportParserImport.vue'),
- meta: { title: '解析器导入管理', perm: 'config:report-parser' }
- },
- {
- path: 'report-collector-trainer',
- name: 'ReportCollectorTrainer',
- component: () => import('@/views/admin/ReportCollectorTrainer.vue'),
- meta: { title: '报告采集训练', perm: 'config:report-parser' }
- },
- {
- path: 'report-template',
- name: 'ReportTemplateManage',
- component: () => import('@/views/admin/ReportTemplateManage.vue'),
- meta: { title: '报告模板管理', perm: 'config:report-parser' }
- },
- {
- path: 'report-unknown-clusters',
- name: 'ReportUnknownCluster',
- component: () => import('@/views/admin/ReportUnknownCluster.vue'),
- meta: { title: '未知报告审核', perm: 'config:report-parser' }
- },
- {
- path: 'report-auto-learn',
- name: 'ReportAutoLearn',
- component: () => import('@/views/admin/ReportAutoLearn.vue'),
- meta: { title: '报告自学习', perm: 'config:report-parser' }
- },
- // ========== LangGraph AI 服务管理 ==========
- {
- path: 'langgraph-admin',
- name: 'LangGraphAdmin',
- component: () => import('@/views/admin/LangGraphAdmin.vue'),
- meta: { title: 'LangGraph 管理', perm: 'config:report-parser' }
- },
- // ========== 营养产品管理 ==========
- {
- path: 'nutrition-products',
- name: 'NutritionProducts',
- component: () => import('@/views/admin/NutritionProducts.vue'),
- meta: { title: '营养产品管理', perm: 'health:*' }
- },
- {
- path: 'file-manage',
- name: 'FileManage',
- component: () => import('@/views/admin/FileManage'),
- meta: { title: '文件管理', perm: 'system:base' }
- }
- ]
- }
- ]
- const router = new VueRouter({
- mode: 'history',
- base: process.env.BASE_URL,
- routes
- })
- // Token 验证缓存:避免 redirect 链中重复调用 /api/admin-auth/info
- let tokenValidationCache = { token: '', timestamp: 0 }
- const TOKEN_CACHE_TTL = 30000 // 30秒内不重复验证
- async function validateToken(token) {
- try {
- const baseURL = process.env.VUE_APP_BASE_API || ''
- const res = await axios.post(`${baseURL}/api/admin-auth/info`, {}, {
- headers: { Authorization: `Bearer ${token}` },
- validateStatus: () => true
- })
- return res.status === 200 && res.data?.code === 200
- } catch (e) {
- return false
- }
- }
- router.beforeEach(async (to, from, next) => {
- const token = localStorage.getItem('token')
- const role = localStorage.getItem('role')
- // 1. 登录页允许访问
- if (to.path === '/login') {
- // 如果已有token和role,直接跳转到对应角色首页
- if (token && role) {
- const rolesStr = localStorage.getItem('roles')
- const roleList = rolesStr ? JSON.parse(rolesStr) : [role]
- const home = getRoleHomePage(roleList)
- if (home !== '/') {
- return next(home)
- }
- }
- return next()
- }
- // 2. 无Token强制跳转
- if (!token) {
- return next('/login')
- }
- // 3. Token有效性验证 (使用缓存避免 redirect 链重复调用)
- const now = Date.now()
- let isValid = false
- if (tokenValidationCache.token === token && (now - tokenValidationCache.timestamp) < TOKEN_CACHE_TTL) {
- isValid = true
- } else {
- isValid = await validateToken(token)
- if (isValid) {
- tokenValidationCache = { token, timestamp: now }
- }
- }
- if (!isValid) {
- tokenValidationCache = { token: '', timestamp: 0 }
- localStorage.clear()
- return next('/login')
- }
- // 3.5 入驻角色访问 /dashboard → 跳转各自工作台(B-6 入驻角色默认首页)
- if (to.path === '/dashboard') {
- const rolesStr = localStorage.getItem('roles')
- const roleList = rolesStr ? JSON.parse(rolesStr) : [role]
- const home = getRoleHomePage(roleList)
- if (home !== '/') {
- return next(home)
- }
- }
- // 4. 权限检查:如果路由有 perm 要求,检查用户权限
- const requiredPerm = to.meta && to.meta.perm
- if (requiredPerm) {
- const rolesStr = localStorage.getItem('roles')
- const roles = rolesStr ? JSON.parse(rolesStr) : [localStorage.getItem('role')]
- const perms = getEffectivePermissions(roles)
- if (!hasPermission(perms, requiredPerm)) {
- console.warn('Access denied: insufficient permissions for', to.name)
- return next({ path: '/403', replace: true })
- }
- }
- return next()
- })
- // Suppress navigation guard redirect errors (teacher/admin route cross-access)
- const originalPush = VueRouter.prototype.push
- VueRouter.prototype.push = function push(location) {
- return originalPush.call(this, location).catch(err => err)
- }
- export default router
|