提交模型设计代码

This commit is contained in:
zhujiyan
2024-05-08 20:44:33 +08:00
parent 1e645adce8
commit 6076cec029
71 changed files with 8222 additions and 1866 deletions

View File

@@ -96,7 +96,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
response.data.code === 'A0000' ||
response.data.type === 'application/json' ||
Array.isArray(response.data) ||
response.data.size
response.data.size
// ||
// response.data.type === 'application/octet-stream' ||
// response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
@@ -228,6 +228,37 @@ export function requestPayload(method: Method, data: anyObj) {
}
}
}
// 适配器, 用于适配不同的请求方式
export function baseRequest(url, value = {}, method = 'post', options = {}) {
url = sysConfig.API_URL + url
if (method === 'post') {
return service.post(url, value, options)
} else if (method === 'get') {
return service.get(url, { params: value, ...options })
} else if (method === 'formdata') {
// form-data表单提交的方式
return service.post(url, qs.stringify(value), {
headers: {
'Content-Type': 'multipart/form-data'
},
...options
})
} else {
// 其他请求方式例如put、delete
return service({
method: method,
url: url,
data: value,
...options
})
}
}
// 模块内的请求, 会自动加上模块的前缀
export const moduleRequest =
(moduleUrl) =>
(url, ...arg) => {
return baseRequest(moduleUrl + url, ...arg)
}
interface LoadingInstance {
target: any