feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -29,7 +29,7 @@ import {
|
||||
TabPane,
|
||||
Popover,
|
||||
Modal,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
IconMail,
|
||||
IconShield,
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
IconKey,
|
||||
IconLock,
|
||||
IconDelete,
|
||||
} from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui/icons';
|
||||
import { UserPlus, ShieldCheck } from 'lucide-react';
|
||||
import {
|
||||
TelegramBrandIcon,
|
||||
|
||||
@@ -28,12 +28,12 @@ import {
|
||||
TabPane,
|
||||
Typography,
|
||||
Avatar,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
IllustrationNoContent,
|
||||
IllustrationNoContentDark,
|
||||
} from '../../../common/illustrations';
|
||||
import { IconChevronDown, IconChevronUp } from '@douyinfe/semi-icons';
|
||||
import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
|
||||
import { Settings } from 'lucide-react';
|
||||
import { renderModelTag, getModelCategories } from '../../../../helpers';
|
||||
|
||||
@@ -76,7 +76,7 @@ const ModelsList = ({ t, models, modelsLoading, copyText }) => {
|
||||
{/* 模拟分类标签 */}
|
||||
<div
|
||||
className='mb-4'
|
||||
style={{ borderBottom: '1px solid var(--semi-color-border)' }}
|
||||
style={{ borderBottom: '1px solid var(--ui-color-border)' }}
|
||||
>
|
||||
<div className='flex overflow-x-auto py-2 gap-2'>
|
||||
{Array.from({ length: 8 }).map((_, index) => (
|
||||
|
||||
@@ -31,8 +31,8 @@ import {
|
||||
Switch,
|
||||
Row,
|
||||
Col,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconMail, IconKey, IconBell, IconLink } from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui';
|
||||
import { IconMail, IconKey, IconBell, IconLink } from '@/components/ui/icons';
|
||||
import { ShieldCheck, Bell, DollarSign, Settings } from 'lucide-react';
|
||||
import {
|
||||
renderQuotaWithPrompt,
|
||||
@@ -768,7 +768,7 @@ const NotificationSettings = ({
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
lineHeight: '1.5',
|
||||
color: 'var(--semi-color-text-2)',
|
||||
color: 'var(--ui-color-text-2)',
|
||||
}}
|
||||
>
|
||||
{t('您可以个性化设置侧边栏的要显示功能')}
|
||||
@@ -778,8 +778,8 @@ const NotificationSettings = ({
|
||||
<div
|
||||
className='border rounded-xl p-4'
|
||||
style={{
|
||||
borderColor: 'var(--semi-color-border)',
|
||||
backgroundColor: 'var(--semi-color-bg-1)',
|
||||
borderColor: 'var(--ui-color-border)',
|
||||
backgroundColor: 'var(--ui-color-bg-1)',
|
||||
}}
|
||||
>
|
||||
{sectionConfigs.map((section) => (
|
||||
@@ -788,9 +788,9 @@ const NotificationSettings = ({
|
||||
<div
|
||||
className='flex justify-between items-center mb-4 p-4 rounded-lg'
|
||||
style={{
|
||||
backgroundColor: 'var(--semi-color-fill-0)',
|
||||
border: '1px solid var(--semi-color-border-light)',
|
||||
borderColor: 'var(--semi-color-fill-1)',
|
||||
backgroundColor: 'var(--ui-color-fill-0)',
|
||||
border: '1px solid var(--ui-color-border-light)',
|
||||
borderColor: 'var(--ui-color-fill-1)',
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
@@ -803,7 +803,7 @@ const NotificationSettings = ({
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
lineHeight: '1.5',
|
||||
color: 'var(--semi-color-text-2)',
|
||||
color: 'var(--ui-color-text-2)',
|
||||
}}
|
||||
>
|
||||
{section.description}
|
||||
@@ -852,7 +852,7 @@ const NotificationSettings = ({
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
lineHeight: '1.5',
|
||||
color: 'var(--semi-color-text-2)',
|
||||
color: 'var(--ui-color-text-2)',
|
||||
marginTop: '4px',
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
/**
|
||||
* 个人设置各页签的区块头:18px 标题 + 说明 + 右侧操作,下方 1px 分隔线。
|
||||
* 只负责呈现;操作按钮及其回调由各页签传入。
|
||||
*/
|
||||
const SectionHeader = ({ title, description, extra }) => (
|
||||
<div className='ui-settings-section-head'>
|
||||
<div>
|
||||
<h2>{title}</h2>
|
||||
{description ? <p>{description}</p> : null}
|
||||
</div>
|
||||
{extra ? <div className='ui-settings-section-extra'>{extra}</div> : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
export default SectionHeader;
|
||||
@@ -30,13 +30,13 @@ import {
|
||||
Steps,
|
||||
Space,
|
||||
Badge,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
IconShield,
|
||||
IconAlertTriangle,
|
||||
IconRefresh,
|
||||
IconCopy,
|
||||
} from '@douyinfe/semi-icons';
|
||||
} from '@/components/ui/icons';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { QRCodeSVG } from 'qrcode.react';
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
Divider,
|
||||
Typography,
|
||||
Badge,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
isRoot,
|
||||
isAdmin,
|
||||
|
||||
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Banner, Input, Modal, Typography } from '@douyinfe/semi-ui';
|
||||
import { IconDelete, IconUser } from '@douyinfe/semi-icons';
|
||||
import { Banner, Input, Modal, Typography } from '@/components/ui';
|
||||
import { IconDelete, IconUser } from '@/components/ui/icons';
|
||||
import Turnstile from 'react-turnstile';
|
||||
|
||||
const AccountDeleteModal = ({
|
||||
|
||||
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Input, Modal, Typography } from '@douyinfe/semi-ui';
|
||||
import { IconLock } from '@douyinfe/semi-icons';
|
||||
import { Input, Modal, Typography } from '@/components/ui';
|
||||
import { IconLock } from '@/components/ui/icons';
|
||||
import Turnstile from 'react-turnstile';
|
||||
|
||||
const ChangePasswordModal = ({
|
||||
|
||||
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Input, Modal } from '@douyinfe/semi-ui';
|
||||
import { IconMail, IconKey } from '@douyinfe/semi-icons';
|
||||
import { Button, Input, Modal } from '@/components/ui';
|
||||
import { IconMail, IconKey } from '@/components/ui/icons';
|
||||
import Turnstile from 'react-turnstile';
|
||||
|
||||
const EmailBindModal = ({
|
||||
|
||||
@@ -18,8 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Input, Modal, Image } from '@douyinfe/semi-ui';
|
||||
import { IconKey } from '@douyinfe/semi-icons';
|
||||
import { Button, Input, Modal, Image } from '@/components/ui';
|
||||
import { IconKey } from '@/components/ui/icons';
|
||||
import { WechatBrandIcon } from '../../../common/icons/BrandIcons';
|
||||
|
||||
const WeChatBindModal = ({
|
||||
|
||||
@@ -0,0 +1,565 @@
|
||||
/*
|
||||
* 个人设置(/user-center/settings)页面样式。
|
||||
* 浅色数值来自原型图.zip:个人设置1/2/3、账号绑定、安全设置、通知设置/通知设置2(1920 宽视口实测)。
|
||||
* 深色主题无原型:统一由现有主题变量与 Ant Design token 推导,不使用固定深色色值以外的装饰。
|
||||
* 页面内只允许使用本文件定义的 --ps-* 变量或既有 --ui-* / --surface-* / --text-* 变量,JSX 中不写颜色。
|
||||
*/
|
||||
.ui-personal-settings {
|
||||
--ps-border: #e2e8ee;
|
||||
--ps-text: rgba(0, 0, 0, 0.88);
|
||||
--ps-desc: #627489;
|
||||
--ps-amount: #a75e0b;
|
||||
--ps-card-shadow: 0 6px 24px rgba(15, 23, 42, 0.025);
|
||||
--ps-header-bg: linear-gradient(90deg, #ffffff 0%, #fef7e9 72%, #eff8f4 100%);
|
||||
--ps-preview-bg: linear-gradient(180deg, #f2f9f4 0%, #fdf6e9 100%);
|
||||
--ps-frame-bg: #ffffff;
|
||||
--ps-option-selected-bg: #fffbf4;
|
||||
--ps-method-selected-bg: #fff0d7;
|
||||
--ps-selected-border: #a75e0b;
|
||||
--ps-selected-title: #914b05;
|
||||
--ps-panel-bg: #f7fafc;
|
||||
--ps-danger-bg: #fff8f8;
|
||||
--ps-danger-border: #efdada;
|
||||
--ps-code-bg: #18232e;
|
||||
--ps-code-text: #dceee9;
|
||||
--ps-tabs-split: #f0f0f0;
|
||||
background: var(--uc-page-bg);
|
||||
}
|
||||
html.dark .ui-personal-settings {
|
||||
--ps-border: var(--border-subtle);
|
||||
--ps-text: var(--uc-heading);
|
||||
--ps-desc: var(--text-secondary);
|
||||
--ps-amount: var(--ui-color-primary);
|
||||
--ps-card-shadow: none;
|
||||
--ps-header-bg: linear-gradient(
|
||||
90deg,
|
||||
var(--surface-card) 0%,
|
||||
color-mix(in srgb, var(--ui-color-primary) 8%, var(--surface-card)) 72%,
|
||||
color-mix(in srgb, var(--ui-color-success) 8%, var(--surface-card)) 100%
|
||||
);
|
||||
--ps-preview-bg: linear-gradient(
|
||||
180deg,
|
||||
color-mix(in srgb, var(--ui-color-success) 7%, var(--surface-card)) 0%,
|
||||
color-mix(in srgb, var(--ui-color-primary) 7%, var(--surface-card)) 100%
|
||||
);
|
||||
--ps-frame-bg: var(--surface-card);
|
||||
--ps-option-selected-bg: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 10%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--ps-method-selected-bg: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 16%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--ps-selected-border: var(--ui-color-primary);
|
||||
--ps-selected-title: var(--ui-color-primary);
|
||||
--ps-panel-bg: var(--ui-color-fill-0);
|
||||
--ps-danger-bg: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-danger) 8%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--ps-danger-border: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-danger) 35%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--ps-code-bg: color-mix(in srgb, #000 35%, var(--surface-card));
|
||||
--ps-code-text: var(--uc-heading);
|
||||
--ps-tabs-split: var(--border-subtle);
|
||||
}
|
||||
|
||||
/* 卡片:1px 边框、10px 圆角、极淡外阴影(原型实测) */
|
||||
.ui-personal-settings .ui-personal-profile,
|
||||
.ui-personal-settings .ui-personal-content {
|
||||
border-color: var(--ps-border);
|
||||
border-radius: 10px;
|
||||
box-shadow: var(--ps-card-shadow);
|
||||
}
|
||||
|
||||
/* 资料头卡 */
|
||||
.ui-personal-settings .ui-personal-profile {
|
||||
margin-bottom: 20px;
|
||||
background: var(--ps-header-bg);
|
||||
}
|
||||
.ui-personal-settings .ui-personal-profile > .ant-card-body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 24px;
|
||||
padding: 21px 26px 23px;
|
||||
}
|
||||
.ui-profile-identity {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
.ui-profile-avatar {
|
||||
display: inline-flex;
|
||||
flex-shrink: 0;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--ps-border);
|
||||
border-radius: 12px;
|
||||
background: var(--ps-frame-bg);
|
||||
}
|
||||
.ui-profile-avatar .ant-avatar {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.ui-profile-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
.ui-profile-name strong {
|
||||
color: var(--ps-text);
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 26px;
|
||||
}
|
||||
.ui-profile-name .ant-tag {
|
||||
margin: 0;
|
||||
}
|
||||
.ui-profile-sub {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
color: var(--ps-desc);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.ui-profile-id {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-profile-id:hover {
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
.ui-profile-id:focus-visible {
|
||||
outline: 2px solid var(--ui-color-primary);
|
||||
outline-offset: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.ui-profile-stats {
|
||||
display: flex;
|
||||
gap: 40px;
|
||||
}
|
||||
.ui-profile-stats span {
|
||||
display: block;
|
||||
color: var(--ps-desc);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.ui-profile-stats strong {
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
color: var(--ps-amount);
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
/* 设置卡与页签:页签文字距卡片上沿 24px,2px 主色下划线 */
|
||||
.ui-personal-settings .ui-personal-content {
|
||||
min-height: 480px;
|
||||
}
|
||||
.ui-personal-settings .ui-personal-content > .ant-card-body {
|
||||
padding: 2px 26px 26px;
|
||||
}
|
||||
.ui-personal-content > .ant-card-body > .ant-tabs > .ant-tabs-nav {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.ui-personal-content > .ant-card-body > .ant-tabs > .ant-tabs-nav::before {
|
||||
border-bottom-color: var(--ps-tabs-split);
|
||||
}
|
||||
.ui-personal-content .ant-tabs-tab {
|
||||
padding: 16px 0 18px;
|
||||
}
|
||||
|
||||
/* 区块头:18px 标题 + 说明 + 操作,下方 1px 分隔线 */
|
||||
.ui-settings-section-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 22px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid var(--ps-border);
|
||||
}
|
||||
.ui-settings-section-head h2 {
|
||||
margin: 0;
|
||||
color: var(--ps-text);
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 26px;
|
||||
}
|
||||
.ui-settings-section-head p {
|
||||
margin: 7px 0 0;
|
||||
color: var(--ps-desc);
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.ui-settings-section-extra {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 头像设置 */
|
||||
.ui-avatar-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 215px minmax(0, 1fr);
|
||||
gap: 28px;
|
||||
}
|
||||
.ui-avatar-preview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 28px 22px 24px;
|
||||
border: 1px solid var(--ps-border);
|
||||
border-radius: 10px;
|
||||
background: var(--ps-preview-bg);
|
||||
text-align: center;
|
||||
}
|
||||
.ui-avatar-preview-frame {
|
||||
display: inline-flex;
|
||||
padding: 8px;
|
||||
border: 1px solid var(--ps-border);
|
||||
border-radius: 18px;
|
||||
background: var(--ps-frame-bg);
|
||||
}
|
||||
.ui-avatar-preview-frame > img {
|
||||
display: block;
|
||||
width: 94px;
|
||||
height: 94px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.ui-avatar-preview strong {
|
||||
margin-top: 20px;
|
||||
color: var(--ps-text);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
}
|
||||
.ui-avatar-preview-live {
|
||||
margin-top: 10px;
|
||||
color: var(--ps-amount);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.ui-avatar-preview p {
|
||||
margin: 9px 0 0;
|
||||
color: var(--ps-desc);
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.ui-avatar-field-label {
|
||||
margin-bottom: 9px;
|
||||
color: var(--ps-text);
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.ui-avatar-field {
|
||||
margin-top: 24px;
|
||||
}
|
||||
.ui-avatar-field .ui-avatar-field-label {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.ui-avatar-field .ui-avatar-field-label-muted {
|
||||
margin-bottom: 14px;
|
||||
color: var(--ps-desc);
|
||||
}
|
||||
.ui-avatar-text-input {
|
||||
width: 600px;
|
||||
max-width: 100%;
|
||||
}
|
||||
.ui-avatar-help {
|
||||
margin: 6px 0 0;
|
||||
color: var(--ui-color-text-2);
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.ui-avatar-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 15px 13px;
|
||||
}
|
||||
.ui-avatar-option {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 13px;
|
||||
padding: 16px 8px 12px;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
color: var(--ps-text);
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-avatar-option img {
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.ui-avatar-option span {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.ui-avatar-option:hover {
|
||||
background: var(--ui-color-fill-0);
|
||||
}
|
||||
.ui-avatar-option.selected {
|
||||
border-color: var(--ps-selected-border);
|
||||
background: var(--ps-option-selected-bg);
|
||||
}
|
||||
.ui-avatar-check {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
color: var(--ps-selected-border);
|
||||
}
|
||||
.ui-avatar-option:focus-visible {
|
||||
outline: 2px solid var(--ui-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* 账号绑定 / 安全设置:描边行卡 */
|
||||
.ui-settings-rows {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
.ui-settings-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
padding: 22px;
|
||||
border: 1px solid var(--ps-border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface-card);
|
||||
}
|
||||
.ui-settings-row-danger {
|
||||
border-color: var(--ps-danger-border);
|
||||
background: var(--ps-danger-bg);
|
||||
}
|
||||
.ui-settings-row-text {
|
||||
min-width: 0;
|
||||
}
|
||||
.ui-settings-row-text h3 {
|
||||
margin: 0;
|
||||
color: var(--ps-text);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
}
|
||||
.ui-settings-row-text p {
|
||||
margin: 8px 0 0;
|
||||
color: var(--ps-desc);
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.ui-settings-row-text .ui-settings-row-warning {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--ui-color-warning);
|
||||
}
|
||||
.ui-settings-row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
gap: 16px;
|
||||
}
|
||||
.ui-settings-row-actions .ant-tag {
|
||||
margin: 0;
|
||||
}
|
||||
.ui-binding-muted {
|
||||
color: var(--ui-color-text-2);
|
||||
}
|
||||
.ui-binding-account {
|
||||
display: inline-block;
|
||||
max-width: 240px;
|
||||
overflow: hidden;
|
||||
color: var(--ps-desc);
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
vertical-align: bottom;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-binding-account:hover {
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
.ui-binding-popover-label {
|
||||
margin-top: 4px;
|
||||
color: var(--ui-color-text-2);
|
||||
font-size: 11px;
|
||||
}
|
||||
.ui-binding-telegram-tip {
|
||||
margin: 12px 0;
|
||||
color: var(--ui-color-text-1);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 通知设置 */
|
||||
.ui-notify-label {
|
||||
margin-bottom: 8px;
|
||||
color: var(--ps-text);
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.ui-notify-methods-field {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.ui-notify-methods {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 15px;
|
||||
}
|
||||
.ui-notify-method {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 16px 16px 16px 20px;
|
||||
border: 1px solid var(--ps-border);
|
||||
border-radius: 8px;
|
||||
background: var(--surface-card);
|
||||
color: var(--ps-desc);
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-notify-method:hover {
|
||||
border-color: var(--ui-color-primary-hover);
|
||||
}
|
||||
.ui-notify-method.selected {
|
||||
border-color: var(--ps-selected-border);
|
||||
background: var(--ps-method-selected-bg);
|
||||
}
|
||||
.ui-notify-method:focus-visible {
|
||||
outline: 2px solid var(--ui-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.ui-notify-method-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
.ui-notify-method-text strong {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
}
|
||||
.ui-notify-method.selected .ui-notify-method-text strong {
|
||||
color: var(--ps-selected-title);
|
||||
}
|
||||
.ui-notify-method-text span {
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.ui-notify-method-check {
|
||||
flex-shrink: 0;
|
||||
color: var(--ps-selected-border);
|
||||
}
|
||||
.ui-notify-form .ant-form-item-label > label {
|
||||
color: var(--ps-text);
|
||||
}
|
||||
/* 与上方 Form.Item 的 24px 下外边距折叠,实际间距 25px(原型实测) */
|
||||
.ui-notify-panel {
|
||||
margin-top: 25px;
|
||||
padding: 20px 20px 19px;
|
||||
border: 1px solid var(--ps-border);
|
||||
border-radius: 10px;
|
||||
background: var(--ps-panel-bg);
|
||||
}
|
||||
.ui-notify-panel .ant-form-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.ui-notify-code-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 4px 0 12px;
|
||||
color: var(--ps-text);
|
||||
font-size: 13px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.ui-notify-copy {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--ps-text);
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-notify-copy svg {
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
.ui-notify-copy:hover {
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
.ui-notify-copy:focus-visible {
|
||||
outline: 2px solid var(--ui-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.ui-notify-code {
|
||||
margin: 0 0 1px;
|
||||
padding: 18px 20px;
|
||||
overflow-x: auto;
|
||||
border-radius: 8px;
|
||||
background: var(--ps-code-bg);
|
||||
color: var(--ps-code-text);
|
||||
font-family: var(--ui-font-family-mono);
|
||||
font-size: 12px;
|
||||
line-height: 21.5px;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
/* 窄屏:统一规范,纵向堆叠,保持操作可达 */
|
||||
@media (max-width: 1024px) {
|
||||
.ui-avatar-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.ui-personal-settings .ui-personal-profile > .ant-card-body {
|
||||
padding: 16px;
|
||||
}
|
||||
.ui-personal-settings .ui-personal-content > .ant-card-body {
|
||||
padding: 2px 16px 16px;
|
||||
}
|
||||
.ui-profile-stats {
|
||||
gap: 24px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.ui-avatar-layout {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.ui-settings-section-head,
|
||||
.ui-settings-row {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.ui-settings-row-actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.ui-notify-methods {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
@@ -18,15 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Button, Popover, Typography, Modal } from '@douyinfe/semi-ui';
|
||||
import { IconMail, IconShield, IconGithubLogo } from '@douyinfe/semi-icons';
|
||||
import { Link2, ExternalLink, Check, X } from 'lucide-react';
|
||||
import {
|
||||
TelegramBrandIcon,
|
||||
WechatBrandIcon,
|
||||
LinuxBrandIcon,
|
||||
DiscordBrandIcon,
|
||||
} from '../../../common/icons/BrandIcons';
|
||||
import { Tag as AntTag } from 'antd';
|
||||
import { Button, Popover, Typography, Modal } from '@/components/ui';
|
||||
import TelegramLoginButton from 'react-telegram-login';
|
||||
import {
|
||||
onGitHubOAuthClicked,
|
||||
@@ -34,62 +27,17 @@ import {
|
||||
onLinuxDOOAuthClicked,
|
||||
onDiscordOAuthClicked,
|
||||
} from '../../../../helpers';
|
||||
import SectionHeader from '../components/SectionHeader';
|
||||
|
||||
// 绑定卡片配置
|
||||
// 绑定项顺序(原型为纯文字行卡,不展示品牌图标与渐变底)
|
||||
const BINDING_CARDS = [
|
||||
{
|
||||
key: 'email',
|
||||
icon: IconMail,
|
||||
gradient: 'from-blue-500 to-cyan-500',
|
||||
panelClass:
|
||||
'bg-gradient-to-br from-blue-50/78 to-cyan-50/70 dark:from-blue-500/[0.09] dark:to-cyan-400/[0.07]',
|
||||
},
|
||||
{
|
||||
key: 'wechat',
|
||||
icon: WechatBrandIcon,
|
||||
gradient: 'from-green-500 to-emerald-500',
|
||||
panelClass:
|
||||
'bg-gradient-to-br from-green-50/78 to-emerald-50/70 dark:from-green-500/[0.09] dark:to-emerald-400/[0.07]',
|
||||
isBrandIcon: true,
|
||||
},
|
||||
{
|
||||
key: 'github',
|
||||
icon: IconGithubLogo,
|
||||
gradient: 'from-gray-700 to-gray-900',
|
||||
panelClass:
|
||||
'bg-gradient-to-br from-gray-50/88 to-slate-50/75 dark:from-slate-500/[0.10] dark:to-slate-700/[0.10]',
|
||||
},
|
||||
{
|
||||
key: 'discord',
|
||||
icon: DiscordBrandIcon,
|
||||
gradient: 'from-brand-from to-brand-to',
|
||||
panelClass:
|
||||
'bg-gradient-to-br from-brand-from/10 to-brand-to/10 dark:from-brand-from/[0.14] dark:to-brand-to/[0.12]',
|
||||
isBrandIcon: true,
|
||||
},
|
||||
{
|
||||
key: 'oidc',
|
||||
icon: IconShield,
|
||||
gradient: 'from-orange-500 to-red-500',
|
||||
panelClass:
|
||||
'bg-gradient-to-br from-orange-50/78 to-red-50/70 dark:from-orange-500/[0.10] dark:to-red-500/[0.08]',
|
||||
},
|
||||
{
|
||||
key: 'telegram',
|
||||
icon: TelegramBrandIcon,
|
||||
gradient: 'from-sky-500 to-blue-500',
|
||||
panelClass:
|
||||
'bg-gradient-to-br from-sky-50/78 to-blue-50/70 dark:from-sky-500/[0.10] dark:to-blue-500/[0.08]',
|
||||
isBrandIcon: true,
|
||||
},
|
||||
{
|
||||
key: 'linuxdo',
|
||||
icon: LinuxBrandIcon,
|
||||
gradient: 'from-yellow-500 to-orange-500',
|
||||
panelClass:
|
||||
'bg-gradient-to-br from-yellow-50/78 to-orange-50/70 dark:from-yellow-500/[0.10] dark:to-orange-500/[0.08]',
|
||||
isBrandIcon: true,
|
||||
},
|
||||
{ key: 'email' },
|
||||
{ key: 'wechat' },
|
||||
{ key: 'github' },
|
||||
{ key: 'discord' },
|
||||
{ key: 'oidc' },
|
||||
{ key: 'telegram' },
|
||||
{ key: 'linuxdo' },
|
||||
];
|
||||
|
||||
const AccountBindingSection = ({
|
||||
@@ -105,7 +53,7 @@ const AccountBindingSection = ({
|
||||
|
||||
const renderAccountInfo = (accountId, label) => {
|
||||
if (!accountId || accountId === '') {
|
||||
return <span className='text-gray-400'>{t('未绑定')}</span>;
|
||||
return <span className='ui-binding-muted'>{t('未绑定')}</span>;
|
||||
}
|
||||
|
||||
const popContent = (
|
||||
@@ -113,15 +61,13 @@ const AccountBindingSection = ({
|
||||
<Typography.Paragraph copyable={{ content: accountId }}>
|
||||
{accountId}
|
||||
</Typography.Paragraph>
|
||||
{label && <div className='mt-1 text-[11px] text-gray-500'>{label}</div>}
|
||||
{label && <div className='ui-binding-popover-label'>{label}</div>}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Popover content={popContent} position='top' trigger='hover'>
|
||||
<span className='text-sm text-gray-600 dark:text-gray-300 hover:text-blue-600 cursor-pointer truncate max-w-[120px] inline-block'>
|
||||
{accountId}
|
||||
</span>
|
||||
<span className='ui-binding-account'>{accountId}</span>
|
||||
</Popover>
|
||||
);
|
||||
};
|
||||
@@ -131,6 +77,7 @@ const AccountBindingSection = ({
|
||||
case 'email':
|
||||
return {
|
||||
name: t('邮箱'),
|
||||
description: t('绑定邮箱,用于账户关联和接收通知'),
|
||||
value: userState.user?.email,
|
||||
label: t('邮箱地址'),
|
||||
enabled: true,
|
||||
@@ -199,99 +146,49 @@ const AccountBindingSection = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='space-y-6'>
|
||||
{/* 页面标题 */}
|
||||
<div className='flex items-center gap-3 rounded-3xl border border-white/70 dark:border-white/10 bg-white/50 dark:bg-white/[0.045] backdrop-blur-xl px-5 py-4'>
|
||||
<div className='w-11 h-11 rounded-2xl bg-gradient-to-br from-sky-500 to-cyan-400 flex items-center justify-center shadow-lg shadow-sky-500/20'>
|
||||
<Link2 className='w-5 h-5 text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-xl font-bold text-gray-900 dark:text-white'>
|
||||
{t('账号绑定')}
|
||||
</h2>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400'>
|
||||
{t('管理邮箱和第三方登录方式')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='ui-binding-section'>
|
||||
<SectionHeader
|
||||
title={t('账号绑定')}
|
||||
description={t('管理邮箱和第三方登录方式')}
|
||||
/>
|
||||
|
||||
{/* 绑定卡片网格 */}
|
||||
<div className='grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4'>
|
||||
<div className='ui-settings-rows'>
|
||||
{BINDING_CARDS.map((card) => {
|
||||
const data = getBindingData(card.key);
|
||||
if (!data) return null;
|
||||
// 未启用的绑定方式不显示卡片
|
||||
if (!data.enabled) return null;
|
||||
|
||||
const Icon = card.icon;
|
||||
const bound = isBound(data.value);
|
||||
const disabled = data.disableWhenBound && bound;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={card.key}
|
||||
className={`relative group p-5 rounded-[22px] border backdrop-blur-xl transition-all duration-300 ${
|
||||
bound
|
||||
? 'bg-white/62 dark:bg-white/[0.055] border-white/70 dark:border-white/10'
|
||||
: `${card.panelClass} border-white/70 dark:border-white/10 hover:border-white dark:hover:border-white/20`
|
||||
} hover:shadow-[0_18px_45px_rgba(15,23,42,0.10)] hover:-translate-y-0.5`}
|
||||
>
|
||||
{/* 状态指示器 */}
|
||||
<div className='absolute top-3 right-3'>
|
||||
<div key={card.key} className='ui-settings-row'>
|
||||
<div className='ui-settings-row-text'>
|
||||
<h3>{data.name}</h3>
|
||||
{bound ? (
|
||||
<div className='flex items-center gap-1 px-2 py-0.5 bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400 rounded-full text-xs font-medium'>
|
||||
<Check size={12} />
|
||||
{t('已绑定')}
|
||||
</div>
|
||||
) : (
|
||||
<div className='flex items-center gap-1 px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 rounded-full text-xs'>
|
||||
<X size={12} />
|
||||
{t('未绑定')}
|
||||
</div>
|
||||
)}
|
||||
<p>{renderAccountInfo(data.value, data.label)}</p>
|
||||
) : data.description ? (
|
||||
<p>{data.description}</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{/* 图标和名称 */}
|
||||
<div className='flex items-center gap-3 mb-4 pr-20'>
|
||||
<div
|
||||
className={`w-12 h-12 rounded-2xl flex items-center justify-center bg-gradient-to-br ${card.gradient} shadow-lg`}
|
||||
<div className='ui-settings-row-actions'>
|
||||
<AntTag bordered={false} color={bound ? 'success' : undefined}>
|
||||
{bound ? t('已绑定') : t('未绑定')}
|
||||
</AntTag>
|
||||
<Button
|
||||
theme={bound ? 'light' : 'solid'}
|
||||
type='primary'
|
||||
disabled={disabled}
|
||||
onClick={data.onBind}
|
||||
>
|
||||
{card.isBrandIcon ? (
|
||||
<Icon size={24} color='#FFFFFF' />
|
||||
) : (
|
||||
<Icon size='extra-large' className='text-white' />
|
||||
)}
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<h3 className='font-semibold text-gray-900 dark:text-white'>
|
||||
{data.name}
|
||||
</h3>
|
||||
<div className='text-sm'>
|
||||
{bound ? renderAccountInfo(data.value, data.label) : null}
|
||||
</div>
|
||||
</div>
|
||||
{bound
|
||||
? data.disableWhenBound
|
||||
? t('已绑定')
|
||||
: t('修改绑定')
|
||||
: t('立即绑定')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* 操作按钮 */}
|
||||
<Button
|
||||
theme={bound ? 'light' : 'solid'}
|
||||
type='primary'
|
||||
size='small'
|
||||
disabled={disabled}
|
||||
onClick={data.onBind}
|
||||
className={`w-full !rounded-lg ${
|
||||
!bound
|
||||
? `!bg-gradient-to-r ${card.gradient} !border-0 hover:opacity-90`
|
||||
: ''
|
||||
}`}
|
||||
icon={bound ? null : <ExternalLink size={14} />}
|
||||
>
|
||||
{bound
|
||||
? data.disableWhenBound
|
||||
? t('已绑定')
|
||||
: t('修改绑定')
|
||||
: t('立即绑定')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
@@ -304,7 +201,7 @@ const AccountBindingSection = ({
|
||||
onCancel={() => setShowTelegramBindModal(false)}
|
||||
footer={null}
|
||||
>
|
||||
<div className='my-3 text-sm text-gray-600'>
|
||||
<div className='ui-binding-telegram-tip'>
|
||||
{t('点击下方按钮通过 Telegram 完成绑定')}
|
||||
</div>
|
||||
<div className='flex justify-center'>
|
||||
|
||||
@@ -18,34 +18,21 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Input, Radio, RadioGroup, Tag } from '@douyinfe/semi-ui';
|
||||
import { Image, Palette, Sparkles, Type, Wand2 } from 'lucide-react';
|
||||
import { Input as AntInput, Segmented } from 'antd';
|
||||
import { Button, Input } from '@/components/ui';
|
||||
import { Check } from 'lucide-react';
|
||||
import {
|
||||
CARTOON_AVATAR_PRESETS,
|
||||
USER_AVATAR_TYPES,
|
||||
getCartoonAvatarDataUrl,
|
||||
getInitialAvatarDataUrl,
|
||||
} from '../../../../helpers';
|
||||
import SectionHeader from '../components/SectionHeader';
|
||||
|
||||
const AVATAR_TYPE_OPTIONS = [
|
||||
{
|
||||
value: USER_AVATAR_TYPES.PRESET,
|
||||
label: '卡通形象',
|
||||
desc: '从系统内置卡通头像中选择,适合默认展示',
|
||||
icon: Palette,
|
||||
},
|
||||
{
|
||||
value: USER_AVATAR_TYPES.INITIAL,
|
||||
label: '姓名首字',
|
||||
desc: '根据用户名自动生成简洁文字头像',
|
||||
icon: Type,
|
||||
},
|
||||
{
|
||||
value: USER_AVATAR_TYPES.CUSTOM,
|
||||
label: '图片链接',
|
||||
desc: '填写公网图片 URL,使用自己的头像',
|
||||
icon: Image,
|
||||
},
|
||||
{ value: USER_AVATAR_TYPES.PRESET, label: '卡通形象' },
|
||||
{ value: USER_AVATAR_TYPES.INITIAL, label: '姓名首字' },
|
||||
{ value: USER_AVATAR_TYPES.CUSTOM, label: '图片链接' },
|
||||
];
|
||||
|
||||
const AvatarSection = ({
|
||||
@@ -71,108 +58,58 @@ const AvatarSection = ({
|
||||
avatarSettings.avatarType === USER_AVATAR_TYPES.CUSTOM &&
|
||||
!avatarSettings.customAvatarUrl?.trim();
|
||||
|
||||
// 与 getInitialAvatarDataUrl 相同的首字取法,仅用于展示,不进入保存载荷
|
||||
const initialText = username ? username[0].toUpperCase() : '';
|
||||
|
||||
return (
|
||||
<div className='space-y-6'>
|
||||
<div className='flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 rounded-3xl border border-white/70 dark:border-white/10 bg-white/50 dark:bg-white/[0.045] backdrop-blur-xl px-5 py-4'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='w-11 h-11 rounded-2xl bg-gradient-to-br from-rose-500 to-orange-400 flex items-center justify-center shadow-lg shadow-rose-500/20'>
|
||||
<Wand2 className='w-5 h-5 text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-xl font-bold text-gray-900 dark:text-white'>
|
||||
{t('头像设置')}
|
||||
</h2>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400'>
|
||||
{t('选择你在平台内展示的头像样式')}
|
||||
</p>
|
||||
</div>
|
||||
<section className='ui-avatar-section'>
|
||||
<SectionHeader
|
||||
title={t('头像设置')}
|
||||
description={t('选择你在平台内展示的头像样式')}
|
||||
extra={
|
||||
<Button
|
||||
theme='solid'
|
||||
loading={savingAvatarSettings}
|
||||
disabled={customAvatarInvalid}
|
||||
onClick={saveAvatarSettings}
|
||||
>
|
||||
{t('保存头像')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<div className='ui-avatar-layout'>
|
||||
<div className='ui-avatar-preview'>
|
||||
<span className='ui-avatar-preview-frame'>
|
||||
<img src={previewUrl} alt={t('头像预览')} />
|
||||
</span>
|
||||
<strong>{username}</strong>
|
||||
<span className='ui-avatar-preview-live'>{t('实时预览')}</span>
|
||||
<p>{t('头像将同步显示在用户入口和体验中心对话中')}</p>
|
||||
</div>
|
||||
<Button
|
||||
theme='solid'
|
||||
loading={savingAvatarSettings}
|
||||
disabled={customAvatarInvalid}
|
||||
onClick={saveAvatarSettings}
|
||||
className='!bg-gradient-to-r !from-rose-500 !to-orange-400 !border-0 !rounded-xl !shadow-lg !shadow-rose-500/20'
|
||||
>
|
||||
{t('保存头像')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className='grid grid-cols-1 xl:grid-cols-[280px_1fr] gap-5'>
|
||||
<div className='relative overflow-hidden rounded-[28px] border border-white/70 dark:border-white/10 bg-white/[0.54] dark:bg-white/[0.045] p-5 shadow-[0_20px_55px_rgba(244,63,94,0.10)]'>
|
||||
<div className='absolute inset-0 bg-[radial-gradient(circle_at_25%_20%,rgba(251,113,133,0.22),transparent_32%),radial-gradient(circle_at_90%_85%,rgba(251,146,60,0.16),transparent_34%)] pointer-events-none' />
|
||||
<div className='relative flex flex-col items-center text-center'>
|
||||
<div className='relative mb-4'>
|
||||
<div className='absolute inset-0 rounded-[32px] bg-gradient-to-br from-rose-500 to-orange-400 blur-lg opacity-30' />
|
||||
<img
|
||||
src={previewUrl}
|
||||
alt={t('头像预览')}
|
||||
className='relative w-28 h-28 rounded-[32px] object-cover ring-4 ring-white/90 dark:ring-slate-950 shadow-xl'
|
||||
/>
|
||||
<span className='absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-emerald-500 border-4 border-white dark:border-slate-950' />
|
||||
</div>
|
||||
<div className='text-base font-semibold text-gray-900 dark:text-white'>
|
||||
{username}
|
||||
</div>
|
||||
<div className='mt-2 text-xs text-gray-500 dark:text-gray-400 leading-relaxed'>
|
||||
{t('该头像会同步展示在右上角用户入口和体验中心文本对话中。')}
|
||||
</div>
|
||||
<Tag
|
||||
color='pink'
|
||||
shape='circle'
|
||||
className='mt-4 !bg-white/70 dark:!bg-white/[0.08]'
|
||||
>
|
||||
{t('实时预览')}
|
||||
</Tag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='rounded-[28px] border border-white/70 dark:border-white/10 bg-white/50 dark:bg-white/[0.045] backdrop-blur-xl p-5'>
|
||||
<div className='mb-5'>
|
||||
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3'>
|
||||
{t('头像类型')}
|
||||
</label>
|
||||
<RadioGroup
|
||||
type='button'
|
||||
value={avatarSettings.avatarType}
|
||||
onChange={(e) =>
|
||||
handleAvatarSettingChange('avatarType', e.target.value)
|
||||
}
|
||||
className='!flex !flex-wrap !gap-2'
|
||||
>
|
||||
{AVATAR_TYPE_OPTIONS.map((option) => {
|
||||
const Icon = option.icon;
|
||||
return (
|
||||
<Radio key={option.value} value={option.value}>
|
||||
<span className='inline-flex items-center gap-1.5'>
|
||||
<Icon size={14} />
|
||||
{t(option.label)}
|
||||
</span>
|
||||
</Radio>
|
||||
);
|
||||
})}
|
||||
</RadioGroup>
|
||||
<p className='mt-2 text-xs text-gray-500 dark:text-gray-400'>
|
||||
{t(
|
||||
AVATAR_TYPE_OPTIONS.find(
|
||||
(item) => item.value === avatarSettings.avatarType,
|
||||
)?.desc || '',
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className='ui-avatar-editor'>
|
||||
<div className='ui-avatar-field-label'>{t('头像类型')}</div>
|
||||
<Segmented
|
||||
block
|
||||
value={avatarSettings.avatarType}
|
||||
onChange={(value) => handleAvatarSettingChange('avatarType', value)}
|
||||
options={AVATAR_TYPE_OPTIONS.map((option) => ({
|
||||
value: option.value,
|
||||
label: t(option.label),
|
||||
}))}
|
||||
/>
|
||||
{avatarSettings.avatarType === USER_AVATAR_TYPES.PRESET && (
|
||||
<div>
|
||||
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3'>
|
||||
<div className='ui-avatar-field'>
|
||||
<div className='ui-avatar-field-label ui-avatar-field-label-muted'>
|
||||
{t('选择卡通形象')}
|
||||
</label>
|
||||
<div className='grid grid-cols-2 sm:grid-cols-4 gap-3'>
|
||||
</div>
|
||||
<div className='ui-avatar-grid'>
|
||||
{CARTOON_AVATAR_PRESETS.map((preset) => {
|
||||
const selected = avatarSettings.avatarPreset === preset.id;
|
||||
return (
|
||||
<button
|
||||
key={preset.id}
|
||||
type='button'
|
||||
aria-pressed={selected}
|
||||
onClick={() => {
|
||||
handleAvatarSettingChange(
|
||||
'avatarType',
|
||||
@@ -180,25 +117,15 @@ const AvatarSection = ({
|
||||
);
|
||||
handleAvatarSettingChange('avatarPreset', preset.id);
|
||||
}}
|
||||
className={`group relative rounded-2xl border p-3 transition-all duration-200 ${
|
||||
selected
|
||||
? 'border-rose-300 bg-white/[0.82] dark:bg-white/[0.08] shadow-lg shadow-rose-500/10'
|
||||
: 'border-white/70 dark:border-white/10 bg-white/[0.46] dark:bg-white/[0.035] hover:border-rose-200 dark:hover:border-rose-400/25'
|
||||
}`}
|
||||
className={`ui-avatar-option ${selected ? 'selected' : ''}`}
|
||||
>
|
||||
<img
|
||||
src={getCartoonAvatarDataUrl(preset.id, 96)}
|
||||
alt={preset.label}
|
||||
className='mx-auto w-14 h-14 rounded-2xl object-cover transition-transform group-hover:scale-105'
|
||||
/>
|
||||
<div className='mt-2 text-xs font-medium text-gray-700 dark:text-gray-200 truncate'>
|
||||
{t(preset.label)}
|
||||
</div>
|
||||
<span>{t(preset.label)}</span>
|
||||
{selected && (
|
||||
<Sparkles
|
||||
size={16}
|
||||
className='absolute top-2 right-2 text-rose-500'
|
||||
/>
|
||||
<Check size={14} className='ui-avatar-check' />
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
@@ -206,28 +133,37 @@ const AvatarSection = ({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{avatarSettings.avatarType === USER_AVATAR_TYPES.INITIAL && (
|
||||
<div className='ui-avatar-field'>
|
||||
<div className='ui-avatar-field-label'>{t('显示文字')}</div>
|
||||
<AntInput
|
||||
readOnly
|
||||
value={initialText}
|
||||
className='ui-avatar-text-input'
|
||||
aria-label={t('显示文字')}
|
||||
/>
|
||||
<p className='ui-avatar-help'>
|
||||
{t('根据用户名自动生成简洁文字头像')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{avatarSettings.avatarType === USER_AVATAR_TYPES.CUSTOM && (
|
||||
<div className='rounded-2xl border border-sky-100 dark:border-sky-400/20 bg-sky-50/[0.55] dark:bg-sky-400/[0.06] p-4'>
|
||||
<div className='ui-avatar-field'>
|
||||
<div className='ui-avatar-field-label'>{t('图片链接')}</div>
|
||||
<Input
|
||||
className='ui-avatar-text-input'
|
||||
value={avatarSettings.customAvatarUrl}
|
||||
onChange={(value) =>
|
||||
handleAvatarSettingChange('customAvatarUrl', value)
|
||||
}
|
||||
placeholder={t(
|
||||
'请输入图片 URL,例如 https://example.com/avatar.png',
|
||||
)}
|
||||
prefix={<Image size={15} className='text-sky-500' />}
|
||||
placeholder='https://example.com/avatar.png'
|
||||
showClear
|
||||
/>
|
||||
<p className='mt-2 text-xs text-gray-500 dark:text-gray-400'>
|
||||
{t('支持公网图片链接。若图片加载失败,会回退到默认卡通头像。')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,11 +18,20 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useRef, useEffect } from 'react';
|
||||
import { Button, Form, Toast } from '@douyinfe/semi-ui';
|
||||
import { IconMail, IconKey, IconLink } from '@douyinfe/semi-icons';
|
||||
import { Bell, Mail, Save, Webhook } from 'lucide-react';
|
||||
import { Button, Form, Toast } from '@/components/ui';
|
||||
import { Check, Copy } from 'lucide-react';
|
||||
import { FormQuotaInput } from '../../../common/ui/QuotaInput';
|
||||
import CodeViewer from '../../../playground/CodeViewer';
|
||||
import { copy } from '../../../../helpers';
|
||||
import SectionHeader from '../components/SectionHeader';
|
||||
|
||||
// Webhook 请求结构示例(只读展示,与原 CodeViewer 展示的内容相同)
|
||||
const WEBHOOK_EXAMPLE = {
|
||||
type: 'quota_exceed',
|
||||
title: '额度预警通知',
|
||||
content: '您的额度即将用尽,当前剩余额度为 {{value}}',
|
||||
values: ['¥0.99'],
|
||||
timestamp: 1739950503,
|
||||
};
|
||||
|
||||
const NotificationSection = ({
|
||||
t,
|
||||
@@ -58,212 +67,164 @@ const NotificationSection = ({
|
||||
}
|
||||
};
|
||||
|
||||
// 复制示例:沿用原 CodeViewer 的复制方式与提示
|
||||
const handleCopyExample = async () => {
|
||||
try {
|
||||
const success = await copy(JSON.stringify(WEBHOOK_EXAMPLE, null, 2));
|
||||
Toast.success(t('已复制到剪贴板'));
|
||||
if (!success) {
|
||||
throw new Error('Copy operation failed');
|
||||
}
|
||||
} catch (err) {
|
||||
Toast.error(t('复制失败'));
|
||||
console.error('Copy failed:', err);
|
||||
}
|
||||
};
|
||||
|
||||
// 通知方式选项(仅保留邮件通知和Webhook)
|
||||
const notifyOptions = [
|
||||
{
|
||||
value: 'email',
|
||||
label: t('邮件提醒'),
|
||||
desc: t('发送到绑定邮箱或指定邮箱'),
|
||||
icon: Mail,
|
||||
selectedClass:
|
||||
'border-sky-300 bg-sky-50/82 dark:bg-sky-500/[0.10] dark:border-sky-400/25',
|
||||
iconClass: 'text-sky-500',
|
||||
textClass: 'text-sky-700 dark:text-sky-300',
|
||||
desc: t('发送到账户邮箱或指定邮箱'),
|
||||
},
|
||||
{
|
||||
value: 'webhook',
|
||||
label: 'Webhook',
|
||||
desc: t('将提醒推送到外部系统'),
|
||||
icon: Webhook,
|
||||
selectedClass:
|
||||
'border-amber-300 bg-amber-50/82 dark:bg-amber-500/[0.10] dark:border-amber-400/25',
|
||||
iconClass: 'text-amber-500',
|
||||
textClass: 'text-amber-700 dark:text-amber-300',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='space-y-6'>
|
||||
{/* 页面标题 */}
|
||||
<div className='flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 rounded-3xl border border-white/70 dark:border-white/10 bg-white/50 dark:bg-white/[0.045] backdrop-blur-xl px-5 py-4'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='w-11 h-11 rounded-2xl bg-gradient-to-br from-amber-500 to-yellow-400 flex items-center justify-center shadow-lg shadow-amber-500/20'>
|
||||
<Bell className='w-5 h-5 text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-xl font-bold text-gray-900 dark:text-white'>
|
||||
{t('通知设置')}
|
||||
</h2>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400'>
|
||||
{t('设置额度预警和系统提醒接收方式')}
|
||||
</p>
|
||||
<div className='ui-notify-section'>
|
||||
<SectionHeader
|
||||
title={t('通知设置')}
|
||||
description={t('设置额度预警和系统提醒接收方式')}
|
||||
extra={
|
||||
<Button theme='solid' onClick={handleSubmit}>
|
||||
{t('保存设置')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
<Form
|
||||
className='ui-notify-form'
|
||||
requiredMark={false}
|
||||
getFormApi={(api) => (formApiRef.current = api)}
|
||||
initValues={notificationSettings}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
{/* 通知方式选择 */}
|
||||
<div className='ui-notify-methods-field'>
|
||||
<div className='ui-notify-label'>{t('通知方式')}</div>
|
||||
<div className='ui-notify-methods'>
|
||||
{notifyOptions.map((option) => {
|
||||
const isSelected =
|
||||
notificationSettings.warningType === option.value;
|
||||
return (
|
||||
<button
|
||||
key={option.value}
|
||||
type='button'
|
||||
aria-pressed={isSelected}
|
||||
onClick={() => handleFormChange('warningType', option.value)}
|
||||
className={`ui-notify-method ${isSelected ? 'selected' : ''}`}
|
||||
>
|
||||
<span className='ui-notify-method-text'>
|
||||
<strong>{option.label}</strong>
|
||||
<span>{option.desc}</span>
|
||||
</span>
|
||||
{isSelected && (
|
||||
<Check size={16} className='ui-notify-method-check' />
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
theme='solid'
|
||||
onClick={handleSubmit}
|
||||
icon={<Save size={15} />}
|
||||
className='!bg-gradient-to-r !from-amber-500 !to-yellow-400 !border-0 !rounded-xl !shadow-lg !shadow-amber-500/20'
|
||||
>
|
||||
{t('保存设置')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* 表单内容 */}
|
||||
<div className='bg-white/50 dark:bg-white/[0.045] backdrop-blur-xl rounded-[28px] border border-white/70 dark:border-white/10 p-5 sm:p-6'>
|
||||
<Form
|
||||
getFormApi={(api) => (formApiRef.current = api)}
|
||||
initValues={notificationSettings}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
{/* 通知方式选择 */}
|
||||
<div className='mb-6'>
|
||||
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3'>
|
||||
{t('通知方式')}
|
||||
</label>
|
||||
<div className='grid grid-cols-1 sm:grid-cols-2 gap-3'>
|
||||
{notifyOptions.map((option) => {
|
||||
const Icon = option.icon;
|
||||
const isSelected =
|
||||
notificationSettings.warningType === option.value;
|
||||
return (
|
||||
<button
|
||||
key={option.value}
|
||||
type='button'
|
||||
onClick={() =>
|
||||
handleFormChange('warningType', option.value)
|
||||
}
|
||||
className={`p-4 rounded-2xl border transition-all text-left ${
|
||||
isSelected
|
||||
? option.selectedClass
|
||||
: 'border-white/70 dark:border-white/10 bg-white/48 dark:bg-white/[0.035] hover:bg-white/72 dark:hover:bg-white/[0.07]'
|
||||
}`}
|
||||
>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='w-10 h-10 rounded-2xl bg-white/70 dark:bg-white/[0.07] flex items-center justify-center'>
|
||||
<Icon
|
||||
size={20}
|
||||
className={isSelected ? option.iconClass : 'text-gray-400'}
|
||||
/>
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<div
|
||||
className={`text-sm font-semibold ${
|
||||
isSelected
|
||||
? option.textClass
|
||||
: 'text-gray-700 dark:text-gray-200'
|
||||
}`}
|
||||
>
|
||||
{option.label}
|
||||
</div>
|
||||
<div className='mt-0.5 text-xs text-gray-500 dark:text-gray-400 truncate'>
|
||||
{option.desc}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 预警阈值 */}
|
||||
<FormQuotaInput
|
||||
field='warningThreshold'
|
||||
label={t('额度预警阈值')}
|
||||
onChange={(val) => handleFormChange('warningThreshold', val)}
|
||||
extraText={t(
|
||||
'当剩余额度低于此数值时,系统将通过选择的方式发送通知',
|
||||
)}
|
||||
style={{ maxWidth: '320px', width: '100%' }}
|
||||
rules={[
|
||||
{ required: true, message: t('请输入预警阈值') },
|
||||
{
|
||||
validator: (rule, value) => {
|
||||
const numValue = Number(value);
|
||||
if (isNaN(numValue) || numValue <= 0) {
|
||||
return Promise.reject(t('预警阈值必须为正数'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
{/* 预警阈值 */}
|
||||
<FormQuotaInput
|
||||
field='warningThreshold'
|
||||
label={t('额度预警阈值')}
|
||||
onChange={(val) => handleFormChange('warningThreshold', val)}
|
||||
extraText={t('当剩余额度低于此数值时,通过所选方式发送通知')}
|
||||
style={{ width: 260, maxWidth: '100%' }}
|
||||
rules={[
|
||||
{ required: true, message: t('请输入预警阈值') },
|
||||
{
|
||||
validator: (rule, value) => {
|
||||
const numValue = Number(value);
|
||||
if (isNaN(numValue) || numValue <= 0) {
|
||||
return Promise.reject(t('预警阈值必须为正数'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
]}
|
||||
/>
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
{/* 邮件通知设置 */}
|
||||
{notificationSettings.warningType === 'email' && (
|
||||
<div className='mt-4 p-4 bg-sky-50/55 dark:bg-sky-500/[0.07] rounded-2xl border border-sky-100 dark:border-sky-400/20'>
|
||||
<Form.Input
|
||||
field='notificationEmail'
|
||||
label={t('通知邮箱')}
|
||||
placeholder={t('留空则使用账号绑定的邮箱')}
|
||||
onChange={(val) => handleFormChange('notificationEmail', val)}
|
||||
prefix={<IconMail />}
|
||||
extraText={t(
|
||||
'设置用于接收额度预警的邮箱地址,不填则使用账号绑定的邮箱',
|
||||
)}
|
||||
showClear
|
||||
/>
|
||||
{/* 邮件通知设置 */}
|
||||
{notificationSettings.warningType === 'email' && (
|
||||
<div className='ui-notify-panel'>
|
||||
<Form.Input
|
||||
field='notificationEmail'
|
||||
label={t('通知邮箱')}
|
||||
placeholder={t('留空则使用账号绑定的邮箱')}
|
||||
onChange={(val) => handleFormChange('notificationEmail', val)}
|
||||
extraText={t('不填写则使用账号绑定的邮箱')}
|
||||
showClear
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Webhook通知设置 */}
|
||||
{notificationSettings.warningType === 'webhook' && (
|
||||
<div className='ui-notify-panel'>
|
||||
<Form.Input
|
||||
field='webhookUrl'
|
||||
label={t('Webhook 地址')}
|
||||
placeholder='https://example.com/webhook'
|
||||
onChange={(val) => handleFormChange('webhookUrl', val)}
|
||||
extraText={t('仅支持 HTTPS,系统以 POST 方式发送通知')}
|
||||
showClear
|
||||
rules={[
|
||||
{
|
||||
required: notificationSettings.warningType === 'webhook',
|
||||
message: t('请输入Webhook地址'),
|
||||
},
|
||||
{
|
||||
pattern: /^https:\/\/.+/,
|
||||
message: t('Webhook地址必须以https://开头'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<Form.Input
|
||||
field='webhookSecret'
|
||||
label={t('接口凭证')}
|
||||
mode='password'
|
||||
placeholder={t('请输入密钥')}
|
||||
onChange={(val) => handleFormChange('webhookSecret', val)}
|
||||
extraText={t('密钥以 Bearer 方式添加到请求头中')}
|
||||
/>
|
||||
|
||||
<div className='ui-notify-code-head'>
|
||||
<span>{t('Webhook 请求结构说明')}</span>
|
||||
<button
|
||||
type='button'
|
||||
className='ui-notify-copy'
|
||||
onClick={handleCopyExample}
|
||||
>
|
||||
{t('复制')}
|
||||
<Copy size={14} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Webhook通知设置 */}
|
||||
{notificationSettings.warningType === 'webhook' && (
|
||||
<div className='mt-4 p-4 bg-amber-50/55 dark:bg-amber-500/[0.07] rounded-2xl border border-amber-100 dark:border-amber-400/20 space-y-4'>
|
||||
<Form.Input
|
||||
field='webhookUrl'
|
||||
label={t('Webhook地址')}
|
||||
placeholder={t(
|
||||
'请输入Webhook地址,例如: https://example.com/webhook',
|
||||
)}
|
||||
onChange={(val) => handleFormChange('webhookUrl', val)}
|
||||
prefix={<IconLink />}
|
||||
extraText={t('只支持HTTPS,系统将以POST方式发送通知')}
|
||||
showClear
|
||||
rules={[
|
||||
{
|
||||
required: notificationSettings.warningType === 'webhook',
|
||||
message: t('请输入Webhook地址'),
|
||||
},
|
||||
{
|
||||
pattern: /^https:\/\/.+/,
|
||||
message: t('Webhook地址必须以https://开头'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<Form.Input
|
||||
field='webhookSecret'
|
||||
label={t('接口凭证')}
|
||||
placeholder={t('请输入密钥')}
|
||||
onChange={(val) => handleFormChange('webhookSecret', val)}
|
||||
prefix={<IconKey />}
|
||||
extraText={t('密钥将以Bearer方式添加到请求头中')}
|
||||
showClear
|
||||
/>
|
||||
|
||||
<div>
|
||||
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2'>
|
||||
{t('Webhook请求结构说明')}
|
||||
</label>
|
||||
<div style={{ height: '180px' }}>
|
||||
<CodeViewer
|
||||
content={{
|
||||
type: 'quota_exceed',
|
||||
title: '额度预警通知',
|
||||
content: '您的额度即将用尽,当前剩余额度为 {{value}}',
|
||||
values: ['¥0.99'],
|
||||
timestamp: 1739950503,
|
||||
}}
|
||||
title='webhook'
|
||||
language='json'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Form>
|
||||
</div>
|
||||
<pre className='ui-notify-code'>
|
||||
{JSON.stringify(WEBHOOK_EXAMPLE, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Switch } from '@douyinfe/semi-ui';
|
||||
import { Button, Switch } from '@/components/ui';
|
||||
import { Lock, Eye, DollarSign, MapPin } from 'lucide-react';
|
||||
|
||||
const PrivacySection = ({
|
||||
|
||||
@@ -18,9 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Modal } from '@douyinfe/semi-ui';
|
||||
import { IconLock, IconDelete } from '@douyinfe/semi-icons';
|
||||
import { Shield, Lock, Fingerprint, Trash2, AlertTriangle } from 'lucide-react';
|
||||
import { Button, Modal } from '@/components/ui';
|
||||
import { AlertTriangle } from 'lucide-react';
|
||||
import SectionHeader from '../components/SectionHeader';
|
||||
|
||||
const SecuritySection = ({
|
||||
t,
|
||||
@@ -40,64 +40,30 @@ const SecuritySection = ({
|
||||
? new Date(passkeyStatus.last_used_at).toLocaleString()
|
||||
: t('尚未使用');
|
||||
|
||||
// 安全设置卡片
|
||||
const SecurityCard = ({
|
||||
icon: Icon,
|
||||
gradient,
|
||||
title,
|
||||
description,
|
||||
children,
|
||||
danger = false,
|
||||
}) => (
|
||||
// 安全设置行卡:标题 + 说明 + 右侧操作(原型无图标与渐变底)
|
||||
const SecurityRow = ({ title, description, children, extra, danger }) => (
|
||||
<div
|
||||
className={`p-5 rounded-[24px] border backdrop-blur-xl transition-all ${
|
||||
danger
|
||||
? 'bg-gradient-to-br from-red-50/70 to-rose-50/60 dark:from-red-500/[0.09] dark:to-rose-500/[0.07] border-red-100/80 dark:border-red-400/20'
|
||||
: 'bg-white/54 dark:bg-white/[0.045] border-white/70 dark:border-white/10'
|
||||
} hover:shadow-[0_18px_50px_rgba(15,23,42,0.10)]`}
|
||||
className={`ui-settings-row ${danger ? 'ui-settings-row-danger' : ''}`}
|
||||
>
|
||||
<div className='flex items-start gap-4'>
|
||||
<div
|
||||
className={`w-12 h-12 rounded-2xl flex items-center justify-center bg-gradient-to-br ${gradient} shadow-lg flex-shrink-0`}
|
||||
>
|
||||
<Icon className='w-6 h-6 text-white' />
|
||||
</div>
|
||||
<div className='flex-1 min-w-0'>
|
||||
<h3 className='font-semibold text-gray-900 dark:text-white mb-1'>
|
||||
{title}
|
||||
</h3>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400 mb-4'>
|
||||
{description}
|
||||
</p>
|
||||
{children}
|
||||
</div>
|
||||
<div className='ui-settings-row-text'>
|
||||
<h3>{title}</h3>
|
||||
<p>{description}</p>
|
||||
{extra}
|
||||
</div>
|
||||
<div className='ui-settings-row-actions'>{children}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className='space-y-6'>
|
||||
{/* 页面标题 */}
|
||||
<div className='flex items-center gap-3 rounded-3xl border border-white/70 dark:border-white/10 bg-white/50 dark:bg-white/[0.045] backdrop-blur-xl px-5 py-4'>
|
||||
<div className='w-11 h-11 rounded-2xl bg-gradient-to-br from-emerald-500 to-teal-400 flex items-center justify-center shadow-lg shadow-emerald-500/20'>
|
||||
<Shield className='w-5 h-5 text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-xl font-bold text-gray-900 dark:text-white'>
|
||||
{t('安全设置')}
|
||||
</h2>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400'>
|
||||
{t('集中管理密码和免密登录')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='ui-security-section'>
|
||||
<SectionHeader
|
||||
title={t('安全设置')}
|
||||
description={t('管理账户密码与账户状态')}
|
||||
/>
|
||||
|
||||
{/* 安全设置卡片列表 */}
|
||||
<div className='space-y-4'>
|
||||
<div className='ui-settings-rows'>
|
||||
{/* 密码管理 */}
|
||||
<SecurityCard
|
||||
icon={Lock}
|
||||
gradient='from-blue-500 to-brand-to'
|
||||
<SecurityRow
|
||||
title={t('密码管理')}
|
||||
description={
|
||||
hasPassword
|
||||
@@ -105,48 +71,35 @@ const SecuritySection = ({
|
||||
: t('设置密码后可使用账号密码登录')
|
||||
}
|
||||
>
|
||||
<Button
|
||||
theme='solid'
|
||||
onClick={() => setShowChangePasswordModal(true)}
|
||||
className='!bg-gradient-to-r !from-blue-500 !to-brand-to !border-0 !rounded-lg'
|
||||
icon={<IconLock />}
|
||||
>
|
||||
<Button onClick={() => setShowChangePasswordModal(true)}>
|
||||
{hasPassword ? t('修改密码') : t('设置密码')}
|
||||
</Button>
|
||||
</SecurityCard>
|
||||
</SecurityRow>
|
||||
|
||||
{/* Passkey 登录 - 仅管理员启用时显示 */}
|
||||
{status.passkey_login && (
|
||||
<SecurityCard
|
||||
icon={Fingerprint}
|
||||
gradient={
|
||||
passkeyEnabled
|
||||
? 'from-emerald-500 to-teal-500'
|
||||
: 'from-brand-from to-pink-500'
|
||||
}
|
||||
<SecurityRow
|
||||
title={t('Passkey 登录')}
|
||||
description={
|
||||
passkeyEnabled
|
||||
? t('已启用 Passkey,无需密码即可登录')
|
||||
: t('使用 Passkey 实现免密且更安全的登录体验')
|
||||
}
|
||||
extra={
|
||||
<>
|
||||
<p className='ui-settings-row-meta'>
|
||||
{t('最后使用时间')}:{lastUsedLabel}
|
||||
</p>
|
||||
{!passkeySupported && (
|
||||
<p className='ui-settings-row-warning'>
|
||||
<AlertTriangle size={14} />
|
||||
{t('当前设备不支持 Passkey')}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className='mb-4 space-y-2'>
|
||||
<div className='flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400'>
|
||||
<span>{t('最后使用时间')}:</span>
|
||||
<span className='font-medium text-gray-700 dark:text-gray-300'>
|
||||
{lastUsedLabel}
|
||||
</span>
|
||||
</div>
|
||||
{!passkeySupported && (
|
||||
<div className='flex items-center gap-2 text-sm text-amber-600 dark:text-amber-400'>
|
||||
<AlertTriangle size={14} />
|
||||
{t('当前设备不支持 Passkey')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Button
|
||||
theme='solid'
|
||||
type={passkeyEnabled ? 'danger' : 'primary'}
|
||||
onClick={
|
||||
passkeyEnabled
|
||||
@@ -164,11 +117,6 @@ const SecuritySection = ({
|
||||
}
|
||||
: onPasskeyRegister
|
||||
}
|
||||
className={`!rounded-lg ${
|
||||
passkeyEnabled
|
||||
? '!bg-gradient-to-r !from-red-500 !to-rose-500 !border-0'
|
||||
: '!bg-gradient-to-r !from-brand-from !to-pink-500 !border-0'
|
||||
}`}
|
||||
disabled={!passkeySupported && !passkeyEnabled}
|
||||
loading={
|
||||
passkeyEnabled ? passkeyDeleteLoading : passkeyRegisterLoading
|
||||
@@ -176,27 +124,19 @@ const SecuritySection = ({
|
||||
>
|
||||
{passkeyEnabled ? t('解绑 Passkey') : t('注册 Passkey')}
|
||||
</Button>
|
||||
</SecurityCard>
|
||||
</SecurityRow>
|
||||
)}
|
||||
|
||||
{/* 危险区域 - 删除账户 */}
|
||||
<SecurityCard
|
||||
icon={Trash2}
|
||||
gradient='from-red-500 to-rose-500'
|
||||
<SecurityRow
|
||||
title={t('删除账户')}
|
||||
description={t('此操作不可逆,所有数据将被永久删除')}
|
||||
danger
|
||||
>
|
||||
<Button
|
||||
type='danger'
|
||||
theme='solid'
|
||||
onClick={() => setShowAccountDeleteModal(true)}
|
||||
className='!bg-gradient-to-r !from-red-500 !to-rose-500 !border-0 !rounded-lg'
|
||||
icon={<IconDelete />}
|
||||
>
|
||||
<Button type='danger' onClick={() => setShowAccountDeleteModal(true)}>
|
||||
{t('删除账户')}
|
||||
</Button>
|
||||
</SecurityCard>
|
||||
</SecurityRow>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect, useContext } from 'react';
|
||||
import { Button, Switch, Row, Col } from '@douyinfe/semi-ui';
|
||||
import { Button, Switch, Row, Col } from '@/components/ui';
|
||||
import {
|
||||
LayoutGrid,
|
||||
MessageSquare,
|
||||
|
||||
Reference in New Issue
Block a user