From e98e91659647692a3d3711734c9de8be0c1a19ed Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Wed, 30 Dec 2020 15:53:46 +0800 Subject: [PATCH] 延长请求超时设定,更改事件名称 --- bases/Fetcher.js | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bases/Fetcher.js b/bases/Fetcher.js index c84c458..96b61aa 100644 --- a/bases/Fetcher.js +++ b/bases/Fetcher.js @@ -31,7 +31,7 @@ 'Ax-Rq-Type': 'separation', }, dataType: 'json', - timeout: 10000, + timeout: 30 * 1000, }; /** @@ -102,8 +102,10 @@ 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); } @@ -117,7 +119,7 @@ * @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, -- Gitblit v1.9.1