From 7c2e817088e096f5b69471730f55f7a94da82db0 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Tue, 21 Mar 2023 16:19:52 +0800
Subject: [PATCH] 允许关闭mock,使用post请求本地模拟接口

---
 bases/Fetcher.js  |    8 ++++++--
 bases/HostBoot.js |    4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bases/Fetcher.js b/bases/Fetcher.js
index 5a3c494..c81008e 100644
--- a/bases/Fetcher.js
+++ b/bases/Fetcher.js
@@ -64,8 +64,12 @@
     spellURL(devSuffix, serSuffix) {
         let url = '';
         // mock地址
-        if ($hostBoot.isOnMock()) {
-            url = this._data.urlPrefix[0].replace('api/', '') + devSuffix + '.json';
+        if ($hostBoot.isDevMod()) {
+            if ($hostBoot.isOnMock())  {
+                url = this._data.urlPrefix[0].replace('api/', '') + devSuffix + '.json';
+            } else {
+                url = this._data.urlPrefix[0] + devSuffix;
+            }
         }
         // 正常地址
         else {
diff --git a/bases/HostBoot.js b/bases/HostBoot.js
index 12f98bc..83aefda 100644
--- a/bases/HostBoot.js
+++ b/bases/HostBoot.js
@@ -14,6 +14,7 @@
      */
     constructor() {
         this._data = {
+            mockOff: Tools.getUrlParam('mock') === 'off',
             // 可用主机列表
             hostList: {
                 ...project.host.hosts,
@@ -193,6 +194,9 @@
      */
     isOnMock() {
         if (this.isDevMod()) {
+            if (this._data.mockOff) {
+                return false;
+            }
             return this.getHostName() === 'lc';
         } else {
             return false;

--
Gitblit v1.9.1