diff --git a/src/api/index.ts b/src/api/index.ts index 1ba32af..f983583 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -19,6 +19,8 @@ export { default as MenuApi } from './modules/menu' export type { MenuItem } from './modules/menu' export { SystemApi } from './modules/system' export type { SystemSettings, DictItem } from './modules/system' +export { ResourceApi } from './modules/resource' +export type { FeaturedResource } from './modules/resource' // API 基础配置 export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/jeecgboot' diff --git a/src/router/index.ts b/src/router/index.ts index ec2e0b9..652b66a 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -708,6 +708,12 @@ const routes: RouteRecordRaw[] = [ component: Resources, meta: { title: '精选资源' } }, + { + path: '/resource-test', + name: 'ResourceTest', + component: () => import('@/views/ResourceTest.vue'), + meta: { title: '精选资源API测试' } + }, { path: '/special-training', name: 'SpecialTraining', diff --git a/src/views/Ai/utils/http.ts b/src/views/Ai/utils/http.ts index ba71324..424f2b5 100644 --- a/src/views/Ai/utils/http.ts +++ b/src/views/Ai/utils/http.ts @@ -174,28 +174,28 @@ class HttpClient { * GET请求 */ get(url: string, config?: HttpRequestConfig): Promise> { - return this.instance.get(url, config) + return this.instance.get(url, config).then(response => response.data) } /** * POST请求 */ post(url: string, data?: any, config?: HttpRequestConfig): Promise> { - return this.instance.post(url, data, config) + return this.instance.post(url, data, config).then(response => response.data) } /** * PUT请求 */ put(url: string, data?: any, config?: HttpRequestConfig): Promise> { - return this.instance.put(url, data, config) + return this.instance.put(url, data, config).then(response => response.data) } /** * DELETE请求 */ delete(url: string, config?: HttpRequestConfig): Promise> { - return this.instance.delete(url, config) + return this.instance.delete(url, config).then(response => response.data) } /** diff --git a/src/views/Resources.vue b/src/views/Resources.vue index ac2efb4..d77fef2 100644 --- a/src/views/Resources.vue +++ b/src/views/Resources.vue @@ -13,22 +13,40 @@