连接后端的category/list接口

Change-Id: I8077f1fe25b0f453b7b07c9bfe4be92f983bff56
diff --git a/src/api/auth.js b/src/api/auth.js
index a3c672a..b0f11aa 100644
--- a/src/api/auth.js
+++ b/src/api/auth.js
@@ -13,7 +13,7 @@
     }

     

     return request({

-      url: '/api/auth/login',  // 需要 /api 前缀

+      url: '/auth/login',  // 需要 /api 前缀

       method: 'post',

       data: requestData

     })

@@ -32,7 +32,7 @@
     }

     

     return request({

-      url: '/api/auth/register',  // 需要 /api 前缀

+      url: '/auth/register',  // 需要 /api 前缀

       method: 'post',

       data: requestData

     })

@@ -43,7 +43,7 @@
    */

   logout() {

     return request({

-      url: '/api/auth/logout',  // 需要 /api 前缀

+      url: '/auth/logout',  // 需要 /api 前缀

       method: 'post'

     })

   },

@@ -53,7 +53,7 @@
    */

   getStatus() {

     return request({

-      url: '/api/auth/status',  // 需要 /api 前缀

+      url: '/auth/status',  // 需要 /api 前缀

       method: 'get'

     })

   }

diff --git a/src/api/request.js b/src/api/request.js
index 239e97a..0e06f0a 100644
--- a/src/api/request.js
+++ b/src/api/request.js
@@ -15,12 +15,15 @@
 request.interceptors.request.use(

   config => {

     const token = localStorage.getItem('token')

+    console.log('📤 添加 token 到请求头:', token)

     if (token) {

       config.headers.Authorization = `Bearer ${token}`

     }

     

     console.log('🚀 发送请求:', config.method?.toUpperCase(), config.url)

     console.log('📤 请求数据:', config.data)

+    console.log('🔍 VUE_APP_BASE_API:', process.env.VUE_APP_BASE_API)

+    console.log('🔍 VUE_APP_BACKEND:', process.env.VUE_APP_BACKEND)

     

     return config

   },

diff --git a/src/api/torrent.js b/src/api/torrent.js
index f5df487..bccf99c 100644
--- a/src/api/torrent.js
+++ b/src/api/torrent.js
@@ -21,29 +21,11 @@
  * @returns {Promise}

  */

 export function getCategories() {

-    console.log('调用获取分类列表API(使用假数据)...')

-    

-    // 由于后端分类API还没实现,返回模拟数据

-    return new Promise((resolve) => {

-      setTimeout(() => {

-        const categories = [

-          { id: 1, name: '操作系统', slug: 'os', icon: 'computer' },

-          { id: 2, name: '软件应用', slug: 'software', icon: 'application' },

-          { id: 3, name: '游戏', slug: 'games', icon: 'game' },

-          { id: 4, name: '影音娱乐', slug: 'media', icon: 'video' },

-          { id: 5, name: '开发工具', slug: 'dev-tools', icon: 'code' },

-          { id: 6, name: '学习资料', slug: 'education', icon: 'book' },

-          { id: 7, name: '移动应用', slug: 'mobile', icon: 'mobile' },

-          { id: 8, name: '服务器软件', slug: 'server', icon: 'server' },

-          { id: 9, name: '安全工具', slug: 'security', icon: 'shield' },

-          { id: 10, name: '其他', slug: 'others', icon: 'folder' }

-        ]

-        

-        console.log('分类列表模拟数据加载成功:', categories)

-        resolve({ data: categories })

-      }, 200) // 模拟网络延迟

-    })

-  }

+  return request({

+    url: '/category/list', // 注意这里不需要加 /api,已经在代理中配置了

+    method: 'get'

+  })

+}

 

 /**

  * 获取标签列表

@@ -58,16 +40,8 @@
         resolve({

           data: [

             { id: 1, name: 'linux' },

-            { id: 2, name: 'ubuntu' },

-            { id: 3, name: 'debian' },

-            { id: 4, name: 'windows' },

-            { id: 5, name: 'macos' },

-            { id: 6, name: 'centos' },

-            { id: 7, name: 'redhat' },

-            { id: 8, name: 'android' },

-            { id: 9, name: 'ios' },

-            { id: 10, name: 'server' },

-            { id: 11, name: 'desktop' }

+            { id: 2, name: 'ios' },

+            { id: 3, name: 'ubuntu' }

           ]

         })

       }, 100)