From dec047c9fbceb85c668970bf6e9dae0588bfd104 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Sun, 15 Aug 2021 15:22:13 +0800 Subject: [PATCH] 对接App跨端通讯机制 --- bases/Fetcher.js | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bases/Fetcher.js b/bases/Fetcher.js index 5dce631..61f4159 100644 --- a/bases/Fetcher.js +++ b/bases/Fetcher.js @@ -19,7 +19,11 @@ urlPrefix: options.urlPrefix || ['/api/common/', '/api/common/'], }; if (project.host.mock === 'on') { - this._defaultConfig.url = Fetcher.host + project.host.assetsPath.replace('/assets', '/mocks'); + if (project.host.assetsPath.indexOf('..') === 0) { + this._defaultConfig.url = Fetcher.host + '/' + project.host.assetsPath.replace('/assets', '/mocks'); + } else { + this._defaultConfig.url = Fetcher.host + project.host.assetsPath.replace('/assets', '/mocks'); + } } else { this._defaultConfig.url = Fetcher.host; } @@ -280,7 +284,7 @@ msg += '解析通讯数据异常!'; } setTimeout(() => { - this.message('error', msg); + this.message('fail', msg); }, 20); } @@ -549,7 +553,7 @@ title: msg, icon: 'none', mask: true, - duration: type === 'error' ? 5000 : 3000, + duration: type === 'fail' ? 3000 : 2000, }); } -- Gitblit v1.9.1