finstep-template-cli 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +41 -0
  2. package/cli.js +117 -0
  3. package/package.json +39 -0
  4. package/template/.env.development +3 -0
  5. package/template/.env.production +3 -0
  6. package/template/.env.staging +3 -0
  7. package/template/.env.test +3 -0
  8. package/template/.eslintrc.cjs +21 -0
  9. package/template/README.md +69 -0
  10. package/template/auto-imports.d.ts +47 -0
  11. package/template/eslint.config.js +26 -0
  12. package/template/index.html +16 -0
  13. package/template/package.json +46 -0
  14. package/template/postcss.config.js +5 -0
  15. package/template/public/logo.svg +85 -0
  16. package/template/public/vite.svg +1 -0
  17. package/template/src/App.css +42 -0
  18. package/template/src/App.tsx +25 -0
  19. package/template/src/api/home/index.ts +56 -0
  20. package/template/src/api/home/typings.d.ts +8 -0
  21. package/template/src/assets/logo.svg +85 -0
  22. package/template/src/assets/react.svg +1 -0
  23. package/template/src/components/admin-layout.tsx +211 -0
  24. package/template/src/components/f-b-footer.tsx +46 -0
  25. package/template/src/components/f-b-header.tsx +894 -0
  26. package/template/src/components/global-loading.tsx +143 -0
  27. package/template/src/components/hero-section.tsx +371 -0
  28. package/template/src/components/products-preview.tsx +175 -0
  29. package/template/src/components/stats-section.tsx +85 -0
  30. package/template/src/components/trusted-by.tsx +53 -0
  31. package/template/src/hooks/useGlobalLoading.ts +57 -0
  32. package/template/src/index.css +341 -0
  33. package/template/src/main.tsx +30 -0
  34. package/template/src/pages/admin/index.tsx +361 -0
  35. package/template/src/pages/admin/pages/applications/index.tsx +558 -0
  36. package/template/src/pages/home/index.tsx +129 -0
  37. package/template/src/router/index.tsx +9 -0
  38. package/template/src/router/routes.tsx +30 -0
  39. package/template/src/stores/loading.store.ts +46 -0
  40. package/template/src/stores/root.store.ts +22 -0
  41. package/template/src/stores/store-context.tsx +43 -0
  42. package/template/src/stores/user.store.ts +46 -0
  43. package/template/src/utils/index.ts +14 -0
  44. package/template/src/utils/request.ts +116 -0
  45. package/template/src/utils/tokenManager.ts +168 -0
  46. package/template/src/vite-env.d.ts +1 -0
  47. package/template/tailwind.config.js +19 -0
  48. package/template/tsconfig.app.json +29 -0
  49. package/template/tsconfig.json +7 -0
  50. package/template/tsconfig.node.json +26 -0
  51. package/template/vite.config.ts +36 -0
