用户资料接口添加

Change-Id: Id55e7fef307ec1663bb7a05cfbf7f81e097ac767
diff --git a/front/src/InfoPage.js b/front/src/InfoPage.js
index 1e00527..755d922 100644
--- a/front/src/InfoPage.js
+++ b/front/src/InfoPage.js
@@ -40,6 +40,7 @@
 export default function InfoPage() {

   const navigate = useNavigate();

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

+  const [infoList, setInfoList] = React.useState(0);

 

   // 每个tab对应的资料类型

   const infoTypesList = [

@@ -51,6 +52,18 @@
   ];

   const infoTypes = infoTypesList[activeTab] || [];

 

+  React.useEffect(() => {

+    // 这里假设后端接口为 /api/get-seed-list-by-tag?tag=大陆

+    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 => {

+        console.log('资料区返回数据:', data);

+        setInfoList(data);

+      })

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

+  }, [activeTab]);

+

   return (

     <div className="container">

       {/* 顶部空白与音乐界面一致,用户栏绝对定位在页面右上角 */}

@@ -163,27 +176,39 @@
             </tr>

           </thead>

           <tbody>

-            {infoTypes.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>

-            ))}

+            {infoList.length > 0 ? (

+              infoList.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>

+              ))

+            ) : (

+              infoTypesList.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>