| | |
| | | * @param {boolean?} throwError 是否不使用默认的异常处理方法,而把异常抛出来 |
| | | * @return {Promise} 返回一个promise对象。其中then方法传递回包中的data数据;catch事件则传递整个回包,其参数为{data:{},status{code:123,message:'xxx'}} |
| | | */ |
| | | post(url, data = {}, throwError) { |
| | | post(url, data = {}, params= {}, throwError) { |
| | | const config = { |
| | | method: 'POST', |
| | | url, |
| | | params, |
| | | data: JSON.stringify(data), |
| | | errorHandler: (!throwError && this.defaultErrorHandler) || null, |
| | | headers: { |
| | |
| | | data: formElem instanceof FormData ? formElem : new FormData(formElem), |
| | | onUploadProgress, |
| | | errorHandler: (!throwError && this.defaultErrorHandler) || null, |
| | | timeout: 500000, |
| | | enableRepeat: true |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | }, |
| | | }) |
| | | } |
| | | } |