update dialog

This commit is contained in:
g7hoo 2022-08-11 14:28:06 +08:00
parent a1056abe80
commit cd9beb120a
2 changed files with 26 additions and 21 deletions

View File

@ -152,7 +152,7 @@ export default {
isDetail: false, isDetail: false,
isUpdated: false, isUpdated: false,
dataForm: {}, dataForm: {},
dataFormRules: {}, dataFormRules: {}
} }
}, },
computed: { computed: {
@ -307,7 +307,8 @@ export default {
url: this.$http.adornUrl(urls[btn.name]), url: this.$http.adornUrl(urls[btn.name]),
method: btn.name === 'save' ? 'POST' : 'PUT', method: btn.name === 'save' ? 'POST' : 'PUT',
data: this.dataForm data: this.dataForm
}).then(({ data: res }) => { })
.then(({ data: res }) => {
if (res && res.code === 0) { if (res && res.code === 0) {
this.$message({ this.$message({
message: btn.name === 'save' ? '添加成功!' : '更新成功!', message: btn.name === 'save' ? '添加成功!' : '更新成功!',
@ -318,8 +319,11 @@ export default {
this.visible = false this.visible = false
} }
}) })
} else {
this.$message.error(res.msg)
} }
}).catch(err => { })
.catch(err => {
this.$message({ this.$message({
message: err, message: err,
type: 'error', type: 'error',

View File

@ -55,9 +55,10 @@ http.interceptors.response.use(response => {
clearLoginInfo() clearLoginInfo()
router.replace({ name: 'login' }) router.replace({ name: 'login' })
return Promise.reject(response.data.msg) 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 return response
}, error => { }, error => {
console.error(error) console.error(error)