Commit 459f57f3 by fengzhaoyu

feat:去掉注释 接口报错向服务端发送日志

parent 16bc937f
......@@ -51,14 +51,6 @@ export default async function login() {
})
})
}
// let time =setInterval(function() {
// if (lock == false) {
// clearInterval(time)
// return;
// }
// }, 100)
async function waitLockRelease(retry) {
for (let i = 0; i < retry; i++) {
if (lock == false) {
......
......@@ -24,7 +24,7 @@ export default function xFetch({ url, method, data, type }) {
if (res.data.code == 401) {
login();
}
alertOnce(res.data.msg || '请求异常,请重试', rejects);
alertOnce(res.data.msg || '请求异常,请重试', rejects, res);
}
},
fail: function (err) {
......@@ -35,7 +35,7 @@ export default function xFetch({ url, method, data, type }) {
} else {
console.log(err)
alertOnce((err && err.errorMsg) || '网络异常,请重试', rejects);
alertOnce((err && err.errorMsg) || '网络异常,请重试', rejects, err);
}
}
});
......@@ -43,8 +43,9 @@ export default function xFetch({ url, method, data, type }) {
}
let alert = false;
function alertOnce(content, rejects) {
function alertOnce(content, rejects, err) {
if (alert == false) {
sendError(JSON.stringify(err))
dd.alert({
content: content,
buttonText: "确定",
......@@ -55,4 +56,22 @@ function alertOnce(content, rejects) {
});
}
alert = true;
}
function sendError(err) {
let url = `${getApp().globalData.globalUrl}/meet/job/addLog`
dd.httpRequest({
headers: {
"Content-Type": "application/json;charset=UTF-8",
Authorization: `Bearer ${getApp().globalData.token}`
},
data: err,
url: url,
method: 'post',
dataType: "json",
timeout: 15000,
success: function (res) {
},
fail: function (err) {
}
});
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment