From 80b2c0bf7de840cae301408da4410de0be04ff19 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 30 Oct 2025 16:55:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20base=20request=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request.js | 10 +++------- src/pages/login/index.vue | 12 ++++++++---- src/store/index.js | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/api/request.js b/src/api/request.js index 50c54b6..5f71e8f 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -4,8 +4,8 @@ import { MessagePlugin } from "tdesign-vue-next" import { useRouter } from 'vue-router'; function get_api_url() { - if (process.env.NODE_ENV === 'development' || (process.env.NODE_ENV === 'production' && window.location.host.indexOf('localhost') > -1)) { - return process.env.VUE_APP_API_BASEURL + if (import.meta.env.MODE === 'development' || (import.meta.env.MODE === 'production' && window.location.host.indexOf('localhost') > -1)) { + return import.meta.env.VITE_API_BASEURL } return 'http://' + window.location.host + '/api' } @@ -39,14 +39,10 @@ instance.interceptors.response.use( }, error => { let err_msg = "请求错误"; + console.log(error) if (error.response) { switch (error.response.status) { case 401: - if (error.response.data?.err_code == 'no_active_account') { - err_msg = "账户密码错误或已禁用" - } else { - err_msg = "认证失败,请重新登录" - } if (authToken.access) { authToken.access = null } if (authToken.refresh) { authToken.refresh = null } if (error.config.url.indexOf('/login') == -1) { diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index fbf512b..8e82646 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -30,8 +30,9 @@