From 9d7de4f5f27fde6948ae38256ce95a702339ef63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BF=8A=E4=BC=9F?= Date: Thu, 26 Aug 2021 14:41:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(=E6=A0=B7=E5=BC=8F=E6=B1=A1=E6=9F=93):?= =?UTF-8?q?=20=E4=BC=9A=E6=B1=A1=E6=9F=93=E5=85=B6=E4=BB=96=E5=B8=A6?= =?UTF-8?q?=E6=9C=89srcollbar=E7=9A=84=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Modal/src/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Modal/src/index.less b/src/components/Modal/src/index.less index 3e476bdfc8c..be64b204d0d 100644 --- a/src/components/Modal/src/index.less +++ b/src/components/Modal/src/index.less @@ -19,7 +19,7 @@ width: 520px; padding-bottom: 0; - .scrollbar { + .ant-modal-body > .scrollbar { padding: 14px; } From 774dac45253131aca8088c9284dedc2dff4c1004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BF=8A=E4=BC=9F?= Date: Tue, 7 Sep 2021 17:12:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(axios):=20urlPrefix=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E4=BC=A0=E9=80=92=E4=B8=8D=E7=94=9F=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/http/axios/axiosTransform.ts | 1 - src/utils/http/axios/index.ts | 8 +++++--- types/axios.d.ts | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils/http/axios/axiosTransform.ts b/src/utils/http/axios/axiosTransform.ts index 1581b96366a..f6cbc80af2d 100644 --- a/src/utils/http/axios/axiosTransform.ts +++ b/src/utils/http/axios/axiosTransform.ts @@ -6,7 +6,6 @@ import type { RequestOptions, Result } from '/#/axios'; export interface CreateAxiosOptions extends AxiosRequestConfig { authenticationScheme?: string; - urlPrefix?: string; transform?: AxiosTransform; requestOptions?: RequestOptions; } diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index 4affadad47f..c5c3fa4617b 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -81,7 +81,7 @@ const transform: AxiosTransform = { // 请求之前处理config beforeRequestHook: (config, options) => { - const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options; + const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true,urlPrefix } = options; if (joinPrefix) { config.url = `${urlPrefix}${config.url}`; @@ -199,8 +199,7 @@ function createAxios(opt?: Partial) { timeout: 10 * 1000, // 基础接口地址 // baseURL: globSetting.apiUrl, - // 接口可能会有通用的地址部分,可以统一抽取出来 - urlPrefix: urlPrefix, + headers: { 'Content-Type': ContentTypeEnum.JSON }, // 如果是form-data格式 // headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED }, @@ -222,6 +221,8 @@ function createAxios(opt?: Partial) { errorMessageMode: 'message', // 接口地址 apiUrl: globSetting.apiUrl, + // 接口拼接地址 + urlPrefix: urlPrefix, // 是否加入时间戳 joinTime: true, // 忽略重复请求 @@ -240,5 +241,6 @@ export const defHttp = createAxios(); // export const otherHttp = createAxios({ // requestOptions: { // apiUrl: 'xxx', +// urlPrefix: 'xxx', // }, // }); diff --git a/types/axios.d.ts b/types/axios.d.ts index e325b65b08b..e60187f9fe9 100644 --- a/types/axios.d.ts +++ b/types/axios.d.ts @@ -14,6 +14,8 @@ export interface RequestOptions { joinPrefix?: boolean; // Interface address, use the default apiUrl if you leave it blank apiUrl?: string; + // 请求拼接路径 + urlPrefix?: string; // Error message prompt type errorMessageMode?: ErrorMessageMode; // Whether to add a timestamp