From 82e27d0cadbddfc73e8b978e778b802dc8e51fa1 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期五, 29 三月 2024 10:51:36 +0800 Subject: [PATCH] 报工入参修改和工序ID修改 --- src/common/utils/request.ts | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/utils/request.ts b/src/common/utils/request.ts index a73faac..82f6c31 100644 --- a/src/common/utils/request.ts +++ b/src/common/utils/request.ts @@ -16,11 +16,12 @@ (config) => { // 鑻ユ槸鏈夊仛閴存潈token , 灏辩粰澶撮儴甯︿笂token const token = getToken() - if (token) { - config.headers.Authorization = 'Bearer ' + token - } else { + if ((token == null || token == '' || token == 'undefined') && config.url != '/api/base/login') { router.push('/login') + return config // window.location = `//${window.location.hostname}:9080`+'/login' + } else if (token) { + config.headers.Authorization = 'Bearer ' + token } return config @@ -47,6 +48,10 @@ } }, (error) => { + if (error.response.status === 401) { + // alert('JWT澶辨晥,鍗冲皢璺宠浆鑷崇櫥褰曢〉..') + router.push('/login') + } let { message } = error if (message === 'Network Error') { message = '鍚庣鎺ュ彛杩炴帴寮傚父' -- Gitblit v1.8.0