wip: 表单BUG修复中

This commit is contained in:
kailong321200875
2023-06-08 09:47:18 +08:00
parent 9c724dc9aa
commit 289c1c2cf5
18 changed files with 1145 additions and 1102 deletions

View File

@@ -4,7 +4,7 @@ import {
AxiosRequestHeaders,
AxiosError,
InternalAxiosRequestConfig
} from './type'
} from './types'
import { ElMessage } from 'element-plus'
import qs from 'qs'

View File

@@ -4,7 +4,7 @@ import config from './config'
const { defaultHeaders } = config
const request = (option: any) => {
const request = (option: AxiosConfig) => {
const { url, method, params, data, headersType, responseType } = option
return service.request({
url: url,
@@ -19,17 +19,17 @@ const request = (option: any) => {
}
export default {
get: <T = any>(option: any) => {
return request({ method: 'get', ...option }) as unknown as T
get: <T = any>(option: AxiosConfig) => {
return request({ method: 'get', ...option }) as Promise<IResponse<T>>
},
post: <T = any>(option: any) => {
return request({ method: 'post', ...option }) as unknown as T
post: <T = any>(option: AxiosConfig) => {
return request({ method: 'post', ...option }) as Promise<IResponse<T>>
},
delete: <T = any>(option: any) => {
return request({ method: 'delete', ...option }) as unknown as T
delete: <T = any>(option: AxiosConfig) => {
return request({ method: 'delete', ...option }) as Promise<IResponse<T>>
},
put: <T = any>(option: any) => {
return request({ method: 'put', ...option }) as unknown as T
put: <T = any>(option: AxiosConfig) => {
return request({ method: 'put', ...option }) as Promise<IResponse<T>>
},
cancelRequest: (url: string | string[]) => {
return service.cancelRequest(url)

View File

@@ -1,10 +1,10 @@
import axios from 'axios'
import config, { defaultRequestInterceptors, defaultResponseInterceptors } from './config'
import { AxiosInstance, InternalAxiosRequestConfig, RequestConfig, AxiosResponse } from './type'
import { AxiosInstance, InternalAxiosRequestConfig, RequestConfig, AxiosResponse } from './types'
const { interceptors, baseUrl } = config
export const PATH_URL = baseUrl[import.meta.env.VITE_API_BASEPATH]
export const PATH_URL = baseUrl[import.meta.env.VITE_API_BASE_PATH]
const { requestInterceptors, responseInterceptors } = interceptors