From 6a759f3f97c4667a9b295000039508dd73b55509 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Thu, 14 Jan 2021 16:52:43 +0800 Subject: [PATCH] 取消锁定页面的设计 --- bases/Fetcher.js | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bases/Fetcher.js b/bases/Fetcher.js index 5793cf1..777ff95 100644 --- a/bases/Fetcher.js +++ b/bases/Fetcher.js @@ -534,16 +534,19 @@ static inDevMod = (() => { // 网页 if (process.env.TARO_ENV === 'h5') { + const reg = new RegExp('(^|&)query=([^&]*)(&|$)', 'i'); + const match = window.location.search.substr(1).match(reg); + const param = match !== null ? decodeURIComponent(match[2]) : null; // 当处于 mock 请求模式,视为本地开发 - if (Tools.getUrlParam('query') === 'mock') { + if (param === 'mock') { return true; } // 强制 real 请求,可在本地使用真实请求 - if (Tools.getUrlParam('query') === 'real') { + if (param === 'real') { return false; } - // 当没有 url 指定时,只有内网 ip 和 33** 的端口号,视为本地开发模式 - return /^(192|127|localhost).*?:33\d{2}$/i.test(window.location.host); + // 当没有 url 指定时,只有内网 ip 和 33**/35** 的端口号,视为本地开发模式 + return /^(192|127|localhost).*?:3[35]\d{2}$/i.test(window.location.host); } // 小程序 else if (process.env.TARO_ENV === 'weapp') { -- Gitblit v1.9.1