Commit 4ca3da28 authored by Junling Bu's avatar Junling Bu
Browse files

feat[litemall-admin]: 管理后台前端进一步显示后端错误信息

parent ba380680
......@@ -370,11 +370,9 @@
attributes: this.attributes
}
publishGoods(finalGoods).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建成功'
})
this.$router.push({ path: '/goods/list' })
}).catch(response => {
......
......@@ -364,11 +364,9 @@ export default {
attributes: this.attributes
}
editGoods(finalGoods).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建成功'
})
this.$router.push({ path: '/goods/list' })
}).catch(response => {
......
......@@ -196,14 +196,17 @@ export default {
},
handleDelete(row) {
deleteGoods(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -204,11 +204,14 @@ export default {
createBrand(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -234,11 +237,14 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -246,14 +252,17 @@ export default {
},
handleDelete(row) {
deleteBrand(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -264,11 +264,14 @@ export default {
createCategory(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -294,11 +297,14 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -306,14 +312,17 @@ export default {
},
handleDelete(row) {
deleteCategory(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -140,11 +140,14 @@ export default {
createIssue(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -170,11 +173,14 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -182,14 +188,17 @@ export default {
},
handleDelete(row) {
deleteIssue(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -175,11 +175,14 @@ export default {
createKeyword(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -205,11 +208,14 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -217,14 +223,17 @@ export default {
},
handleDelete(row) {
deleteKeyword(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -262,13 +262,16 @@ export default {
if (valid) {
shipOrder(this.shipForm).then(response => {
this.shipDialogVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '确认发货成功',
type: 'success',
duration: 2000
message: '确认发货成功'
})
this.getList()
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
})
......@@ -287,13 +290,16 @@ export default {
if (valid) {
refundOrder(this.refundForm).then(response => {
this.refundDialogVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '确认退款成功',
type: 'success',
duration: 2000
message: '确认退款成功'
})
this.getList()
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
})
......
......@@ -68,8 +68,7 @@ export default {
const typeMap = {
'1': '',
'2': '',
'3': '',
'4': '街道'
'3': ''
}
return typeMap[status]
}
......
......@@ -234,11 +234,14 @@ export default {
createAd(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -264,11 +267,14 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新广告成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -276,14 +282,17 @@ export default {
},
handleDelete(row) {
deleteAd(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -178,11 +178,14 @@
publishGroupon(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建团购规则成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -208,11 +211,14 @@
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新团购规则成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -220,14 +226,17 @@
},
handleDelete(row) {
deleteGroupon(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除团购规则成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -253,11 +253,14 @@ export default {
createTopic(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '创建专题成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -287,11 +290,14 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新专题成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -299,14 +305,17 @@ export default {
},
handleDelete(row) {
deleteTopic(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除专题成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -221,11 +221,14 @@ export default {
createAdmin(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '添加管理员成功'
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
})
}
......@@ -251,11 +254,14 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新管理员成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -263,14 +269,17 @@ export default {
},
handleDelete(row) {
deleteAdmin(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除管理员成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -147,11 +147,9 @@ export default {
createStorage(formData).then(response => {
this.list.unshift(response.data.data)
this.createDialogVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '上传成功'
})
}).catch(() => {
this.$message.error('上传失败,请重新上传')
......@@ -176,11 +174,14 @@ export default {
}
}
this.updateDialogVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -188,14 +189,17 @@ export default {
},
handleDelete(row) {
deleteStorage(row).then(response => {
this.$notify({
this.$notify.success({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
},
handleDownload() {
......
......@@ -70,10 +70,7 @@
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input type="password" v-model="dataForm.password" auto-complete="off"></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="checkPassword">
<el-input type="password" v-model="dataForm.checkPassword" auto-complete="off"></el-input>
</el-form-item>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="dataForm.gender">
<el-option label="未知" :value="0">
......@@ -125,25 +122,6 @@ import { fetchList, createUser, updateUser } from '@/api/user'
export default {
name: 'User',
data() {
var validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'))
} else {
if (this.dataForm.checkPassword !== '') {
this.$refs.dataForm.validateField('checkPassword')
}
callback()
}
}
var validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'))
} else if (value !== this.dataForm.password) {
callback(new Error('两次输入密码不一致!'))
} else {
callback()
}
}
return {
list: null,
total: null,
......@@ -161,7 +139,6 @@ export default {
username: '',
mobile: '',
password: undefined,
checkPassword: undefined,
gender: 0,
userLevel: 0,
birthday: undefined,
......@@ -176,14 +153,7 @@ export default {
rules: {
username: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
mobile: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }],
password: [
{ required: true, message: '密码不能为空', trigger: 'blur' },
{ validator: validatePass, trigger: 'blur' }
],
checkPassword: [
{ required: true, message: '密码不能为空', trigger: 'blur' },
{ validator: validatePass2, trigger: 'blur' }
]
password: [{ required: true, message: '密码不能为空', trigger: 'blur' }]
},
downloadLoading: false,
genderDic: ['未知', '', ''],
......@@ -246,11 +216,14 @@ export default {
createUser(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
message: '添加用户成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
......@@ -276,22 +249,23 @@ export default {
}
}
this.dialogFormVisible = false
this.$notify({
this.$notify.success({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
message: '更新成功'
})
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
})
},
handleDelete(row) {
this.$notify({
this.$notify.error({
title: '警告',
message: '用户删除操作不支持!',
type: 'warning',
duration: 3000
message: '用户删除操作不支持!'
})
},
handleDownload() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment