import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import Home from '../pages/Home.vue'
const routes = [{
    path: '/',
    redirect: '/search/create',
},
{
    path: '/',
    name: 'Home',
    redirect: '/search/create',
    component: Home,
    children: [
        {
            icon: 'iconfont iconbaojingpeizhi',
            path: '/search',
            name: 'search',
            redirect: '/search/create',
            meta: {
                title: '查询',
            },
            component: () =>
                import(
                    '../pages/routerViewss.vue'
                ),
            children: [
                {
                    icon: 'el-icon-s-home',
                    path: '/search/create',
                    name: 'searchCreate',
                    meta: {
                        title: '查询',
                    },
                    component: () =>
                        import(
                            '../pages/search/create/index.vue'
                        ),
                        
                },
            ]
        },
       
        {
            icon: 'iconfont iconbaojingpeizhi',
            path: '/redis',
            name: 'redis',
            redirect: '/redis/create',
            meta: {
                title: 'Redis服务',
            },
            component: () =>
                import(
                    '../pages/routerViewss.vue'
                ),
            children: [
                {
                    icon: 'el-icon-s-home',
                    path: '/redis/create',
                    name: 'redisCreate',
                    meta: {
                        title: 'Redis服务',
                    },
                    component: () =>
                        import(
                            '../pages/redis/create/index.vue'
                        ),
                },
            ]
        },
       
        {
            icon: 'iconfont iconbaojingpeizhi',
            path: '/buildTable',
            name: 'buildTable',
            redirect: '/buildTable/create',
            meta: {
                title: '点表管理',
            },
            component: () =>
                import(
                    '../pages/routerViewss.vue'
                ),
            children: [
                {
                    icon: 'el-icon-s-home',
                    path: '/buildTable/create',
                    name: 'buildTableCreate',
                    meta: {
                        title: '点表管理',
                    },
                    component: () =>
                        import(
                            '../pages/buildTable/create/index.vue'
                        ),
                },
            ]
        },
        
        {
            icon: 'iconfont iconbaojingpeizhi',
            path: '/look',
            name: 'look',
            redirect: '/look/create',
            meta: {
                title: '高级查询',
            },
            component: () =>
                import(
                    '../pages/routerViewss.vue'
                ),
            children: [
                {
                    icon: 'el-icon-s-home',
                    path: '/look/create',
                    name: 'lookCreate',
                    meta: {
                        title: '高级查询',
                    },
                    component: () =>
                        import(
                            '../pages/look/create/index.vue'
                        ),
                }
            ]
        },

     
        //  {
        //     // icon: 'el-icon-s-home',
        //     path: '/components/Lookpat',
        //     name: 'Lookpat',
        //     meta: {
        //         title: '高级查询',
        //     },
        //     component: () =>
        //         import(
        //             '../pages/search/create/components/Lookpat.vue'
        //         ),
        // }
    ],
    
       
    
},


// {
//     path: '/login',
//     name: 'Login',
//     meta: {
//         title: '登录',
//     },
//     component: () =>
//         import(
//             /* webpackChunkName: "login" */
//             '../pages/Login.vue'
//         ),
// },
]

const router = createRouter({
    history: createWebHashHistory(''),
    routes,
})

router.beforeEach((to, from, next) => {
    document.title = `${to.meta.title} | taos管理`
    // const role = sessionStorage.getItem('ms_chinesename')
    // if (!role && to.path !== '/login') {
    //     next('/login')
    // } else {
        next()
    // }
})

export default router