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

const errorPage = r => {
  import('view/errorPage/index.vue').then(module => {
    r(module);
  });
};

export const constantRouterMap = [{
  path: '/',
  name: 'index',
  redirect: 'shareIndex',
  component: _import('layout', 'layout'),
  children: [
    // 宣传页
    {
      path: '/leaflets',
      name: '分享首页宣传页',
      component: _import('shareIndex', 'leaflets'),
      meta: {
        title: '分享首页宣传页'
      }
    },
    // 分享首页
    {
      path: '/shareIndex',
      name: '分享首页',
      component: _import('shareIndex', 'index'),
      meta: {
        title: '分享首页'
      }
    },
    {
      path: '/createActive',
      name: '创建活动',
      component: _import('activeConfig', 'index'),
      meta: {
        title: '创建活动'
      }
    },
    {
      path: '/editActive',
      name: '编辑活动',
      component: _import('activeConfig', 'index'),
      meta: {
        title: '编辑活动'
      }
    },
    {
      path: '/checkActive',
      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
  })
});
