You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
3.4 KiB
80 lines
3.4 KiB
import Vue from 'vue'
|
|
import VueRouter from 'vue-router'
|
|
import Login from '../components/Login.vue'
|
|
import Home from '../components/Home.vue'
|
|
import Index from '../views/index8.vue'
|
|
import Product from '../components/initial_value/product.vue'
|
|
import Storehouse from '../components/initial_value/storehouse.vue'
|
|
import Supplier from '../components/initial_value/supplier.vue'
|
|
import Location from '../components/initial_value/location.vue'
|
|
import Purchase from '../components/instorehouse/purchase.vue'
|
|
import Receiving from '../components/instorehouse/receiving.vue'
|
|
import ReceivingManagement from '../components/instorehouse/receivingManagement.vue'
|
|
import Shelves from '../components/storehouseManage/shelves.vue'
|
|
import PutIn from '../components/instorehouse/putIn.vue'
|
|
import ShelvesManagement from '../components/storehouseManage/shelvesManage.vue'
|
|
import PutInManagement from '../components/instorehouse/putInManagement.vue'
|
|
import PutInList from '../components/instorehouse/putInList.vue'
|
|
import Remove from '../components/storehouseManage/remove.vue'
|
|
import RemoveManagement from '../components/storehouseManage/removeManagement.vue'
|
|
import Stock from '../components/stockManagement/stock.vue'
|
|
import StockList from '../components/stockManagement/stockList.vue'
|
|
import OutOrder from '../components/outStorehouseManagement/outStorehouseOrder.vue'
|
|
import OutList from '../components/outStorehouseManagement/outList.vue'
|
|
import Picking from '../components/outStorehouseManagement/picking.vue'
|
|
import PickingManagement from '../components/outStorehouseManagement/pickingManagement.vue'
|
|
import PictureList from '../components/pictureList/pictureList.vue'
|
|
|
|
Vue.use(VueRouter)
|
|
|
|
const routes = [
|
|
{ path: '/login', component: Login },
|
|
// { path: '/', redirect: '/login' },
|
|
{ path: '/', redirect: '/index' },
|
|
{
|
|
path: '/index',
|
|
component: Home,
|
|
redirect: '/index',
|
|
children: [
|
|
{ path: '/index', component: Index },
|
|
{ path: '/product', component: Product },
|
|
{ path: '/storehouse', component: Storehouse },
|
|
{ path: '/supplier', component: Supplier },
|
|
{ path: '/location', component: Location },
|
|
{ path: '/order', component: Purchase },
|
|
{ path: '/receiving', component: Receiving },
|
|
{ path: '/receivingManagement', component: ReceivingManagement },
|
|
{ path: '/shelves', component: Shelves },
|
|
{ path: '/putin', component: PutIn },
|
|
{ path: '/shelvesManagement', component: ShelvesManagement },
|
|
{ path: '/putInManagement', component: PutInManagement },
|
|
{ path: '/putInList', component: PutInList },
|
|
{ path: '/remove', component: Remove },
|
|
{ path: '/removeManagement', component: RemoveManagement },
|
|
{ path: '/stock', component: Stock },
|
|
{ path: '/stockList', component: StockList },
|
|
{ path: '/outOrder', component: OutOrder },
|
|
{ path: '/outList', component: OutList },
|
|
{ path: '/pick', component: Picking },
|
|
{ path: '/pickManagement', component: PickingManagement },
|
|
{ path: '/PictureList', component: PictureList }
|
|
]
|
|
}
|
|
]
|
|
|
|
const router = new VueRouter({
|
|
routes
|
|
})
|
|
|
|
export default router
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
if (to.path === '/login') return next()
|
|
// 2.获取token信息
|
|
const token = "9a3860f0f2af471982e919657099913dddd" // window.sessionStorage.getItem('token')
|
|
// 3.判断token是否有数据?? if(token) 如果token不为null
|
|
// 如果token为null 则跳转到登录页面
|
|
if (!token) return next('/login')
|
|
// 表示放行
|
|
next()
|
|
})
|
|
|