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 |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/bases/Fetcher.js b/bases/Fetcher.js
index 4fd1e10..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 {
@@ -150,8 +154,8 @@
                     // 捕获响应
                     options && options.onCapture && options.onCapture({
                         url: this._createUrlPrefix(options) + url,
-                        request: JSON.stringify(data),
-                        response: JSON.stringify(response.data),
+                        request: data,
+                        response: { ...response.data },
                         httpCode: response.statusCode,
                     });
                     /**
@@ -173,7 +177,7 @@
                         // 捕获响应
                         options && options.onCapture && options.onCapture({
                             url: this._createUrlPrefix(options) + url,
-                            request: JSON.stringify(data),
+                            request: data,
                             httpCode: error && error.status,
                             httpMsg: msg + (error.message ? (' / ' + error.message) : ''),
                         });

--
Gitblit v1.9.1