Commit 63b456a6 by zhaochengxiang

表单

parent da27d97d
...@@ -165,26 +165,25 @@ export function PostFile(url, payload) { ...@@ -165,26 +165,25 @@ export function PostFile(url, payload) {
) )
} }
const config = { let config = {
baseURL, baseURL,
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'multipart/form-data',
}, },
cache: 'no-cache', cache: 'no-cache',
// `paramsSerializer` is an optional function in charge of serializing `params`
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params: any) {
// return qs.stringify(params, { arrayFormat: 'repeat' })
return qs.stringify(params, { arrayFormat: 'brackets' })
},
} }
export const callFetchRaw = (method, url, options) => { export const callFetchRaw = (method, url, options) => {
const { body: data, ...reqConfig } = options const { params, ...reqConfig } = options;
var bodyFormData = new FormData();
Object.keys(params||[]).forEach(key => {
bodyFormData.append(key, params[key]);
});
return axios.request({ return axios.request({
method, method,
url, url,
data, data: bodyFormData,
...config, ...config,
...reqConfig ...reqConfig
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment