From 2c11814ecf148a5fe5a80d03e29481476e47f34d Mon Sep 17 00:00:00 2001
From: 付延余 <f-yanyu@outlook.com>
Date: 星期一, 19 十二月 2022 16:13:34 +0800
Subject: [PATCH] test push two
---
utils/request.js | 39 ++++++++++++++++++++-------------------
1 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/utils/request.js b/utils/request.js
index 43fa9c7..3f3cdea 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -23,16 +23,11 @@
duration: 2000
});
setTimeout(() => {
- try {
- uni.clearStorageSync();
- // 閲嶅畾鍚戠櫥褰�
- uni.redirectTo({
- url: '/pages/login/login'
- })
- } catch (e) {
- // error
- console.log(e)
- }
+ uni.clearStorageSync();
+ // 閲嶅畾鍚戠櫥褰�
+ uni.redirectTo({
+ url: '/pages/login/login'
+ })
}, 2000);
return false;
}
@@ -73,7 +68,7 @@
title: response.data.msg,
icon: 'error',
position: 'top',
- duration: 1000
+ duration: 2000
})
return false;
}
@@ -87,24 +82,30 @@
500: responseError
}
+// let BaseUrl = 'http://192.168.3.159:9999';
+// const BaseUrl = 'https://mx.jzeg.cn:443/app';
+// let BaseUrl = 'http://192.168.0.114:9999';
+
+const BaseUrl = "https://mx.jzeg.cn:9998"; // 姝e紡鏈嶅姟
// 璇锋眰鎷︽埅
-const fetch = (url, opt) => {
+const fetch = (url, opt, urlParam) => {
+
let urls = (api[opt.url]?.url || api[url]?.url || jihua[opt.url]?.url || jihua[url]?.url);
let params = opt.params ? ('?' + Object.keys(opt.params).map(key => key + '=' + opt.params[key]).join('&')) :
- '';
- opt.url = urls + params
+ '';
+ opt.url = urlParam ? BaseUrl + urls + `/${urlParam}` + params : BaseUrl + urls + params
opt.method = opt.method || "GET";
var header = {}
if (uni.getStorageSync('access_token')) {
header = {
"TENANT-ID": 5,
Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
- VERSION: "zzl"
+ VERSION: "zzl",
+ // Accept: 'application/json, text/plain, */*' // 瀹㈡埛绔墍鑳芥帴鍙楃殑鏁版嵁绫诲瀷
}
}
- // 'Bearer'
- // 'version:zzl'
+
opt.header = {
...opt.header,
...header
@@ -136,7 +137,6 @@
statusCode,
data
} = resp;
-
// 楠岃瘉http鐘舵�佺爜
const handlerHTTPStatus = handlerCode[statusCode];
@@ -154,5 +154,6 @@
export {
- fetch
+ fetch,
+ BaseUrl
}
--
Gitblit v1.9.1