import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/views/layout/Layout";


export const constantRouterMap = [
  // {
  //   path: "/redirect",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "/redirect/:path*",
  //       component: () => import("@/views/redirect/index")
  //     }
  //   ]
  // },
  // {path:'/',
  // redirect:'/login'},
  { path: "*", redirect: "/login", hidden: true },
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true
  },  
  {
    path: "/auth-redirect",
    component: () => import("@/views/login/authredirect"),
    hidden: true
  },
  {
    path: "/404",
    component: () => import("@/views/errorPage/404"),
    hidden: true
  },
  {
    path: "/401",
    component: () => import("@/views/errorPage/401"),
    hidden: true
  },
  
  
    
   
];

export const asyncRouterMap=[   
  {
    path: "/404",
    component: () => import("@/views/errorPage/404"),
    hidden: true
  },
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true
  }, 
    {path:'/',
  redirect:'/login'}, 
  {
    path: "/",
    component: Layout,
    children: [
      {
        path: "dashboard",
        component: () => import("@/views/dashboard/index"),
        name: "Dashboard",
        meta: {
          title: "首页",
          icon: "dashboard",
          affix: true

        }
      },
  
    ]
  },
  {
    path: "/profile",
    component: Layout,
    redirect: "noredirect",
    alwaysShow: true,
    children: [
      {
        path: "password",
        component: () => import("@/views/profile/password"),
        name: "password",
        meta: { title: "修改密码", noCache: true }
      },
      {
        path: "notice",
        component: () => import("@/views/profile/notice"),
        name: "notice",
        meta: { title: "通知中心", noCache: true }
      }
    ],
    hidden: true
  },
  {
    path: '/portal/*',
    name: 'portal',
    component: () => import('@/views/layout/Layout'),
  },
  
   
    // {
    //   path: "/report",
    //   redirect: "login",
    //   alwaysShow: true,
    //   name: "userManage",
    //   meta: {
    //     title: "报表系统",
    //     icon: "people"
    //   },
    //   component: Layout,
    //   children: [
    //     {
    //       path: "collectData",
    //       name: "user",
    //       meta: {
    //         perms: ["GET /admin/user/list"],
    //         title: "服务gmv",
    //         noCache: true,
    //         icon: "user",
    //         keepAlive: true
    //       }
    //     },
    //     {
    //       path: "saleGmv",
    //       name: "address",
    //       meta: {
    //         perms: ["GET /admin/address/list"],
    //         title: "销售看板",
    //         noCache: true,
    //         icon: "tree",
    //         keepAlive: true
    //       }
    //     },
    //     {
    //       path: "businessData",
    //       name: "collect",
    //       meta: {
    //         perms: ["GET /admin/collect/list"],
    //         title: "招商看板",
    //         noCache: true,
    //         icon: "clipboard",
    //         keepAlive: true
    //       }
    //     },
    //     {
    //       path: "serviceAbilityDetail", 
    //        meta: {
    //         perms: ["GET /admin/collect/list"],
    //         title: "服务力明细",
    //         noCache: true,
    //         icon: "clipboard",
    //         keepAlive: true
    //       }
    //     }
       
    //   ]
    // },
  
    // {
    //   path: "/jzmall/order",
    //   redirect: "noredirect",
    //   alwaysShow: true,
    //   name: "mallManage",
    //   meta: {
    //     title: "商场系统",
    //     icon: "shopping"
    //   },
    //   component: Layout,
    //   children: [
    //     {
    //       path: "order",
    //       name: "order",
    //       meta: {
    //         perms: [
             
    //         ],
    //         title: "订单管理",
    //         noCache: true,
    //         icon: "order",
    //         keepAlive: true
    //       }
    //     },
    //     {
    //       path: "schedulingP",
    //       name: "schedulingP",
    //       meta: {
    //         perms: [
    //           'POST /admin/workerOccupy/selectOccupyByQuery'
    //         ],
    //         title: "档期管理",
    //         noCache: true,
    //         icon: "form",
    //         keepAlive: true
    //       }
    //     },
    //     {
    //       path: "addressCheck",
    //       name: "addressCheck",
    //       meta: {
    //         perms: [
    //           'GET /admin/addressCheck/getCalendarStockByAddress'
    //         ],
    //         title: "服务区域查询",
    //         noCache: true,
    //         icon: "guide",
    //         keepAlive: true
    //       }
    //     },
    //   ]}
        ];
  
     export default new Router({
          mode:'history',
          base:process.env.BASE_URL,
          // base:'/',
          scrollBehavior: () => ({ y: 0 }),
          // routes: constantRouterMap,
          routes: asyncRouterMap
        });
  
