| | |
| | | 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', |
| | | 'Ax-Rq-Type': 'separation', |
| | | }, |
| | | credentials: 'same-origin', |
| | | dataType: 'json', |
| | | timeout: 10000, |
| | | timeout: 30 * 1000, |
| | | }; |
| | | |
| | | /** |
| | |
| | | const params = Qs.stringify(data); |
| | | const data2 = {}; |
| | | params.split('&').forEach(param => { |
| | | const item = param.split('='); |
| | | data2[decodeURIComponent(item[0])] = decodeURIComponent(item[1]); |
| | | if (param) { |
| | | const item = param.split('='); |
| | | data2[decodeURIComponent(item[0])] = decodeURIComponent(item[1]); |
| | | } |
| | | }); |
| | | return this.query('post', url, data2, remap, options); |
| | | } |
| | |
| | | * @param {object} [options] |
| | | * @return {Promise<any>|} |
| | | */ |
| | | query(type, url, data = null, remap, options) { |
| | | query(type, url, data = null, remap, options = {}) { |
| | | return new Promise((resolve, reject) => { |
| | | Taro.request({ |
| | | ...this._defaultConfig, |
| | |
| | | } else { |
| | | // 修复补齐 |
| | | if (type === 'fix') { |
| | | if (!path || /^\/(upload|static)/.test(path)) { |
| | | if (!path || /^(http|\/upload|\/static)/.test(path)) { |
| | | return path; |
| | | } else { |
| | | return '/upload/' + path; |