增加dialogTag,供临时禁用接口监听,避免异常测试时误告警

This commit is contained in:
zhiyong.yue 2023-11-02 14:12:06 +08:00
parent 6aecdb17d6
commit f85b24dd0a
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@
"use strict";
const win = window.unsafeWindow || document.defaultView || window;
win.maskTag = 1;
win.dialogTag = 1;
let mask = document.createElement("div");
mask.style =
"position: fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1000;height: 100%;background-color: rgba(0,0,0,.0)";
@ -42,9 +43,9 @@
document.body.appendChild(mask);
}
request.response = (res) => {
if (res.status === 403){
if (win.dialogTag && res.status === 403){
win.alert("API:" + res.finalUrl + "-----failInfo:Response status is 403");
}else if(res.json && res.json.hasOwnProperty("failed"))
}else if(win.dialogTag && res.json && res.json.hasOwnProperty("failed"))
{
win.alert("API:" + res.finalUrl + "-----failInfo:" + res.json.message);
}