import Vue from "vue";
import Router from "vue-router";
//import Layout from "../layout/index";
import HomeLayout from "../layout/home";

Vue.use(Router);

export const constantRouterMap = [
	{
        path: "/plus/login",
        meta: { title: "登录login", noCache: true },
        component: (resolve) => {
			require(["@/views/system/user/login"], resolve)
        },
        hidden: true
    },
    {
        path: "/404",
		redirect: "/dashboard",
        component: resolve => require(["@/views/features/404"], resolve),
        hidden: true
    },
    {
        path: "/401",
        component: resolve => require(["@/views/features/401"], resolve),
        hidden: true
    },
    {
		path: "/redirect",
		//component: Layout,
		component: HomeLayout,
		hidden: true,
		children: [
			{
				path: "/redirect/:path*",
				component: resolve => require(["@/views/features/redirect"], resolve)
			}
		]
	},
	{
        path: process.env.VUE_APP_3D_API,
		meta: { title: '三维大屏', icon: "mnt", affix: true, noCache: true }
    },
	{
        path: "/",
        component: HomeLayout,
        redirect: "/dashboard",
		children: [
		  {
			path: 'dashboard',
			component: (resolve) => require(['@/views/home_manage'], resolve),
			name: 'Dashboard',
			meta: { title: '主页面', icon: 'index', affix: true, noCache: true }
		  }
		]
    },
    {
		path: "/user",
		//component: Layout,
		component: HomeLayout,
		hidden: true,
		redirect: "noredirect",
		children: [
			{
				path: "center",
				component: resolve => require(["@/views/system/user/center"], resolve),
				name: "个人中心",
				meta: { title: "个人中心" }
			}
		]
    },
];

export default new Router({
    // mode: 'hash',
    mode:"history",
	//base: '/mobile/',
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRouterMap
});
