fix: 请求成功的判断条件code改为status(部分)
This commit is contained in:
@@ -115,7 +115,8 @@
|
||||
|
||||
<script>
|
||||
import rightBoxMixin from '@/mixins/right-box'
|
||||
import { get, post, put } from '@/utils/http'
|
||||
import axios from 'axios'
|
||||
import _ from 'lodash'
|
||||
import { themeData, langData, storageKey } from '@/utils/constants'
|
||||
import { api } from '@/utils/api'
|
||||
|
||||
@@ -194,7 +195,6 @@ export default {
|
||||
],
|
||||
pinChange: [
|
||||
{ validator: validatePin, trigger: 'blur' },
|
||||
{ required: true, message: this.$t('validate.required') },
|
||||
{ pattern: /^[a-zA-Z0-9]{5,64}$/, message: this.$t('validate.atLeastFive') }
|
||||
],
|
||||
roleIds: [
|
||||
@@ -235,23 +235,23 @@ export default {
|
||||
this.$refs.userForm.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.editObject.id) {
|
||||
put(this.url, this.editObject).then(res => {
|
||||
axios.put(this.url, this.editObject).then(res => {
|
||||
this.blockOperation.save = false
|
||||
if (res.code === 200) {
|
||||
if (res.status === 200) {
|
||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||
this.esc(true)
|
||||
} else {
|
||||
this.$message.error(res.msg || res.message)
|
||||
this.$message.error(res.data.msg || res.data.message)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
post(this.url, this.editObject).then(res => {
|
||||
axios.post(this.url, this.editObject).then(res => {
|
||||
this.blockOperation.save = false
|
||||
if (res.code === 200) {
|
||||
if (res.status === 200) {
|
||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||
this.esc(true)
|
||||
} else {
|
||||
this.$message.error(res.msg || res.message)
|
||||
this.$message.error(res.data.msg || res.data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -262,9 +262,9 @@ export default {
|
||||
})
|
||||
},
|
||||
getRoleData () {
|
||||
get(api.role, { pageSize: -1 }).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.roleData = response.data.list
|
||||
axios.get(api.role, { pageSize: -1 }).then(response => {
|
||||
if (response.status === 200) {
|
||||
this.roleData = _.get(response, 'data.data.list', [])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user