From 9b5d2b2994faf3db15fbda99c4390b4a505fd506 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Wed, 06 Jan 2021 19:44:39 +0800 Subject: [PATCH] 导航返回键改用Taro api --- bases/Fetcher.js | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bases/Fetcher.js b/bases/Fetcher.js index f845bae..689321c 100644 --- a/bases/Fetcher.js +++ b/bases/Fetcher.js @@ -30,8 +30,9 @@ 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'Ax-Rq-Type': 'separation', }, + credentials: 'same-origin', dataType: 'json', - timeout: 10000, + timeout: 30 * 1000, }; /** @@ -102,8 +103,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 +120,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, @@ -439,7 +442,7 @@ } else { // 修复补齐 if (type === 'fix') { - if (!path || /^\/(upload|static)/.test(path)) { + if (!path || /^(http|\/upload|\/static)/.test(path)) { return path; } else { return '/upload/' + path; -- Gitblit v1.9.1