/*
 * @Author: Aimee~
 * @Date: 2023-05-11 12:02:45
 * @LastEditTime: 2023-07-05 15:03:09
 * @LastEditors: Aimee
 * @FilePath: /douhuo-agent/src/config/router.config.js
 * @Description: 路由
 */
import {
  BasicLayout,
  UserLayout
} from '@/layouts'
import detail from './routes/detail'
import stock from './routes/stock'
import user from './routes/user'
import coupon from './routes/coupon'
import permission from './routes/permission'
import sales from './routes/sales'
import cityExperienceOfficer from './routes/cityExperienceOfficer'

export const asyncRouterMap = [{
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: {
      title: 'menu.home'
    },
    redirect: '/home',
    children: [{
        path: '/home',
        name: 'Home',
        component: () => import('@/views/home/Index'),
        meta: {
          title: '数据看板',
          keepAlive: false,
          icon: 'dashboard',
          permission: ['home']
        }
    },
      ...detail,
      ...cityExperienceOfficer,
      ...stock,
      ...sales,
      ...user,
      ...coupon,
      ...permission
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [{
    path: '/auth',
    component: UserLayout,
    redirect: '/auth/login',
    hidden: true,
    children: [{
        path: '/auth/login',
        name: 'Login',
        component: () => import('@/views/auth/Login'),
        meta: {
          title: '登陆水感应经销商系统'
        }
      },
      {
        path: '/auth/forgetPassword',
        name: 'forgetPassword',
        component: () => import('@/views/auth/forgetPassword'),
        meta: {
          title: '重置密码'
        }
      }
    ]
  },
  {
    path: '/404',
    component: () => import('@/views/exception/404')
  }
]
