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: 'changePwd', name: 'changePwd', component: () => import('../view/login/ChangePwd') }, { path: 'waitCreate', name: 'waitCreate', component: () => import('../view/shipping/WaitCreate.vue') }, { path: 'normalSendGoods', name: 'NormalSendGoods', component: () => import('../view/shipping/NormalSendGoods.vue') }, { path: 'shippingDesk', name: 'shippingDesk', component: () => import('../view/shipping/ShippingDesk.vue') }, { path: 'shippingList', name: 'shippingList', component: () => import('../view/shipping/ShippingList.vue') }, { path: 'waitPackageList', name: 'waitPackageList', component: () => import('../view/shipping/WaitPackageList.vue') }, { path: 'waitShippingList', name: 'waitShippingList', component: () => import('../view/shipping/WaitShippingList.vue') }, { path: 'myNormalOrder', name: 'myNormalOrder', component: () => import('../view/shipping/MyNormalOrder.vue') }, { path: 'myUrgencyOrder', name: 'myUrgencyOrder', component: () => import('../view/shipping/MyUrgencyOrder.vue') }, { path: 'productLabel', name: 'productLabel', component: () => import('../view/shipping/ProductLabel.vue') }, { path: 'returnPackage', name: 'returnPackage', component: () => import('../view/stock/ReturnPackage.vue') }, { path: 'returnDetail', name: 'returnDetail', component: () => import('../view/stock/ReturnDetail.vue') }, { path: 'productList', name: 'productList', component: () => import('../view/product/ProductList.vue') }, { path: 'copyProduct', name: 'copyProduct', component: () => import('../view/product/CopyProduct.vue') }, { path: 'sellerSelect', name: 'sellerSelect', component: () => import('../view/product/SellerSelect.vue') }, { path: 'draft', name: 'draft', component: () => import('../view/product/Draft.vue') }, { path: 'findSeller', name: 'findSeller', component: () => import('../view/product/FindSeller.vue') }, { path: 'copyProductAliExpress', name: 'copyProductAliExpress', component: () => import('../view/product/CopyProductAliExpress.vue') }, { path: 'batchUpload', name: 'batchUpload', component: () => import('../view/product/BatchUpload.vue') }, { path: 'niubiCopy', name: 'niubiCopy', component: () => import('../view/selection/NiubiCopy.vue') }, { path: 'aliExpressCopy', name: 'aliExpressCopy', component: () => import('../view/selection/AliExpressCopy.vue') }, { path: 'storeTrack', name: 'storeTrack', component: () => import('../view/selection/storetrack/Index.vue') }, { path: 'keywordTrack', name: 'keywordTrack', component: () => import('../view/selection/keywordtrack/Index.vue') }, { path: 'favoriteTrack', name: 'favoriteTrack', component: () => import('../view/selection/favoritetrack/Index.vue') }, { path: 'indexTrack', name: 'indexTrack', component: () => import('../view/selection/indextrack/Index.vue') }, { path: 'newProduct', name: 'newProduct', component: () => import('../view/selection/newproducttrack/newproduct/Index.vue') }, { path: 'newProductGroup', name: 'newProductGroup', component: () => import('../view/selection/newproducttrack/newproductgroup/Index.vue') }, { path: 'bestSellers', name: 'bestSellers', component: () => import('../view/selection/bestsellers/Index.vue') }, { path: 'singleTrack', name: 'singleTrack', component: () => import('../view/selection/singletrack/Index.vue') }, { path: 'info', name: 'info', component: () => import('../view/Info.vue') }, { path: 'priceFollow', name: 'priceFollow', component: () => import('../view/PriceFollow.vue') }, { path: 'message', name: 'message', component: () => import('../view/Message.vue') }, { path: 'coinFlow', name: 'coinFlow', component: () => import('../view/CoinFlow.vue') }, { path: 'costManageTemu', name: 'costManageTemu', component: () => import('../view/sale/CostManageTemu.vue') }, { path: 'saleData', name: 'saleData', component: () => import('../view/sale/ExportSaleData.vue') }, { path: 'saleOut', name: 'saleOut', component: () => import('../view/sale/ExportSaleOutData.vue') }, { path: 'afterSaleStat', name: 'afterSaleStat', component: () => import('../view/sale/AfterSaleStat.vue') }, { path: 'afterSaleDeductStat', name: 'afterSaleDeductStat', component: () => import('../view/sale/AfterSaleDeductStat.vue') }, { path: 'saleStatTemu', name: 'saleStatTemu', component: () => import('../view/sale/ExportSaleStatTemu.vue') }, { path: 'priceAdjustment', name: 'priceAdjustment', component: () => import('../view/sale/PriceAdjustment.vue') }, { path: 'logisticFee', name: 'logisticFee', component: () => import('../view/sale/LogisticFee.vue') }, { path: 'billStat', name: 'billStat', component: () => import('../view/sale/ExportBillStatTemu.vue') }, { path: 'costManageShein', name: 'costManageShein', component: () => import('../view/shein/CostManageShein.vue') }, { path: 'certCenterShein', name: 'certCenterShein', component: () => import('../view/shein/CertCenterShein.vue') }, { path: 'saleDataShein', name: 'saleDataShein', component: () => import('../view/shein/ExportSaleDataShein.vue') }, { path: 'saleStatShein', name: 'saleStatShein', component: () => import('../view/shein/ExportSaleStatShein.vue') }, { path: 'copyProductShein', name: 'copyProductShein', component: () => import('../view/shein/CopyProductShein.vue') }, { path: 'orderListShein', name: 'orderListShein', component: () => import('../view/shein/OrderListShein.vue') }, { path: 'productListOdm', name: 'productListOdm', component: () => import('../view/shein/ProductListOdm.vue') }, { path: 'returnRecordShein', name: 'returnRecordShein', component: () => import('../view/shein/ReturnRecordShein.vue') }, { path: 'labelInfoShein', name: 'labelInfoShein', component: () => import('../view/shein/LabelInfoShein.vue') }, { path: 'purchaseOrderListShein', name: 'purchaseOrderListShein', component: () => import('../view/shein/PurchaseOrderListShein.vue') }, { path: 'syncDataTemu', name: 'syncDataTemu', component: () => import('../view/data/SyncDataTemu.vue') }, { path: 'sendGoods_xc', name: 'sendGoods_xc', component: () => import('../view/semi/SemiSendGoods_XC.vue') }, // { // path: 'statistics', // name: 'statistics', // component: () => import('../view/Statistics.vue') // }, { path: 'learning', name: 'learning', component: () => import('../view/Learning.vue') }, { path: 'qualification', name: 'qualification', children: [ { path: 'oushuitong', name: 'oushuitong', meta: { activeMenu:'/qualification' } } ] }, { path: 'labelsTemplate', name: 'labelsTemplate', component: () => import('../view/lables/Template.vue') }, { path: 'addLabelsTemplate', name: 'addLabelsTemplate', component: () => import('../view/lables/AddTemplate.vue'), meta: { activeMenu:'/labelsTemplate' } }, { path: 'labelsPrint', name: 'labelsPrint', component: () => import('../view/lables/Print.vue') }, { path: 'skuManage', name: 'skuManage', component: () => import('../view/lables/SkuManage.vue'), meta: { activeMenu:'/labelsTemplate' } } ] }, { path: '/login', name: 'login', meta: { title: '登录' }, component: () => import('../view/login/Login.vue') }, { path: '/register', name: 'register', meta: { title: '注册' }, component: () => import('../view/login/Register.vue') }, { path: '/forget', name: 'forget', meta: { title: '注册' }, component: () => import('../view/login/Forget.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