import Vue from 'vue'
import Router from 'vue-router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en'
import login from '@/components/login'
import index from '@/components/index'
import indexGM from '@/components/GM/indexGM'
import studentIndex from '@/components/studentIndex'
import studioIndex from '@/components/studio/index'
import courseDetail from '@/components/courseDetail'
import courseDetailS from '@/components/student/courseDetail'
import courseDetailStudio from '@/components/studio/courseDetail'
import courseDetailNT from '@/components/noTerminal/courseDetail'
import courseDetailGM from '@/components/GM/courseDetailGM'
import mine from '@/components/mine'
import project from '@/components/project'
import works from '@/components/works'
import worksGM from '@/components/GM/worksGM'
import score from '@/components/score'
import notice from '@/components/notice'
import noticeDetail from '@/components/noticeDetail'
import study from '@/components/study'
import liveRoom from '@/components/liveRoom'
import liveProjectDetail from '@/components/liveProjectDetail'
import audioDemo from '@/components/audioDemo'
import cameraDemo from '@/components/cameraDemo'
import studyStudent from '@/components/studyStudent'
import studyStudentS from '@/components/student/studyStudent'
import studyStudentStudio from '@/components/studio/studyStudent'
import studyStudentNT from '@/components/noTerminal/studyStudent'
import studyStudentE from '@/components/easy/studyStudent'
import studyStudentE2 from '@/components/easy2/studyStudent'
import studyStudentE3 from '@/components/easy3/studyStudent'
import studySutdentClass from '@/components/studySutdentClass/studyStudent'
import studyStudentGM from '@/components/GM/studyStudentGM'
import pdf from '@/components/pdf'
import courseDetailTrain from '@/components/trainCourse/courseDetail'
import studyStudentTrain from '@/components/trainCourse/studyStudent'
import studyStudentE2Train from '@/components/trainCourse/easy2/studyStudent'
import studyStudentE3Train from '@/components/trainCourse/easy3/studyStudent'
import pptEasyClass from '@/components/pptEasyClass'

import cn from "../lang/cn.json";
import hk from "../lang/hk.json";
import en from "../lang/en.json";

// 全局修改默认配置，点击空白处不能关闭弹窗
ElementUI.Dialog.props.closeOnClickModal.default = false
Vue.use(Router)
let lang = new Object();
let domain_name = "";


let region = 'cn'

if (window.location.href.includes('beta') || window.location.href.includes('localhost')) {
  domain_name="cn";
  region = 'beta'
  lang = cn;
}else if (window.location.href.includes("cocorobo.cn")) {
  domain_name="cn";
  region = 'cn'
  lang = cn;
} else if (window.location.href.includes("cocorobo.hk")) {
  domain_name="hk";
   region = 'hk'
  lang = hk;
} else if (window.location.href.includes("cocorobo.com")) {
  domain_name="com";
   region = 'com'
  lang=en;
}else{
   region = 'cn'
   domain_name="cn";
   lang=cn;
}
Vue.prototype.lang =lang;
Vue.prototype.$region = region
if(domain_name==='com'){//英文版
	Vue.use(ElementUI,{locale})
}else{
	Vue.use(ElementUI)
}

