修复:设置弹窗所有提示改用全局 chatDialog,替换原生 alert()

- savePassword():修改密码成功/失败/校验提示全部改为 window.chatDialog.alert()
- saveSettings():保存资料成功/失败提示改为 window.chatDialog.alert()
- sendEmailCode():发送验证码相关提示改为 window.chatDialog.alert()
- 工具栏「银行」按钮的 alert 也一并改为 chatDialog
This commit is contained in:
2026-03-04 14:19:14 +08:00
parent b62a9f6240
commit f867e912e9

View File

@@ -18,7 +18,7 @@
<div class="tool-btn" onclick="openShopModal()" title="购买道具">商店</div>
<div class="tool-btn" onclick="saveExp()" title="手动存经验点">存点</div>
<div class="tool-btn" onclick="openGameHall()" title="娱乐游戏大厅">娱乐</div>
<div class="tool-btn" onclick="alert('🚧 银行功能开发中,敬请期待!')" title="银行(待开发)">银行</div>
<div class="tool-btn" onclick="window.chatDialog.alert('银行功能开发中,敬请期待!', '开发中', '🚧')" title="银行(待开发)">银行</div>
<div class="tool-btn" onclick="openMarriageStatusModal()" title="婚姻状态">婚姻</div>
<div class="tool-btn" onclick="openFriendPanel()" title="好友列表">好友</div>
<div class="tool-btn" onclick="openAvatarPicker()" title="修改头像">头像</div>
@@ -179,15 +179,15 @@
const newPwd = document.getElementById('set-new-pwd').value;
const newPwd2 = document.getElementById('set-new-pwd2').value;
if (!oldPwd || !newPwd) {
alert('请填写旧密码和新密码');
window.chatDialog.alert('请填写旧密码和新密码', '提示', '⚠️');
return;
}
if (newPwd.length < 6) {
alert('新密码最少6位');
window.chatDialog.alert('新密码最少6位', '提示', '⚠️');
return;
}
if (newPwd !== newPwd2) {
alert('两次输入的新密码不一致!');
window.chatDialog.alert('两次输入的新密码不一致!', '提示', '⚠️');
return;
}
@@ -207,15 +207,15 @@
});
const data = await res.json();
if (res.ok && data.status === 'success') {
alert('密码修改成功!');
window.chatDialog.alert('密码修改成功!', '修改成功', '🔒');
document.getElementById('set-old-pwd').value = '';
document.getElementById('set-new-pwd').value = '';
document.getElementById('set-new-pwd2').value = '';
} else {
alert('修改失败: ' + (data.message || '请输入正确的旧密码'));
window.chatDialog.alert('修改失败' + (data.message || '请输入正确的旧密码'), '修改失败', '❌');
}
} catch (e) {
alert('网络异常');
window.chatDialog.alert('网络异常,请稍后重试', '错误', '🌐');
}
}
@@ -246,12 +246,12 @@
});
const data = await res.json();
if (res.ok && data.status === 'success') {
alert('设置保存成功!');
window.chatDialog.alert('资料保存成功!', '保存成功', '✅');
} else {
alert('保存失败: ' + (data.message || '输入有误'));
window.chatDialog.alert('保存失败' + (data.message || '输入有误'), '保存失败', '❌');
}
} catch (e) {
alert('网络异常');
window.chatDialog.alert('网络异常,请稍后重试', '错误', '🌐');
}
}
@@ -261,7 +261,7 @@
async function sendEmailCode() {
const emailInput = document.getElementById('set-email').value.trim();
if (!emailInput) {
alert('请先填写邮箱地址后再获取验证码!');
window.chatDialog.alert('请先填写邮箱地址后再获取验证码!', '提示', '📧');
return;
}
@@ -287,7 +287,7 @@
const data = await res.json();
if (res.ok && data.status === 'success') {
alert(data.message || '验证码发送成功,请前往邮箱查收!(有效期5分钟)');
window.chatDialog.alert(data.message || '验证码发送成功,请前往邮箱查收!有效期5分钟', '发送成功', '📬');
// 开始 60 秒防暴力点击倒计时
let count = 60;
@@ -306,7 +306,7 @@
}, 1000);
} else {
alert('发送失败: ' + (data.message || '系统繁忙'));
window.chatDialog.alert('发送失败' + (data.message || '系统繁忙'), '发送失败', '❌');
// 失败了立刻解除禁用以重新尝试
btn.innerText = '获取验证码';
btn.disabled = false;
@@ -314,7 +314,7 @@
btn.style.cursor = 'pointer';
}
} catch (e) {
alert('网络异常,验证码发送请求失败。');
window.chatDialog.alert('网络异常,验证码发送失败,请稍后重试。', '错误', '🌐');
btn.innerText = '获取验证码';
btn.disabled = false;
btn.style.opacity = '1';