diff --git a/hubcmdui/web/admin.html b/hubcmdui/web/admin.html index 6ff22ab..a9e8873 100644 --- a/hubcmdui/web/admin.html +++ b/hubcmdui/web/admin.html @@ -522,6 +522,390 @@ border-color: rgba(255, 255, 255, 0.5); } + .btn-danger-outline { + background-color: transparent; + border: 2px solid var(--danger-color); + color: var(--danger-color); + padding: 0.6rem 1.2rem; + border-radius: var(--radius-md); + cursor: pointer; + transition: all 0.2s ease; + display: inline-flex; + align-items: center; + gap: 0.5rem; + font-weight: 500; + } + + .btn-danger-outline:hover { + background-color: var(--danger-color); + color: white; + } + + /* 用户统计行样式 */ + .user-stats-row { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 1.5rem; + margin-bottom: 2rem; + } + + @media (max-width: 1200px) { + .user-stats-row { + grid-template-columns: repeat(2, 1fr); + } + } + + @media (max-width: 600px) { + .user-stats-row { + grid-template-columns: 1fr; + } + } + + .stat-card-enhanced { + background: var(--container-bg); + border-radius: var(--radius-lg); + padding: 1.5rem; + display: flex; + align-items: center; + gap: 1rem; + box-shadow: var(--shadow-sm); + border: 1px solid var(--border-light); + transition: all 0.3s ease; + } + + .stat-card-enhanced:hover { + transform: translateY(-3px); + box-shadow: var(--shadow-md); + border-color: var(--primary-color); + } + + .stat-icon-wrapper { + width: 56px; + height: 56px; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + font-size: 1.5rem; + } + + .stat-icon-wrapper.blue { + background: linear-gradient(135deg, #3d7cf4 0%, #5e95f7 100%); + color: white; + } + + .stat-icon-wrapper.green { + background: linear-gradient(135deg, #28a745 0%, #48c764 100%); + color: white; + } + + .stat-icon-wrapper.purple { + background: linear-gradient(135deg, #6f42c1 0%, #8c68cd 100%); + color: white; + } + + .stat-icon-wrapper.orange { + background: linear-gradient(135deg, #fd7e14 0%, #fea347 100%); + color: white; + } + + .stat-content { + flex: 1; + } + + .stat-card-enhanced .stat-value { + font-size: 1.4rem; + font-weight: 700; + color: var(--text-primary); + margin-bottom: 0.25rem; + } + + .stat-card-enhanced .stat-label { + font-size: 0.85rem; + color: var(--text-secondary); + } + + /* 安全设置区域标题 */ + .security-section-header { + margin-bottom: 1.5rem; + padding-bottom: 1rem; + border-bottom: 2px solid var(--border-light); + } + + .security-section-header h2 { + font-size: 1.4rem; + font-weight: 600; + color: var(--text-primary); + margin: 0 0 0.5rem 0; + display: flex; + align-items: center; + gap: 0.5rem; + } + + .security-section-header h2 i { + color: var(--primary-color); + } + + .security-section-header p { + color: var(--text-secondary); + margin: 0; + font-size: 0.9rem; + } + + /* 安全卡片样式 */ + .security-card { + position: relative; + overflow: hidden; + } + + .security-card::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 4px; + height: 100%; + background: var(--primary-color); + border-radius: 4px 0 0 4px; + } + + .card-icon-header { + display: flex; + align-items: center; + gap: 1rem; + margin-bottom: 1rem; + } + + .card-icon { + width: 48px; + height: 48px; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + font-size: 1.3rem; + } + + .card-icon.blue { + background: rgba(61, 124, 244, 0.1); + color: #3d7cf4; + } + + .card-icon.orange { + background: rgba(253, 126, 20, 0.1); + color: #fd7e14; + } + + .card-icon-header .user-center-section-title { + margin: 0; + padding: 0; + } + + .card-icon-header .user-center-section-title::after { + display: none; + } + + .card-description { + color: var(--text-secondary); + font-size: 0.9rem; + margin-bottom: 1.5rem; + line-height: 1.5; + } + + /* 现代表单样式 */ + .modern-form { + display: flex; + flex-direction: column; + gap: 1.25rem; + } + + .modern-form .form-group { + display: flex; + flex-direction: column; + gap: 0.5rem; + } + + .modern-form label { + font-weight: 500; + color: var(--text-primary); + font-size: 0.9rem; + display: flex; + align-items: center; + gap: 0.5rem; + } + + .modern-form label i { + color: var(--primary-color); + font-size: 0.85rem; + } + + .form-input { + width: 100%; + padding: 0.875rem 1rem; + border: 2px solid var(--border-light); + border-radius: var(--radius-md); + font-size: 0.95rem; + transition: all 0.2s ease; + background: var(--container-bg); + } + + .form-input:focus { + outline: none; + border-color: var(--primary-color); + box-shadow: 0 0 0 3px rgba(61, 124, 244, 0.1); + } + + .form-input::placeholder { + color: var(--text-secondary); + opacity: 0.6; + } + + .input-hint { + font-size: 0.8rem; + color: var(--text-secondary); + margin-top: -0.25rem; + } + + .password-input-wrapper { + position: relative; + display: flex; + align-items: center; + } + + .password-input-wrapper .form-input { + padding-right: 3rem; + } + + .toggle-password { + position: absolute; + right: 0.75rem; + background: none; + border: none; + color: var(--text-secondary); + cursor: pointer; + padding: 0.5rem; + transition: color 0.2s ease; + } + + .toggle-password:hover { + color: var(--primary-color); + } + + /* 密码强度条 */ + .password-strength-bar { + height: 4px; + background: var(--border-light); + border-radius: 2px; + overflow: hidden; + margin-top: 0.5rem; + } + + .strength-indicator { + height: 100%; + width: 0; + border-radius: 2px; + transition: all 0.3s ease; + } + + .strength-indicator.weak { + width: 33%; + background: #dc3545; + } + + .strength-indicator.medium { + width: 66%; + background: #ffc107; + } + + .strength-indicator.strong { + width: 100%; + background: #28a745; + } + + .password-strength-text { + font-size: 0.8rem; + margin-top: 0.5rem; + } + + .password-strength-text.weak { + color: #dc3545; + } + + .password-strength-text.medium { + color: #ffc107; + } + + .password-strength-text.strong { + color: #28a745; + } + + .btn-block { + width: 100%; + justify-content: center; + padding: 0.875rem 1.5rem; + font-size: 1rem; + margin-top: 0.5rem; + } + + .form-actions { + display: flex; + flex-direction: column; + gap: 0.5rem; + } + + /* 安全提示样式 */ + .security-tips { + background: linear-gradient(135deg, rgba(61, 124, 244, 0.05) 0%, rgba(61, 124, 244, 0.1) 100%); + border: 1px solid rgba(61, 124, 244, 0.2); + border-radius: var(--radius-lg); + padding: 1.5rem; + margin-top: 2rem; + } + + .tip-header { + display: flex; + align-items: center; + gap: 0.75rem; + margin-bottom: 1rem; + font-weight: 600; + color: var(--primary-color); + font-size: 1.1rem; + } + + .tip-header i { + font-size: 1.3rem; + } + + .tip-list { + list-style: none; + padding: 0; + margin: 0; + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 0.75rem; + } + + @media (max-width: 768px) { + .tip-list { + grid-template-columns: 1fr; + } + } + + .tip-list li { + display: flex; + align-items: flex-start; + gap: 0.5rem; + color: var(--text-secondary); + font-size: 0.9rem; + line-height: 1.4; + } + + .tip-list li i { + color: #28a745; + margin-top: 0.2rem; + flex-shrink: 0; + } + /* 用户信息网格布局 */ .user-dashboard-grid { display: grid; @@ -2914,10 +3298,12 @@
-

用户中心

+

用户中心

管理您的个人信息和账户安全

- +
@@ -2934,73 +3320,163 @@
- +
-
- -
-
-

账户信息

-
-
-
-
--
-
登录次数
-
-
-
-
--
-
上次登录
-
-
-
-
--
-
账户天数
-
-
+ +
+
+
+ +
+
+
--
+
登录次数
- - -
-
-

修改用户名

-
- - 用户名需要3-20位,只能包含字母、数字和下划线 - - - 修改用户名需要验证当前密码 - -
- -
-
+
+
+
+
+
--
+
上次登录
+
+
+
+
+ +
+
+
--
+
账户天数
+
+
+
+
+ +
+
+
安全
+
账户状态
+
+
+
+ + +
+

安全设置

+

管理您的账户安全信息,定期修改密码可以提高账户安全性

+
+ +
+ +
+
+
+ +
+

修改用户名

+
+

修改登录用户名,建议使用不易猜测的用户名以提高安全性

+
+
+ + + 3-20位,只能包含字母、数字和下划线 +
+
+ +
+ + +
+
+ +
-
-
+
+
+
+ +

修改密码

-
- - - - 密码必须包含至少一个字母、一个数字和一个特殊字符,长度在8到16个字符之间 - - - -
- - -
-
+

定期修改密码可以有效提高账户安全性,建议每3个月更换一次

+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+
+ 8-16位,需包含字母、数字和特殊字符 +
+
+ +
+ + +
+
+
+ + +
+
+ + +
+
+ + 安全提示 +
+
    +
  • 使用强密码,包含大小写字母、数字和特殊字符
  • +
  • 不要与他人共享您的登录凭据
  • +
  • 定期更换密码,建议每3个月更换一次
  • +
  • 使用独特的用户名,避免使用常见名称如admin、root等
  • +
+
diff --git a/hubcmdui/web/js/userCenter.js b/hubcmdui/web/js/userCenter.js index d7443a9..72ed87b 100644 --- a/hubcmdui/web/js/userCenter.js +++ b/hubcmdui/web/js/userCenter.js @@ -261,18 +261,20 @@ async function changeUsername(event) { function checkUcPasswordStrength() { const password = document.getElementById('ucNewPassword').value; const strengthSpan = document.getElementById('ucPasswordStrength'); - const strengthBar = document.getElementById('strengthBar'); + const strengthIndicator = document.getElementById('strengthIndicator'); if (!password) { - strengthSpan.textContent = ''; - if (strengthBar) strengthBar.style.width = '0%'; + if (strengthSpan) strengthSpan.textContent = ''; + if (strengthIndicator) { + strengthIndicator.className = 'strength-indicator'; + strengthIndicator.style.width = '0'; + } return; } let strength = 0; let strengthText = ''; - let strengthColor = ''; - let strengthWidth = '0%'; + let strengthClass = ''; // 长度检查 if (password.length >= 8) strength++; @@ -287,59 +289,55 @@ function checkUcPasswordStrength() { // 包含特殊字符 if (/[.,\-_+=()[\]{}|\\;:'"<>?/@$!%*#?&]/.test(password)) strength++; - // 根据强度设置文本和颜色 - switch(strength) { - case 0: - case 1: - strengthText = '密码强度:非常弱'; - strengthColor = '#FF4136'; - strengthWidth = '20%'; - break; - case 2: - strengthText = '密码强度:弱'; - strengthColor = '#FF851B'; - strengthWidth = '40%'; - break; - case 3: - strengthText = '密码强度:中'; - strengthColor = '#FFDC00'; - strengthWidth = '60%'; - break; - case 4: - strengthText = '密码强度:强'; - strengthColor = '#2ECC40'; - strengthWidth = '80%'; - break; - case 5: - strengthText = '密码强度:非常强'; - strengthColor = '#3D9970'; - strengthWidth = '100%'; - break; + // 根据强度设置文本和样式类 + if (strength <= 2) { + strengthText = '密码强度:弱'; + strengthClass = 'weak'; + } else if (strength <= 3) { + strengthText = '密码强度:中'; + strengthClass = 'medium'; + } else { + strengthText = '密码强度:强'; + strengthClass = 'strong'; } - // 用span元素包裹文本,并设置为不换行 - strengthSpan.innerHTML = `${strengthText}`; - strengthSpan.style.color = strengthColor; + // 更新UI + if (strengthSpan) { + strengthSpan.textContent = strengthText; + strengthSpan.className = `password-strength-text ${strengthClass}`; + } - if (strengthBar) { - strengthBar.style.width = strengthWidth; - strengthBar.style.backgroundColor = strengthColor; + if (strengthIndicator) { + strengthIndicator.className = `strength-indicator ${strengthClass}`; } } // 切换密码可见性 -function togglePasswordVisibility(inputId) { +function togglePasswordVisibility(inputId, btnElement) { const passwordInput = document.getElementById(inputId); - const toggleBtn = passwordInput.nextElementSibling.querySelector('i'); + if (!passwordInput) return; + + // 获取图标元素 + let toggleIcon; + if (btnElement) { + toggleIcon = btnElement.querySelector('i'); + } else { + const nextSibling = passwordInput.nextElementSibling; + toggleIcon = nextSibling ? nextSibling.querySelector('i') : null; + } if (passwordInput.type === 'password') { passwordInput.type = 'text'; - toggleBtn.classList.remove('fa-eye'); - toggleBtn.classList.add('fa-eye-slash'); + if (toggleIcon) { + toggleIcon.classList.remove('fa-eye'); + toggleIcon.classList.add('fa-eye-slash'); + } } else { passwordInput.type = 'password'; - toggleBtn.classList.remove('fa-eye-slash'); - toggleBtn.classList.add('fa-eye'); + if (toggleIcon) { + toggleIcon.classList.remove('fa-eye-slash'); + toggleIcon.classList.add('fa-eye'); + } } }