Merge "种子详情-初步" into main
diff --git a/src/api/torrent.js b/src/api/torrent.js
index 2bde101..eb10784 100644
--- a/src/api/torrent.js
+++ b/src/api/torrent.js
@@ -125,7 +125,7 @@
  */

 export function getTorrentDetail(infoHash) {

   return request({

-    url: `/torrent/${infoHash}`,

+    url: `/torrent/view/${infoHash}`,

     method: 'get'

   })

 }
\ No newline at end of file
diff --git a/src/views/torrent/TorrentDetailView.vue b/src/views/torrent/TorrentDetailView.vue
index c3c367e..a79a528 100644
--- a/src/views/torrent/TorrentDetailView.vue
+++ b/src/views/torrent/TorrentDetailView.vue
@@ -299,6 +299,19 @@
 

 export default {

   name: 'TorrentDetailView',

+  components: {

+    ArrowLeft,

+    Download,

+    Star,

+    Flag,

+    User,

+    Clock,

+    Document,

+    Files,

+    Picture,

+    Folder,

+    Like

+  },

   setup() {

     const route = useRoute()

     const router = useRouter()

@@ -345,7 +358,7 @@
     })

     

     onMounted(() => {

-      const infoHash = route.params.infoHash || route.params.id

+      const infoHash = route.params.infoHash

       if (infoHash) {

         fetchTorrentDetail(infoHash)

       } else {

@@ -359,7 +372,7 @@
         loading.value = true

         

         // 获取种子详情

-        const response = await axios.get(`http://localhost:8081/api/torrent/view/${infoHash}`)

+        const response = await axios.get(`/api/torrent/view/${infoHash}`)

         

         if (response.data.code === 0) {

           torrentInfo.value = response.data

@@ -482,13 +495,13 @@
     }

     

     const handleDownload = async () => {

-      if (!torrentInfo.value) return

+      if (!torrentInfo.value?.infoHash) return

       

       downloading.value = true

       try {

-        // 这里应该调用下载种子文件的API

+        // 调用下载种子文件的API

         const response = await axios.get(

-          `http://localhost:8081/api/torrent/download/${torrentInfo.value.infoHash}`,

+          `/api/torrent/download/${torrentInfo.value.infoHash}`,

           { responseType: 'blob' }

         )

         

@@ -580,7 +593,7 @@
     }

     

     const retry = () => {

-      const infoHash = route.params.infoHash || route.params.id

+      const infoHash = route.params.infoHash

       if (infoHash) {

         fetchTorrentDetail(infoHash)

       }

diff --git a/src/views/torrent/TorrentsView.vue b/src/views/torrent/TorrentsView.vue
index f930025..34af25d 100644
--- a/src/views/torrent/TorrentsView.vue
+++ b/src/views/torrent/TorrentsView.vue
@@ -284,7 +284,7 @@
     }
     
     const handleRowClick = (row) => {
-      router.push(`/torrent/${row.id || row.infoHash}`)
+      router.push(`/torrent/${row.infoHash}`)
     }
     
     const handleDownload = (row) => {