fix(ui): 修复登录与并发请求并统一表格、主题和页面展示

验证:868 项单测、ESLint、Prettier、UI 依赖审计和差异检查通过。
This commit is contained in:
zhanjunhao
2026-11-19 18:58:46 +08:00
parent 9f5e0cddfb
commit e70e0d2224
128 changed files with 4672 additions and 5391 deletions
+167 -645
View File
@@ -1,673 +1,195 @@
/*
Copyright (C) 2025 QuantumNous
/* Copyright (C) 2025 QuantumNous */
Video Tutorial Component Styles
*/
/* ===== 容器 ===== */
.video-tutorial {
.tutorial-container .video-tutorial {
display: grid;
grid-template-columns: minmax(0, 1fr) 300px;
gap: 24px;
align-items: start;
}
.video-player-section,
.video-list-section {
min-width: 0;
}
.tutorial-container .video-player-card {
border: 1px solid var(--tt-border);
border-radius: 12px;
overflow: hidden;
box-shadow: none;
}
.video-player-card > .ant-card-body {
padding: 0;
}
.video-player-wrapper {
aspect-ratio: 16 / 9;
background: var(--tt-muted);
display: flex;
flex-direction: column;
gap: 28px;
align-items: center;
justify-content: center;
}
.video-player {
display: block;
width: 100%;
height: 100%;
aspect-ratio: 16 / 9;
object-fit: contain;
}
.video-info {
padding: 24px;
}
.video-info h4.ant-typography {
margin: 0 0 8px;
font-size: 20px;
}
.video-description {
line-height: 1.7;
overflow-wrap: anywhere;
}
.video-meta {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.video-meta-item {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--tt-secondary);
font-size: 12px;
}
.video-list {
display: grid;
gap: 12px;
}
.video-list-section h5.ant-typography {
margin: 0 0 16px;
font-size: 16px;
}
.video-list-item {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
padding: 12px;
text-align: left;
font: inherit;
color: var(--tt-text);
background: var(--tt-surface);
border: 1px solid var(--tt-border);
border-radius: 8px;
cursor: pointer;
}
.video-list-item:hover,
.video-list-item.active {
border-color: var(--tt-accent);
background: var(--tt-soft);
}
.video-list-thumbnail {
position: relative;
width: 88px;
aspect-ratio: 16 / 10;
flex-shrink: 0;
border-radius: 6px;
background: var(--tt-muted);
overflow: hidden;
}
/* 装饰性背景元素 */
.video-tutorial::before {
content: '';
.video-list-thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
}
.video-thumbnail-placeholder {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
color: var(--tt-accent);
}
.video-list-index {
position: absolute;
top: -20px;
right: -20px;
width: 200px;
height: 200px;
background: radial-gradient(
circle,
color-mix(in srgb, var(--brand-primary) 8%, transparent) 0%,
transparent 70%
);
border-radius: 50%;
pointer-events: none;
z-index: -1;
top: 3px;
left: 4px;
font-size: 10px;
padding: 0 4px;
border-radius: 3px;
background: var(--tt-surface);
color: var(--tt-text);
}
.video-tutorial::after {
content: '';
.video-list-duration {
position: absolute;
bottom: 20%;
left: -30px;
width: 150px;
height: 150px;
background: radial-gradient(
circle,
rgba(236, 72, 153, 0.06) 0%,
transparent 70%
);
border-radius: 50%;
pointer-events: none;
z-index: -1;
bottom: 3px;
right: 4px;
font-size: 10px;
padding: 0 4px;
border-radius: 3px;
background: var(--tt-surface);
color: var(--tt-text);
}
.video-list-info {
display: grid;
gap: 4px;
min-width: 0;
}
.video-list-name {
font-size: 13px;
}
.video-list-desc {
font-size: 12px;
}
.video-tips {
grid-column: 1 / -1;
}
.tutorial-container .video-tips-card {
background: var(--tt-muted);
border: 1px solid var(--tt-border);
border-radius: 8px;
box-shadow: none;
}
.video-tips-content {
display: flex;
align-items: flex-start;
gap: 12px;
}
.video-tutorial-loading,
.video-tutorial-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 450px;
text-align: center;
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 3%, transparent),
color-mix(in srgb, var(--brand-gradient-via) 3%, transparent)
);
border-radius: 24px;
border: 2px dashed color-mix(in srgb, var(--brand-primary) 20%, transparent);
}
/* ===== 视频播放器区域 ===== */
.video-player-section {
width: 100%;
}
.video-player-card {
border-radius: 16px !important;
overflow: hidden;
border: 1px solid var(--ui-color-border) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.video-player-wrapper {
position: relative;
width: 100%;
padding-top: 56.25%; /* 16:9 宽高比 */
background: #000;
}
.video-player {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: contain;
}
/* 视频错误状态 */
.video-error {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20px;
background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
color: white;
z-index: 5;
}
@keyframes errorPulse {
0%,
100% {
opacity: 0.4;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(1.05);
}
}
.video-retry-btn {
padding: 12px 32px;
background: linear-gradient(
135deg,
var(--brand-primary),
var(--brand-gradient-via)
);
border: none;
border-radius: 14px;
color: white;
font-weight: 600;
font-size: 14px;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
overflow: hidden;
}
.video-retry-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.3),
transparent
);
transition: left 0.5s ease;
}
.video-retry-btn:hover::before {
left: 100%;
}
.video-retry-btn:hover {
transform: translateY(-3px) scale(1.02);
box-shadow: 0 12px 28px
color-mix(in srgb, var(--brand-primary) 50%, transparent);
}
/* 视频信息 */
.video-info {
padding: 28px;
background: linear-gradient(
135deg,
rgba(255, 255, 255, 0.8),
rgba(255, 255, 255, 0.6)
);
backdrop-filter: blur(10px);
position: relative;
}
.video-info::before {
content: '🎬';
position: absolute;
top: 24px;
right: 24px;
font-size: 32px;
opacity: 0.15;
}
.video-title {
margin-bottom: 10px !important;
color: var(--ui-color-text-0);
font-size: 20px !important;
font-weight: 600 !important;
background: linear-gradient(135deg, #1a1a2e, #374151);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.video-description {
margin-bottom: 18px;
line-height: 1.7;
color: var(--ui-color-text-1);
}
.video-meta {
display: flex;
gap: 24px;
flex-wrap: wrap;
}
.video-meta-item {
display: flex;
align-items: center;
gap: 8px;
color: var(--ui-color-text-2);
font-size: 13px;
padding: 6px 14px;
background: color-mix(in srgb, var(--brand-primary) 6%, transparent);
border-radius: 20px;
transition: all 0.3s ease;
}
.video-meta-item:hover {
background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
transform: translateY(-1px);
}
/* ===== 视频列表 ===== */
.video-list-section {
width: 100%;
position: relative;
}
.video-list-title {
margin-bottom: 20px !important;
padding-left: 8px;
display: flex;
align-items: center;
gap: 10px;
font-size: 18px !important;
}
.video-list-title::before {
content: '';
width: 4px;
height: 20px;
background: linear-gradient(
135deg,
var(--brand-primary),
var(--brand-gradient-via)
);
border-radius: 2px;
}
.video-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 18px;
}
.video-list-item {
display: flex;
gap: 16px;
padding: 16px;
background: linear-gradient(
135deg,
rgba(255, 255, 255, 0.9),
rgba(255, 255, 255, 0.7)
);
backdrop-filter: blur(10px);
border: 2px solid color-mix(in srgb, var(--brand-primary) 10%, transparent);
border-radius: 18px;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
overflow: hidden;
}
/* 列表项悬停装饰 */
.video-list-item::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 4px;
height: 100%;
background: linear-gradient(
135deg,
var(--brand-primary),
var(--brand-gradient-via)
);
transform: scaleY(0);
transition: transform 0.3s ease;
border-radius: 0 4px 4px 0;
}
.video-list-item:hover::before {
transform: scaleY(1);
}
.video-list-item:hover {
background: linear-gradient(
135deg,
rgba(255, 255, 255, 0.95),
rgba(249, 250, 251, 0.9)
);
border-color: color-mix(in srgb, var(--brand-primary) 25%, transparent);
transform: translateY(-4px) translateX(4px);
box-shadow:
0 12px 32px color-mix(in srgb, var(--brand-primary) 12%, transparent),
0 4px 12px rgba(0, 0, 0, 0.06);
}
.video-list-item.active {
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 12%, transparent),
color-mix(in srgb, var(--brand-gradient-via) 8%, transparent)
);
border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent);
box-shadow:
0 8px 24px color-mix(in srgb, var(--brand-primary) 20%, transparent),
inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.video-list-item.active::before {
transform: scaleY(1);
background: linear-gradient(135deg, var(--brand-primary), #ec4899);
}
/* 正在播放标识 */
.video-list-item.active::after {
content: '▶';
position: absolute;
top: 8px;
right: 8px;
width: 24px;
height: 24px;
background: linear-gradient(
135deg,
var(--brand-primary),
var(--brand-gradient-via)
);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
color: white;
animation: playingPulse 1.5s ease-in-out infinite;
}
@keyframes playingPulse {
0%,
100% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.1);
opacity: 0.8;
}
}
.video-list-thumbnail {
position: relative;
width: 110px;
height: 66px;
flex-shrink: 0;
padding: 56px 24px;
border: 1px solid var(--tt-border);
border-radius: 12px;
overflow: hidden;
background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
background: var(--tt-surface);
text-align: center;
}
.video-list-thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.4s ease;
}
.video-list-item:hover .video-list-thumbnail img {
transform: scale(1.08);
}
.video-thumbnail-placeholder {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.4);
font-size: 24px;
}
.video-list-index {
position: absolute;
top: 6px;
left: 6px;
width: 22px;
height: 22px;
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 90%, transparent),
color-mix(in srgb, var(--brand-gradient-via) 90%, transparent)
);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 11px;
font-weight: 700;
color: white;
box-shadow: 0 2px 8px
color-mix(in srgb, var(--brand-primary) 40%, transparent);
}
.video-list-duration {
position: absolute;
bottom: 6px;
right: 6px;
padding: 3px 8px;
background: rgba(0, 0, 0, 0.85);
border-radius: 6px;
font-size: 11px;
font-weight: 500;
color: white;
letter-spacing: 0.5px;
}
.video-list-info {
flex: 1;
min-width: 0;
.video-error {
display: flex;
flex-direction: column;
justify-content: center;
gap: 6px;
align-items: center;
gap: 12px;
padding: 24px;
text-align: center;
}
.video-list-name {
line-height: 1.5;
font-weight: 600 !important;
color: var(--ui-color-text-0) !important;
transition: color 0.3s ease;
}
.video-list-item:hover .video-list-name {
color: var(--brand-primary) !important;
}
.video-list-item.active .video-list-name {
color: var(--brand-primary) !important;
}
.video-list-desc {
line-height: 1.4;
font-size: 12px;
}
/* ===== 提示卡片 ===== */
.video-tips {
margin-top: 8px;
}
.video-tips-card {
border-radius: 20px !important;
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 6%, transparent),
color-mix(in srgb, var(--brand-gradient-via) 6%, transparent),
rgba(236, 72, 153, 0.04)
) !important;
border: 2px solid color-mix(in srgb, var(--brand-primary) 15%, transparent) !important;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
}
.video-tips-card:hover {
border-color: color-mix(
in srgb,
var(--brand-primary) 25%,
transparent
) !important;
transform: translateY(-2px);
box-shadow: 0 8px 24px
color-mix(in srgb, var(--brand-primary) 10%, transparent);
}
.video-tips-card::before {
content: '';
position: absolute;
top: -50%;
right: -10%;
width: 200px;
height: 200px;
background: radial-gradient(
circle,
color-mix(in srgb, var(--brand-primary) 8%, transparent) 0%,
transparent 70%
);
pointer-events: none;
}
.video-tips-content {
display: flex;
align-items: flex-start;
gap: 18px;
position: relative;
z-index: 1;
}
.video-tips-icon {
font-size: 32px;
line-height: 1;
animation: tipBounce 2s ease-in-out infinite;
}
@keyframes tipBounce {
0%,
100% {
transform: translateY(0);
@media (max-width: 1000px) {
.tutorial-container .video-tutorial {
grid-template-columns: minmax(0, 1fr);
}
50% {
transform: translateY(-4px);
}
}
.video-tips-content strong {
color: var(--brand-primary);
font-size: 15px;
}
/* ===== 响应式 ===== */
@media (max-width: 768px) {
.video-tutorial::before,
.video-tutorial::after {
display: none;
}
.video-list {
grid-template-columns: 1fr;
gap: 12px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.video-list-item {
padding: 14px;
border-radius: 14px;
}
@media (max-width: 600px) {
.video-list {
grid-template-columns: minmax(0, 1fr);
}
.video-list-thumbnail {
width: 90px;
height: 54px;
border-radius: 10px;
}
.video-info {
padding: 20px;
padding: 16px;
}
.video-info::before {
display: none;
.video-info h4.ant-typography {
font-size: 18px;
}
.video-title {
font-size: 17px !important;
}
.video-player-card {
border-radius: 18px !important;
}
.video-tips-content {
gap: 14px;
}
.video-tips-icon {
font-size: 26px;
.video-tutorial-loading,
.video-tutorial-empty {
padding: 40px 16px;
}
}
/* ===== 深色模式 ===== */
html.dark .video-tutorial-loading,
html.dark .video-tutorial-empty {
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 5%, transparent),
color-mix(in srgb, var(--brand-gradient-via) 5%, transparent)
);
border-color: color-mix(in srgb, var(--brand-primary) 15%, transparent);
}
html.dark .video-player-card {
background: var(--ui-color-bg-1);
border-color: color-mix(
in srgb,
var(--brand-primary) 20%,
transparent
) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
html.dark .video-info {
background: linear-gradient(
135deg,
rgba(30, 30, 40, 0.8),
rgba(25, 25, 35, 0.6)
);
}
html.dark .video-title {
background: linear-gradient(135deg, #e5e7eb, #d1d5db);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
html.dark .video-meta-item {
background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
}
html.dark .video-meta-item:hover {
background: color-mix(in srgb, var(--brand-primary) 20%, transparent);
}
html.dark .video-list-item {
background: linear-gradient(
135deg,
rgba(30, 30, 40, 0.9),
rgba(25, 25, 35, 0.7)
);
border-color: color-mix(in srgb, var(--brand-primary) 15%, transparent);
}
html.dark .video-list-item:hover {
background: linear-gradient(
135deg,
rgba(40, 40, 55, 0.9),
rgba(35, 35, 50, 0.8)
);
border-color: color-mix(in srgb, var(--brand-primary) 30%, transparent);
box-shadow:
0 12px 32px rgba(0, 0, 0, 0.3),
0 4px 12px rgba(0, 0, 0, 0.2);
}
html.dark .video-list-item.active {
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 18%, transparent),
color-mix(in srgb, var(--brand-gradient-via) 15%, transparent)
);
border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent);
}
html.dark .video-tips-card {
background: linear-gradient(
135deg,
color-mix(in srgb, var(--brand-primary) 10%, transparent),
color-mix(in srgb, var(--brand-gradient-via) 10%, transparent)
) !important;
border-color: color-mix(
in srgb,
var(--brand-primary) 25%,
transparent
) !important;
}
html.dark .video-tips-content strong {
color: var(--brand-gradient-from);
}
+16 -12
View File
@@ -21,7 +21,8 @@ import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
import React, { useState, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { Typography, Card, Empty, Spin, Toast } from '@/components/ui';
import { Typography, Card, Spin, Toast } from '@/components/ui';
import { Button, Empty } from 'antd';
import { IconPlayCircle, IconClock, IconFile } from '@/components/ui/icons';
import { API } from '../../../helpers';
import './VideoTutorial.css';
@@ -114,14 +115,15 @@ const VideoTutorial = () => {
return (
<div className='video-tutorial-empty'>
<Empty
image={
<IconPlayCircle
size='extra-large'
style={{ fontSize: 64, color: 'var(--ui-color-text-3)' }}
/>
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={
<>
<Title heading={5}>{t('暂无视频教程')}</Title>
<Paragraph type='secondary'>
{t('管理员还没有上传视频教程,请查看图文教程')}
</Paragraph>
</>
}
title={t('暂无视频教程')}
description={t('管理员还没有上传视频教程,请查看图文教程')}
/>
</div>
);
@@ -139,12 +141,12 @@ const VideoTutorial = () => {
<div className='video-error'>
<IconPlayCircle size='extra-large' />
<Text type='danger'>{t('视频加载失败')}</Text>
<button
<Button
className='video-retry-btn'
onClick={refreshVideoUrl}
>
{t('点击重试')}
</button>
</Button>
</div>
) : (
<video
@@ -200,9 +202,11 @@ const VideoTutorial = () => {
</Title>
<div className='video-list'>
{videos.map((video, index) => (
<div
<button
type='button'
key={video.id}
className={`video-list-item ${currentVideo?.id === video.id ? 'active' : ''}`}
aria-pressed={currentVideo?.id === video.id}
onClick={() => handleSelectVideo(video)}
>
<div className='video-list-thumbnail'>
@@ -239,7 +243,7 @@ const VideoTutorial = () => {
</Text>
)}
</div>
</div>
</button>
))}
</div>
</div>
+63 -74
View File
@@ -19,9 +19,11 @@ For commercial licensing, please contact support@quantumnous.com
import { Trans } from 'react-i18next';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import React, { useState, useContext, useRef } from 'react';
import React, { useState, useContext, useRef, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { Link, useNavigate, useSearchParams } from 'react-router-dom';
import { Button as AntButton, Tooltip } from 'antd';
import { X as ActionClose } from '@/components/common/icons/ActionIcons';
import {
Typography,
Button,
@@ -40,7 +42,6 @@ import {
IconCode,
IconSend,
IconSearch,
IconClose,
IconVideo,
IconArticle,
} from '@/components/ui/icons';
@@ -62,6 +63,35 @@ const Tutorial = () => {
const [activeOS, setActiveOS] = useState('windows');
const [activeTutorialTab, setActiveTutorialTab] = useState('video'); // 默认视频教程
const scrollContainerRef = useRef(null);
const [activeStep, setActiveStep] = useState(0);
useEffect(() => {
if (activeTutorialTab !== 'steps') return;
const sections = scrollContainerRef.current?.querySelectorAll(
'.tutorial-step-section',
);
if (!sections?.length) return;
let frame;
// Capture scrolling from the shared layout as well as the document.
const update = () => {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(() => {
let current = 0;
sections.forEach((section, index) => {
if (section.getBoundingClientRect().top <= 200) current = index;
});
setActiveStep(current);
});
};
update();
document.addEventListener('scroll', update, true);
window.addEventListener('resize', update);
return () => {
cancelAnimationFrame(frame);
document.removeEventListener('scroll', update, true);
window.removeEventListener('resize', update);
};
}, [activeTutorialTab]);
// 处理关闭教程
const handleClose = () => {
@@ -86,31 +116,26 @@ const Tutorial = () => {
key: 'create-key',
title: t('创建密钥'),
icon: <IconKey />,
color: 'var(--brand-gradient-via)',
},
{
key: 'view-models',
title: t('查看可用模型'),
icon: <IconSearch />,
color: 'var(--brand-gradient-to)',
},
{
key: 'recharge',
title: t('充值'),
icon: <IconCreditCard />,
color: 'var(--brand-primary)',
},
{
key: 'install-client',
title: t('安装客户端'),
icon: <IconCode />,
color: 'var(--brand-gradient-from)',
},
{
key: 'start-journey',
title: t('开启之旅'),
icon: <IconSend />,
color: 'var(--brand-primary-hover)',
},
];
@@ -153,13 +178,7 @@ const Tutorial = () => {
const createKeyStep = (
<div className='tutorial-step-content'>
<div className='tutorial-step-header'>
<div
className='tutorial-step-icon'
style={{
background:
'linear-gradient(135deg, var(--brand-gradient-via), var(--brand-gradient-to))',
}}
>
<div className='tutorial-step-icon'>
<IconKey size='large' />
</div>
<div>
@@ -240,13 +259,7 @@ const Tutorial = () => {
const viewModelsStep = (
<div className='tutorial-step-content'>
<div className='tutorial-step-header'>
<div
className='tutorial-step-icon'
style={{
background:
'linear-gradient(135deg, var(--brand-gradient-to), var(--brand-primary-hover))',
}}
>
<div className='tutorial-step-icon'>
<IconSearch size='large' />
</div>
<div>
@@ -321,13 +334,7 @@ const Tutorial = () => {
const rechargeStep = (
<div className='tutorial-step-content'>
<div className='tutorial-step-header'>
<div
className='tutorial-step-icon'
style={{
background:
'linear-gradient(135deg, var(--brand-primary), var(--brand-gradient-via))',
}}
>
<div className='tutorial-step-icon'>
<IconCreditCard size='large' />
</div>
<div>
@@ -407,13 +414,7 @@ const Tutorial = () => {
const installClientStep = (
<div className='tutorial-step-content'>
<div className='tutorial-step-header'>
<div
className='tutorial-step-icon'
style={{
background:
'linear-gradient(135deg, var(--brand-gradient-from), var(--brand-gradient-via))',
}}
>
<div className='tutorial-step-icon'>
<IconCode size='large' />
</div>
<div>
@@ -561,13 +562,7 @@ source ~/.bashrc`,
const startJourneyStep = (
<div className='tutorial-step-content'>
<div className='tutorial-step-header'>
<div
className='tutorial-step-icon'
style={{
background:
'linear-gradient(135deg, var(--brand-primary-hover), var(--brand-primary))',
}}
>
<div className='tutorial-step-icon'>
<IconSend size='large' />
</div>
<div>
@@ -686,27 +681,22 @@ source ~/.bashrc`,
{
component: createKeyStep,
title: t('创建密钥'),
color: 'var(--brand-gradient-via)',
},
{
component: viewModelsStep,
title: t('查看可用模型'),
color: 'var(--brand-gradient-to)',
},
{
component: rechargeStep,
title: t('充值'),
color: 'var(--brand-primary)',
},
{
component: installClientStep,
title: t('安装客户端'),
color: 'var(--brand-gradient-from)',
},
{
component: startJourneyStep,
title: t('开启之旅'),
color: 'var(--brand-primary-hover)',
},
];
@@ -724,14 +714,15 @@ source ~/.bashrc`,
const stepsTutorial = (
<div className='tutorial-scroll-wrapper'>
{/* 顶部快速导航 */}
<div className='tutorial-quick-nav'>
<nav className='tutorial-quick-nav' aria-label={t('图文教程')}>
<div className='tutorial-directory-title'>{t('快速上手')}</div>
<div className='tutorial-quick-nav-inner'>
{visibleSteps.map((step, index) => (
<a
key={step.key}
href={`#tutorial-step-${index}`}
className='tutorial-quick-nav-item'
style={{ '--step-color': step.color }}
className={`tutorial-quick-nav-item${activeStep === index ? ' active' : ''}`}
aria-current={activeStep === index ? 'step' : undefined}
onClick={(e) => {
e.preventDefault();
const element = document.getElementById(
@@ -739,9 +730,15 @@ source ~/.bashrc`,
);
if (element && scrollContainerRef.current) {
element.scrollIntoView({
behavior: 'smooth',
behavior: window.matchMedia(
'(prefers-reduced-motion: reduce)',
).matches
? 'instant'
: 'smooth',
block: 'start',
});
element.focus({ preventScroll: true });
setActiveStep(index);
}
}}
>
@@ -754,29 +751,26 @@ source ~/.bashrc`,
<span className='tutorial-scroll-hint-icon'>↓</span>
<span>{t('向下滚动查看所有步骤')}</span>
</div>
</div>
</nav>
{/* 可滚动的内容区域 */}
<div className='tutorial-scroll-container' ref={scrollContainerRef}>
<div className='tutorial-all-steps'>
{visibleStepComponents.map((step, index) => (
<div
<section
key={`step-wrapper-${index}`}
id={`tutorial-step-${index}`}
className='tutorial-step-section'
aria-label={step.title}
tabIndex={-1}
>
<div className='tutorial-step-divider'>
<div
className='tutorial-step-badge'
style={{
background: `linear-gradient(135deg, ${step.color}, color-mix(in srgb, ${step.color} 85%, transparent))`,
}}
>
<div className='tutorial-step-badge'>
{step.number} / {allStepComponents.length}
</div>
</div>
{step.component}
</div>
</section>
))}
</div>
@@ -814,20 +808,15 @@ source ~/.bashrc`,
{t('5 分钟快速上手,开启您的 AI 之旅')}
</Paragraph>
</div>
<Button
type='tertiary'
theme='borderless'
icon={<IconClose />}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleClose();
}}
className='tutorial-close-btn'
size='large'
>
{t('关闭教程')}
</Button>
<Tooltip title={t('关闭教程')}>
<AntButton
type='text'
icon={<ActionClose size={16} aria-hidden />}
aria-label={t('关闭教程')}
onClick={handleClose}
className='tutorial-close-btn'
/>
</Tooltip>
</div>
{/* 教程类型切换 Tab */}
File diff suppressed because it is too large Load Diff