import Vue from 'vue'
import Router from 'vue-router'

// import Login from '@/pages/loginView/loginView.vue'
import mainView from '@/pages/mainView/mainView.vue'
import webgl_rxdz_roam from '@/pages/webgl_rxdz_roam/webgl_rxdz_roam.vue'
import webgl_rxdz_look from '@/pages/webgl_rxdz_look/webgl_rxdz_look.vue'
import webgl_rxdz_customize from '@/pages/webgl_rxdz_customize/webgl_rxdz_customize'

Vue.use(Router)
const router = new Router({
    // mode: 'history',
    routes: [
        // 页面初始化
        {
            path: '/',
            redirect: '/pages/mainView'
        },
        {
            path: '/pages/mainView',
            name: 'mainView',
            component: mainView
        },
        {
            path: '/pages/webgl_rxdz_roam',
            name: 'webgl_rxdz_roam',
            component: webgl_rxdz_roam
        },
		{
		    path: '/pages/webgl_rxdz_look',
		    name: 'webgl_rxdz_look',
		    component: webgl_rxdz_look
		},
        {
            path: '/pages/webgl_rxdz_customize',
            name: 'webgl_rxdz_customize',
            component: webgl_rxdz_customize
        }
		
    ],
})

router.beforeEach((to, from, next) => {
	console.warn("router:start-1", from,to);
	//如果存在用户账号信息|| to.query.uid
	next();
})
//同一个路由跳转报错解决，NavigationDuplicated: Avoided redundant navigation to current location:
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return  originalPush.call(this,location).catch(err=>err)
}

export default router;
