import App from '../app.vue'
import container from '../components/layout/container.vue'
import error404 from '../components/errorPage/404.vue'

export default [
  { path: '/', redirect: '/login' },
  { path: '/login', component: () => import('../../../components/login/dialogLogin.vue') },
  {
    path: '/app',
    component: App,
    children: [
      { path: 'error/404', component: error404 },
      {
        path: 'news',
        component: container,
        children: [
          { path: 'add-news', component: () => import('../pages/news/addNews.vue') },
          { path: 'news-list', component: () => import('../pages/news/newsList.vue') }
        ]
      },
      {
        path: 'website',
        component: container,
        children: [
          { path: 'site-show', component: () => import('../pages/website/siteShow.vue') }
        ]
      },
      {
        path: 'content',
        component: container,
        children: [
          { path: 'content-list', component: () => import('../pages/content/contentList.vue') },
          { path: 'add-carousel', component: () => import('../pages/content/addCarousel.vue') }
        ]
      },
      {
        path: 'seo',
        component: container,
        children: [
          { path: 'page-list', component: () => import('../pages/seo/pageList.vue') }
        ]
      },
      {
        path: 'account',
        component: container,
        children: [
          { path: 'set-pwd', component: () => import('../pages/account/setPwd.vue') }
        ]
      }
    ]
  },
  /* App 内未找到页面时 - 指向 */
  { path: '/app/*', redirect: '/app/error/404' },
  /* 如果所有页面都没找到 - 指向 */
  { path: '*', redirect: '/error/404' },
  { path: 'error/404', component: error404 }
]
