epans 11 kuukautta sitten
vanhempi
commit
b97ab068f8
5 muutettua tiedostoa jossa 124 lisäystä ja 1 poistoa
  1. 4 0
      src/App.vue
  2. BIN
      src/assets/nlogin-bg1.jpg
  3. 1 0
      src/router/index.js
  4. 1 1
      src/router/index100.js
  5. 118 0
      src/router/index102.js

+ 4 - 0
src/App.vue

@@ -78,6 +78,10 @@ console.log = (function (oldLogFunc) {
 .cust-rest{display: inline-block;width:33%;color:#FF4949}
 
 
+/* 按钮 搜索 大 */
+/* .btn-search{ background: #d1d9e9; border-color: $color8; color: $color3;padding: 7px 10px !important;font-size:14px;min-width:60px;}
+  .miniPrimary:focus{background: $color8; border-color: $color8; color: $color3;padding: 7px 10px !important;font-size:14px;min-width:60px;}
+  .miniPrimary:hover{color: $color3; border-color: $color9; background-color: $color9;padding: 7px 10px !important;font-size:14px;min-width:60px;} */
 
  
 </style>

BIN
src/assets/nlogin-bg1.jpg


+ 1 - 0
src/router/index.js

@@ -1,3 +1,4 @@
+// 102 按需加载路由
 import Vue from 'vue'
 import Router from 'vue-router'
 /*import Login from '@/views/Login.vue'

+ 1 - 1
src/router/index1.js → src/router/index100.js

@@ -1,4 +1,4 @@
-// 普通路由
+// 100普通路由
 import Vue from 'vue'
 import Router from 'vue-router'
 import Login from '@/views/Login.vue'

+ 118 - 0
src/router/index102.js

@@ -0,0 +1,118 @@
+// 102 按需加载路由
+import Vue from 'vue'
+import Router from 'vue-router'
+/*import Login from '@/views/Login.vue'
+import Home from '@/views/Home.vue'
+
+import Welcome from '@/views/Welcome.vue'
+
+
+
+import FeedProcess from '@/views/dataStatistics/FeedProcess.vue'
+import WeightTrend from '@/views/dataStatistics/WeightTrend.vue'
+import FormulaEffect from '@/views/dataStatistics/FormulaEffect.vue'
+import GrowthRate from '@/views/dataStatistics/GrowthRate.vue'
+import GrowthRate from '@/views/dataStatistics/GrowthRate.vue'
+import FeedCost from '@/views/dataStatistics/FeedCost.vue'
+import DiseaseSituation from '@/views/dataStatistics/DiseaseSituation.vue'
+import SurvivalRate from '@/views/dataStatistics/SurvivalRate.vue'
+
+
+import WeightRecord from '@/views/cowManagement/WeightRecord.vue'
+import CowInfo from '@/views/cowManagement/CowInfo.vue'
+import EventRecord from '@/views/cowManagement/EventRecord.vue'
+
+
+
+
+import CowCowShed from '@/views/cowShedManagement/CowCowShed.vue'
+import CowShedGroup from '@/views/cowShedManagement/CowShedGroup.vue'
+
+import FeedPlan from '@/views/formulaPlan/FeedPlan.vue'
+import FormulaTemplate from '@/views/formulaPlan/FormulaTemplate.vue'
+
+import WorkTaskAssign from '@/views/workManagement/WorkTaskAssign.vue'
+import WorkTaskImplement from '@/views/workManagement/WorkTaskImplement.vue'
+
+
+import CalfType from '@/views/basicSettings/CalfType.vue'
+import WorkOrderType from '@/views/basicSettings/WorkOrderType.vue'
+import FeedCarManagement from '@/views/basicSettings/FeedCarManagement.vue'
+import DiseaseManagement from '@/views/basicSettings/DiseaseManagement.vue'
+import InfoRemind from '@/views/basicSettings/InfoRemind.vue'
+import DiseaseType from '@/views/basicSettings/DiseaseType.vue'
+import FeedTemplate from '@/views/basicSettings/FeedTemplate.vue'
+import DefaultPara from '@/views/basicSettings/DefaultPara.vue'
+import FeedCostSet from '@/views/basicSettings/FeedCostSet.vue'
+
+import User from '@/views/systemManagement/User.vue'
+import Role from '@/views/systemManagement/Role.vue'
+*/
+
+Vue.use(Router)
+
+const router =  new Router({
+  mode:'hash',
+  routes: [
+    // 当路径为/,重定向路径到/login
+    { path: '/', redirect: '/login' },
+    // 当路径为/login,转到组件Login
+    { path: '/login', component: () =>import('../views/Login.vue') },
+    {
+      path: '/home',
+      component: () => import('../views/Home.vue'),
+      // 当路径为/home,转到组件welcome
+      redirect: '/welcome',
+      //children里面放的是home组件下的子组件
+      children:[
+        { path: '/welcome', component: ()=> import('../views/Welcome.vue') },
+        { path: '/FeedProcess', component: ()=> import('../views/dataStatistics/FeedProcess.vue') },
+        { path: '/WeightTrend', component:() =>import('../views/dataStatistics/WeightTrend.vue') },
+        { path: '/FormulaEffect', component: () => import('../views/dataStatistics/FormulaEffect.vue') },
+        { path: '/GrowthRate', component: ()=> import('../views/dataStatistics/GrowthRate.vue') },
+        { path: '/FeedCost', component: () => import('../views/dataStatistics/FeedCost.vue') },
+        { path: '/DiseaseSituation', component: () => import('../views/dataStatistics/DiseaseSituation.vue') },
+        { path: '/SurvivalRate', component: () => import('../views/dataStatistics/SurvivalRate.vue') },
+        { path: '/WeightRecord', component: () => import('../views/cowManagement/WeightRecord.vue') },
+        { path: '/CowInfo', component: () => import('../views/cowManagement/CowInfo.vue') },
+        { path: '/EventRecord', component: () => import('../views/cowManagement/EventRecord.vue') },
+        { path: '/CowCowShed', component: () => import('../views/cowShedManagement/CowCowShed.vue') },
+        { path: '/CowShedGroup', component: () => import('../views/cowShedManagement/CowShedGroup.vue') },
+        { path: '/FeedPlan', component: () => import('../views/formulaPlan/FeedPlan.vue') },
+        { path: '/FormulaTemplate', component: () => import('../views/formulaPlan/FormulaTemplate.vue') },
+        { path: '/WorkTaskAssign', component: () => import('../views/workManagement/WorkTaskAssign.vue') },
+        { path: '/WorkTaskImplement', component: () => import('../views/workManagement/WorkTaskImplement.vue') },
+        { path: '/CalfType', component: () => import('../views/basicSettings/CalfType.vue') },
+        { path: '/WorkOrderType', component: () => import('../views/basicSettings/WorkOrderType.vue') },
+        { path: '/FeedCarManagement', component: () => import('../views/basicSettings/FeedCarManagement.vue') },
+        { path: '/DiseaseManagement', component: () => import('../views/basicSettings/DiseaseManagement.vue') },
+        { path: '/InfoRemind', component: () => import('../views/basicSettings/InfoRemind.vue') },
+        { path: '/DiseaseType', component: () => import('../views/basicSettings/DiseaseType.vue') },
+        { path: '/FeedTemplate', component: () => import('../views/basicSettings/FeedTemplate.vue') },
+        { path: '/DefaultPara', component: () => import('../views/basicSettings/DefaultPara.vue') },
+        { path: '/FeedCostSet', component: () => import('../views/basicSettings/FeedCostSet.vue') },
+        { path: '/User', component: () => import('../views/systemManagement/User.vue') },
+        { path: '/Role', component: () => import('../views/systemManagement/Role.vue') },
+      ]
+    }
+  ]
+})
+
+
+
+// 添加 beforeEach 导航守卫,如果用户没登录,直接访问其他页面,就跳转到登录页
+router.beforeEach((to, form, next) => {
+  // to 将要访问的路径
+  // form 代表从哪个路径跳转而来
+  // next 是一个函数,表示放行
+  // next() 放行,next('/login')强制跳转
+  //如果用户访问登录页,直接放行,
+  if(to.path === '/login') return next();
+  //从本地存储获取到token信息
+  // const tokenStr  = window.sessionStorage.getItem('token')
+  //没有token就强制跳转到登录页
+  //if (!tokenStr) return next('/login')
+  next()
+})
+
+export default router