|
@@ -2,27 +2,30 @@ import Vue from 'vue';
|
|
|
import VueRouter from 'vue-router';
|
|
|
import store from '@/store/index';
|
|
|
const jwt = require('jsonwebtoken');
|
|
|
-
|
|
|
+const originalPush = VueRouter.prototype.push;
|
|
|
+VueRouter.prototype.push = function push(location) {
|
|
|
+ return originalPush.call(this, location).catch((err) => err);
|
|
|
+};
|
|
|
Vue.use(VueRouter);
|
|
|
-const routes = [
|
|
|
+const web = [
|
|
|
{
|
|
|
path: '/',
|
|
|
- meta: { title: 'index', isleftarrow: false },
|
|
|
+ name: 'index',
|
|
|
+ meta: { title: '网站首页' },
|
|
|
component: () => import('../views/index.vue'),
|
|
|
},
|
|
|
];
|
|
|
-
|
|
|
+const routes = [...web];
|
|
|
const router = new VueRouter({
|
|
|
mode: 'history',
|
|
|
- base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
|
|
|
+ base: process.env.VUE_APP_ROUTER,
|
|
|
routes,
|
|
|
});
|
|
|
// router.beforeEach((to, from, next) => {
|
|
|
// document.title = `${to.meta.title} `;
|
|
|
-// let token = localStorage.getItem('token');
|
|
|
-// console.log(token);
|
|
|
-// if (to.path == '/account/index') {
|
|
|
-// if (token == null) {
|
|
|
+// const token = localStorage.getItem('token');
|
|
|
+// if (to.path == '/adminCenter/homeIndex') {
|
|
|
+// if (!token) {
|
|
|
// next('/login');
|
|
|
// } else {
|
|
|
// let user = jwt.decode(token);
|
|
@@ -35,10 +38,5 @@ const router = new VueRouter({
|
|
|
// next();
|
|
|
// }
|
|
|
// });
|
|
|
-const originalPush = VueRouter.prototype.push;
|
|
|
-VueRouter.prototype.push = function push(location, onResolve, onReject) {
|
|
|
- if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject);
|
|
|
- return originalPush.call(this, location).catch((err) => err);
|
|
|
-};
|
|
|
|
|
|
export default router;
|