index.ts
768 Bytes
import { defHttp } from '@/utils/external/http/axios'
import { DictItem, UploadResponse } from './model'
enum Api {
GET_DICT = '/dict_item',
UPLOAD = '/oss/upload',
DOWNLOAD = '/oss/download_file/',
AREALIST = '/area/list'
}
export const getDictItemByCode = (value: string) => {
return defHttp.post<DictItem[]>({
url: `${Api.GET_DICT}/find`,
params: {
dictCode: value
}
})
}
export const upload = (file: FormData) => {
return defHttp.post<UploadResponse>({
url: Api.UPLOAD,
params: file
})
}
export const downloadFile = (fileName: string) => {
return defHttp.get({ url: `${Api.DOWNLOAD}${fileName}` })
}
export const getAreaList = (data: object) => {
return defHttp.post<any>({
url: Api.AREALIST,
data
})
}