/*
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-11-12 10:18:30
 * @LastEditors: 无尘
 * @LastEditTime: 2019-11-18 11:23:30
 */
// import Vue from 'vue';
import Router from 'vue-router';
import _import from './_import.js';
// Vue.use(Router);

/* const error403 = r => {
  import('view/errorPage/403.vue').then(module => {
    r(module);
  });
};
const error404 = r => {
  import('view/errorPage/404.vue').then(module => {
    r(module);
  });
};
const error500 = r => {
  import('view/errorPage/500.vue').then(module => {
    r(module);
  });
}; */
const errorPage = r => {
  import('view/errorPage/index.vue').then(module => {
    r(module);
  });
};

export const constantRouterMap = [{
  path: '/',
  name: 'index',
  redirect: 'shareIndex',
  component: _import('index', 'index'),
  children: [
    // 分享首页
    {
      path: '/shareIndex',
      name: '分享首页',
      component: _import('shareIndex', 'index'),
      meta: {
        title: '分享首页'
      }
    },
    {
      path: '/createActive',
      name: '创建完成',
      component: _import('activeConfig', 'index'),
      meta: {
        title: '创建完成'
      }
    },
    // 活动创建完成
    {
      path: '/createCompletion',
      name: '创建完成',
      component: _import('activeConfig', 'createCompletion'),
      meta: {
        title: '创建完成'
      }
    },
    {
      path: '/dataDetail',
      name: '数据明细',
      component: _import('dataDetails', 'index'),
      meta: {
        title: '数据明细'
      }
    },
    {
      path: '/inviterLog',
      name: '邀请人日志',
      component: _import('dataDetails', 'inviterLog'),
      meta: {
        title: '邀请人日志'
      }
    },
    {
      path: '/invitedLog',
      name: '受邀人日志',
      component: _import('dataDetails', 'invitedLog'),
      meta: {
        title: '受邀人日志'
      }
    },
  ]
},
{
  path: '/403',
  name: '无权访问',
  component: errorPage
},
{
  path: '/404',
  name: 'error404',
  component: errorPage
},
{
  path: '/500',
  name: 'error500',
  component: errorPage
},
{
  path: '*',
  redirect: '/404',
  hidden: true
}
];

export default new Router({
  mode: 'history',
  base: '/share-config/',
  routes: constantRouterMap,
  scrollBehavior: () => ({
    y: 0
  })
});
