|
@@ -7,10 +7,10 @@ import Axios from 'axios';
|
|
|
import { Util, Error } from 'naf-core';
|
|
|
import { Loading } from 'element-ui';
|
|
|
import UserUtil from './user-util';
|
|
|
-
|
|
|
+import { MessageBox } from 'element-ui';
|
|
|
const { trimData, isNullOrUndefined } = Util;
|
|
|
const { ErrorCode } = Error;
|
|
|
-
|
|
|
+let timer = 0;
|
|
|
let currentRequests = 0;
|
|
|
|
|
|
export default class AxiosWrapper {
|
|
@@ -76,6 +76,21 @@ export default class AxiosWrapper {
|
|
|
});
|
|
|
const user = localStorage.getItem('user');
|
|
|
if (user) {
|
|
|
+ let uobj = JSON.parse(user);
|
|
|
+ if (uobj.type === '2') {
|
|
|
+ if (!uobj.code) {
|
|
|
+ if (timer <= 0) {
|
|
|
+ // 没有学校编码,不能使用,需要联系中心管理员添加编码后重新登录
|
|
|
+ MessageBox.confirm('没有学校编码,需要联系中心管理员添加编码后重新登录', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ timer++;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
axios.defaults.headers.common.Authorization = encodeURI(user);
|
|
|
}
|
|
|
axios.defaults.headers.common.dtype = 'pc';
|