import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/home/HomeView.vue'
import SaasManage from '@/views/saasManage/indexPage.vue'
import LoginPage from '@/views/LoginPage.vue'
import menuPage from '@/views/menu.vue'
import TaskManage from '@/views/taskManage/index.vue'
import HomePage from '@/views/homePage/index.vue'
export const DEFAULT_DASHBOARD = 'home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: LoginPage,
  },

  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: '/saas/home',
    children: [
      {
        path: '/saas/home',
        name: 'home',
        component: HomePage,
        meta: { title: '首页' },
      },
      {
        path: '/saas/manage',
        name: 'saasManage',
        meta: { title: 'ERP管理' },
        component: SaasManage,
      },
      {
        path: '/saas/menu',
        component: menuPage,
        name: 'saasMenu',
        meta: { title: '菜单管理' },
      },
      {
        path: '/saas/taskManage',
        component: TaskManage,
        name: 'taskManage',
        meta: { title: '工单管理' },
      },
      {
        path: '/saas/user',
        component: () => import('@/views/system/users.vue'),
        name: 'system_user',
        meta: { title: '用户管理' },
      },
      {
        path: '/saas/currency',
        component: () => import('@/views/basics/currency.vue'),
        name: 'basics_currency',
        meta: { title: '汇率币种' },
      },
      {
        path: '/saas/timed_task',
        component: () => import('@/views/system/timed_task.vue'),
        name: 'system_timed_task',
        meta: { title: '定时任务' },
      },
      {
        path: '/saas/countryCode',
        component: () => import('@/views/system/countryCode.vue'),
        name: 'system_countryCode',
        meta: { title: '国家代码' },
      },
      {
        path: '/saas/abbreviation',
        component: () => import('@/views/system/abbreviation.vue'),
        name: 'system_abbreviation',
        meta: { title: '州省简称' },
      },
    ],
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router
