From b45a01a8bee4a9bff5f9c248ead301b8675d1099 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 28 十月 2022 17:22:35 +0800
Subject: [PATCH] 2022.10.28
---
service/baserequest.js | 49 ++++++++++++++++++++++++++++++++-----------------
1 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/service/baserequest.js b/service/baserequest.js
index e05ce6b..3a5e333 100644
--- a/service/baserequest.js
+++ b/service/baserequest.js
@@ -7,16 +7,21 @@
* fail: function(error)
* }
*/
+const { duration } = require("../utils/moment.min.js");
const util = require("../utils/util.js")
const originProperties = ['url', 'data', 'header', 'method', 'success', 'fail', 'complete'];
-// const baseUrl = "http://127.0.0.1:8080"
-const baseUrl = "http://192.168.0.116:8080"
-// const baseUrl = "https://fyami.com.cn:447/"
-const basePicUrl = baseUrl + "images/"
-const baseFileUrl = baseUrl + "meeting/file/"
+// const baseUrl = "http://192.168.0.137:8080"
+// const baseUrl = "https://fyami.com.cn:447"
+const baseUrl = "https://fyami.com.cn"
-function request(fun) {
+const bu = "https://fyami.com.cn"
+// const bu = "https://fyami.com.cn:447"
+const basePicUrl = `${bu}/images/`
+const baseIconUrl = `${bu}/images/weixin/eplaw/`
+const baseFileUrl = `${bu}/meeting/file/`
+
+function request(fun) {
if (fun.params != undefined) {
var param = ""
Object.keys(fun.params).forEach(key => {
@@ -28,16 +33,20 @@
}
});
var url = fun.url
- fun.url = baseUrl + url + "?" + param
- }else{
+ fun.url = baseUrl + url + "?" + param
+ } else {
var url = fun.url
fun.url = baseUrl + url
}
var fun1 = util.deepCopy(fun)
fun1.success = function (res) {
- console.log("--------------璇锋眰缁撴灉----------------" + fun.url);
- console.log(res);
-
+ console.log("|------------------------------------------------------------------------------------------------------------");
+ console.log("|--璁块棶: ", fun.url);
+ console.log("|--缁撴灉: ", res);
+
+ if (fun.onHead) {
+ fun.onHead(res.header)
+ }
fun.success(res.data)
// if(res.data.success) {
// var head = res.data['head']
@@ -50,11 +59,16 @@
// }
}
fun1.fail = function (error) {
+ console.log("--------------璇锋眰閿欒----------------" + fun.url);
+ console.log(error);
wx.showToast({
- title: '缃戠粶杩炴帴澶辫触',
- icon: 'none'
+ title: '璇锋眰澶辫触',
+ icon: 'none',
+ duration: 2000
})
- fun.fail(error)
+ if (fun.fail) {
+ fun.fail(error)
+ }
}
fun1.complete = fun.complete
wx.request(fun1)
@@ -69,7 +83,8 @@
fun['method'] = 'POST'
request(fun)
},
- basePicUrl:basePicUrl,
- baseUrl:baseUrl,
- baseFileUrl:baseFileUrl
+ basePicUrl: basePicUrl,
+ baseUrl: baseUrl,
+ baseFileUrl: baseFileUrl,
+ baseIconUrl: baseIconUrl
}
\ No newline at end of file
--
Gitblit v1.9.3