拦截错误并提示
This commit is contained in:
parent
d436041233
commit
7baea26e4d
@ -6,6 +6,7 @@ import { MessageBox } from 'element-ui';
|
|||||||
import { getToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import { getBaseUrl } from '@/utils/baseUrl';
|
import { getBaseUrl } from '@/utils/baseUrl';
|
||||||
import { EventBus } from '@/scripts/event-bus';
|
import { EventBus } from '@/scripts/event-bus';
|
||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
const BASE_API = getBaseUrl();
|
const BASE_API = getBaseUrl();
|
||||||
|
|
||||||
@ -61,8 +62,15 @@ service.interceptors.response.use(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Vue.prototype.$alert('<strong>服务异常: <i style="color: red;">' + res.message + '</i></strong>', '请求结果', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
closeOnClickModal: false
|
||||||
|
}).then(() => {
|
||||||
|
return Promise.reject(res);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return Promise.reject(res);
|
|
||||||
} else {
|
} else {
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
@ -227,9 +227,11 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => {
|
importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => {
|
||||||
that.loadingDig.close();
|
that.loadingDig.close();
|
||||||
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
if (response && response.code == 200) {
|
||||||
that.$emit('refresh');
|
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
||||||
|
that.$emit('refresh');
|
||||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||||
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
that.loadingDig.close();
|
that.loadingDig.close();
|
||||||
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user