From 6cc6e0574ee083479a5c9acdcee936e125868958 Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Thu, 12 Jan 2023 17:07:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=B7=E6=B1=82=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/request.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/request.js b/common/request.js index 0ec5496..7713e15 100644 --- a/common/request.js +++ b/common/request.js @@ -1,9 +1,13 @@ import store from "@/store" function host(host='default'){ - return({ - default:"http://127.0.0.1:8080" - })[host] + return( + process.env.NODE_ENV === 'development' ?{ + default:"http://vtm3hk.natappfree.cc/jeecgboot" + }:{ + default:"http://vtm3hk.natappfree.cc/jeecgboot" + } + )[host] } @@ -18,7 +22,7 @@ const request=async function(url,param={}){ mask:true, }) //路径数据 - var pathData=Object.entries({...(url.match(/\?(.+)/)||{1:""})[1].split("&").map(v=>v.split('=')).filter(v=>v[0]&&v[1]).reduce((a,b)=>{a[b[0]]=b[1];return a},{}), ...(param.pathData||{})}).map(v=>`${v[0]}=${v[1]}`).join("&") + var pathData=Object.entries({...(url.match(/\?(.+)/)||{1:""})[1].split("&").map(v=>v.split('=')).filter(v=>v[0]&&v[1]).reduce((a,b)=>{a[b[0]]=b[1];return a},{}), ...(param.params||{})}).map(v=>`${v[0]}=${v[1]}`).join("&") var res=await uni.request({ url:(param.host||host())+('/'+url).replace(/\/{2}/,'/').replace(/\?.+/,"")+`?${pathData}`,