import Layout from '@/layout'
import config from '@/config'

/**
 // path可以设置为网址
 path : http://haha.com

 // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 hidden: true // (默认 false)

 // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 redirect: 'noRedirect'

 // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式
 // 只有一个时，会将那个子路由当做根路由显示在侧边栏
 // 若你想不管路由下面的 children 声明的个数都显示你的根路由你可以设置 alwaysShow: true，
 // 这样它就会忽略之前定义的规则，一直显示根路由
 alwaysShow: true

 name: 'router-name' // 必要的，设定路由的名字。使用<keep-alive>缓存时，路由名称必须与页面组件名称一致

 meta: {
    title: 'title' // 可选的，菜单栏和面包屑中的名称，默认为空。建议填写
    icon: 'svg-name' // 可选的，菜单栏中的icon，默认为空。建议填写
    whitelist: true // 可选的，白名单无需登录，默认为false
    permissions: 'permissions1,permissions2' // 可选的，设置该路由进入的权限，支持多个权限判断，有其中一个权限则可访问。默认为空，不需要权限控制
    noCache: true // 可选的，是否不被<keep-alive>缓存，默认false。
    breadcrumb: false // 可选的，是否在面包屑中显示，默认true
    activeMenu: '/example/list'  // 可选的，高亮显示路径，默认当前路径
    activePath: '/example/list'  // 可选的，当path中包含:配备时，转到此路径
 }
 */
export default [
    {
        path: '/redirect',
        component: Layout,
        name: "redirect",
        hidden: true,
        meta: {title: '转发', icon: 'user', permissions: 'developer'},
        children: [{
            path: ':path*',
            component: () => import('@/views/common/redirect')
        }]
    }, {
        path: '/login',
        hidden: true,
        name: 'login',
        component: () => import('@/views/common/login/' + config.appName),
        meta: {whitelist: true, permissions: 'developer'}
    },
    {
        path: '/personal',
        component: Layout,
        hidden: true,
        redirect: '/personal/index',
        meta: {title: '个人中心', icon: 'user', permissions: '个人中心'},
        children: [{
            path: 'index',
            name: 'personalIndex',
            component: () => import('@/views/common/personal/index'),
            meta: {title: '个人中心', icon: 'user'}
        }]
    },
    {
        path: '/element',
        component: Layout,
        redirect: '/element/table',
        meta: {title: 'element组件', icon: 'user', permissions: 'developer'},
        children: [{
            path: 'input',
            name: 'elementForm',
            component: () => import('@/views/common/element/form'),
            meta: {title: 'Form组件', icon: 'user'}
        }]
    },
    {
        path: '/map',
        component: Layout,
        redirect: '/map/polyline',
        meta: {title: '地图操作', icon: 'user', permissions: 'developer'},
        children: [{
            path: 'polyline',
            name: 'polyline',
            component: () => import('@/views/common/map/polyline'),
            meta: {title: '地理围栏', icon: 'user'},
        }, {
            path: 'polygon',
            name: 'polygon',
            component: () => import('@/views/common/map/polygon'),
            meta: {title: '多边形', icon: 'user'},
        }, {
            path: 'position',
            name: 'position',
            component: () => import('@/views/common/map/position'),
            meta: {title: '位置信息', icon: 'user'},
        }]
    },
    {
        path: '/other',
        component: Layout,
        redirect: '/other/fileUpload',
        meta: {title: '其他组件', icon: 'user', permissions: 'developer'},
        children: [{
            path: 'fileUpload',
            name: 'fileUpload',
            component: () => import('@/views/common/other/FileUpload'),
            meta: {title: '文件上传', icon: 'user'},
        }, {
            path: 'tinymce',
            name: 'tinymce',
            component: () => import('@/views/common/other/tinymceRichText'),
            meta: {title: 'tinymce富文本编辑器', icon: 'user'},
        }, {
            path: 'iframe',
            name: 'iframe',
            component: () => import('@/views/common/other/iframe'),
            meta: {title: 'iframe网页', icon: 'user'},
        }]
    },
    {
        path: '/test',
        component: Layout,
        meta: {title: '测试', icon: 'user', permissions: 'developer'},
        children: [{
            path: 'index',
            name: 'Test',
            component: () => import('@/views/common/test/index'),
            meta: {title: '测试', icon: 'user', whitelist: true},
        }, {
            path: 'index2',
            name: 'Test2',
            component: () => import('@/views/common/test/index2'),
            meta: {title: '测试2', icon: 'user', whitelist: true},
        }],
    },
    {
        path: 'https://www.feihangkeji.com',
        component: Layout,
        meta: {title: '关于我们', icon: 'user', permissions: 'developer'},
    },
    // 404 page must be placed at the end !!!
    {
        path: '*',
        redirect: '/home',
        meta: {title: 'other', icon: 'user', permissions: 'developer'},
        hidden: true
    }
]
