|
|
|
@ -50,13 +50,19 @@ export async function ReportError(stack: any, msg: string = "未捕获的错误!
|
|
|
|
|
let userName = localStorage.getItem(StoreageKeys.UserName);
|
|
|
|
|
let userPhone = localStorage.getItem(StoreageKeys.UserPhone);
|
|
|
|
|
|
|
|
|
|
await PostData("https://cf.qcad.cc:25100/monitoring", {
|
|
|
|
|
stack,
|
|
|
|
|
href: window.location.href,
|
|
|
|
|
path: window.location.pathname,
|
|
|
|
|
user: userName,
|
|
|
|
|
msg: msg + "\n" + browserMsg,
|
|
|
|
|
phone: userPhone
|
|
|
|
|
await fetch("http://cf.qcad.cc:25111/logs/error", {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: JSON.stringify({
|
|
|
|
|
stack,
|
|
|
|
|
href: window.location.href,
|
|
|
|
|
path: window.location.pathname,
|
|
|
|
|
user: userName,
|
|
|
|
|
msg: msg + "\n" + browserMsg,
|
|
|
|
|
phone: userPhone
|
|
|
|
|
}),
|
|
|
|
|
headers: {
|
|
|
|
|
'content-type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
console.log("上报成功");
|
|
|
|
|
}
|
|
|
|
@ -65,19 +71,3 @@ export async function ReportError(stack: any, msg: string = "未捕获的错误!
|
|
|
|
|
console.log("上报失败", error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function PostData(url: RequestInfo, data: {})
|
|
|
|
|
{
|
|
|
|
|
return fetch(url, {
|
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
|
cache: 'no-cache',
|
|
|
|
|
credentials: 'include',
|
|
|
|
|
headers: {
|
|
|
|
|
'content-type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
method: 'POST',
|
|
|
|
|
mode: 'cors',
|
|
|
|
|
redirect: 'follow',
|
|
|
|
|
referrer: 'no-referrer',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|