From c2efc244f18fede3689db469798649e785cb6a95 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Wed, 27 Jan 2021 19:16:37 +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