@@ -0,0 +1,894 @@
1
+ import { useState } from "react";
2
+ // AI生成的代码 - 自定义Link组件替换Next.js Link
3
+ import React from "react";
4
+ // AI生成的代码 - 导入 Ant Design 组件
5
+ import { Drawer, Menu, Dropdown } from "antd";
6
+ // AI生成的代码 - 导入用户状态管理
7
+ import { useStore } from "../stores/store-context";
8
+ import { observer } from "mobx-react-lite";
9
+ // AI生成:导入React Router的useNavigate hook
10
+ import { useNavigate } from "react-router-dom";
11
+ // import {
12
+ // FileTextOutlined,
13
+ // DollarOutlined,
14
+ // ScanOutlined,
15
+ // SettingOutlined,
16
+ // AuditOutlined,
17
+ // SearchOutlined,
18
+ // } from "@ant-design/icons";
19
+
20
+ // 自定义Link组件,用于替换Next.js的Link组件
21
+ interface LinkProps {
22
+ href: string;
23
+ className?: string;
24
+ children: React.ReactNode;
25
+ onClick?: () => void;
26
+ }
27
+
28
+ const Link: React.FC<LinkProps> = ({ href, className, children, onClick }) => {
29
+ const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
30
+ e.preventDefault();
31
+ if (onClick) {
32
+ onClick();
33
+ }
34
+ // 使用window.location进行页面导航
35
+ window.location.href = href;
36
+ };
37
+
38
+ return (
39
+ <a href={href} className={className} onClick={handleClick}>
40
+ {children}
41
+ </a>
42
+ );
43
+ };
44
+
45
+ // AI生成的代码 - 用户信息接口定义
46
+ interface UserInfo {
47
+ userId: string;
48
+ login: boolean;
49
+ phone: string;
50
+ avatar?: string;
51
+ username?: string;
52
+ }
53
+
54
+ const Header = observer(() => {
55
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
56
+ const [activeDropdown, setActiveDropdown] = useState<string | null>(null);
57
+ const [showLoginModal, setShowLoginModal] = useState(false);
58
+ const [loginMode, setLoginMode] = useState<"login" | "register">("login");
59
+ // AI生成的代码 - 移动端用户下拉菜单状态
60
+ const [isMobileDropdownOpen, setIsMobileDropdownOpen] = useState(false);
61
+
62
+ // AI生成的代码 - 获取用户状态管理
63
+ const { userStore } = useStore();
64
+ // AI生成:使用React Router的navigate函数
65
+ const navigate = useNavigate();
66
+
67
+ // AI生成的代码 - 初始化时从localStorage恢复用户状态
68
+ React.useEffect(() => {
69
+ const savedUserInfo = localStorage.getItem("userInfo");
70
+ if (savedUserInfo) {
71
+ try {
72
+ const userInfo = JSON.parse(savedUserInfo);
73
+ if (userInfo.login) {
74
+ userStore.setUserInfo(userInfo);
75
+ }
76
+ } catch (error) {
77
+ console.error("解析用户信息失败:", error);
78
+ localStorage.removeItem("userInfo");
79
+ }
80
+ }
81
+ }, [userStore]);
82
+ const handleMouseEnter = (dropdown: string) => {
83
+ setActiveDropdown(dropdown);
84
+ };
85
+
86
+ const handleMouseLeave = () => {
87
+ setActiveDropdown(null);
88
+ };
89
+
90
+ const handleLoginClick = () => {
91
+ setShowLoginModal(true);
92
+ // setIsMenuOpen(false);
93
+ };
94
+
95
+ const handleCloseModal = () => {
96
+ setShowLoginModal(false);
97
+ };
98
+
99
+ const handleLoginSubmit = (e: React.FormEvent) => {
100
+ e.preventDefault();
101
+ // AI生成的代码 - 处理登录逻辑,模拟登录成功
102
+ const mockUserInfo: UserInfo = {
103
+ userId: "user123",
104
+ login: true,
105
+ phone: "13800138000",
106
+ avatar: "https://api.dicebear.com/7.x/avataaars/svg?seed=Felix",
107
+ username: "用户123",
108
+ };
109
+
110
+ // 存储用户信息到store
111
+ userStore.setUserInfo(mockUserInfo);
112
+
113
+ // 存储到localStorage持久化
114
+ localStorage.setItem("userInfo", JSON.stringify(mockUserInfo));
115
+
116
+ console.log("登录成功");
117
+ setShowLoginModal(false);
118
+ };
119
+
120
+ const handleRegisterSubmit = (e: React.FormEvent) => {
121
+ e.preventDefault();
122
+ // 处理申请提交逻辑
123
+ console.log("申请提交");
124
+ alert("申请已提交,我们将在1-2个工作日内审核您的申请,请耐心等待。");
125
+ setShowLoginModal(false);
126
+ };
127
+
128
+ return (
129
+ <>
130
+ <header className="bg-slate-950 border-b border-slate-800/60 sticky top-0 z-[60]">
131
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
132
+ <div className="flex justify-between items-center h-24">
133
+ {/* Logo */}
134
+ <div className="flex items-center">
135
+ <Link href="/" className="flex items-center space-x-3 group">
136
+ <img
137
+ src="/logo.svg"
138
+ alt="logo"
139
+ className="w-[40px] h-[40px] transition-transform duration-300 hover:scale-110 group-hover:scale-110"
140
+ />
141
+ <span className="text-2xl font-bold bg-gradient-to-r from-white to-slate-300 bg-clip-text text-transparent group-hover:from-blue-400 group-hover:to-white transition-all duration-300">
142
+ 财跃星辰
143
+ </span>
144
+ </Link>
145
+ </div>
146
+
147
+ {/* Desktop Navigation */}
148
+ <nav className="hidden lg:flex items-center space-x-2">
149
+ <Link
150
+ href="/"
151
+ className="relative px-6 py-3 text-slate-300 hover:text-white transition-all duration-300 group"
152
+ >
153
+ <span className="relative z-10 font-semibold">首页</span>
154
+ <div className="absolute inset-0 bg-gradient-to-r from-blue-600/0 to-purple-600/0 group-hover:from-blue-600/20 group-hover:to-purple-600/20 rounded-lg transition-all duration-300"></div>
155
+ <div className="absolute inset-0 border border-transparent group-hover:border-blue-500/30 rounded-lg transition-all duration-300"></div>
156
+ </Link>
157
+
158
+ {/* AIGC产品 Dropdown */}
159
+ <div
160
+ className="relative"
161
+ onMouseEnter={() => handleMouseEnter("aigc")}
162
+ onMouseLeave={handleMouseLeave}
163
+ >
164
+ <button className="relative px-6 py-3 text-slate-300 hover:text-white transition-all duration-300 group flex items-center">
165
+ <span className="relative z-10 font-semibold">AIGC产品</span>
166
+ <i
167
+ className="ri-arrow-down-s-line ml-1 text-sm transition-transform duration-200"
168
+ style={{
169
+ transform:
170
+ activeDropdown === "aigc"
171
+ ? "rotate(180deg)"
172
+ : "rotate(0deg)",
173
+ }}
174
+ ></i>
175
+ <div className="absolute inset-0 bg-gradient-to-r from-blue-600/0 to-purple-600/0 group-hover:from-blue-600/20 group-hover:to-purple-600/20 rounded-lg transition-all duration-300"></div>
176
+ <div className="absolute inset-0 border border-transparent group-hover:border-blue-500/30 rounded-lg transition-all duration-300"></div>
177
+ </button>
178
+
179
+ {activeDropdown === "aigc" && (
180
+ <div className="absolute top-full left-0 w-56 bg-slate-900/95 backdrop-blur-xl border border-slate-800/80 rounded-xl shadow-2xl shadow-black/40 overflow-hidden z-[70]">
181
+ <div className="py-2">
182
+ {/* <Link
183
+ href="/aigc/ai-morning"
184
+ className="block px-4 py-3 text-slate-300 hover:text-white hover:bg-gradient-to-r hover:from-blue-600/20 hover:to-purple-600/20 transition-all duration-200 group"
185
+ >
186
+ <div className="flex items-center">
187
+ <i className="ri-sun-line w-5 h-5 flex items-center justify-center mr-3 text-blue-400 group-hover:text-white"></i>
188
+ <span>AI早报</span>
189
+ </div>
190
+ </Link>
191
+ <Link
192
+ href="/aigc/ai-gold"
193
+ className="block px-4 py-3 text-slate-300 hover:text-white hover:bg-gradient-to-r hover:from-blue-600/20 hover:to-purple-600/20 transition-all duration-200 group"
194
+ >
195
+ <div className="flex items-center">
196
+ <i className="ri-money-dollar-circle-line w-5 h-5 flex items-center justify-center mr-3 text-yellow-400 group-hover:text-white"></i>
197
+ <span>AI掘金</span>
198
+ </div>
199
+ </Link> */}
200
+ <Link
201
+ href="/aigc/ai-scanner"
202
+ className="block px-4 py-3 text-slate-300 hover:text-white hover:bg-gradient-to-r hover:from-blue-600/20 hover:to-purple-600/20 transition-all duration-200 group"
203
+ >
204
+ <div className="flex items-center">
205
+ <i className="ri-search-2-line w-5 h-5 flex items-center justify-center mr-3 text-green-400 group-hover:text-white"></i>
206
+ <span>AI扫雷</span>
207
+ </div>
208
+ </Link>
209
+ </div>
210
+ </div>
211
+ )}
212
+ </div>
213
+
214
+ {/* Agent产品 Dropdown */}
215
+ <div
216
+ className="relative"
217
+ onMouseEnter={() => handleMouseEnter("agent")}
218
+ onMouseLeave={handleMouseLeave}
219
+ >
220
+ <button className="relative px-6 py-3 text-slate-300 hover:text-white transition-all duration-300 group flex items-center">
221
+ <span className="relative z-10 font-semibold">Agent产品</span>
222
+ <i
223
+ className="ri-arrow-down-s-line ml-1 text-sm transition-transform duration-200"
224
+ style={{
225
+ transform:
226
+ activeDropdown === "agent"
227
+ ? "rotate(180deg)"
228
+ : "rotate(0deg)",
229
+ }}
230
+ ></i>
231
+ <div className="absolute inset-0 bg-gradient-to-r from-blue-600/0 to-purple-600/0 group-hover:from-blue-600/20 group-hover:to-purple-600/20 rounded-lg transition-all duration-300"></div>
232
+ <div className="absolute inset-0 border border-transparent group-hover:border-blue-500/30 rounded-lg transition-all duration-300"></div>
233
+ </button>
234
+
235
+ {activeDropdown === "agent" && (
236
+ <div className="absolute top-full left-0 w-64 bg-slate-900/95 backdrop-blur-xl border border-slate-800/80 rounded-xl shadow-2xl shadow-black/40 overflow-hidden z-[70]">
237
+ <div className="py-2">
238
+ <Link
239
+ href="/agent/risk-config"
240
+ className="block px-4 py-3 text-slate-300 hover:text-white hover:bg-gradient-to-r hover:from-blue-600/20 hover:to-purple-600/20 transition-all duration-200 group"
241
+ >
242
+ <div className="flex items-center">
243
+ <i className="ri-settings-3-line w-5 h-5 flex items-center justify-center mr-3 text-red-400 group-hover:text-white"></i>
244
+ <span>风控因子配置Agent</span>
245
+ </div>
246
+ </Link>
247
+ {/* <Link
248
+ href="/agent/audit"
249
+ className="block px-4 py-3 text-slate-300 hover:text-white hover:bg-gradient-to-r hover:from-blue-600/20 hover:to-purple-600/20 transition-all duration-200 group"
250
+ >
251
+ <div className="flex items-center">
252
+ <i className="ri-shield-check-line w-5 h-5 flex items-center justify-center mr-3 text-blue-400 group-hover:text-white"></i>
253
+ <span>审核Agent</span>
254
+ </div>
255
+ </Link>
256
+ <Link
257
+ href="/agent/search"
258
+ className="block px-4 py-3 text-slate-300 hover:text-white hover:bg-gradient-to-r hover:from-blue-600/20 hover:to-purple-600/20 transition-all duration-200 group"
259
+ >
260
+ <div className="flex items-center">
261
+ <i className="ri-search-line w-5 h-5 flex items-center justify-center mr-3 text-purple-400 group-hover:text-white"></i>
262
+ <span>搜索Agent</span>
263
+ </div>
264
+ </Link> */}
265
+ </div>
266
+ </div>
267
+ )}
268
+ </div>
269
+ </nav>
270
+
271
+ {/* Desktop Actions */}
272
+ <div className="hidden lg:flex items-center">
273
+ {/* AI生成的代码 - 根据登录状态显示不同内容 */}
274
+ {userStore.userInfo.login ? (
275
+ // AI生成的代码 - 已登录状态,显示用户头像和下拉菜单,调整样式与首页主题一致
276
+ <Dropdown
277
+ menu={{
278
+ items: [
279
+ {
280
+ key: "profile",
281
+ label: (
282
+ <div
283
+ className="px-4 py-3 text-slate-200 hover:text-blue-400 hover:bg-slate-800/50 transition-all duration-300 flex items-center space-x-2"
284
+ onClick={() => {
285
+ // AI生成:使用React Router跳转到admin路由
286
+ navigate("/admin");
287
+ }}
288
+ >
289
+ <i className="ri-user-line text-blue-400"></i>
290
+ <span>管理后台</span>
291
+ </div>
292
+ ),
293
+ },
294
+ {
295
+ type: "divider",
296
+ style: {
297
+ borderColor: "rgba(148, 163, 184, 0.2)",
298
+ margin: "8px 0",
299
+ },
300
+ },
301
+ {
302
+ key: "logout",
303
+ label: (
304
+ <div
305
+ className="px-4 py-3 text-red-400 hover:text-red-300 transition-all duration-300 flex items-center space-x-2"
306
+ onClick={() => {
307
+ // AI生成的代码 - 退出登录
308
+ userStore.setUserInfo({
309
+ userId: "",
310
+ login: false,
311
+ phone: "",
312
+ });
313
+ localStorage.removeItem("userInfo");
314
+ }}
315
+ >
316
+ <i className="ri-logout-box-line text-red-400"></i>
317
+ <span>退出登录</span>
318
+ </div>
319
+ ),
320
+ },
321
+ ],
322
+ }}
323
+ placement="bottomRight"
324
+ trigger={["hover"]}
325
+ popupRender={(menu) => (
326
+ <div className="bg-slate-900/95 backdrop-blur-xl border border-slate-700/50 rounded-xl shadow-2xl shadow-black/50 overflow-hidden">
327
+ <div className="">{menu}</div>
328
+ </div>
329
+ )}
330
+ >
331
+ <div className="flex items-center space-x-3 cursor-pointer group">
332
+ <div className="flex items-center space-x-2">
333
+ <img
334
+ src={
335
+ userStore.userInfo.avatar ||
336
+ "https://api.dicebear.com/7.x/avataaars/svg?seed=default"
337
+ }
338
+ alt="用户头像"
339
+ className="w-8 h-8 rounded-full border-2 border-blue-500/30 group-hover:border-blue-500/60 transition-all duration-300"
340
+ />
341
+ <span className="text-slate-300 group-hover:text-white transition-colors duration-300 font-medium">
342
+ {userStore.userInfo.username || "用户"}
343
+ </span>
344
+ </div>
345
+ {/* AI生成的代码 - 鼠标hover时箭头旋转效果 */}
346
+ <i className="ri-arrow-down-s-line ml-1 text-sm transition-transform duration-300 group-hover:rotate-180"></i>
347
+ </div>
348
+ </Dropdown>
349
+ ) : (
350
+ // 未登录状态 - 显示点击试用按钮
351
+ <button
352
+ onClick={handleLoginClick}
353
+ className="relative bg-gradient-to-r from-blue-600 via-blue-700 to-purple-700 text-white px-6 py-2 rounded-xl hover:from-blue-700 hover:via-blue-800 hover:to-purple-800 transition-all duration-300 whitespace-nowrap cursor-pointer group shadow-lg shadow-blue-500/25 hover:shadow-blue-500/40 hover:shadow-xl"
354
+ >
355
+ <span className="relative z-10 font-medium">点击试用</span>
356
+ <div className="absolute inset-0 bg-gradient-to-r from-white/0 to-white/0 group-hover:from-white/10 group-hover:to-white/5 rounded-xl transition-all duration-300"></div>
357
+ <div className="absolute -inset-1 bg-gradient-to-r from-blue-600 to-purple-600 rounded-xl blur opacity-0 group-hover:opacity-20 transition-all duration-300"></div>
358
+ </button>
359
+ )}
360
+ </div>
361
+ </div>
362
+
363
+ {/* Mobile Navigation */}
364
+ {/* AI生成的代码 - 侧边栏弹出菜单 */}
365
+ {/* AI生成的代码 - 使用 Ant Design 的 Drawer 和 Menu 组件实现侧边栏,与首页风格保持一致 */}
366
+ <Drawer
367
+ closeIcon={false}
368
+ title={
369
+ <div className="flex items-center ml-4 h-24">
370
+ <div className="flex items-center">
371
+ <Link href="/" className="flex items-center space-x-3 group">
372
+ <img
373
+ src="/logo.svg"
374
+ alt="logo"
375
+ className="w-[40px] h-[40px] transition-transform duration-500 hover:scale-110 group-hover:scale-110"
376
+ />
377
+ <span className="text-2xl font-bold bg-gradient-to-r from-white to-slate-300 bg-clip-text text-transparent group-hover:from-blue-400 group-hover:to-white transition-all duration-500">
378
+ 财跃星辰
379
+ </span>
380
+ </Link>
381
+ </div>
382
+ </div>
383
+ }
384
+ placement="right"
385
+ onClose={() => setIsMenuOpen(false)}
386
+ open={isMenuOpen}
387
+ width="80%"
388
+ className="lg:hidden drawer-slow-animation"
389
+ styles={{
390
+ wrapper: {
391
+ width: "360px",
392
+ maxWidth: "80%",
393
+ },
394
+ body: {
395
+ padding: 0,
396
+ background:
397
+ "linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%)",
398
+ color: "#ffffff",
399
+ position: "relative",
400
+ },
401
+ header: {
402
+ background: "oklch(12.9% 0.042 264.695)",
403
+ backdropFilter: "blur(20px)",
404
+ borderBottom: "1px solid rgba(59, 130, 246, 0.2)",
405
+ color: "#ffffff",
406
+ boxShadow: "0 4px 20px rgba(0, 0, 0, 0.3)",
407
+ padding: 0,
408
+ },
409
+ mask: {
410
+ backgroundColor: "rgba(0, 0, 0, 0.6)",
411
+ backdropFilter: "blur(8px)",
412
+ },
413
+ }}
414
+ maskClosable={true}
415
+ destroyOnClose={false}
416
+ >
417
+ <div className="h-full flex flex-col relative overflow-hidden">
418
+ {/* 背景装饰效果 */}
419
+ <div className="absolute inset-0 pointer-events-none">
420
+ {/* 渐变光晕效果 */}
421
+ <div className="absolute top-0 right-0 w-32 h-32 bg-gradient-to-bl from-blue-500/20 via-purple-500/10 to-transparent rounded-full blur-2xl"></div>
422
+ <div className="absolute bottom-1/3 left-0 w-24 h-24 bg-gradient-to-tr from-cyan-500/15 via-blue-500/10 to-transparent rounded-full blur-xl"></div>
423
+ <div className="absolute top-1/2 right-1/4 w-16 h-16 bg-gradient-to-l from-purple-500/20 to-transparent rounded-full blur-lg"></div>
424
+
425
+ {/* 动态粒子效果 */}
426
+ {Array.from({ length: 6 }).map((_, i) => (
427
+ <div
428
+ key={i}
429
+ className="absolute w-1 h-1 bg-blue-400/40 rounded-full"
430
+ style={{
431
+ left: `${20 + i * 15}%`,
432
+ top: `${30 + i * 10}%`,
433
+ animation: `floatSmall ${4 + i}s linear infinite`,
434
+ animationDelay: `${i * 0.8}s`,
435
+ }}
436
+ />
437
+ ))}
438
+ </div>
439
+
440
+ {/* 菜单内容 */}
441
+ <Menu
442
+ mode="inline"
443
+ theme="dark"
444
+ className="flex-1 border-none relative z-10"
445
+ style={{
446
+ background: "transparent",
447
+ color: "#ffffff",
448
+ }}
449
+ items={[
450
+ {
451
+ key: "aigc",
452
+ label: (
453
+ <span className="font-medium bg-gradient-to-r from-blue-400 to-purple-400 bg-clip-text text-transparent">
454
+ AIGC产品
455
+ </span>
456
+ ),
457
+ children: [
458
+ {
459
+ key: "ai-scanner",
460
+ label: (
461
+ <Link
462
+ href="/aigc/ai-scanner"
463
+ className="text-slate-200 hover:text-white font-medium transition-all duration-300 hover:bg-gradient-to-r hover:from-blue-500/10 hover:to-purple-500/10 rounded-lg py-1"
464
+ onClick={() => setIsMenuOpen(false)}
465
+ >
466
+ AI扫雷
467
+ </Link>
468
+ ),
469
+ icon: (
470
+ <i className="ri-search-2-line w-5 h-5 flex items-center justify-center !text-green-400"></i>
471
+ ),
472
+ },
473
+ ],
474
+ },
475
+ {
476
+ key: "agent",
477
+ label: (
478
+ <span className="font-medium bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent">
479
+ Agent产品
480
+ </span>
481
+ ),
482
+ children: [
483
+ {
484
+ key: "risk-config",
485
+ label: (
486
+ <Link
487
+ href="/agent/risk-config"
488
+ className="text-slate-200 hover:text-white font-medium transition-all duration-300 hover:bg-gradient-to-r hover:from-blue-500/10 hover:to-purple-500/10 rounded-lg py-1"
489
+ onClick={() => setIsMenuOpen(false)}
490
+ >
491
+ 风控因子配置Agent
492
+ </Link>
493
+ ),
494
+ icon: (
495
+ <i className="ri-settings-3-line w-5 h-5 flex items-center justify-center !text-red-400 "></i>
496
+ ),
497
+ },
498
+ ],
499
+ },
500
+ ]}
501
+ />
502
+
503
+ {/* 底部按钮 */}
504
+ <div className="p-6 border-t border-blue-500/20 bg-gradient-to-r from-slate-900/50 to-slate-800/50 backdrop-blur-sm relative">
505
+ {/* AI生成的代码 - 装饰性光效,修复点击事件被阻挡的问题 */}
506
+ <div className="absolute inset-0 bg-gradient-to-r from-blue-500/5 via-purple-500/5 to-cyan-500/5 rounded-t-lg pointer-events-none"></div>
507
+
508
+ {/* AI生成的代码 - 根据登录状态显示不同内容 */}
509
+ {userStore.userInfo.login ? (
510
+ // AI生成:已登录状态 - 显示用户信息和下拉菜单
511
+ <Dropdown
512
+ menu={{
513
+ items: [
514
+ {
515
+ key: "profile",
516
+ label: (
517
+ <div
518
+ className="px-4 py-3 text-slate-200 hover:text-blue-400 hover:bg-slate-800/50 transition-all duration-300 flex items-center space-x-2"
519
+ onClick={() => {
520
+ // AI生成:使用React Router跳转到admin路由
521
+ console.log("点击管理后台");
522
+ navigate("/admin");
523
+ }}
524
+ >
525
+ <i className="ri-user-line text-blue-400"></i>
526
+ <span>管理后台</span>
527
+ </div>
528
+ ),
529
+ },
530
+ {
531
+ type: "divider",
532
+ style: {
533
+ borderColor: "rgba(148, 163, 184, 0.2)",
534
+ margin: "8px 0",
535
+ },
536
+ },
537
+ {
538
+ key: "logout",
539
+ label: (
540
+ <div
541
+ className="px-4 py-3 text-red-400 hover:text-red-300 transition-all duration-300 flex items-center space-x-2"
542
+ onClick={() => {
543
+ // AI生成的代码 - 退出登录
544
+ console.log("点击退出登录");
545
+ userStore.setUserInfo({
546
+ userId: "",
547
+ login: false,
548
+ phone: "",
549
+ });
550
+ localStorage.removeItem("userInfo");
551
+ }}
552
+ >
553
+ <i className="ri-logout-box-line text-red-400"></i>
554
+ <span>退出登录</span>
555
+ </div>
556
+ ),
557
+ },
558
+ ],
559
+ }}
560
+ placement="bottomCenter"
561
+ trigger={["click"]}
562
+ popupRender={(menu) => (
563
+ <div className="bg-slate-900/95 backdrop-blur-xl border border-slate-700/50 rounded-xl shadow-2xl shadow-black/50 overflow-hidden">
564
+ <div className="">{menu}</div>
565
+ </div>
566
+ )}
567
+ onOpenChange={(open) => {
568
+ console.log("Dropdown状态:", open);
569
+ // AI生成的代码 - 更新移动端下拉菜单状态
570
+ setIsMobileDropdownOpen(open);
571
+ }}
572
+ overlayStyle={{
573
+ minWidth: "100px",
574
+ }}
575
+ >
576
+ {/* AI生成的代码 - 移动端下拉菜单触发器,与PC端样式保持一致 */}
577
+ <div className="flex items-center space-x-3 cursor-pointer group justify-center">
578
+ <div className="flex items-center space-x-2">
579
+ <img
580
+ src={
581
+ userStore.userInfo.avatar ||
582
+ "https://api.dicebear.com/7.x/avataaars/svg?seed=default"
583
+ }
584
+ alt="用户头像"
585
+ className={`w-8 h-8 rounded-full border-2 border-blue-500/30 transition-all duration-300 ${
586
+ isMobileDropdownOpen ? "border-blue-500/60" : ""
587
+ }`}
588
+ />
589
+ <span
590
+ className={`text-slate-300 transition-colors duration-300 font-medium ${
591
+ isMobileDropdownOpen ? "text-white" : ""
592
+ }`}
593
+ >
594
+ {userStore.userInfo.username || "用户"}
595
+ </span>
596
+ </div>
597
+ {/* AI生成的代码 - 点击时箭头旋转效果 */}
598
+ <i
599
+ className={`ri-arrow-down-s-line ml-1 text-sm transition-transform duration-300 ${
600
+ isMobileDropdownOpen ? "rotate-180" : "rotate-0"
601
+ }`}
602
+ ></i>
603
+ </div>
604
+ </Dropdown>
605
+ ) : (
606
+ // 未登录状态 - 显示点击试用按钮
607
+ <button
608
+ onClick={handleLoginClick}
609
+ className="bg-gradient-to-r from-blue-600 via-blue-700 to-purple-700 text-white px-6 py-[12px] rounded-xl hover:from-blue-700 hover:via-blue-800 hover:to-purple-800 transition-all duration-300 whitespace-nowrap cursor-pointer group shadow-lg shadow-blue-500/25 hover:shadow-blue-500/40 hover:shadow-xl w-full"
610
+ >
611
+ <span className="relative z-10 font-medium text-[16px]">
612
+ 点击试用
613
+ </span>
614
+ <div className="absolute inset-0 bg-gradient-to-r from-white/0 to-white/0 group-hover:from-white/10 group-hover:to-white/5 rounded-xl transition-all duration-300"></div>
615
+ <div className="absolute -inset-1 bg-gradient-to-r from-blue-600 to-purple-600 rounded-xl blur opacity-0 group-hover:opacity-20 transition-all duration-300"></div>
616
+ </button>
617
+ )}
618
+ </div>
619
+ </div>
620
+ </Drawer>
621
+ </div>
622
+ </header>
623
+
624
+ {/* Login Modal */}
625
+ {showLoginModal && (
626
+ <div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[99999]">
627
+ <div className="bg-slate-900/98 backdrop-blur-xl border border-slate-800/60 rounded-2xl shadow-2xl shadow-black/40 w-full max-w-md mx-4 max-h-[90vh] overflow-y-auto">
628
+ {/* Modal Header */}
629
+ <div className="flex items-center justify-between p-6 border-b border-slate-800/60">
630
+ <h2 className="text-xl font-semibold text-white">
631
+ {loginMode === "login" ? "登录账户" : "申请试用"}
632
+ </h2>
633
+ <button
634
+ onClick={handleCloseModal}
635
+ className="text-slate-400 hover:text-white transition-colors w-8 h-8 flex items-center justify-center rounded-lg hover:bg-slate-800/50"
636
+ >
637
+ <i className="ri-close-line text-xl"></i>
638
+ </button>
639
+ </div>
640
+
641
+ {/* Modal Content */}
642
+ <div className="p-6">
643
+ {/* Mode Toggle */}
644
+ <div className="flex mb-6 bg-slate-800/50 rounded-xl p-1">
645
+ <button
646
+ onClick={() => setLoginMode("login")}
647
+ className={`flex-1 py-2 px-4 rounded-lg text-sm font-medium transition-all duration-200 ${
648
+ loginMode === "login"
649
+ ? "bg-gradient-to-r from-blue-600 to-blue-700 text-white shadow-lg"
650
+ : "text-slate-400 hover:text-white"
651
+ }`}
652
+ >
653
+ 已有账号
654
+ </button>
655
+ <button
656
+ onClick={() => setLoginMode("register")}
657
+ className={`flex-1 py-2 px-4 rounded-lg text-sm font-medium transition-all duration-200 ${
658
+ loginMode === "register"
659
+ ? "bg-gradient-to-r from-blue-600 to-blue-700 text-white shadow-lg"
660
+ : "text-slate-400 hover:text-white"
661
+ }`}
662
+ >
663
+ 申请试用
664
+ </button>
665
+ </div>
666
+
667
+ {/* Login Form */}
668
+ {loginMode === "login" && (
669
+ <form onSubmit={handleLoginSubmit} className="space-y-4">
670
+ <div>
671
+ <label className="block text-sm font-medium text-slate-300 mb-2">
672
+ 手机号
673
+ </label>
674
+ <input
675
+ type="tel"
676
+ required
677
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm"
678
+ placeholder="请输入手机号"
679
+ />
680
+ </div>
681
+ <div>
682
+ <label className="block text-sm font-medium text-slate-300 mb-2">
683
+ 密码
684
+ </label>
685
+ <input
686
+ type="password"
687
+ required
688
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm"
689
+ placeholder="请输入密码"
690
+ />
691
+ </div>
692
+ {/* <div className="flex items-center justify-between">
693
+ <label className="flex items-center">
694
+ <input
695
+ type="checkbox"
696
+ className="rounded border-slate-600 bg-slate-800 text-blue-600 focus:ring-blue-500 focus:ring-offset-slate-900"
697
+ />
698
+ <span className="ml-2 text-sm text-slate-400">
699
+ 记住我
700
+ </span>
701
+ </label>
702
+ <button
703
+ type="button"
704
+ className="text-sm text-blue-400 hover:text-blue-300 transition-colors"
705
+ >
706
+ 忘记密码?
707
+ </button>
708
+ </div> */}
709
+ <button
710
+ type="submit"
711
+ className="w-full bg-gradient-to-r from-blue-600 via-blue-700 to-purple-700 text-white px-6 py-3 rounded-xl hover:from-blue-700 hover:via-blue-800 hover:to-purple-800 transition-all duration-300 font-medium shadow-lg shadow-blue-500/25 hover:shadow-blue-500/40 mt-[10px]"
712
+ >
713
+ 立即登录
714
+ </button>
715
+ </form>
716
+ )}
717
+
718
+ {/* Register Form */}
719
+ {loginMode === "register" && (
720
+ <form onSubmit={handleRegisterSubmit} className="space-y-4">
721
+ <div className="mb-4 p-4 bg-blue-900/20 border border-blue-700/50 rounded-xl">
722
+ <div className="flex items-center mb-2">
723
+ <i className="ri-information-line w-5 h-5 flex items-center justify-center text-blue-400 mr-2"></i>
724
+ <span className="text-sm font-medium text-blue-400">
725
+ 申请说明
726
+ </span>
727
+ </div>
728
+ <p className="text-sm text-slate-300 leading-relaxed">
729
+ 提交申请后,我们将在1-2个工作日内审核您的申请。审核通过后,我们会通过邮箱和手机短信通知您登录信息。
730
+ </p>
731
+ </div>
732
+
733
+ <div>
734
+ <label className="block text-sm font-medium text-slate-300 mb-2">
735
+ 公司名称 <span className="text-red-400">*</span>
736
+ </label>
737
+ <input
738
+ type="text"
739
+ required
740
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm"
741
+ placeholder="请输入公司名称"
742
+ />
743
+ </div>
744
+ <div>
745
+ <label className="block text-sm font-medium text-slate-300 mb-2">
746
+ 姓名 <span className="text-red-400">*</span>
747
+ </label>
748
+ <input
749
+ type="text"
750
+ required
751
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm"
752
+ placeholder="请输入您的姓名"
753
+ />
754
+ </div>
755
+ <div>
756
+ <label className="block text-sm font-medium text-slate-300 mb-2">
757
+ 手机号 <span className="text-red-400">*</span>
758
+ </label>
759
+ <input
760
+ type="tel"
761
+ required
762
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm"
763
+ placeholder="请输入手机号"
764
+ />
765
+ </div>
766
+ <div>
767
+ <label className="block text-sm font-medium text-slate-300 mb-2">
768
+ 邮箱 <span className="text-red-400">*</span>
769
+ </label>
770
+ <input
771
+ type="email"
772
+ required
773
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm"
774
+ placeholder="请输入邮箱地址"
775
+ />
776
+ </div>
777
+ <div>
778
+ <label className="block text-sm font-medium text-slate-300 mb-2">
779
+ 职位
780
+ </label>
781
+ <input
782
+ type="text"
783
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm"
784
+ placeholder="请输入您的职位(选填)"
785
+ />
786
+ </div>
787
+ <div>
788
+ <label className="block text-sm font-medium text-slate-300 mb-2">
789
+ 使用需求
790
+ </label>
791
+ <textarea
792
+ rows={3}
793
+ className="w-full px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-white placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all text-sm resize-none"
794
+ placeholder="请简要描述您的使用需求和场景(选填)"
795
+ ></textarea>
796
+ </div>
797
+ {/* <div>
798
+ <label className="flex items-start">
799
+ <input
800
+ type="checkbox"
801
+ required
802
+ className="mt-1 rounded border-slate-600 bg-slate-800 text-blue-600 focus:ring-blue-500 focus:ring-offset-slate-900"
803
+ />
804
+ <span className="ml-2 text-sm text-slate-400 leading-relaxed">
805
+ 我已阅读并同意
806
+ <span className="text-blue-400 hover:text-blue-300 cursor-pointer">
807
+ 《用户协议》
808
+ </span>
809
+
810
+ <span className="text-blue-400 hover:text-blue-300 cursor-pointer">
811
+ 《隐私政策》
812
+ </span>
813
+ </span>
814
+ </label>
815
+ </div> */}
816
+ <button
817
+ type="submit"
818
+ className="w-full bg-gradient-to-r from-blue-600 via-blue-700 to-purple-700 text-white px-6 py-3 rounded-xl hover:from-blue-700 hover:via-blue-800 hover:to-purple-800 transition-all duration-300 font-medium shadow-lg shadow-blue-500/25 hover:shadow-blue-500/40"
819
+ >
820
+ 提交申请
821
+ </button>
822
+ </form>
823
+ )}
824
+
825
+ {/* Divider */}
826
+ {loginMode === "login" && (
827
+ <div className="flex items-center my-6">
828
+ <div className="flex-1 h-px bg-slate-700"></div>
829
+ <span className="px-4 text-slate-400 text-sm">或</span>
830
+ <div className="flex-1 h-px bg-slate-700"></div>
831
+ </div>
832
+ )}
833
+
834
+ {/* Social Login */}
835
+ {loginMode === "login" && (
836
+ <div className="space-y-3">
837
+ <button className="w-full flex items-center justify-center px-4 py-3 bg-slate-800/50 border border-slate-700/50 rounded-xl text-slate-300 hover:text-white hover:bg-slate-800 transition-all">
838
+ <i className="ri-calendar-check-line w-5 h-5 flex items-center justify-center mr-3 text-blue-400"></i>
839
+ <span>飞书快速登录</span>
840
+ </button>
841
+ </div>
842
+ )}
843
+ </div>
844
+ </div>
845
+ </div>
846
+ )}
847
+
848
+ {/* Mobile Menu Button */}
849
+ <div className="lg:hidden">
850
+ <button
851
+ onClick={() => setIsMenuOpen(!isMenuOpen)}
852
+ className="text-slate-300 hover:text-white cursor-pointer rounded-lg hover:bg-slate-800/50 transition-all duration-500 fixed top-[28px] right-[20px] z-[9999]"
853
+ >
854
+ <div className="w-10 h-10 flex items-center justify-center">
855
+ <div className="relative w-6 h-6 flex items-center justify-center">
856
+ {/* AI生成的代码 - 优化的汉堡菜单到X形状的平滑动画 */}
857
+ <div className="relative w-6 h-6">
858
+ {/* 第一条线 - 顶部线条,关闭时旋转45度 */}
859
+ <div
860
+ className={`absolute w-5 h-0.5 bg-gradient-to-r from-cyan-400 to-blue-400 rounded-full shadow-sm transition-all duration-700 ease-in-out ${
861
+ isMenuOpen
862
+ ? "top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 rotate-45 shadow-cyan-400/50"
863
+ : "top-1 left-1/2 transform -translate-x-1/2 rotate-0 group-hover:shadow-cyan-400/30"
864
+ }`}
865
+ ></div>
866
+
867
+ {/* 第二条线 - 中间线条,关闭时透明度为0,添加延迟避免与其他线条冲突 */}
868
+ <div
869
+ className={`absolute w-5 h-0.5 bg-gradient-to-r from-cyan-400 to-blue-400 rounded-full shadow-sm top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ${
870
+ isMenuOpen
871
+ ? "opacity-0 scale-0 transition-all duration-500 ease-in-out delay-100"
872
+ : "opacity-100 scale-100 transition-all duration-500 ease-in-out delay-200 group-hover:shadow-cyan-400/30"
873
+ }`}
874
+ ></div>
875
+
876
+ {/* 第三条线 - 底部线条,关闭时旋转-45度 */}
877
+ <div
878
+ className={`absolute w-5 h-0.5 bg-gradient-to-r from-cyan-400 to-blue-400 rounded-full shadow-sm transition-all duration-700 ease-in-out ${
879
+ isMenuOpen
880
+ ? "top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 -rotate-45 shadow-cyan-400/50"
881
+ : "bottom-1 left-1/2 transform -translate-x-1/2 rotate-0 group-hover:shadow-cyan-400/30"
882
+ }`}
883
+ ></div>
884
+ </div>
885
+ </div>
886
+ </div>
887
+ </button>
888
+ </div>
889
+ </>
890
+ );
891
+ });
892
+
893
+ // AI生成的代码 - 默认导出
894
+ export default Header;