someone-oa/pc/change-password.html
2025-12-11 19:04:46 +08:00

143 lines
6.3 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>修改密码 - OA系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 统一布局样式 -->
<link rel="stylesheet" href="unified-layout.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
background: #f0f2f5;
overflow: hidden;
}
.layout-container { height: 100vh; display: flex; flex-direction: column; }
.sidebar {
width: 220px;
background: #fff;
border-right: 1px solid #e6e6e6;
padding: 12px 0;
}
.sidebar-title { padding: 0 20px 12px; color: #909399; font-size: 13px; }
.menu-item { padding: 12px 20px; cursor: pointer; color: #303133; }
.menu-item:hover { background: #ecf5ff; color: #409EFF; }
.menu-item.active { background: #409EFF; color: #fff; }
.content { flex: 1; padding: 20px; overflow-y: auto; background: #f0f2f5; }
.card {
background: #fff;
border: 1px solid #e6e6e6;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
padding: 24px;
max-width: 640px;
}
.page-header { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.page-title { font-size: 18px; font-weight: 500; color: #303133; }
.form-item { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 8px; color: #606266; font-size: 14px; }
.form-label .required { color: #ff4d4f; }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; }
.password-tips { font-size: 12px; color: #909399; margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.btn { padding: 8px 20px; border: none; border-radius: 4px; cursor: pointer; }
.btn-primary { background: #409EFF; color: #fff; }
.btn-default { background: #fff; color: #303133; border: 1px solid #dcdfe6; }
</style>
<!-- Vue.js -->
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<!-- Element UI JS -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="app">
<div class="layout-container">
<div class="main-container">
<div class="sidebar">
<div class="sidebar-title">个人中心</div>
<div class="menu-item" onclick="window.location.href='profile.html'">我的资料</div>
<div class="menu-item" onclick="window.location.href='profile-edit.html'">编辑资料</div>
<div class="menu-item active">修改密码</div>
</div>
<div class="content">
<div class="card">
<div class="page-header">
<div class="page-title">修改密码</div>
</div>
<form id="passwordForm">
<div class="form-item">
<label class="form-label">
<span class="required">*</span>原密码
</label>
<input type="password" class="form-input" placeholder="请输入原密码" required>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>新密码
</label>
<input type="password" class="form-input" placeholder="请输入新密码" required>
<div class="password-tips">密码长度8-20位包含字母和数字</div>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>确认新密码
</label>
<input type="password" class="form-input" placeholder="请再次输入新密码" required>
</div>
<div class="form-actions">
<button type="button" class="btn btn-default" onclick="window.location.href='profile.html'">取消</button>
<button type="submit" class="btn btn-primary">确认修改</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="common.js"></script>
<script>
document.getElementById('passwordForm').addEventListener('submit', function(e) {
e.preventDefault();
const inputs = this.querySelectorAll('input[type="password"]');
const oldPwd = inputs[0].value;
const newPwd = inputs[1].value;
const confirmPwd = inputs[2].value;
if (!oldPwd || !newPwd || !confirmPwd) {
CommonUtils.showMessage('请填写完整信息', 'error');
return;
}
if (newPwd.length < 8 || newPwd.length > 20) {
CommonUtils.showMessage('密码长度必须在8-20位之间', 'error');
return;
}
if (!/^(?=.*[A-Za-z])(?=.*\d)/.test(newPwd)) {
CommonUtils.showMessage('密码必须包含字母和数字', 'error');
return;
}
if (newPwd !== confirmPwd) {
CommonUtils.showMessage('两次输入的新密码不一致', 'error');
return;
}
CommonUtils.confirm('确认修改密码?', () => {
CommonUtils.showMessage('密码修改成功!请重新登录');
setTimeout(() => window.location.href = 'login.html', 1500);
});
});
</script>
<script src="unified-layout.js"></script>
<script>
initUnifiedLayout('home');
</script>
</div>
</body>
</html>