|
@@ -1,8 +1,10 @@
|
|
|
-let v = wx.getAccountInfoSync()
|
|
|
|
|
-let {
|
|
|
|
|
- envVersion
|
|
|
|
|
-} = v.miniProgram
|
|
|
|
|
-let apiUrl = `${envVersion == 'release'?'https://interface.huihenduo.cc/hhd-ship/':'https://interface.huihenduo.com.cn/hhd-ship-dev/'}`
|
|
|
|
|
|
|
+let v = wx.getAccountInfoSync();
|
|
|
|
|
+let { envVersion } = v.miniProgram;
|
|
|
|
|
+let apiUrl = `${
|
|
|
|
|
+ envVersion == "release"
|
|
|
|
|
+ ? "https://interface.huihenduo.cc/hhd-ship/"
|
|
|
|
|
+ : "https://interface.huihenduo.com.cn/hhd-ship-dev/"
|
|
|
|
|
+}`;
|
|
|
|
|
|
|
|
function api(url, data, method) {
|
|
function api(url, data, method) {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
@@ -10,17 +12,17 @@ function api(url, data, method) {
|
|
|
url: `${apiUrl}/${url}`,
|
|
url: `${apiUrl}/${url}`,
|
|
|
method,
|
|
method,
|
|
|
data,
|
|
data,
|
|
|
- dataType: 'json',
|
|
|
|
|
|
|
+ dataType: "json",
|
|
|
header: {
|
|
header: {
|
|
|
- 'content-type': 'application/json'
|
|
|
|
|
|
|
+ "content-type": "application/json",
|
|
|
},
|
|
},
|
|
|
success: resolve,
|
|
success: resolve,
|
|
|
- fail: reject
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ fail: reject,
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
module.exports = {
|
|
|
apiUrl,
|
|
apiUrl,
|
|
|
- api
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ api,
|
|
|
|
|
+};
|