From e894c20b98f3c9113eb7c7e703e8120d6f83e6bc Mon Sep 17 00:00:00 2001 From: ovo Date: Sun, 8 Dec 2024 16:19:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=B5=B7=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/video.ts | 126 ++-- src/views/VideoView.vue | 1252 +++++++++++++-------------------------- 2 files changed, 496 insertions(+), 882 deletions(-) diff --git a/src/api/video.ts b/src/api/video.ts index d7934ec..1e1ca0f 100644 --- a/src/api/video.ts +++ b/src/api/video.ts @@ -41,7 +41,7 @@ const mockVideos: Video[] = [ duration: '15:30', category: 'health', views: 2345, - description: '专业��生讲解养生知识', + description: '专业医生讲解养生知识', uploadTime: '2024-03-19', likes: 342, comments: 67, @@ -99,54 +99,108 @@ export const videoCategories = [ { label: '新闻资讯', value: 'news' } ] -// 模拟 API 接口 +// 视频相关接口 export const videoApi = { // 获取视频列表 - async getVideoList(category: string = ''): Promise { - await delay(500) // 模拟网络延迟 - return mockVideos.filter(video => - category ? video.category === category : true - ) + async getList(params: { + pageNum?: number + pageSize?: number + keyword?: string + }) { + const res = await request.get('/videos', { params }) + return res.data }, // 获取视频详情 - async getVideoDetail(id: number): Promise