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

// 主页
// import main from '@/components/main.vue'
const main = () => import('@/components/main.vue')

// 登录
// import login from '@/views/index/components/login.vue' // 登录
const login = () => import('@/views/index/components/login.vue')

import download from '@/views/index/components/download.vue'
// 抽奖结果
//import luckDraw from "@/views/index/components/luckDraw.vue";

import luckDraw from '@/views/index/components/luckDraw.vue'

import printScan1 from '../components/printScan1'
import printScan2 from '../components/printScan2'
import printScan6 from '../components/printScan6'

import printReceipt from '../components/printReceipt'
import printReceipt1 from '../components/printReceipt1'
import printReceipt2 from '../components/printReceipt2'
import printReceipt6 from '../components/printReceipt6'

//记录打印日志
import printScan3 from '../components/printScan3'
import printReceipt3 from '../components/printReceipt3'
import printScan4 from '../components/printScan4'
import printReceipt4 from '../components/printReceipt4'
// 网页登录不可访问
import page404 from '@/views/index/components/page404.vue'

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

import printScan from '@/views/index/components/printScan.vue'
// import { transform } from 'babel-core'

Vue.use(Router)

export const constantRouterMap = [
  {
    path: '/',
    meta: {
      title: '登录'
    },
    component: login
  },

  {
    path: '/download',
    name: 'download',
    meta: {
      title: '下载'
    },
    component: download
  },
  {
    path: '/printScan',
    name: 'printScan',
    meta: {
      title: '下载'
    },
    component: printScan
  },
  {
    path: '/printScan1',
    name: 'printScan1',
    meta: {
      title: '下载'
    },
    component: printScan1
  },
  {
    path: '/printScan2',
    name: 'printScan2',
    meta: {
      title: '下载'
    },
    component: printScan2
  },
  {
    path: '/printReceipt',
    name: 'printReceipt',
    component: printReceipt
  },
  {
    path: '/printReceipt1',
    name: 'printReceipt1',
    component: printReceipt1
  },
  {
    path: '/printReceipt2',
    name: 'printReceipt2',
    component: printReceipt2
  },

  {
    path: '/printScan3',
    name: 'printScan3',
    meta: {
      title: '下载'
    },
    component: printScan3
  },
  {
    path: '/printReceipt3',
    name: 'printReceipt3',
    component: printReceipt3
  },
  {
    path: '/printScan4',
    name: 'printScan4',
    meta: {
      title: '下载'
    },
    component: printScan4
  },
  {
    path: '/printReceipt4',
    name: 'printReceipt4',
    component: printReceipt4
  },
  {
    path: '/printScan6',
    name: 'printScan6',
    meta: {
      title: '下载'
    },
    component: printScan6
  },
  {
    path: '/printReceipt6',
    name: 'printReceipt6',
    component: printReceipt6
  },

  {
    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
