diff --git a/src/utils/api.js b/src/utils/api.js index 135cd84..bbfe6c7 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -174,9 +174,9 @@ service.interceptors.response.use( // 直接返回响应数据(根据后端接口规范调整) // console.log(response.data.code); if (response.data.code === 403) { + localStorage.removeItem("token"); // 如果在微信浏览器中,自动重新授权 if (WechatAuth.isWechatBrowser() && !isAuthing) { - localStorage.removeItem("token"); const urlParams = new URLSearchParams(window.location.search); const friend_account_id = urlParams.get('friend_account_id'); const accountId = urlParams.get('accountId'); @@ -185,6 +185,10 @@ service.interceptors.response.use( window.location.reload(); } // return Promise.reject(new Error('正在重新授权,请稍候...')); + }else{ + //跳转h5登录 + window.location.href = '/login?redirect='+encodeURIComponent(window.location.href); + return Promise.reject(new Error('正在重新授权,请稍候...')); } } return response.data;