|
@@ -71,8 +71,8 @@ const pageMap = {
|
|
|
|
|
|
//导出时间天数
|
|
|
const exportTimeLimit = {
|
|
|
- defectTime: 90,
|
|
|
- normalTime: 7,
|
|
|
+ defectTime: 365,
|
|
|
+ normalTime: 90,
|
|
|
yiwuTime: 30,
|
|
|
};
|
|
|
|
|
@@ -136,9 +136,9 @@ window.abortAjax = '';
|
|
|
|
|
|
const post = function (url, data, opts) {
|
|
|
const token = localStorage.getItem('accessToken');
|
|
|
- if(localStorage.getItem('toLogin')==='1'&&token){
|
|
|
+ if (localStorage.getItem('toLogin') === '1' && token) {
|
|
|
//如果前面已经被标记为登录失效,接下来的请求都不发送
|
|
|
- return new Promise(()=>{});
|
|
|
+ return new Promise(() => { });
|
|
|
}
|
|
|
let isPlacefile = getCookie('isPlacefile') || 1;
|
|
|
if (!token && window.location.href.indexOf('login') == -1) {
|
|
@@ -173,60 +173,60 @@ const post = function (url, data, opts) {
|
|
|
})),
|
|
|
contentType: 'application/json; charset=UTF-8',
|
|
|
beforeSend: function (xmlHttp) {
|
|
|
- if(url.indexOf("sys/user/getHospitalMark")===-1){
|
|
|
- xmlHttp.setRequestHeader('If-Modified-Since', '0');
|
|
|
- xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
|
|
|
- xmlHttp.setRequestHeader('Authorization', token ? 'Bearer ' + token : '');
|
|
|
+ if (url.indexOf("sys/user/getHospitalMark") === -1) {
|
|
|
+ xmlHttp.setRequestHeader('If-Modified-Since', '0');
|
|
|
+ xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
|
|
|
+ xmlHttp.setRequestHeader('Authorization', token ? 'Bearer ' + token : '');
|
|
|
}
|
|
|
},
|
|
|
success: function (resq) {
|
|
|
- const doc = parent?parent.document:document;
|
|
|
+ const doc = parent ? parent.document : document;
|
|
|
//console.log($(doc).find(".alertModal:visible"))
|
|
|
- //失效后不点知道了直接刷新处理:跳回登录页
|
|
|
- if(localStorage.getItem('toLogin')==='1'&&$(doc).find(".alertModal:visible").length===0){
|
|
|
- (parent||window).location.href='login.html';
|
|
|
- }
|
|
|
- let res=resq;
|
|
|
- if(typeof resq ==='string'){
|
|
|
+ //失效后不点知道了直接刷新处理:跳回登录页
|
|
|
+ if (localStorage.getItem('toLogin') === '1' && $(doc).find(".alertModal:visible").length === 0) {
|
|
|
+ (parent || window).location.href = 'login.html';
|
|
|
+ }
|
|
|
+ let res = resq;
|
|
|
+ if (typeof resq === 'string') {
|
|
|
res = JSON.parse(resq);
|
|
|
}
|
|
|
const code = res.code;
|
|
|
- const isOut = code === '10020011' || code === '10020012' || code === '10020013';
|
|
|
- if(isOut){
|
|
|
+ const isOut = code === '10020011' || code === '10020012' || code === '10020013';
|
|
|
+ if (isOut) {
|
|
|
//登录信息失效处理
|
|
|
- unloginPop(res.msg);
|
|
|
- }else{
|
|
|
- resolve({
|
|
|
- data: res
|
|
|
- });
|
|
|
+ unloginPop(res.msg);
|
|
|
+ } else {
|
|
|
+ resolve({
|
|
|
+ data: res
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
error: function (error) {
|
|
|
- if (error.status === 403 || error.status === 401) {
|
|
|
- setCookie('behosDateStart', '');
|
|
|
- setCookie('behosDateEnd', '');
|
|
|
- if (!token && window.location.href.indexOf('login') == -1) {
|
|
|
- } else {
|
|
|
- if($(".alertModal:visible").length){
|
|
|
- return;
|
|
|
- }
|
|
|
- $.alerModal({
|
|
|
- "message": "没有该权限"+error.status,
|
|
|
- type: "tip",
|
|
|
- time: '1000',
|
|
|
- isFather: true,
|
|
|
- fatherWrapper: $("#mainBox", parent.document)
|
|
|
- });
|
|
|
+ if (error.status === 403 || error.status === 401) {
|
|
|
+ setCookie('behosDateStart', '');
|
|
|
+ setCookie('behosDateEnd', '');
|
|
|
+ if (!token && window.location.href.indexOf('login') == -1) {
|
|
|
+ } else {
|
|
|
+ if ($(".alertModal:visible").length) {
|
|
|
+ return;
|
|
|
}
|
|
|
- } else if (error.status === 500 || error.status === 501 || error.status === 404) {
|
|
|
$.alerModal({
|
|
|
- "message": '接口错误',
|
|
|
+ "message": "没有该权限" + error.status,
|
|
|
type: "tip",
|
|
|
time: '1000',
|
|
|
isFather: true,
|
|
|
fatherWrapper: $("#mainBox", parent.document)
|
|
|
});
|
|
|
}
|
|
|
+ } else if (error.status === 500 || error.status === 501 || error.status === 404) {
|
|
|
+ $.alerModal({
|
|
|
+ "message": '接口错误',
|
|
|
+ type: "tip",
|
|
|
+ time: '1000',
|
|
|
+ isFather: true,
|
|
|
+ fatherWrapper: $("#mainBox", parent.document)
|
|
|
+ });
|
|
|
+ }
|
|
|
reject(error);
|
|
|
},
|
|
|
});
|
|
@@ -234,39 +234,39 @@ const post = function (url, data, opts) {
|
|
|
};
|
|
|
|
|
|
//登录失效弹窗处理
|
|
|
-function unloginPop(msg){
|
|
|
+function unloginPop(msg) {
|
|
|
/*const isOut = code === '10020011' || code === '10020012' || code === '10020013';
|
|
|
if(isOut){*/
|
|
|
- const isQcScore = parent&&parent.location.href.indexOf("qcScore.html")===-1;
|
|
|
- if(self != top&&isQcScore){//子窗口并且不是病例列表
|
|
|
- const dialogmessage = {
|
|
|
- iframemessage: 1,
|
|
|
- data: msg
|
|
|
- }
|
|
|
- console.log('子窗口')
|
|
|
- window.parent.postMessage(JSON.stringify(dialogmessage), '*')
|
|
|
- }else{
|
|
|
- console.log('父窗口')
|
|
|
- $.alerModal({
|
|
|
- gobackBtn: true,
|
|
|
- title: "提示",
|
|
|
- type: "modal",
|
|
|
- width: '470',
|
|
|
- time: 1000,
|
|
|
- cancalText: '我知道了',
|
|
|
- isFather: true,
|
|
|
- fatherWrapper: $("#mainBox", parent.document),
|
|
|
- sureBtn: false,
|
|
|
- message: msg || '登录过期',
|
|
|
- callback: function () {
|
|
|
- (parent||window).location.href = 'login.html'
|
|
|
- }
|
|
|
- });
|
|
|
- //失效后不点知道了直接刷新处理标记
|
|
|
- localStorage.setItem('toLogin',1);
|
|
|
+ const isQcScore = parent && parent.location.href.indexOf("qcScore.html") === -1;
|
|
|
+ if (self != top && isQcScore) {//子窗口并且不是病例列表
|
|
|
+ const dialogmessage = {
|
|
|
+ iframemessage: 1,
|
|
|
+ data: msg
|
|
|
}
|
|
|
+ console.log('子窗口')
|
|
|
+ window.parent.postMessage(JSON.stringify(dialogmessage), '*')
|
|
|
+ } else {
|
|
|
+ console.log('父窗口')
|
|
|
+ $.alerModal({
|
|
|
+ gobackBtn: true,
|
|
|
+ title: "提示",
|
|
|
+ type: "modal",
|
|
|
+ width: '470',
|
|
|
+ time: 1000,
|
|
|
+ cancalText: '我知道了',
|
|
|
+ isFather: true,
|
|
|
+ fatherWrapper: $("#mainBox", parent.document),
|
|
|
+ sureBtn: false,
|
|
|
+ message: msg || '登录过期',
|
|
|
+ callback: function () {
|
|
|
+ (parent || window).location.href = 'login.html'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //失效后不点知道了直接刷新处理标记
|
|
|
+ localStorage.setItem('toLogin', 1);
|
|
|
+ }
|
|
|
/*}else{
|
|
|
- callback()
|
|
|
+ callback()
|
|
|
}*/
|
|
|
|
|
|
}
|