From 51c7896fd8e45085dd5cdfff11e79a00ee0a7379 Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期五, 05 九月 2025 15:16:54 +0800 Subject: [PATCH] 上料/下料、报工/打印机配置/产线选择 、排产工单 --- common/router/index.js | 61 +++++++----------------------- 1 files changed, 14 insertions(+), 47 deletions(-) diff --git a/common/router/index.js b/common/router/index.js index 9b23857..f15dabf 100644 --- a/common/router/index.js +++ b/common/router/index.js @@ -1,64 +1,31 @@ import modules from './modules' import Vue from 'vue' import Router from '@/plugin/uni-simple-router/index.js' -import { - ACCESS_TOKEN -} from '@/common/util/constants.js' -import { - isOAuth2AppEnv -} from '@/common/util/util.js' +import {ACCESS_TOKEN} from '@/common/util/constants.js' Vue.use(Router) //鍒濆鍖� const router = new Router({ - - encodeURI: true, - routes: [...modules] //璺敱琛� + encodeURI:true, + routes: [...modules]//璺敱琛� }); -const whiteList = ['/pages/login/login', '/pages/login/loginOauth2'] +const whiteList = ['/pages/login/login'] //鍏ㄥ眬璺敱鍓嶇疆瀹堝崼 router.beforeEach((to, from, next) => { - if (to.path == '/oauth2-app/login') { - let temp = location.href; - location.href = temp.replace('/oauth2-app/login', '/pages/login/loginOauth2') - return; - } - let token = uni.getStorageSync(ACCESS_TOKEN); - if (token) { - if (to.path === '/pages/login/login' || to.path === '/pages/login/loginOauth2') { - // if (from.path === '/pages/index/index') { - // return; - // } else { - // next() - // } - next({ - path: '/pages/index/index' - }) - } - next() - } else { + let token=uni.getStorageSync(ACCESS_TOKEN); + if(token){ + next() + }else{ if (whiteList.indexOf(to.path) !== -1) { - // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝濡傛灉杩涘叆鐨勯〉闈㈡槸login椤甸潰骞朵笖褰撳墠鏄疧Auth2app鐜锛屽氨杩涘叆OAuth2鐧诲綍椤甸潰 - if (to.path === '/pages/login/login' && isOAuth2AppEnv()) { - next({ - path: '/pages/login/loginOauth2' - }) - } else { - // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆 - next() - } - } else { - // 濡傛灉褰撳墠鏄湪OAuth2APP鐜锛屽氨璺宠浆鍒癘Auth2鐧诲綍椤甸潰 - let path = isOAuth2AppEnv() ? '/pages/login/loginOauth2' : '/pages/login/login'; - next({ - path: path - }) + next() + }else{ + next({ path: '/pages/login/login'}) } - } + } }) // 鍏ㄥ眬璺敱鍚庣疆瀹堝崼 router.afterEach((to, from) => { console.log("afterEach") -}); -export default router; +}) +export default router; \ No newline at end of file -- Gitblit v1.9.3