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

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

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