1、配合地区管理接口的api文件,后端修改相应字段可以不要此文件
2、基础设施/文件管理/文件列表 上传失败无法上传只能刷新页面才能上传bug 3、基础设施/文件管理/文件列表 新增是下拉框显示0 设置为nullliutao_branch
parent
d6f2eafbde
commit
944015484a
@ -0,0 +1,50 @@
|
|||||||
|
import { service } from './service'
|
||||||
|
|
||||||
|
import { config } from './config'
|
||||||
|
|
||||||
|
const { default_headers } = config
|
||||||
|
|
||||||
|
const request = (option: any) => {
|
||||||
|
const { url, method, params, data, headersType, responseType } = option
|
||||||
|
return service({
|
||||||
|
url: url,
|
||||||
|
method,
|
||||||
|
params,
|
||||||
|
data,
|
||||||
|
responseType: responseType,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': headersType || default_headers
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
get: async <T = any>(option: any) => {
|
||||||
|
const res = await request({ method: 'GET', ...option })
|
||||||
|
return res as unknown as T
|
||||||
|
},
|
||||||
|
post: async <T = any>(option: any) => {
|
||||||
|
const res = await request({ method: 'POST', ...option })
|
||||||
|
return res as unknown as T
|
||||||
|
},
|
||||||
|
delete: async <T = any>(option: any) => {
|
||||||
|
const res = await request({ method: 'DELETE', ...option })
|
||||||
|
return res as unknown as T
|
||||||
|
},
|
||||||
|
put: async <T = any>(option: any) => {
|
||||||
|
const res = await request({ method: 'PUT', ...option })
|
||||||
|
return res as unknown as T
|
||||||
|
},
|
||||||
|
patch: async <T = any>(option: any) => {
|
||||||
|
const res = await request({ method: 'PATCH', ...option })
|
||||||
|
return res as unknown as T
|
||||||
|
},
|
||||||
|
download: async <T = any>(option: any) => {
|
||||||
|
const res = await request({ method: 'GET', responseType: 'blob', ...option })
|
||||||
|
return res as unknown as Promise<T>
|
||||||
|
},
|
||||||
|
upload: async <T = any>(option: any) => {
|
||||||
|
option.headersType = 'multipart/form-data'
|
||||||
|
const res = await request({ method: 'POST', ...option })
|
||||||
|
return res as unknown as Promise<T>
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue