import Vue from 'vue';
import Router from 'vue-router';
import Admin from '@/views/Admin';
import store from './store';
import http from './plugins/http';
import { Message } from 'element-ui';

Vue.use(Router);

const router = new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [
        {
            path: '/',
            component: Admin,
            children: [
                {
                    path: '/',
                    redirect: 'dashboard'
                },
                {
                    path: '/404',
                    name: '404',
                    component: () => import(/* webpackChunkName: "404" */ '@/views/404.vue')
                },
                {
                    path: '/dashboard',
                    name: 'dashboard',
                    component: () => import(/* webpackChunkName: "404" */ '@/views/Dashboard.vue'),
                    meta: {
                        title: '首页'
                    }
                },
                {
                    path: '/api',
                    name: 'api',
                    component: () => import(/* webpackChunkName: "api" */ '@/views/Api.vue'),
                    meta: {
                        title: '接口调试'
                    }
                },
                {
                    path: '/genCodeEdit',
                    name: 'genCodeEdit',
                    component: () => import(/* webpackChunkName: "genCodeEdit" */ '@/views/GenCodeEdit.vue'),
                    meta: {
                        title: '代码生成编辑'
                    }
                },
                {
                    path: '/genCodeList',
                    name: 'genCodeList',
                    component: () => import(/* webpackChunkName: "genCodeList" */ '@/views/GenCodeList.vue'),
                    meta: {
                        title: '代码生成'
                    }
                },
                {
                    path: '/menus',
                    name: 'menus',
                    component: () => import(/* webpackChunkName: "menus" */ '@/views/Menus.vue'),
                    meta: {
                        title: '菜单配置'
                    }
                },
                {
                    path: '/menuAuthority',
                    name: 'menuAuthority',
                    component: () => import(/* webpackChunkName: "menuAuthority" */ '@/views/MenuAuthority.vue'),
                    meta: {
                        title: '菜单权限'
                    }
                },
                {
                    path: '/upload',
                    name: 'upload',
                    component: () => import(/* webpackChunkName: "upload" */ '@/views/Upload.vue'),
                    meta: {
                        title: '上传'
                    }
                },
                {
                    path: '/userEdit',
                    name: 'userEdit',
                    component: () => import(/* webpackChunkName: "userEdit" */ '@/views/user/UserEdit.vue'),
                    meta: {
                        title: '用户编辑'
                    }
                },
                {
                    path: '/userList',
                    name: 'userList',
                    component: () => import(/* webpackChunkName: "userList" */ '@/views/user/UserList.vue'),
                    meta: {
                        title: '用户管理'
                    }
                },
                {
                    path: '/staffList',
                    name: 'StaffList',
                    component: () => import(/* webpackChunkName: "staffList" */ '@/views/user/StaffList.vue'),
                    meta: {
                        title: '工作人员'
                    }
                },
                {
                    path: '/expertList',
                    name: 'expertList',
                    component: () => import(/* webpackChunkName: "expertList" */ '@/views/user/ExpertList.vue'),
                    meta: {
                        title: '专家管理'
                    }
                },
                {
                    path: '/expertEdit',
                    name: 'expertEdit',
                    component: () => import(/* webpackChunkName: "expertEdit" */ '@/views/user/ExpertEdit.vue'),
                    meta: {
                        title: '专家编辑'
                    }
                },
                {
                    path: '/organizationEdit',
                    name: 'OrganizationEdit',
                    component: () =>
                        import(/* webpackChunkName: "organizationEdit" */ '@/views/organization/OrganizationEdit.vue'),
                    meta: {
                        title: '承办单位编辑'
                    }
                },
                {
                    path: '/organizationList',
                    name: 'OrganizationList',
                    component: () =>
                        import(/* webpackChunkName: "organizationList" */ '@/views/organization/OrganizationList.vue'),
                    meta: {
                        title: '承办单位'
                    }
                },
                {
                    path: '/gradingOrganizationEdit',
                    name: 'GradingOrganizationEdit',
                    component: () =>
                        import(/* webpackChunkName: "gradingOrganizationEdit" */ '@/views/GradingOrganizationEdit.vue'),
                    meta: {
                        title: '考级机构编辑'
                    }
                },
                {
                    path: '/gradingOrganizationList',
                    name: 'GradingOrganizationList',
                    component: () =>
                        import(/* webpackChunkName: "gradingOrganizationList" */ '@/views/GradingOrganizationList.vue'),
                    meta: {
                        title: '考级机构'
                    }
                },
                {
                    path: '/operationLogList',
                    name: 'OperationLogList',
                    component: () => import(/* webpackChunkName: "operationLogList" */ '@/views/OperationLogList.vue'),
                    meta: {
                        title: '操作日志'
                    }
                },
                {
                    path: '/exceptionLogList',
                    name: 'ExceptionLogList',
                    component: () => import(/* webpackChunkName: "exceptionLogList" */ '@/views/ExceptionLogList.vue'),
                    meta: {
                        title: '异常日志'
                    }
                },
                /**通用设置 */
                {
                    path: '/settings',
                    name: 'Settings',
                    component: () => import(/* webpackChunkName: "settingList" */ '@/views/Settings.vue'),
                    meta: {
                        title: '设置'
                    }
                },
                {
                    path: '/artTypes',
                    name: 'ArtTypes',
                    component: () => import(/* webpackChunkName: "artTypes" */ '@/views/ArtTypes.vue'),
                    meta: {
                        title: '艺术分类'
                    }
                },
                {
                    path: '/sysConfigList',
                    name: 'sysConfigList',
                    component: () => import(/* webpackChunkName: "sysConfigList" */ '@/views/SysConfigList.vue'),
                    meta: {
                        title: '参数配置'
                    }
                },
                {
                    path: '/awardEdit',
                    name: 'AwardEdit',
                    component: () => import(/* webpackChunkName: "awardEdit" */ '@/views/AwardEdit.vue'),
                    meta: {
                        title: '奖项类别设置编辑'
                    }
                },
                {
                    path: '/awardList',
                    name: 'AwardList',
                    component: () => import(/* webpackChunkName: "awardList" */ '@/views/AwardList.vue'),
                    meta: {
                        title: '奖项类别设置'
                    }
                },
                /**备案 */
                {
                    path: '/recordEdit',
                    name: 'RecordEdit',
                    component: () => import(/* webpackChunkName: "recordEdit" */ '@/views/record/RecordEdit.vue'),
                    meta: {
                        title: '备案管理编辑'
                    }
                },
                {
                    path: '/recordAdd',
                    name: 'RecordAdd',
                    component: () => import(/* webpackChunkName: "recordAdd" */ '@/views/record/RecordAdd.vue'),
                    meta: {
                        title: '备案管理编辑'
                    }
                },
                {
                    path: '/recordInfo',
                    name: 'RecordInfo',
                    component: () => import(/* webpackChunkName: "recordInfo" */ '@/views/record/RecordInfo.vue'),
                    meta: {
                        title: '备案管理'
                    }
                },
                {
                    path: '/recordOrganizationList',
                    name: 'RecordOrganizationList',
                    component: () =>
                        import(/* webpackChunkName: "recordList" */ '@/views/record/RecordOrganizationList.vue'),
                    meta: {
                        title: '备案管理'
                    }
                },
                {
                    path: '/recordDistrictList',
                    name: 'RecordList',
                    component: () =>
                        import(/* webpackChunkName: "recordList" */ '@/views/record/RecordDistrictList.vue'),
                    meta: {
                        title: '备案管理'
                    }
                },
                {
                    path: '/recordDistrictList2',
                    name: 'RecordDistrictList2',
                    component: () =>
                        import(/* webpackChunkName: "recordList" */ '@/views/record/RecordDistrictList2.vue'),
                    meta: {
                        title: '监管管理'
                    }
                },
                {
                    path: '/recordList',
                    name: 'RecordList',
                    component: () => import(/* webpackChunkName: "recordList" */ '@/views/record/RecordList.vue'),
                    meta: {
                        title: '备案管理'
                    }
                },
                /**监管 */
                {
                    path: '/recordRegulationList',
                    name: 'RecordRegulationList',
                    component: () =>
                        import(/* webpackChunkName: "recordList" */ '@/views/record/RecordRegulationList.vue'),
                    meta: {
                        title: '监管管理'
                    }
                },
                {
                    path: '/videoList',
                    name: 'VideoList',
                    component: () => import(/* webpackChunkName: "videoList" */ '@/views/record/VideoList.vue'),
                    meta: {
                        title: '视频监控'
                    }
                },
                {
                    path: '/recordRegulationHistory',
                    name: 'RecordRegulationHistory',
                    component: () =>
                        import(/* webpackChunkName: "recordList" */ '@/views/record/RecordRegulationHistory.vue'),
                    meta: {
                        title: '监管管理'
                    }
                },
                {
                    path: '/historyRoomList',
                    name: 'HistoryRoomList',
                    component: () =>
                        import(/* webpackChunkName: "historyRoomList" */ '@/views/video/HistoryRoomList.vue'),
                    meta: {
                        title: '视频管理'
                    }
                },
                {
                    path: '/recordCheck',
                    name: 'RecordCheck',
                    component: () => import(/* webpackChunkName: "recordCheck" */ '@/views/record/RecordCheck.vue'),
                    meta: {
                        title: '检查记录'
                    }
                },
                {
                    path: '/echarts',
                    name: 'echarts',
                    component: () => import('@/views/Echarts.vue'),
                    meta: {
                        title: '地图图表'
                    }
                },
                {
                    path: '/videoOrganizationList',
                    name: 'VideoOrganizationList',
                    component: () =>
                        import(
                            /* webpackChunkName: "videoOrganizationList" */ '@/views/record/VideoOrganizationList.vue'
                        ),
                    meta: {
                        title: '视频监控'
                    }
                },
                {
                    path: '/examRoomEdit',
                    name: 'ExamRoomEdit',
                    component: () => import(/* webpackChunkName: "examRoomEdit" */ '@/views/ExamRoomEdit.vue'),
                    meta: {
                        title: '考场管理编辑'
                    }
                },
                {
                    path: '/examRoomList',
                    name: 'ExamRoomList',
                    component: () => import(/* webpackChunkName: "examRoomList" */ '@/views/ExamRoomList.vue'),
                    meta: {
                        title: '考场管理'
                    }
                },
                {
                    path: '/showRoomList',
                    name: 'ShowRoomList',
                    component: () => import(/* webpackChunkName: "showRoomList" */ '@/views/video/ShowRoomList.vue'),
                    meta: {
                        title: '监控列表'
                    }
                },
                /**咨询投诉 */
                {
                    path: '/complainEdit',
                    name: 'ComplainEdit',
                    component: () => import(/* webpackChunkName: "complainEdit" */ '@/views/ComplainEdit.vue'),
                    meta: {
                        title: '咨询投诉编辑'
                    }
                },
                {
                    path: '/complainShow',
                    name: 'ComplainShow',
                    component: () => import(/* webpackChunkName: "complainShow" */ '@/views/ComplainShow.vue'),
                    meta: {
                        title: '咨询投诉详情'
                    }
                },
                {
                    path: '/complainList',
                    name: 'ComplainList',
                    component: () => import(/* webpackChunkName: "complainList" */ '@/views/ComplainList.vue'),
                    meta: {
                        title: '咨询投诉'
                    }
                },
                /**等级评定 */
                /**承办单位 */
                {
                    path: '/organizationInfo',
                    name: 'OrganizationInfo',
                    component: () =>
                        import(/* webpackChunkName: "organizationInfo" */ '@/views/organization/OrganizationInfo.vue'),
                    meta: {
                        title: '基本信息'
                    }
                },
                {
                    path: '/organization',
                    name: 'organization',
                    component: () =>
                        import(/* webpackChunkName: "organization" */ '@/views/organization/Organization.vue'),
                    meta: {
                        title: '等级评定'
                    }
                },
                {
                    path: '/organization1',
                    name: 'organization1',
                    component: () =>
                        import(/* webpackChunkName: "organization1" */ '@/views/organization/Organization1.vue'),
                    meta: {
                        title: '等级评定'
                    }
                },
                /**等级评定流程 */
                {
                    path: '/rateEdit',
                    name: 'RateEdit',
                    component: () => import(/* webpackChunkName: "rateEdit" */ '@/views/rate/RateEdit.vue'),
                    meta: {
                        title: '等级评定申请'
                    }
                },
                {
                    path: '/rateAudit',
                    name: 'RateAudit',
                    component: () => import(/* webpackChunkName: "rateAudit" */ '@/views/rate/RateAudit.vue'),
                    meta: {
                        title: '等级评定申请'
                    }
                },
                {
                    path: '/assignExpert',
                    name: 'assignExpert',
                    component: () => import(/* webpackChunkName: "assignExpert" */ '@/views/rate/AssignExpert.vue'),
                    meta: {
                        title: '分配专家组'
                    }
                },
                {
                    path: '/organizationExpert',
                    name: 'OrganizationExpert',
                    component: () =>
                        import(
                            /* webpackChunkName: "gradingOrganizationList" */ '@/views/organization/OrganizationExpert.vue'
                        ),
                    meta: {
                        title: '分配专家组'
                    }
                },
                {
                    path: '/gradeList',
                    name: 'gradeList',
                    component: () => import(/* webpackChunkName: "gradeList" */ '@/views/rate/GradeList.vue'),
                    meta: {
                        title: '评分'
                    }
                },
                {
                    path: '/rateExpertList',
                    name: 'RateExpertList',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateExpertList.vue'),
                    meta: {
                        title: '等级评定'
                    }
                },
                {
                    path: '/rateGrade',
                    name: 'RateGrade',
                    component: () => import(/* webpackChunkName: "rateGrade" */ '@/views/rate/RateGrade.vue'),
                    meta: {
                        title: '打分'
                    }
                },
                /**等级评定列表 */
                {
                    path: '/rateOrganizerList',
                    name: 'RateOrganizerList',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateOrganizerList.vue'),
                    meta: {
                        title: '等级评定'
                    }
                },
                {
                    path: '/rateDistrictList',
                    name: 'RateDistrictList',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateDistrictList.vue'),
                    meta: {
                        title: '等级评定'
                    }
                },
                {
                    path: '/rateDistrictListPending',
                    name: 'RateDistrictListPending',
                    component: () =>
                        import(/* webpackChunkName: "rateList" */ '@/views/rate/RateDistrictListPending.vue'),
                    meta: {
                        title: '申请待办'
                    }
                },
                {
                    path: '/rateDistrictListDone',
                    name: 'RateDistrictListDone',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateDistrictListDone.vue'),
                    meta: {
                        title: '申请已办'
                    }
                },
                {
                    path: '/rateList',
                    name: 'RateList',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateList.vue'),
                    meta: {
                        title: '等级评定'
                    }
                },
                {
                    path: '/rateListPending',
                    name: 'RateListPending',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateListPending.vue'),
                    meta: {
                        title: '申请待办'
                    }
                },
                {
                    path: '/rateListDone',
                    name: 'RateListDone',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateListDone.vue'),
                    meta: {
                        title: '申请已办'
                    }
                },
                {
                    path: '/rateListRejected',
                    name: 'RateListRejected',
                    component: () => import(/* webpackChunkName: "rateList" */ '@/views/rate/RateListRejected.vue'),
                    meta: {
                        title: '驳回记录'
                    }
                },
                /**展演 */
                /**活动信息 */
                {
                    path: '/performanceEdit',
                    name: 'PerformanceEdit',
                    component: () =>
                        import(/* webpackChunkName: "performanceEdit" */ '@/views/performance/PerformanceEdit.vue'),
                    meta: {
                        title: '展演管理编辑'
                    }
                },
                {
                    path: '/performanceList',
                    name: 'PerformanceList',
                    component: () =>
                        import(/* webpackChunkName: "performanceList" */ '@/views/performance/PerformanceList.vue'),
                    meta: {
                        title: '展演管理'
                    }
                },
                {
                    path: '/performanceListShow',
                    name: 'PerformanceListShow',
                    component: () =>
                        import(/* webpackChunkName: "performanceList" */ '@/views/performance/PerformanceListShow.vue'),
                    meta: {
                        title: '展演列表'
                    }
                },
                {
                    path: '/performanceShow',
                    name: 'PerformanceShow',
                    component: () =>
                        import(/* webpackChunkName: "performanceShow" */ '@/views/performance/PerformanceShow.vue'),
                    meta: {
                        title: '展演详情'
                    }
                },
                /**节目初审 */
                {
                    path: '/programmeOrgList',
                    name: 'ProgrammeOrgList',
                    component: () =>
                        import(/* webpackChunkName: "programmeOrgList" */ '@/views/performance/ProgrammeOrgList.vue'),
                    meta: {
                        title: '节目管理'
                    }
                },
                {
                    path: '/programmeEdit',
                    name: 'ProgrammeEdit',
                    component: () =>
                        import(/* webpackChunkName: "programmeEdit" */ '@/views/performance/ProgrammeEdit.vue'),
                    meta: {
                        title: '节目管理编辑'
                    }
                },
                {
                    path: '/programmeList',
                    name: 'ProgrammeList',
                    component: () =>
                        import(/* webpackChunkName: "programmeList" */ '@/views/performance/ProgrammeList.vue'),
                    meta: {
                        title: '节目列表'
                    }
                },
                {
                    path: '/programmeShow',
                    name: 'ProgrammeShow',
                    component: () =>
                        import(/* webpackChunkName: "programmeShow" */ '@/views/performance/ProgrammeShow.vue'),
                    meta: {
                        title: '节目详情'
                    }
                },
                {
                    path: '/arrangeList',
                    name: 'ArrangeList',
                    component: () =>
                        import(/* webpackChunkName: "arrangeList" */ '@/views/performance/ArrangeList.vue'),
                    meta: {
                        title: '节目编排'
                    }
                },
                {
                    path: '/progGroupOnlineList',
                    name: 'ProgGroupOnlineList',
                    component: () =>
                        import(
                            /* webpackChunkName: "progGroupOnlineList" */ '@/views/performance/ProgGroupOnlineList.vue'
                        ),
                    meta: {
                        title: '节目分组'
                    }
                },
                {
                    path: '/programmeGroupList',
                    name: 'ProgrammeGroupList',
                    component: () =>
                        import(
                            /* webpackChunkName: "programmeGroupList" */ '@/views/performance/ProgrammeGroupList.vue'
                        ),
                    meta: {
                        title: '节目分组'
                    }
                },
                {
                    path: '/arrangeJudgeList',
                    name: 'ArrangeJudgeList',
                    component: () =>
                        import(/* webpackChunkName: "arrangeJudgeList" */ '@/views/performance/ArrangeJudgeList.vue'),
                    meta: {
                        title: '分配评委'
                    }
                },
                {
                    path: '/programmeSignList',
                    name: 'ProgrammeSignList',
                    component: () =>
                        import(/* webpackChunkName: "programmeSignList" */ '@/views/performance/ProgrammeSignList.vue'),
                    meta: {
                        title: '节目签到'
                    }
                },
                {
                    path: '/programmeScoreList',
                    name: 'ProgrammeScoreList',
                    component: () =>
                        import(
                            /* webpackChunkName: "programmeScoreList" */ '@/views/performance/ProgrammeScoreList.vue'
                        ),
                    meta: {
                        title: '节目评审'
                    }
                },
                {
                    path: '/progScoreAdminList',
                    name: 'ProgScoreAdminList',
                    component: () =>
                        import(
                            /* webpackChunkName: "progScoreAdminList" */ '@/views/performance/ProgScoreAdminList.vue'
                        ),
                    meta: {
                        title: '节目评审'
                    }
                },
                {
                    path: '/programmeAwardEdit',
                    name: 'ProgrammeAwardEdit',
                    component: () =>
                        import(
                            /* webpackChunkName: "programmeAwardEdit" */ '@/views/performance/ProgrammeAwardEdit.vue'
                        ),
                    meta: {
                        title: '奖项设置编辑'
                    }
                },
                {
                    path: '/programmeAwardList',
                    name: 'ProgrammeAwardList',
                    component: () =>
                        import(
                            /* webpackChunkName: "programmeAwardList" */ '@/views/performance/ProgrammeAwardList.vue'
                        ),
                    meta: {
                        title: '奖项设置'
                    }
                },
                {
                    path: '/programmeResultList',
                    name: 'ProgrammeResultList',
                    component: () =>
                        import(
                            /* webpackChunkName: "programmeResultList" */ '@/views/performance/ProgrammeResultList.vue'
                        ),
                    meta: {
                        title: '节目获奖'
                    }
                },
                /**展演复审 */
                {
                    path: '/programmeReviewList',
                    name: 'ProgrammeList',
                    component: () =>
                        import(/* webpackChunkName: "programmeList" */ '@/views/performance/review/ProgrammeList.vue'),
                    meta: {
                        title: '节目列表'
                    }
                },
                {
                    path: '/arrangeReviewList',
                    name: 'ArrangeList',
                    component: () =>
                        import(/* webpackChunkName: "arrangeList" */ '@/views/performance/review/ArrangeList.vue'),
                    meta: {
                        title: '节目编排'
                    }
                },
                {
                    path: '/judgeReviewList',
                    name: 'ArrangeJudgeList',
                    component: () =>
                        import(
                            /* webpackChunkName: "arrangeJudgeList" */ '@/views/performance/review/ArrangeJudgeList.vue'
                        ),
                    meta: {
                        title: '分配评委'
                    }
                },
                {
                    path: '/signReviewList',
                    name: 'ProgrammeSignList',
                    component: () =>
                        import(
                            /* webpackChunkName: "programmeSignList" */ '@/views/performance/review/ProgrammeSignList.vue'
                        ),
                    meta: {
                        title: '节目签到'
                    }
                },
                {
                    path: '/scoreReviewList',
                    name: 'ProgrammeScoreList',
                    component: () =>
                        import(
                            /* webpackChunkName: "programmeScoreList" */ '@/views/performance/review/ProgrammeScoreList.vue'
                        ),
                    meta: {
                        title: '节目评审'
                    }
                },
                {
                    path: '/scoreAdminReviewList',
                    name: 'ProgScoreAdminList',
                    component: () =>
                        import(
                            /* webpackChunkName: "progScoreAdminList" */ '@/views/performance/review/ProgScoreAdminList.vue'
                        ),
                    meta: {
                        title: '节目评审'
                    }
                },
                {
                    path: '/trainingInstitutionEdit',
                    name: 'TrainingInstitutionEdit',
                    component: () =>
                        import(/* webpackChunkName: "trainingInstitutionEdit" */ '@/views/TrainingInstitutionEdit.vue'),
                    meta: {
                        title: '培训机构编辑'
                    }
                },
                {
                    path: '/trainingInstitutionList',
                    name: 'TrainingInstitutionList',
                    component: () =>
                        import(/* webpackChunkName: "trainingInstitutionList" */ '@/views/TrainingInstitutionList.vue'),
                    meta: {
                        title: '培训机构'
                    }
                },
                {
                    path: '/announcementEdit',
                    name: 'AnnouncementEdit',
                    component: () => import(/* webpackChunkName: "announcementEdit" */ '@/views/AnnouncementEdit.vue'),
                    meta: {
                        title: '通知公告编辑'
                    }
                },
                {
                    path: '/announcementDetail',
                    name: 'AnnouncementDetail',
                    component: () =>
                        import(/* webpackChunkName: "announcementEdit" */ '@/views/AnnouncementDetail.vue'),
                    meta: {
                        title: '通知公告'
                    }
                },
                {
                    path: '/announcementList',
                    name: 'AnnouncementList',
                    component: () => import(/* webpackChunkName: "announcementList" */ '@/views/AnnouncementList.vue'),
                    meta: {
                        title: '通知公告'
                    }
                }
                /**INSERT_LOCATION**/
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('@/views/Login'),
            meta: {
                title: '登录'
            }
        },
        /**初审 */
        {
            path: '/programmeGOList',
            name: 'ProgrammegoList',
            component: () => import(/* webpackChunkName: "programmeList" */ '@/views/performance/ProgrammeGOList.vue'),
            meta: {
                title: '节目列表'
            }
        }
    ]
});
router.beforeEach((to, from, next) => {
    //console.log(to);
    if (/^\/http/.test(to.path)) {
        console.log(Vue.$baseUrl);
        let url = to.path.replace('/', '');
        let params = [];
        if (to.query) {
            for (let key in to.query) {
                if (to.query.hasOwnProperty(key)) {
                    params.push(`${key}=${to.query[key]}`);
                }
            }
        }
        if (params.length > 0) {
            url += `?${params.join('&')}`;
        }
        window.open(url);
        return;
    }
    // console.log(store.state.isORGANIZER);
    if (!store.state.userInfo && to.path !== '/login' && to.path !== '/programmeGOList') {
        store
            .dispatch('getUserInfo')
            .then(() => {
                store
                    .dispatch('checkOrganization')
                    .then(() => {
                        if (to.path === '/dashboard' && store.state.isORGANIZER) {
                            next('/organizationInfo');
                        } else {
                            next();
                        }
                    })
                    .catch(() => {
                        next('/organizationInfo');
                    });
            })
            .catch(() => {
                sessionStorage.removeItem('token');
                next('/login');
            });
    } else if (!to.matched.length) {
        next('/404');
    } else if (to.path !== '/organizationInfo' && to.path !== '/login') {
        store
            .dispatch('checkOrganization')
            .then(() => {
                if (to.path === '/dashboard' && store.state.isORGANIZER) {
                    next();
                }
                next();
            })
            .catch(() => {
                if (from.path === '/organizationInfo') {
                    Message({
                        message: '请补全信息',
                        type: 'warning'
                    });

                    next(false);
                }
                next('/organizationInfo');
            });
    } else if (to.path === '/dashboard' && store.state.isORGANIZER) {
        next('/organizationInfo');
    } else {
        next();
    }
});

export default router;
