账号问题新增
This commit is contained in:
@@ -29,6 +29,42 @@
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
/* 弹窗样式 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0,0,0,0.45);
|
||||
display: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.modal {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
||||
width: 360px;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.modal h3 {
|
||||
margin-bottom: 12px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 30px;
|
||||
@@ -269,8 +305,9 @@
|
||||
<div class="container">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
||||
<h1 style="margin: 0;">职位信息爬虫工具</h1>
|
||||
<div style="display: flex; gap: 15px;">
|
||||
<a href="/auth/logout" style="color: #f44336; text-decoration: none; padding: 8px 15px; border-radius: 4px; background: #ffebee;">退出登录</a>
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<button class="btn btn-secondary" style="background:#2196F3;" onclick="openPwdModal()">修改密码</button>
|
||||
<a href="/auth/logout" style="color: #f44336; text-decoration: none; padding: 8px 15px; border-radius: 4px; background: #ffebee;">退出登录</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -454,7 +491,7 @@
|
||||
showMessage('config-message', '请求失败: ' + error.message, 'error');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 获取地区选项
|
||||
function getDsdmOptions() {
|
||||
const examid = document.getElementById('examid').value.trim();
|
||||
@@ -934,6 +971,81 @@
|
||||
const container = document.getElementById(containerId);
|
||||
container.innerHTML = `<div class="message ${type}">${message}</div>`;
|
||||
}
|
||||
|
||||
// 弹窗:打开、关闭
|
||||
function openPwdModal() {
|
||||
document.getElementById('pwd-modal').style.display = 'flex';
|
||||
}
|
||||
function closePwdModal() {
|
||||
document.getElementById('pwd-modal').style.display = 'none';
|
||||
document.getElementById('modal-old-password').value = '';
|
||||
document.getElementById('modal-new-password').value = '';
|
||||
document.getElementById('modal-new-password-confirm').value = '';
|
||||
document.getElementById('modal-pwd-message').innerHTML = '';
|
||||
}
|
||||
|
||||
// 弹窗内修改密码
|
||||
function changePasswordModal() {
|
||||
const oldPassword = document.getElementById('modal-old-password').value.trim();
|
||||
const newPassword = document.getElementById('modal-new-password').value.trim();
|
||||
const newPasswordConfirm = document.getElementById('modal-new-password-confirm').value.trim();
|
||||
|
||||
if (!oldPassword || !newPassword || !newPasswordConfirm) {
|
||||
showMessage('modal-pwd-message', '请填写完整的旧密码和新密码', 'error');
|
||||
return;
|
||||
}
|
||||
if (newPassword !== newPasswordConfirm) {
|
||||
showMessage('modal-pwd-message', '两次输入的新密码不一致', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
showMessage('modal-pwd-message', '正在修改密码...', 'info');
|
||||
fetch(API_BASE_URL + '/crawler/changePassword', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
body: `old_password=${encodeURIComponent(oldPassword)}&new_password=${encodeURIComponent(newPassword)}`
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.code === 1) {
|
||||
showMessage('modal-pwd-message', data.msg || '密码修改成功', 'success');
|
||||
setTimeout(() => {
|
||||
closePwdModal();
|
||||
}, 600);
|
||||
} else {
|
||||
showMessage('modal-pwd-message', data.msg || '密码修改失败', 'error');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
showMessage('modal-pwd-message', '请求失败: ' + error.message, 'error');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<!-- 密码修改弹窗 -->
|
||||
<div class="modal-overlay" id="pwd-modal">
|
||||
<div class="modal">
|
||||
<h3>修改密码</h3>
|
||||
<div id="modal-pwd-message"></div>
|
||||
<div class="form-group">
|
||||
<label for="modal-old-password">旧密码:</label>
|
||||
<input type="password" id="modal-old-password" placeholder="请输入旧密码">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="modal-new-password">新密码:</label>
|
||||
<input type="password" id="modal-new-password" placeholder="请输入新密码">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="modal-new-password-confirm">确认新密码:</label>
|
||||
<input type="password" id="modal-new-password-confirm" placeholder="请再次输入新密码">
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<button class="btn btn-secondary" style="background:#9e9e9e;" onclick="closePwdModal()">取消</button>
|
||||
<button class="btn" onclick="changePasswordModal()">确定修改</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user