| | |
| | | } |
| | | |
| | | // post请求 |
| | | export const reqPost = (url, params, form, opt = {}) => { |
| | | export const reqPost = (url, params,form, opt = {}) => { |
| | | if(form == 'form'){ |
| | | opt.header = {'Content-Type': 'application/x-www-form-urlencoded'} |
| | | } else { |
| | |
| | | } |
| | | opt.method = "POST"; |
| | | opt.data = params; |
| | | opt.params = params; |
| | | return fetch(url, opt) |
| | | } |
| | | |
| | | // put请求 |
| | | export const reqPut = (url, params,form, opt = {}) => { |
| | | if(form == 'form'){ |
| | | opt.header = {'Content-Type': 'application/x-www-form-urlencoded'} |
| | | } else { |
| | | opt.header = typeObj['headerPOST']; |
| | | } |
| | | opt.method = "PUT"; |
| | | opt.data = params; |
| | | opt.params = params; |
| | | return fetch(url, opt) |
| | | } |