/**
 * 定义静态路由表：
 * 1、在任何权限下都可以访问，例如：login、401、404
 * 2、这些路由不会出现在菜单树上
 */
import Layout from '/@/layout/index.vue';
import {homeRoute} from "./home";

/**
 * 静态路由表
 */
export const staticRoutes = [
    // 登录页
    {
        name: 'login',
        path: '/login',
        component: () => import('/@/sp-views/login/index.vue'),
    },
    // 404
    {
        name: '403',
        path: "/403",
        component: () => import('/@/layout/view/403'),
    },
    // 404
    {
        name: '404',
        path: "/404",
        component: () => import('/@/layout/view/404'),
    },
    // iframe 视图
    {
        redirect: homeRoute.path,
        component: Layout,
        children: [
            {
                name: 'iframe',
                path: '/iframe',
                component: () => import('/@/layout/view/iframe-view'),
            }
        ],
    },
    {
        name: 'whole404',
        path: "/:pathMatch(.*)*",
        component: () => import('/@/layout/view/whole404'),
        // redirect: '/404',   // 使用 redirect 方式，会导致浏览器path也变成404，不方便调试，所以改为 component 显示方式 
        // component: () => import('/@/layout/view/404'),
    }
];

// 判断一个路由是否为静态路由 
export const isStaticRoute = function (to) {
    return ['login', '403', '404', 'iframe', homeRoute.name].indexOf(to.name) > -1;
}
