mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-17 14:56:51 +08:00
refactor(system): 重构request.js
-移除了多余的错误代码判断和冗余的错误提示 - 优化了请求成功和失败的处理流程 - 统一了错误信息的展示方式 - 调整了部分代码结构以提高可读性和维护性
This commit is contained in:
@@ -183,11 +183,7 @@ export default {
|
||||
|
||||
getRoleList({})
|
||||
.then(response => {
|
||||
if (response.code === '0') {
|
||||
this.roleListData = response.content.content || []
|
||||
} else {
|
||||
this.$message.error(response.msg || '获取角色列表失败')
|
||||
}
|
||||
this.roleListData = response.content.content || []
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error('获取角色列表出错', error)
|
||||
@@ -218,22 +214,12 @@ export default {
|
||||
: addUser(submitData)
|
||||
|
||||
apiRequest
|
||||
.then(response => {
|
||||
if (response.code === '0') {
|
||||
this.$message.success(this.isEdit ? '修改成功' : '添加成功')
|
||||
this.$emit('submit', submitData)
|
||||
this.handleClose()
|
||||
} else {
|
||||
this.$message.error(
|
||||
response.msg || (this.isEdit ? '修改失败' : '添加失败')
|
||||
)
|
||||
}
|
||||
.then(() => {
|
||||
this.$message.success(this.isEdit ? '修改成功' : '添加成功')
|
||||
this.$emit('submit', submitData)
|
||||
this.handleClose()
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(
|
||||
this.isEdit ? '修改用户出错:' : '添加用户出错:',
|
||||
error
|
||||
)
|
||||
.catch(() => {
|
||||
this.$message.error(this.isEdit ? '修改用户出错' : '添加用户出错')
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user