From f3515c2b848794e3b855aa14e8d3690e70a3ceee Mon Sep 17 00:00:00 2001 From: GL <954534408@qq.com> Date: Wed, 28 Oct 2020 14:49:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/utils.js | 37 +++++++++++++++++++------------------ vue.config.js | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/services/utils.js b/src/services/utils.js index a261937..22a5f46 100644 --- a/src/services/utils.js +++ b/src/services/utils.js @@ -7,24 +7,25 @@ const isDev = process.env.NODE_ENV === 'development'; // 开发 or 生产 // 匹配接口前缀 export function autoMatch (prefix) { - let baseUrl = `/${prefix || 'fumao'}`; - // if (isDev) { - // // 开发环境 通过proxy配置转发请求; - // baseUrl = `/${prefix || 'fumao'}`; - // } else { - // // 生产环境 根据实际配置 根据 prefix 匹配url; - // // 配置来源 根据实际应用场景更改配置。(1.从全局读取;2.线上配置中心读取) - // switch (prefix) { - // case 'baidu': - // baseUrl = window.LOCAL_CONFIG.baidu; - // break; - // case 'alipay': - // baseUrl = window.LOCAL_CONFIG.alipay; - // break; - // default: - // baseUrl = window.LOCAL_CONFIG.default; - // } - // } + let baseUrl = ``; + if (isDev) { + // 开发环境 通过proxy配置转发请求; + baseUrl = `/${prefix || 'fumao'}`; + } else { + // 生产环境 根据实际配置 根据 prefix 匹配url; + // 配置来源 根据实际应用场景更改配置。(1.从全局读取;2.线上配置中心读取) + // switch (prefix) { + // case 'baseurl': + // baseUrl = window.LOCAL_CONFIG.baseurl; + // break; + // case 'fumao': + // baseUrl = window.LOCAL_CONFIG.fumao; + // break; + // default: + // baseUrl = window.LOCAL_CONFIG.default; + // } + baseUrl = `/${prefix || 'fumao'}`; + } return baseUrl; } diff --git a/vue.config.js b/vue.config.js index 1e97682..192bf96 100644 --- a/vue.config.js +++ b/vue.config.js @@ -20,7 +20,7 @@ module.exports = { } }, '/fumao': { - target: 'https://btest.malls.iformall.com/B', + target: 'https://bh5test.malls.iformall.com/B', changeOrigin: true, pathRewrite: { '^/fumao': ''