版本迭代

This commit is contained in:
liuye
2023-08-06 16:50:17 +08:00
parent 590fb406cc
commit 5c0b1afe69
63 changed files with 14131 additions and 40 deletions

96
src/router/index.js Normal file
View File

@@ -0,0 +1,96 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import store from '@/store'
Vue.use(VueRouter)
const router = new VueRouter({
routes: [
{
path: '/',
name: 'Home',
meta: {
isAuth: true
},
redirect: '/Welcome',
component: () => import('../view/Home.vue'),
children: [
{
path: 'welcome',
name: 'welcome',
component: () => import('../view/Welcome.vue')
},
{
path: 'normalSendGoods',
name: 'NormalSendGoods',
component: () => import('../view/NormalSendGoods.vue')
},
{
path: 'copyProduct',
name: 'copyProduct',
component: () => import('../view/CopyProduct.vue')
},
{
path: 'saleData',
name: 'saleData',
component: () => import('../view/ExportSaleData.vue')
},
// {
// path: 'statistics',
// name: 'statistics',
// component: () => import('../view/Statistics.vue')
// },
{
path: 'learning',
name: 'learning',
component: () => import('../view/Learning.vue')
}
]
},
{
path: '/login',
name: 'login',
meta: {
title: '登录'
},
component: () => import('../view/login/Login.vue')
},
{
path: '/register',
name: 'register',
meta: {
title: '注册'
},
component: () => import('../view/login/Register.vue')
}
],
scrollBehavior (to, from, savedPosition) {
if (savedPosition) {
return savedPosition
} else {
return { x: 0, y: 0 }
}
}
})
router.beforeEach((to, from, next) => {
const isLogin = !!store.state.token
if (to.meta.isAuth && !isLogin) {
next({
path: '/login',
query: {
redirect: to.fullPath
}
})
} else {
next()
}
})
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
export default router