import Vue from 'vue'
import Router from 'vue-router'
import routerBefore from '@/config/routerBefore.js'

// 主页
import main from '@/components/main.vue'

// 登录
import login from '@/views/index/components/login.vue'// 登录
import download from '@/views/index/components/download.vue'
// 抽奖结果
import luckDraw from '@/views/index/components/luckDraw.vue'


// 网页登录不可访问
import page404 from '@/views/index/components/page404.vue'

// 集团公司选择过渡页
import selectCompany from '@/views/index/components/selectCompany.vue'

Vue.use(Router)

export const constantRouterMap = [{
        path: '/',
        meta: {
            'title': '登录'
        },
        component: login
    },
    
    {
        path: '/download',
        name: 'download',
        meta: {
            'title': '下载'
        },
        component: download
    },
    {
        path: '/login',
        name: 'login',
        meta: {
            'title': '登录'
        },
        component: login
    },
    {
        path:'/luckDraw',
        name:'luckDraw',
        meta:{
            'title':'抽奖结果'
        },
        component:luckDraw
    },
    {
        path: '/default',
        name: 'default',
        component: main,
        meta: {
            'title': '首页'
        }
    },
    {
        path: '/selectCompany',
        name: 'selectCompany',
        component: selectCompany,
        meta: {
            'title': '集团与公司用户跳转页'
        }
    },,
    {
        path: '/page404',
        name: 'page404',
        meta: {
            'title': '404'
        },
        component: page404
}];

const router = new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
});

//  before
routerBefore(router, constantRouterMap);

export default router;

//  constantRouterMap
export const routes = constantRouterMap;
