import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/pages/Index/Index'
import Notice from '@/pages/Notice/Notice'
import Policy from '@/pages/Policy/Policy'
import Train from '@/pages/Train/Train'
import Detail from '@/pages/Detail/Detail'
import Public from '@/pages/Public/Public'
import PersonCenter from '@/pages/PersonCenter/PersonCenter'
import Question from '@/pages/Question/Question'
import Login from '@/pages/Login/Login'
import Register from '@/pages/Register/Register'
import Test from '@/pages/Test/Test'
import CommonProblem from '@/pages/CommonProblem/CommonProblem'
import ForgetPassword from '@/pages/ForgetPassword/ForgetPassword'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index
    },
    {
      path: '/notice',
      name: 'Notice',
      component: Notice
    },
    {
      path: '/policy',
      name: 'Policy',
      component: Policy
    },
    {
      path: '/train',
      name: 'Train',
      component: Train
    },
    {
      path: '/detail',
      name: 'Detail',
      component: Detail
    },
    {
      path: '/public',
      name: 'Public',
      component: Public
    },
    {
      path: '/center',
      name: 'PersonCenter',
      component: PersonCenter
    },
    {
      path: '/question',
      name: 'Question',
      component: Question
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path: '/test',
      name: 'Test',
      component: Test
    },
    {
      path: '/common',
      name: 'CommonProblem',
      component: CommonProblem
    },
    {
      path: '/forget',
      name: 'ForgetPassword',
      component: ForgetPassword
    }
  ],
  scrollBehavior(to, from, saveTop) {
    if (saveTop) {
      return saveTop;
    } else {
      return { x: 0, y: 0 }
    }
  },
})
