种子列表优化、添加用户充值

Change-Id: I602e9eef78efe3527c320352d4522244d41ae807
diff --git a/src/pages/SeedList/SeedList.jsx b/src/pages/SeedList/SeedList.jsx
index adb2bb3..4f558fc 100644
--- a/src/pages/SeedList/SeedList.jsx
+++ b/src/pages/SeedList/SeedList.jsx
@@ -1,3 +1,4 @@
+// export default SeedList;
 import React, { useState, useEffect } from 'react';
 import { Link } from 'wouter';
 import axios from 'axios';
@@ -18,28 +19,28 @@
     const [errorMsg, setErrorMsg] = useState('');
     const { user } = useUser();
 
-
     const TAGS = ['猜你喜欢', '电影', '电视剧', '动漫', '音乐', '游戏', '综艺', '软件', '体育', '学习', '纪录片', '其他'];
 
-    const CATEGORY_MAP = {
-        '电影': '电影',
-        '电视剧': '电视剧',
-        '动漫': '动漫',
-        '音乐': '音乐',
-        '游戏': '游戏',
-        '综艺': '综艺',
-        '软件': '软件',
-        '体育': '体育',
-        '学习': '学习',
-        '纪录片': '纪录片',
-        '其他': '其他',
+const CATEGORY_MAP = {
+        '电影': 'movie',
+        '电视剧': 'tv',
+        '动漫': 'anime',
+        '音乐': 'music',
+        '游戏': 'game',
+        '综艺': 'variety',
+        '软件': 'software',
+        '体育': 'sports',
+        '学习': 'study',
+        '纪录片': 'documentary',
+        '其他': 'other',
         '猜你喜欢': '',        
         '种子列表': '',        
-    };
+};
+
 
     const buildQueryParams = () => {
         const category = CATEGORY_MAP[activeTab] || '';
-        const orderKey = sortOption === '最新' ? ['upload_time'] : (sortOption === '最热' ? ['downloads'] : ['upload_time']);
+        const orderKey = sortOption === '最新' ? 'upload_time' : (sortOption === '最热' ? 'downloads' : 'upload_time');
         const params = {
             page: 1,
             size: 20,
@@ -72,8 +73,7 @@
         setErrorMsg('');
         try {
             const params = buildQueryParams();
-            const response = await axios.get('/seeds/list', params);
-            // const response = await axios.get('/seeds/list', { params });
+            const response = await axios.get('/seeds/list', { params });
 
             const data = response.data;
 
@@ -119,7 +119,6 @@
         fetchSeeds();
     }, [activeTab, sortOption, selectedFilters, tagMode, searchTerm]);
 
-    // ✅ 修改后的下载函数
     const handleDownload = async (seedId) => {
         if (!user || !user.userId) {
             alert('请先登录再下载种子文件');
@@ -254,7 +253,6 @@
                         </div>
                         <div className="seed-list-body">
                             {seeds.map((seed, index) => {
-                                // 处理 tags 字段,兼容字符串和数组
                                 let tagsArray = [];
                                 if (seed.tags) {
                                     if (Array.isArray(seed.tags)) {
@@ -263,18 +261,15 @@
                                         try {
                                             tagsArray = JSON.parse(seed.tags);
                                             if (!Array.isArray(tagsArray)) {
-                                                // 解析后不是数组,按逗号分割
                                                 tagsArray = seed.tags.split(',').map(t => t.trim()).filter(t => t);
                                             }
                                         } catch {
-                                            // 解析失败,按逗号分割
                                             tagsArray = seed.tags.split(',').map(t => t.trim()).filter(t => t);
                                         }
                                     }
                                 }
 
                                 return (
-                                    
                                    <Link to={`/seed/${seed.id}`} key={index} className="seed-item-link">
                                         <div className="seed-item">
                                             {seed.imageUrl && (
@@ -300,7 +295,7 @@
                                             <div className="seed-item-downloads">{seed.downloads ?? 0} 次下载</div>
                                             <div
                                                 className="seed-item-actions"
-                                                onClick={e => e.stopPropagation()} // 阻止事件冒泡,避免跳转
+                                                onClick={e => e.stopPropagation()}
                                             >
                                                 <button
                                                     className="btn-primary"
@@ -313,35 +308,34 @@
                                                     下载
                                                 </button>
                                                 <button
-    className="btn-outline"
-    onClick={async (e) => {
-        e.preventDefault();
-        e.stopPropagation();
+                                                    className="btn-outline"
+                                                    onClick={async (e) => {
+                                                        e.preventDefault();
+                                                        e.stopPropagation();
 
-        if (!user || !user.userId) {
-            alert('请先登录再收藏');
-            return;
-        }
+                                                        if (!user || !user.userId) {
+                                                            alert('请先登录再收藏');
+                                                            return;
+                                                        }
 
-        try {
-            const res = await axios.post(`/seeds/${seed.id}/favorite-toggle`, null, {
-                params: { user_id: user.userId },
-            });
+                                                        try {
+                                                            const res = await axios.post(`/seeds/${seed.id}/favorite-toggle`, null, {
+                                                                params: { user_id: user.userId },
+                                                            });
 
-            if (res.data.code === 0) {
-                alert('操作成功'); // 你可以改成 toast 或 icon 状态提示
-            } else {
-                alert(res.data.msg || '操作失败');
-            }
-        } catch (err) {
-            console.error('收藏失败:', err);
-            alert('收藏失败,请稍后再试。');
-        }
-    }}
->
-    收藏
-</button>
-
+                                                            if (res.data.code === 0) {
+                                                                alert('操作成功');
+                                                            } else {
+                                                                alert(res.data.msg || '操作失败');
+                                                            }
+                                                        } catch (err) {
+                                                            console.error('收藏失败:', err);
+                                                            alert('收藏失败,请稍后再试。');
+                                                        }
+                                                    }}
+                                                >
+                                                    收藏
+                                                </button>
                                             </div>
                                         </div>
                                     </Link>