用户资料接口添加

Change-Id: Id55e7fef307ec1663bb7a05cfbf7f81e097ac767
diff --git a/front/src/TVPage.js b/front/src/TVPage.js
index 13b7391..bf1db6c 100644
--- a/front/src/TVPage.js
+++ b/front/src/TVPage.js
@@ -21,40 +21,37 @@
   { label: "发布", icon: <AccountCircleIcon />, path: "/publish" }, // Added Publish option

 ];

 

-const tvTypes = [

-  "华语剧集(大陆)",

-  "欧美剧集",

-  "日韩剧集",

-  "港台剧集",

-  "其他"

+const tvTypesList = [

+  ["华语剧集(大陆)", "欧美剧集", "日韩剧集", "港台剧集", "其他"], // 大陆

+  ["港台都市", "港台爱情", "港台悬疑", "港台其他"], // 港台

+  ["欧美悬疑", "欧美历史", "欧美其他"], // 欧美

+  ["日韩青春", "日韩家庭", "日韩其他"], // 日韩

+  ["其他类型1", "其他类型2"] // 其他

 ];

 

 const areaTabs = [

-  { label: "大陆", icon: <MovieIcon fontSize="small" /> },

-  { label: "港台", icon: <EmailIcon fontSize="small" /> },

-  { label: "欧美", icon: <PersonIcon fontSize="small" /> },

-  { label: "日韩", icon: <EmojiPeopleIcon fontSize="small" /> },

-  { label: "其他", icon: <PersonIcon fontSize="small" /> },

-];

-

-const exampleTorrents = [

-  { type: "Drama", title: "实例1", id: 1 },

-  { type: "Comedy", title: "实例2", id: 2 },

-  { type: "Sci-Fi", title: "实例3", id: 3 },

+  { label: "国产电视剧", icon: <MovieIcon fontSize="small" /> },

+  { label: "港剧", icon: <EmailIcon fontSize="small" /> },

+  { label: "欧美剧", icon: <PersonIcon fontSize="small" /> },

+  { label: "日韩剧", icon: <EmojiPeopleIcon fontSize="small" /> },

+  // { label: "其他", icon: <PersonIcon fontSize="small" /> },

 ];

 

 export default function TVPage() {

   const navigate = useNavigate();

   const [activeTab, setActiveTab] = React.useState(0);

+  const [tvList, setTvList] = React.useState([]);

+

+  React.useEffect(() => {

+    // 假设后端接口为 /api/tvs?area=大陆

+    const area = areaTabs[activeTab].label;

+    fetch(`http://192.168.5.9:8080/api/get-seed-list-by-tag?tag=${encodeURIComponent(area)}`)

+      .then(res => res.json())

+      .then(data => setTvList(data))

+      .catch(() => setTvList([]));

+  }, [activeTab]);

 

   // 每个tab对应的剧集类型

-  const tvTypesList = [

-    ["华语剧集(大陆)", "欧美剧集", "日韩剧集", "港台剧集", "其他"], // 大陆

-    ["港台都市", "港台爱情", "港台悬疑", "港台其他"], // 港台

-    ["欧美悬疑", "欧美历史", "欧美其他"], // 欧美

-    ["日韩青春", "日韩家庭", "日韩其他"], // 日韩

-    ["其他类型1", "其他类型2"] // 其他

-  ];

   const tvTypes = tvTypesList[activeTab] || [];

 

   return (

@@ -114,21 +111,39 @@
             </tr>

           </thead>

           <tbody>

-            {tvTypes.map((type, index) => (

-              <tr key={type}>

-                <td>

-                  <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>

-                    {type}

-                  </a>

-                </td>

-                <td>

-                  <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>

-                    种子{index + 1}

-                  </a>

-                </td>

-                <td></td>

-              </tr>

-            ))}

+            {tvList.length > 0 ? (

+              tvList.map((item, index) => (

+                <tr key={item.id || index}>

+                  <td>

+                    <a href={`/torrent/${item.seedid}`} style={{ color: '#1a237e', textDecoration: 'none' }}>

+                      {item.seedtag}

+                    </a>

+                  </td>

+                  <td>

+                    <a href={`/torrent/${item.seedid}`} style={{ color: '#1a237e', textDecoration: 'none' }}>

+                      {item.title}

+                    </a>

+                  </td>

+                  <td>{item.user.username}</td>

+                </tr>

+              ))

+            ) : (

+              tvTypes.map((type, index) => (

+                <tr key={type}>

+                  <td>

+                    <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>

+                      {type}

+                    </a>

+                  </td>

+                  <td>

+                    <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>

+                      种子{index + 1}

+                    </a>

+                  </td>

+                  <td>发布者{index + 1}</td>

+                </tr>

+              ))

+            )}

           </tbody>

         </table>

       </div>