Commit 12a16596 by 谢林威

feat: 不可删除自己账号

1 parent 2ba2c875
Pipeline #6051 passed
in 2 minutes 19 seconds
Showing with 9 additions and 4 deletions
......@@ -87,10 +87,10 @@
<st-form-item v-if="submitType === 'create'" :label="'重复密码:'" prop="confirmPwd">
<st-input v-model="form.confirmPwd" type="password"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'edit'" :label="'原密码:'" prop="passwordd">
<st-form-item v-if="submitType === 'edit'" :label="'原密码:'" prop="password">
<st-input v-model="form.password" type="password"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'edit'" :label="'新密码:'" prop="new_passwordd">
<st-form-item v-if="submitType === 'edit'" :label="'新密码:'" prop="new_password">
<st-input v-model="form.new_password" type="password"></st-input>
</st-form-item>
<st-form-item
......@@ -192,7 +192,7 @@ export default {
username: [{ required: true, message: '请输入账号', trigger: 'blur' }],
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
role: [{ required: true, message: '请选择角色', trigger: 'change' }],
email: [{ required: true, message: '请选择邮箱', trigger: 'change' }],
email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
confirmPwd: [
{ required: true, message: '请确认密码', trigger: 'blur' },
......@@ -230,6 +230,7 @@ export default {
submitForm.creater = browserStorage.getItem('username')
res = await createUser(submitForm)
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
this.getData()
}
this.showDialog = false
......@@ -239,6 +240,7 @@ export default {
submitForm = JSON.parse(JSON.stringify(this.form))
res = await editUser(submitForm)
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
this.getData()
}
this.showDialog = false
......@@ -266,7 +268,10 @@ export default {
async handleDelete(row) {
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此账号?' })
if (!confirmDelete) return
if (row.username === browserStorage.getItem('username')) {
Toast.warning('不可删除自己的账号')
return
}
const res = await deleteUser({ username: row.username })
if (res) {
Toast.success('操作成功')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!