拦截错误并提示
This commit is contained in:
parent
d436041233
commit
7baea26e4d
@ -6,6 +6,7 @@ import { MessageBox } from 'element-ui';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { getBaseUrl } from '@/utils/baseUrl';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import Vue from 'vue';
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return response.data;
|
||||
}
|
||||
|
@ -227,9 +227,11 @@ export default {
|
||||
} else {
|
||||
importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => {
|
||||
that.loadingDig.close();
|
||||
if (response && response.code == 200) {
|
||||
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
||||
that.$emit('refresh');
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
}
|
||||
}).catch(error => {
|
||||
that.loadingDig.close();
|
||||
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
||||
|
Loading…
Reference in New Issue
Block a user