feat: 完善鉴权和密码功能,添加飞书通知模块
- 完善Token过期/不存在时跳转登录重新认证 - 实现正常的账号密码登录验证(邮箱/手机号+密码) - 用户初始化密码设为工号(sn) - 添加修改密码功能(API+前端页面) - 修复扫码登录后跳转问题(zustand persist格式) - 创建飞书通知服务 FeishuNotificationService - 设置页面添加修改密码入口 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { showLanguageSwitcher } from '@/components/LanguageSwitcher'
|
||||
import styles from './settings.module.css'
|
||||
|
||||
interface SettingItem {
|
||||
id: string
|
||||
icon: string
|
||||
label: string
|
||||
description?: string
|
||||
path?: string
|
||||
onClick?: () => void
|
||||
}
|
||||
|
||||
export default function Settings() {
|
||||
const navigate = useNavigate()
|
||||
const { t } = useTranslation()
|
||||
|
||||
const settingGroups = [
|
||||
{
|
||||
title: t('profile.security'),
|
||||
items: [
|
||||
{
|
||||
id: 'change-password',
|
||||
icon: '🔒',
|
||||
label: t('profile.changePassword'),
|
||||
description: t('changePassword.title'),
|
||||
path: '/change-password',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('settings.title'),
|
||||
items: [
|
||||
{
|
||||
id: 'language',
|
||||
icon: '🌐',
|
||||
label: t('settings.language'),
|
||||
description: t('settings.language'),
|
||||
onClick: () => showLanguageSwitcher(),
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
const handleItemClick = (item: SettingItem) => {
|
||||
if (item.onClick) {
|
||||
item.onClick()
|
||||
} else if (item.path) {
|
||||
navigate(item.path)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.settings}>
|
||||
<div className={styles.header}>
|
||||
<h1 className={styles.title}>{t('profile.settings')}</h1>
|
||||
</div>
|
||||
|
||||
{settingGroups.map((group) => (
|
||||
<div key={group.title} className={styles.group}>
|
||||
<div className={styles.groupTitle}>{group.title}</div>
|
||||
<div className={styles.groupContent}>
|
||||
{group.items.map((item) => (
|
||||
<div
|
||||
key={item.id}
|
||||
className={styles.item}
|
||||
onClick={() => handleItemClick(item)}
|
||||
>
|
||||
<div className={styles.itemLeft}>
|
||||
<span className={styles.itemIcon}>{item.icon}</span>
|
||||
<div className={styles.itemInfo}>
|
||||
<div className={styles.itemLabel}>{item.label}</div>
|
||||
{item.description && (
|
||||
<div className={styles.itemDescription}>{item.description}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<span className={styles.itemArrow}>›</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
.settings {
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: #fff;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin-top: 12px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.groupTitle {
|
||||
padding: 12px 20px 8px;
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.groupContent {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 20px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.item:active {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.itemLeft {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.itemIcon {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.itemInfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.itemLabel {
|
||||
font-size: 15px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.itemDescription {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.itemArrow {
|
||||
font-size: 18px;
|
||||
color: #ccc;
|
||||
}
|
||||
Reference in New Issue
Block a user