v0.8.6测试
This commit is contained in:
@@ -135,6 +135,7 @@ async function loadAdmins() {
|
||||
<td>${escapeHtml(admin.role_type)}</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-primary" onclick="showEditAdminModal(${admin.user_id}, '${escapeHtml(admin.username)}', '${escapeHtml(admin.real_name)}', '${escapeHtml(admin.role_type)}')">编辑</button>
|
||||
<button class="btn btn-sm btn-warning" onclick="resetAdminPassword(${admin.user_id}, '${escapeHtml(admin.real_name)}')">重置密码</button>
|
||||
<button class="btn btn-sm btn-danger" onclick="deleteAdmin(${admin.user_id}, '${escapeHtml(admin.real_name)}')">删除</button>
|
||||
</td>
|
||||
</tr>`;
|
||||
@@ -227,6 +228,19 @@ async function deleteAdmin(userId, realName) {
|
||||
}
|
||||
}
|
||||
|
||||
async function resetAdminPassword(userId, realName) {
|
||||
if (!confirm(`确定要重置管理员 "${realName}" 的密码吗?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await apiPost(`/api/admin/reset-password/${userId}`, {});
|
||||
if (res && res.success) {
|
||||
alert(`密码重置成功!\n管理员:${realName}\n新密码:${res.data.password}\n请妥善保管并及时通知该管理员。`);
|
||||
} else {
|
||||
showToast(res?.message || '密码重置失败', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
function closeModal(modalId) {
|
||||
const modal = document.getElementById(modalId);
|
||||
if (modal) modal.style.display = 'none';
|
||||
|
||||
Reference in New Issue
Block a user