From 244968a1cb7c14fd9f75ddb0b26bf8cabd81f1fe Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Sat, 22 Nov 2025 12:07:55 +0800 Subject: [PATCH] update pay function --- package.json | 2 +- src/views/AgentChat/README.md | 15 +- src/views/AgentChat/index.js | 281 ++++++++++++++++++++-------------- 3 files changed, 174 insertions(+), 124 deletions(-) diff --git a/package.json b/package.json index a789ce15..6930f97a 100755 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "echarts": "^5.6.0", "echarts-for-react": "^3.0.2", "echarts-wordcloud": "^2.1.0", - "framer-motion": "^4.1.17", + "framer-motion": "^12.23.24", "fullcalendar": "^5.9.0", "globalize": "^1.7.0", "history": "^5.3.0", diff --git a/src/views/AgentChat/README.md b/src/views/AgentChat/README.md index 5ce9fa6b..a88c22b9 100644 --- a/src/views/AgentChat/README.md +++ b/src/views/AgentChat/README.md @@ -7,10 +7,10 @@ ### 🚀 技术栈 - **Hero UI** - 现代化 React UI 组件库(NextUI 的继任者) -- **Framer Motion** - 物理动画引擎 +- **Framer Motion 12** - 物理动画引擎(已升级!) - **Tailwind CSS** - 原子化 CSS 框架(Hero UI 内置) - **Lucide Icons** - 现代化图标库 -- **Chakra UI Toast** - 通知提示(保留) +- **Chakra UI Toast** - 通知提示(待迁移到 Hero UI Toast) ### 🎨 视觉特性 @@ -19,11 +19,12 @@ - `backdrop-blur-xl` + 渐变背景 - 深色模式完美支持 -2. **流畅动画** - - 侧边栏 Spring 动画滑入/滑出 - - 消息依次淡入(错开延迟) - - 按钮悬停/点击缩放效果 - - AI 头像持续旋转动画 +2. **流畅动画(Framer Motion 12 物理引擎)** + - ✨ 侧边栏 **Spring 弹性动画**滑入/滑出(stiffness: 300, damping: 30) + - ✨ 消息 **淡入上移** + **错开延迟**(staggerChildren: 0.05) + - ✨ 按钮 **悬停缩放**(1.05x) + **点击压缩**(0.95x) + - ✨ AI 头像 **360度持续旋转**(duration: 3s, linear) + - ✨ 快捷问题卡片 **退出动画**(AnimatePresence) 3. **渐变色设计** - 标题:蓝到紫渐变 diff --git a/src/views/AgentChat/index.js b/src/views/AgentChat/index.js index fdd8e52b..c09a2d40 100644 --- a/src/views/AgentChat/index.js +++ b/src/views/AgentChat/index.js @@ -1,8 +1,9 @@ // src/views/AgentChat/index.js // 超炫酷的 AI 投研助手 - Hero UI 版本 -// 使用 CSS 动画替代 Framer Motion(避免版本冲突) +// 使用 Framer Motion 物理动画引擎 import React, { useState, useEffect, useRef } from 'react'; +import { motion, AnimatePresence } from 'framer-motion'; import { Button, Card, @@ -67,6 +68,78 @@ import { Rocket, } from 'lucide-react'; +/** + * Framer Motion 动画变体配置 + */ +const animations = { + // 侧边栏滑入动画(带弹性效果) + slideInLeft: { + initial: { x: -320, opacity: 0 }, + animate: { + x: 0, + opacity: 1, + transition: { + type: 'spring', + stiffness: 300, + damping: 30, + }, + }, + exit: { + x: -320, + opacity: 0, + transition: { duration: 0.2 }, + }, + }, + slideInRight: { + initial: { x: 320, opacity: 0 }, + animate: { + x: 0, + opacity: 1, + transition: { + type: 'spring', + stiffness: 300, + damping: 30, + }, + }, + exit: { + x: 320, + opacity: 0, + transition: { duration: 0.2 }, + }, + }, + // 消息淡入动画(带上移效果) + fadeInUp: { + initial: { opacity: 0, y: 20 }, + animate: { + opacity: 1, + y: 0, + transition: { + type: 'spring', + stiffness: 400, + damping: 25, + }, + }, + }, + // 列表项淡入(错开延迟) + staggerItem: { + initial: { opacity: 0, y: 10 }, + animate: { opacity: 1, y: 0 }, + }, + // 父容器错开动画 + staggerContainer: { + animate: { + transition: { + staggerChildren: 0.05, + }, + }, + }, + // 按钮点击动画 + pressScale: { + whileTap: { scale: 0.95 }, + whileHover: { scale: 1.05 }, + }, +}; + /** * 消息类型 */ @@ -355,7 +428,13 @@ const AgentChat = () => {
{/* 左侧栏 */} {isLeftSidebarOpen && ( -
+
@@ -457,7 +536,7 @@ const AgentChat = () => {
-
+ )} {/* 中间主聊天区域 */} @@ -476,12 +555,17 @@ const AgentChat = () => { )} - } - classNames={{ - base: 'bg-gradient-to-br from-purple-500 to-pink-500 animate-spin-slow', - }} - /> + + } + classNames={{ + base: 'bg-gradient-to-br from-purple-500 to-pink-500', + }} + /> +

@@ -524,43 +608,66 @@ const AgentChat = () => {

-
- {messages.map((message) => ( -
- -
- ))} + + + {messages.map((message, index) => ( + + + + ))} +
-
+
- {messages.length <= 2 && !isProcessing && ( -
-
+ + {messages.length <= 2 && !isProcessing && ( + +

快速开始

{quickQuestions.map((question, idx) => ( - + + + ))}
-
- )} + + )} +
@@ -579,18 +686,20 @@ const AgentChat = () => { inputWrapper: 'border-2 hover:border-primary-500 transition-colors', }} /> - + + +
@@ -611,7 +720,13 @@ const AgentChat = () => { {/* 右侧栏 */} {isRightSidebarOpen && ( -
+
@@ -709,80 +824,14 @@ const AgentChat = () => { -
+ )} - -
); }; +export default AgentChat; + /** * 消息渲染器 */