132 lines
3.3 KiB
JavaScript
132 lines
3.3 KiB
JavaScript
import Vue from 'vue'
|
|
import VueRouter from 'vue-router'
|
|
import HomeView from '../views/HomeView.vue'
|
|
import index from '../views/index.vue'
|
|
import login from '../views/login.vue'
|
|
import control from '../views/control.vue'
|
|
Vue.use(VueRouter)
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: 'login',
|
|
component: login,
|
|
},
|
|
{
|
|
path: '/home',
|
|
name: 'home',
|
|
component: HomeView,
|
|
redirect: '/status',
|
|
children: [{
|
|
path: '/status',
|
|
name: 'status',
|
|
component: () => import('../views/page/status.vue')
|
|
},]
|
|
},
|
|
{
|
|
path: '/largeScreen',
|
|
name: 'largeScreen',
|
|
component: () => import('../views/page/largeScreen.vue')
|
|
},
|
|
{
|
|
path: '/index',
|
|
name: 'index',
|
|
component: index,
|
|
redirect: '/realTime',
|
|
children: [{
|
|
path: '/realTime',
|
|
name: 'realTime',
|
|
component: () => import('../views/page/realTime.vue')
|
|
},{
|
|
path: '/formula',
|
|
name: 'formula',
|
|
component: () => import('../views/page/formula.vue')
|
|
},{
|
|
path: '/irrigateSet',
|
|
name: 'irrigateSet',
|
|
component: () => import('../views/page/irrigateSet.vue')
|
|
},{
|
|
path: '/PIDSet',
|
|
name: 'PIDSet',
|
|
component: () => import('../views/page/PIDSet.vue')
|
|
},{
|
|
path: '/systemSet',
|
|
name: 'systemSet',
|
|
component: () => import('../views/page/systemSet.vue')
|
|
},{
|
|
path: '/upload',
|
|
name: 'upload',
|
|
component: () => import('../views/page/upload.vue')
|
|
},{
|
|
path: '/sensorSet',
|
|
name: 'sensorSet',
|
|
component: () => import('../views/page/sensorSet.vue')
|
|
},{
|
|
path: '/history',
|
|
name: 'history',
|
|
component: () => import('../views/page/history.vue')
|
|
},{
|
|
path: '/dataAnalysis',
|
|
name: 'dataAnalysis',
|
|
component: () => import('../views/page/dataAnalysis.vue')
|
|
},{
|
|
path: '/systemManage',
|
|
name: 'systemManage',
|
|
component: () => import('../views/page/systemManage.vue')
|
|
}, {
|
|
path: '/control',
|
|
name: 'control',
|
|
component: control,
|
|
redirect: '/skylight',
|
|
children: [{
|
|
path: '/skylight',
|
|
name: 'skylight',
|
|
component: () => import('../views/page/skylight.vue')
|
|
},{
|
|
path: '/fan',
|
|
name: 'fan',
|
|
component: () => import('../views/page/fan.vue')
|
|
},{
|
|
path: '/upload-con',
|
|
name: 'upload-con',
|
|
component: () => import('../views/page/upload-con.vue')
|
|
},{
|
|
path: '/sensorSet-con',
|
|
name: 'sensorSet-con',
|
|
component: () => import('../views/page/sensorSet-con.vue')
|
|
},{
|
|
path: '/synthesis-con',
|
|
name: 'synthesis-con',
|
|
component: () => import('../views/page/synthesis-con.vue')
|
|
},]
|
|
},]
|
|
},
|
|
|
|
{
|
|
path: '/vrcode',
|
|
name: 'vrcode',
|
|
component: () => import('../views/vrcode.vue'),
|
|
redirect: '/plantingPlan',
|
|
children: [{
|
|
path: '/plantingPlan',
|
|
name: 'plantingPlan',
|
|
component: () => import('../views/vrcode/plantingPlan.vue')
|
|
}]
|
|
},
|
|
]
|
|
|
|
const router = new VueRouter({
|
|
mode: 'hash',
|
|
base: process.env.BASE_URL,
|
|
routes
|
|
})
|
|
router.beforeEach(async (to,from,next) => {
|
|
if (to.meta.title) { // 判断是否有标题
|
|
document.title = to.meta.title;
|
|
}else{
|
|
document.title ='温室智慧云'
|
|
}
|
|
next();
|
|
});
|
|
export default router
|