From 4076fed6ad20dbbec939fa11230a290f018886db Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Sun, 14 Nov 2021 20:28:09 +0800 Subject: [PATCH] 完善混合App退出机制 --- bases/Fetcher.js | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/bases/Fetcher.js b/bases/Fetcher.js index dd90242..b0abf5f 100644 --- a/bases/Fetcher.js +++ b/bases/Fetcher.js @@ -82,12 +82,8 @@ } // 正常模式 else { - // 代理模式 - if (typeof project.host.proxyType !== 'undefined' && project.host.proxyType !== 'lc') { - url = '/proxy' + this._data.urlPrefix[1] + (serSuffix || devSuffix); - } // 开发环境地址 - else if (Fetcher.inDevMod) { + if (Fetcher.inDevMod) { url = this._data.urlPrefix[0] + devSuffix; } // 生产环境地址 @@ -110,7 +106,7 @@ * @param {object} [options] * @return {Promise<any>} */ - get(url, data, options = null) { + get(url, data, options = {}) { const params = Qs.stringify(data); if (url.indexOf('?') >= 0) { url += '&' + params; @@ -127,7 +123,7 @@ * @param {object} [options] * @return {Promise<any>} */ - post(url, data, options = null) { + post(url, data, options = {}) { if (this._data.mock === 'on') { return this.get(url, data, options); } @@ -392,7 +388,8 @@ } // 在App中,直接跳转登陆页 if (project.appHybrid) { - Taro.reLaunch({ url: '/pages/home/login/login' }); + Taro.removeStorageSync('AiSim@UserInfo'); + Taro.navigateBack({ delta: Taro.getCurrentPages().length }); } return null; } else { @@ -606,9 +603,11 @@ // 如果网址参数有指定服务器 const server = Tools.getUrlParam('server'); if (server) { - // 如果是完整网址,直接使用地址 + // 如果是完整网址,使用网址对应的域名 if (server.indexOf('http') >= 0) { - return server; + const portal = server.split('//')[0]; + const domain = server.split('//')[1].split('/')[0]; + return portal + '//' + domain; } // 如果有匹配服务器,使用指定的服务器地址 if (typeof project.host.hosts[server] !== 'undefined') { -- Gitblit v1.9.1