diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 44d8ef4..20cb6a2 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -152,7 +152,7 @@ export default { isDetail: false, isUpdated: false, dataForm: {}, - dataFormRules: {}, + dataFormRules: {} } }, computed: { @@ -307,25 +307,29 @@ export default { url: this.$http.adornUrl(urls[btn.name]), method: btn.name === 'save' ? 'POST' : 'PUT', data: this.dataForm - }).then(({ data: res }) => { - if (res && res.code === 0) { - this.$message({ - message: btn.name === 'save' ? '添加成功!' : '更新成功!', - type: 'success', - duration: 1500, - onClose: () => { - this.$emit('refreshDataList') - this.visible = false - } - }) - } - }).catch(err => { - this.$message({ - message: err, - type: 'error', - duration: 2000 - }) }) + .then(({ data: res }) => { + if (res && res.code === 0) { + this.$message({ + message: btn.name === 'save' ? '添加成功!' : '更新成功!', + type: 'success', + duration: 1500, + onClose: () => { + this.$emit('refreshDataList') + this.visible = false + } + }) + } else { + this.$message.error(res.msg) + } + }) + .catch(err => { + this.$message({ + message: err, + type: 'error', + duration: 2000 + }) + }) } }) return diff --git a/src/utils/request.js b/src/utils/request.js index 0bc40da..f885819 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -55,9 +55,10 @@ http.interceptors.response.use(response => { clearLoginInfo() router.replace({ name: 'login' }) return Promise.reject(response.data.msg) - } else if (response.data.code === 500) { - return Promise.reject(response.data.msg) } + // else if (response.data.code === 500) { + // return Promise.reject(response.data.msg) + // } return response }, error => { console.error(error)