export default new Router({
    routes: [
        // {
        //   path: '/login',
        //   name: 'login',
        //   component: login
        // },
        {
            path: '/',
            redirect: '/index'
        },
        {
            path: '/index',
            name: 'index',
            component: index,
            requireAuth: ''
        },
        {
            path: '/studentIndex',
            name: 'studentIndex',
            component: studentIndex,
            requireAuth: ''
        },
        {
            path: '/indexGM',
            name: 'indexGM',
            component: indexGM,
            requireAuth: ''
        },
        {
            path: '/courseDetail',
            name: 'courseDetail',
            component: courseDetail,
            requireAuth: ''
        },
        {
            path: '/courseDetailGM',
            name: 'courseDetailGM',
            component: courseDetailGM,
            requireAuth: ''
        },
        {
            path: '/mine',
            name: 'mine',
            component: mine,
            requireAuth: ''
        },
        {
            path: '/project',
            name: 'project',
            component: project,
            requireAuth: ''
        },
        {
            path: '/works',
            name: 'works',
            component: works,
            requireAuth: ''
        },
        {
            path: '/worksGM',
            name: 'worksGM',
            component: worksGM,
            requireAuth: ''
        },
        {
            path: '/score',
            name: 'score',
            component: score,
            requireAuth: ''
        },
        {
            path: '/notice',
            name: 'notice',
            component: notice,
            requireAuth: ''
        },
        {
            path: '/noticeDetail',
            name: 'noticeDetail',
            component: noticeDetail,
            requireAuth: ''
        },
        {
            path: '/study',
            name: 'study',
            component: study,
            requireAuth: ''
        },
        {
            path: '/liveRoom',
            name: 'liveRoom',
            component: liveRoom,
            requireAuth: ''
        },
        {
            path: '/liveProjectDetail',
            name: 'liveProjectDetail',
            component: liveProjectDetail,
            requireAuth: ''
        },
        {
            path: '/audioDemo',
            name: 'audioDemo',
            component: audioDemo,
            requireAuth: ''
        },
        {
            path: '/cameraDemo',
            name: 'cameraDemo',
            component: cameraDemo,
            requireAuth: ''
        },
        {
            path: '/studyStudent',
            name: 'studyStudent',
            component: studyStudent,
            requireAuth: ''
        },{
            path: '/studyStudentGM',
            name: 'studyStudentGM',
            component: studyStudentGM,
            requireAuth: ''
        },{
            path: '/pdf',
            name: 'pdf',
            component: pdf,
            requireAuth: ''
        },
        {
            path: '/studyStudentS',
            name: 'studyStudentS',
            component: studyStudentS,
            requireAuth: ''
        }, {
            path: '/courseDetailS',
            name: 'courseDetailS',
            component: courseDetailS,
            requireAuth: ''
        },
        {
            path: '/studyStudentNT',
            name: 'studyStudentNT',
            component: studyStudentNT,
            requireAuth: ''
        }, {
            path: '/courseDetailNT',
            name: 'courseDetailNT',
            component: courseDetailNT,
            requireAuth: ''
        },{
            path: '/studyStudentE',
            name: 'studyStudentE',
            component: studyStudentE,
            requireAuth: ''
        },{
            path: '/studyStudentE2',
            name: 'studyStudentE2',
            component: studyStudentE2,
            requireAuth: ''
        },{
            path: '/studyStudentE3',
            name: 'studyStudentE3',
            component: studyStudentE3,
            requireAuth: ''
        },{
            path: '/studySutdentClass',
            name: 'studySutdentClass',
            component: studySutdentClass,
            requireAuth: ''
        },{
            path: '/studioIndex',
            name: 'studioIndex',
            component: studioIndex,
            requireAuth: ''
        }, {
            path: '/courseDetailStudio',
            name: 'courseDetailStudio',
            component: courseDetailStudio,
            requireAuth: ''
        }, {
            path: '/studyStudentStudio',
            name: 'studyStudentStudio',
            component: studyStudentStudio,
            requireAuth: ''
        }, {
            path: '/courseDetailTrain',
            name: 'courseDetailTrain',
            component: courseDetailTrain,
            requireAuth: ''
        }, {
            path: '/studyStudentTrain',
            name: 'studyStudentTrain',
            component: studyStudentTrain,
            requireAuth: ''
        }, {
            path: '/studyStudentE2Train',
            name: 'studyStudentE2Train',
            component: studyStudentE2Train,
            requireAuth: ''
        }, {
            path: '/studyStudentE3Train',
            name: 'studyStudentE3Train',
            component: studyStudentE3Train,
            requireAuth: ''
        },{
            path: '/pptEasyClass',
            name: 'pptEasyClass',
            component: pptEasyClass,
            requireAuth: ''
        }
    ]
})
