import Auth from '@/student/layout/auth'
import { router, rootRouter } from './routes-common'

type metaType = {
  isRegister: boolean
}

const noLoginRouter = [
  {
    path: '/share-music-sheet',
    name: 'share-music-sheet',
    component: () => import('@/teacher/share-page/share-music-sheet/index'),
    meta: {
      title: '分享乐曲'
    }
  },
  {
    path: '/leaderboard',
    component: () => import('@/student/leaderboard/index'),
    meta: {
      title: '曲目挑战排行榜'
      // isExternal: true // 是否外部浏览器可以打开
    }
  },
  {
    path: '/payCenter',
    name: 'payCenter',
    component: () => import('@/views/adapay/pay-center'),
    meta: {
      title: '支付'
    }
  },
  {
    path: '/payDefine',
    name: 'payDefine',
    component: () => import('@/views/adapay/pay-define'),
    meta: {
      title: '支付'
    }
  },
  {
    path: '/payResult',
    name: 'payResult',
    component: () => import('@/views/adapay/pay-result'),
    meta: {
      title: '支付'
    }
  },
  {
    path: '/tradeDetail',
    name: 'tradeDetail',
    component: () => import('@/views/trade/trade-detail'),
    meta: {
      title: '交易详情'
    }
  },
  {
    path: '/helpCenter',
    name: 'helpCenter',
    component: () => import('@/views/article-center/help-center')
  },
  {
    path: '/helpCenterDetail',
    name: 'helpCenterDetail',
    component: () => import('@/views/article-center/help-center-detail')
  },
  {
    path: '/shareCreation',
    component: () => import('@/views/creation/index-share'),
    meta: {
      title: '作品详情'
    }
  },
  {
    path: '/tenantStudentRejest',
    component: () => import('@/views/tenantStudentRejest/index'),
    meta: {
      title: '机构学员注册'
    }
  }
]

export default [
  {
    path: '/',
    component: Auth,
    children: [
      // ...router,
      {
        path: '/login',
        name: 'login',
        component: () => import('@/tenant/layout/login'),
        meta: {
          isRegister: false
        } as metaType
      },
      {
        path: '/music-album',
        component: () => import('@/tenant/music/album/index'),
        meta: {
          title: '专辑'
        }
      },
      {
        path: '/music-album-detail/:id',
        name: 'music-album-detail',
        component: () => import('@/tenant/music/album-detail'),
        meta: {
          title: '专辑详情'
        }
      },
      {
        path: '/music-list',
        component: () => import('@/tenant/music/list'),
        meta: {
          title: '曲谱列表'
        }
      },
      {
        path: '/train-list',
        component: () => import('@/tenant/music/train-list'),
        meta: {
          title: '声部云练'
        }
      },
      {
        path: '/lessonCourseware',
        component: () => import('@/tenant/music/lessonCourseware'),
        meta: {
          title: '云教程'
        }
      },
      {
        path: '/courseList',
        component: () => import('@/tenant/music/courseList'),
        meta: {
          title: '教程详情'
        }
      },
      {
        path: '/coursewarePlay',
        component: () => import('@/tenant/music/coursewarePlay'),
        meta: {
          title: '教程播放'
        }
      },
      {
        path: '/music-detail',
        component: () => import('@/tenant/music/music-detail/new-index'),
        meta: {
          title: '曲谱详情'
        }
      },
      {
        path: '/memberCenter',
        name: 'memberCenter',
        component: () => import('@/tenant/member-center/index'),
        meta: {
          title: '会员中心'
        }
      },
      {
        path: '/orderDetail',
        name: 'orderDetail',
        component: () => import('@/views/order-detail/index'),
        meta: {
          title: '订单详情'
        }
      },
      {
        path: '/music-personal',
        component: () => import('@/tenant/music/personal'),
        meta: {
          title: '我的曲库'
        }
      },
      {
        path: '/train-tool',
        component: () => import('@/tenant/music/train-tool'),
        meta: {
          title: '训练教程'
        }
      },
      {
        path: '/look-album-list',
        component: () => import('@/tenant/music/look-album-list'),
        meta: {
          title: '查看专辑'
        }
      },
      {
        path: '/exercise-record',
        name: 'exercise-record',
        component: () => import('@/tenant/exercise-record/exercis-detail'),
        meta: {
          title: '练习统计'
        }
      },
      {
        path: '/activation-code',
        name: 'activation-code',
        component: () => import('@/tenant/activation-code'),
        meta: {
          title: '激活码'
        }
      },
      {
        path: '/ranking-list',
        name: 'ranking-list',
        component: () => import('@/tenant/ranking-list'),
        meta: {
          title: '排行榜'
        }
      },
      {
        path: '/goodsOrder',
        name: 'goodsOrder',
        component: () => import('@/tenant/trade/index'),
        meta: {
          title: '订单信息'
        }
      },
      {
        path: '/goodsDetail',
        name: 'goodsDetail',
        component: () => import('@/tenant/trade/detail'),
        meta: {
          title: '订单详情'
        }
      },
      {
        path: '/music-songbook',
        component: () => import('@/tenant/music/search/header'),
        meta: {
          title: '搜索顶部'
        },
        children: [
          {
            path: '/music-songbook/search',
            name: 'musicSearch',
            component: () => import('@/tenant/music/search'),
            meta: {
              title: '搜索结果'
            }
          },
          {
            path: '/music-songbook/musicSongbook',
            name: 'musicSongbook',
            component: () => import('@/tenant/music/songbook'),
            meta: {
              title: '乐谱库'
            }
          },
          {
            path: '/music-songbook/searchAlbum',
            name: 'searchAlbum',
            component: () => import('@/tenant/music/search/searchAlbum'),
            meta: {
              title: '搜索结果'
            }
          },
          {
            path: '/music-songbook/result',
            name: 'musicSongresult',
            component: () => import('@/tenant/music/search/search-result'),
            meta: {
              title: '搜索结果'
            }
          }
        ]
      },
      {
        path: '/memberRecord',
        name: 'memberRecord',
        component: () => import('@/tenant/exercise-record/exercis-detail'),
        meta: {
          title: '练习统计'
        }
      },
      {
        path: '/creation',
        component: () => import('@/views/creation/index'),
        meta: {
          title: '作品详情'
        }
      },
      {
        path: '/creation-edit',
        component: () => import('@/views/creation/edit/index'),
        meta: {
          title: '作品详情'
        }
      }
    ]
  },
  ...noLoginRouter,
  // ...rootRouter,
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/404'),
    meta: {
      title: '404 Not Fund',
      platform: 'STUDENT'
    }
  }
]
