|
|
@ -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}`, |
|
|
|