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

type metaType = {
  isRegister: boolean
}

// 不需要登录的路由
const noLoginRouter = [
  {
    path: '/shareVideo',
    name: 'shareVideo',
    component: () => import('@/teacher/share-page/share-video/index'),
    meta: {
      title: '分享视频课'
    }
  },
  {
    path: '/shareLive',
    name: 'shareLive',
    component: () => import('@/teacher/share-page/share-live/index'),
    meta: {
      title: '分享直播课'
    }
  },
  {
    path: '/shareMall',
    name: 'shareMall',
    component: () => import('@/teacher/share-page/share-mall/index'),
    meta: {
      title: '分享商品'
    }
  },
  {
    path: '/shareVip',
    name: 'shareVip',
    component: () => import('@/teacher/share-page/share-vip/index'),
    meta: {
      title: '会员中心'
    }
  },
  {
    path: '/shareAblum',
    name: 'shareAblum',
    component: () => import('@/teacher/share-page/share-album/index'),
    meta: {
      title: '分享专辑'
    }
  },
  {
    path: '/shareMusic',
    name: 'shareMusic',
    component: () => import('@/teacher/share-page/share-music/index'),
    meta: {
      title: '分享曲谱'
    }
  }
]

export default [
  {
    path: '/',
    component: Auth,
    children: [
      ...router,
      {
        path: '/login',
        name: 'login',
        component: () => import('@/teacher/layout/login'),
        meta: {
          isRegister: false
        } as metaType
      },
      {
        path: '/home',
        name: 'home',
        component: () => import('@/teacher/home/index')
      },
      {
        path: '/teacherCert',
        name: 'teacherCert',
        component: () => import('@/teacher/teacher-cert/index'),
        meta: {
          title: '达人认证'
        }
      },
      {
        path: '/teacherCertUpdate',
        name: 'teacherCertUpdate',
        component: () =>
          import('@/teacher/teacher-cert/teacher-cert-update/index'),
        meta: {
          title: '资料修改'
        }
      },
      {
        path: '/music-upload',
        component: () => import('@/teacher/music/upload'),
        meta: {
          title: '上传曲谱'
        }
      },
      {
        path: '/music-upload/:id/edit',
        component: () => import('@/teacher/music/upload'),
        meta: {
          title: '修改曲谱'
        }
      },
      // {
      //   path: '/music-list',
      //   component: () => import('@/teacher/music/list/switch'),
      //   meta: {
      //     title: '曲谱列表'
      //   }
      // },
      {
        path: '/review-list',
        component: () => import('@/teacher/review/list'),
        meta: {
          title: '曲谱审核列表'
        }
      },
      {
        path: '/review/:id',
        component: () => import('@/teacher/review/detail'),
        meta: {
          title: '曲谱审核详情'
        }
      },
      {
        path: '/openLive',
        name: 'openLive',
        component: () => import('@/teacher/open-live/index'),
        meta: {
          title: '开通直播'
        }
      },
      {
        path: '/liveDetail',
        name: 'liveDetail',
        component: () => import('@/teacher/live-class/live-detail'),
        meta: {
          title: '直播课详情'
        }
      },
      {
        path: '/musicCert',
        name: 'musicCert',
        component: () => import('@/teacher/music-cert/index'),
        meta: {
          title: '音乐人认证'
        }
      },
      {
        path: '/videoCreate',
        name: 'videoCreate',
        component: () => import('@/teacher/video-class/create'),
        meta: {
          title: '创建视频课'
        }
      },
      {
        path: '/videoDetail',
        name: 'videoDetail',
        component: () => import('@/teacher/video-class/video-detail'),
        meta: {
          title: '视频课详情'
        }
      },
      {
        path: '/videoClassDetail',
        name: 'videoClassDetail',
        component: () => import('@/teacher/video-class/video-class-detail'),
        meta: {
          title: '视频课详情'
        }
      },
      {
        path: '/liveCreate',
        name: 'liveCreate',
        component: () => import('@/teacher/live-class/create'),
        meta: {
          title: '创建直播课'
        }
      },
      {
        path: '/practiceSetting',
        name: 'practiceSetting',
        component: () => import('@/teacher/practice-class/practice-setting'),
        meta: {
          title: '陪练课设置'
        }
      },
      {
        path: '/myFans',
        name: 'myFans',
        component: () => import('@/teacher/my-fans/index'),
        meta: {
          title: '我的粉丝'
        }
      },
      {
        path: '/pianoRoom',
        name: 'pianoRoom',
        component: () => import('@/teacher/piano-room/index'),
        meta: {
          title: '云酷琴房'
        }
      },
      {
        path: '/courseRecord',
        name: 'courseRecord',
        component: () => import('@/teacher/piano-room/course-record'),
        meta: {
          title: '课程记录'
        }
      },
      {
        path: '/accountRechargeTimer',
        name: 'accountRechargeTimer',
        component: () => import('@/teacher/piano-room/account-recharge-timer'),
        meta: {
          title: '账户充值'
        }
      },
      {
        path: '/myStudent',
        name: 'myStudent',
        component: () => import('@/teacher/piano-room/my-student'),
        meta: {
          title: '我的学员'
        }
      },
      {
        path: '/classArrangement',
        name: 'classArrangement',
        component: () => import('@/teacher/piano-room/class-arrangement'),
        meta: {
          title: '排课'
        }
      },
      {
        path: '/createClass',
        name: 'createClass',
        component: () =>
          import('@/teacher/piano-room/class-arrangement/create-class'),
        meta: {
          title: '创建直播课'
        }
      },
      {
        path: '/rechargeRecord',
        name: 'rechargeRecord',
        component: () => import('@/teacher/piano-room/recharge-record'),
        meta: {
          title: '交易记录'
        }
      },
      {
        path: '/cashProtocol',
        name: 'cashProtocol',
        component: () => import('@/teacher/cash-protocol/index'),
        meta: {
          title: '结算协议'
        }
      },
      {
        path: '/incomeConsus',
        name: 'incomeConsus',
        component: () => import('@/teacher/income-consus/index'),
        meta: {
          title: '收入统计'
        }
      },
      {
        path: '/extendPlan',
        name: 'extendPlan',
        component: () => import('@/teacher/extend-plan/index'),
        meta: {
          title: '推广计划'
        }
      },
      {
        path: '/extendPlanDetail',
        name: 'extendPlanDetail',
        component: () => import('@/teacher/extend-plan/detail'),
        meta: {
          title: '推广计划'
        }
      },
      {
        path: '/track-review-activity',
        component: () =>
          import('@/teacher/share-page/track-review-activity/index'),
        meta: {
          title: '曲目评测活动'
        }
      },
      {
        path: '/leaderboard',
        component: () => import('@/teacher/leaderboard/index'),
        meta: {
          title: '曲目挑战排行榜'
          // isExternal: true // 是否外部浏览器可以打开
        }
      },
      {
        path: '/mySheetMusic',
        component: () => import('@/teacher/my-sheetMusic'),
        meta: {
          title: '我的乐谱'
        }
      },
      {
        path: '/teacherHome',
        component: () => import('@/teacher/teacher-dependent/teacher-home'),
        meta: {
          title: '老师主页'
        }
      },
      {
        path: '/train-tool',
        component: () => import('@/tenant/music/train-tool'),
        meta: {
          title: '训练教程'
        }
      },
      {
        path: '/courseList',
        component: () => import('@/tenant/music/courseList'),
        meta: {
          title: '教程详情'
        }
      },
      {
        path: '/coursewarePlay',
        component: () => import('@/tenant/music/coursewarePlay'),
        meta: {
          title: '教程播放'
        }
      }
    ]
  },
  ...rootRouter,
  ...noLoginRouter,
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/404'),
    meta: {
      title: '404 Not Fund',
      platform: 'TEACHER'
    }
  }
]
