|
|
@ -26,8 +26,8 @@ |
|
|
|
:message="updatePinMessage" description="您正在更改PIN码,请谨慎操作" confirm-text="确认更新" cancel-text="取消更新" |
|
|
|
@confirm="handleConfirmUpdatePin" @cancel="handleCancelUpdatePin" /> |
|
|
|
|
|
|
|
<EnterPinModal v-if="enterPinModal" :visible="enterPinModal" :loading="updatePinLoading" @confirm="updatePinConfirm" |
|
|
|
@cancel="closeEnterPinModal" /> |
|
|
|
<EnterPinModal v-if="enterPinModal" :visible="enterPinModal" :loading="updatePinLoading" mode="edit" :userId="selectedUsers[0]?.id" |
|
|
|
@confirm="updatePinConfirm" @cancel="closeEnterPinModal" /> |
|
|
|
|
|
|
|
<DelMessage v-if="updatePinMsgModal" :visible="updatePinMsgModal" icon="/src/assets/OK.svg" message="PIN码更新成功" |
|
|
|
:username="selectedUsers[0].account" @confirm="handleConfirmMsg" /> |
|
|
@ -39,7 +39,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-else-if="currentStep === 'pin'"> |
|
|
|
<EnterPinModal :visible="isPinModalVisible" :loading="registerLoading" @confirm="handlePinConfirm" |
|
|
|
<EnterPinModal :visible="isPinModalVisible" :loading="registerLoading" mode="add" @confirm="handlePinConfirm" |
|
|
|
@cancel="closeModal" /> |
|
|
|
</template> |
|
|
|
|
|
|
@ -190,39 +190,47 @@ const handleConfirmMsgDelete = () => { |
|
|
|
//更新PIN |
|
|
|
//定义请求 |
|
|
|
const handleUpdatePin = async () => { |
|
|
|
if (selectedUsers.value.length!== 1) { |
|
|
|
if (selectedUsers.value.length !== 1) { |
|
|
|
ElMessage.warning('请选择一个用户来修改PIN码') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const user = tempUser.value |
|
|
|
const user = selectedUsers.value[0] |
|
|
|
const response = await changeUserPassword({ |
|
|
|
id: user.id, |
|
|
|
password: user.password, |
|
|
|
oldpasswd: tempUser.value.password, // 旧密码 |
|
|
|
password: tempUser.value.password // 新密码 |
|
|
|
}) |
|
|
|
|
|
|
|
if (response && response.success) { |
|
|
|
ElMessage.success('PIN码更新成功') |
|
|
|
fetchUserList() |
|
|
|
} else { |
|
|
|
ElMessage.error('修改用户权限失败') |
|
|
|
ElMessage.error('修改密码失败') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//确认更新pin,打开输入框 |
|
|
|
const handleConfirmUpdatePin = () => { |
|
|
|
if (selectedUsers.value.length !== 1) { |
|
|
|
ElMessage.warning('请选择一个用户来修改PIN码') |
|
|
|
return |
|
|
|
} |
|
|
|
updatePinModal.value = false |
|
|
|
enterPinModal.value = true |
|
|
|
} |
|
|
|
|
|
|
|
//输入pin,确认,发送请求 |
|
|
|
const updatePinConfirm = (val: string) => { |
|
|
|
const updatePinConfirm = (parameters: ChangePasswordParams) => { |
|
|
|
enterPinModal.value = false |
|
|
|
updatePinLoading.value = true |
|
|
|
tempUser.value.password = val |
|
|
|
handleUpdatePin().then(() => { |
|
|
|
|
|
|
|
changeUserPassword(parameters).then(() => { |
|
|
|
updatePinLoading.value = false |
|
|
|
updatePinMsgModal.value = true |
|
|
|
}).catch(() => { |
|
|
|
ElMessage.error('修改密码失败') |
|
|
|
updatePinLoading.value = false |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|