diff --git a/public/images/Featured_resources/全部图片1.png b/public/images/Featured_resources/全部图片1.png new file mode 100644 index 0000000..d56e265 Binary files /dev/null and b/public/images/Featured_resources/全部图片1.png differ diff --git a/public/images/Featured_resources/全部图片2.png b/public/images/Featured_resources/全部图片2.png new file mode 100644 index 0000000..c5283cf Binary files /dev/null and b/public/images/Featured_resources/全部图片2.png differ diff --git a/public/images/Featured_resources/全部图片3.png b/public/images/Featured_resources/全部图片3.png new file mode 100644 index 0000000..91472f0 Binary files /dev/null and b/public/images/Featured_resources/全部图片3.png differ diff --git a/public/images/Featured_resources/全部图片4.png b/public/images/Featured_resources/全部图片4.png new file mode 100644 index 0000000..1513b42 Binary files /dev/null and b/public/images/Featured_resources/全部图片4.png differ diff --git a/public/images/Featured_resources/全部图片5.png b/public/images/Featured_resources/全部图片5.png new file mode 100644 index 0000000..9a04a90 Binary files /dev/null and b/public/images/Featured_resources/全部图片5.png differ diff --git a/public/images/Featured_resources/全部图片6.png b/public/images/Featured_resources/全部图片6.png new file mode 100644 index 0000000..6095487 Binary files /dev/null and b/public/images/Featured_resources/全部图片6.png differ diff --git a/public/images/Featured_resources/全部图片7.png b/public/images/Featured_resources/全部图片7.png new file mode 100644 index 0000000..477e604 Binary files /dev/null and b/public/images/Featured_resources/全部图片7.png differ diff --git a/public/images/Featured_resources/全部图片8.png b/public/images/Featured_resources/全部图片8.png new file mode 100644 index 0000000..9ea8498 Binary files /dev/null and b/public/images/Featured_resources/全部图片8.png differ diff --git a/public/images/Featured_resources/全部视频1.png b/public/images/Featured_resources/全部视频1.png new file mode 100644 index 0000000..d1ba28a Binary files /dev/null and b/public/images/Featured_resources/全部视频1.png differ diff --git a/public/images/Featured_resources/全部视频2.png b/public/images/Featured_resources/全部视频2.png new file mode 100644 index 0000000..4941ebc Binary files /dev/null and b/public/images/Featured_resources/全部视频2.png differ diff --git a/public/images/Featured_resources/全部视频3.png b/public/images/Featured_resources/全部视频3.png new file mode 100644 index 0000000..cb64db9 Binary files /dev/null and b/public/images/Featured_resources/全部视频3.png differ diff --git a/public/images/Featured_resources/全部视频4.png b/public/images/Featured_resources/全部视频4.png new file mode 100644 index 0000000..fac7d2d Binary files /dev/null and b/public/images/Featured_resources/全部视频4.png differ diff --git a/public/images/Featured_resources/全部视频5.png b/public/images/Featured_resources/全部视频5.png new file mode 100644 index 0000000..7410ade Binary files /dev/null and b/public/images/Featured_resources/全部视频5.png differ diff --git a/public/images/Featured_resources/全部视频6.png b/public/images/Featured_resources/全部视频6.png new file mode 100644 index 0000000..2f49aff Binary files /dev/null and b/public/images/Featured_resources/全部视频6.png differ diff --git a/public/images/Featured_resources/全部视频7.png b/public/images/Featured_resources/全部视频7.png new file mode 100644 index 0000000..2cedbd2 Binary files /dev/null and b/public/images/Featured_resources/全部视频7.png differ diff --git a/public/images/Featured_resources/全部视频8.png b/public/images/Featured_resources/全部视频8.png new file mode 100644 index 0000000..8121303 Binary files /dev/null and b/public/images/Featured_resources/全部视频8.png differ diff --git a/public/images/Featured_resources/精品视频3.png b/public/images/Featured_resources/精品视频3.png new file mode 100644 index 0000000..4f233c4 Binary files /dev/null and b/public/images/Featured_resources/精品视频3.png differ diff --git a/public/images/Featured_resources/精选视频1.png b/public/images/Featured_resources/精选视频1.png new file mode 100644 index 0000000..3725927 Binary files /dev/null and b/public/images/Featured_resources/精选视频1.png differ diff --git a/public/images/Featured_resources/精选视频2.png b/public/images/Featured_resources/精选视频2.png new file mode 100644 index 0000000..406a054 Binary files /dev/null and b/public/images/Featured_resources/精选视频2.png differ diff --git a/public/images/Featured_resources/精选资源轮播.png b/public/images/Featured_resources/精选资源轮播.png new file mode 100644 index 0000000..6a0328a Binary files /dev/null and b/public/images/Featured_resources/精选资源轮播.png differ diff --git a/public/images/Teachers/师资力量1.png b/public/images/Teachers/师资力量1.png new file mode 100644 index 0000000..218e2b4 Binary files /dev/null and b/public/images/Teachers/师资力量1.png differ diff --git a/public/images/Teachers/师资力量2.png b/public/images/Teachers/师资力量2.png new file mode 100644 index 0000000..f522e13 Binary files /dev/null and b/public/images/Teachers/师资力量2.png differ diff --git a/public/images/Teachers/师资力量3.png b/public/images/Teachers/师资力量3.png new file mode 100644 index 0000000..a2f2fc8 Binary files /dev/null and b/public/images/Teachers/师资力量3.png differ diff --git a/public/images/Teachers/师资力量4.png b/public/images/Teachers/师资力量4.png new file mode 100644 index 0000000..7d3ff51 Binary files /dev/null and b/public/images/Teachers/师资力量4.png differ diff --git a/public/images/Teachers/师资力量5.png b/public/images/Teachers/师资力量5.png new file mode 100644 index 0000000..2a710a8 Binary files /dev/null and b/public/images/Teachers/师资力量5.png differ diff --git a/public/images/Teachers/师资力量6.png b/public/images/Teachers/师资力量6.png new file mode 100644 index 0000000..c7c5520 Binary files /dev/null and b/public/images/Teachers/师资力量6.png differ diff --git a/public/images/Teachers/师资力量7.png b/public/images/Teachers/师资力量7.png new file mode 100644 index 0000000..2bbbfaf Binary files /dev/null and b/public/images/Teachers/师资力量7.png differ diff --git a/public/images/Teachers/师资力量8.png b/public/images/Teachers/师资力量8.png new file mode 100644 index 0000000..7c10830 Binary files /dev/null and b/public/images/Teachers/师资力量8.png differ diff --git a/public/images/Teachers/师资力量切图-轮播区.png b/public/images/Teachers/师资力量切图-轮播区.png new file mode 100644 index 0000000..3211f4d Binary files /dev/null and b/public/images/Teachers/师资力量切图-轮播区.png differ diff --git a/public/images/activity/活动切图-轮播区.png b/public/images/activity/活动切图-轮播区.png new file mode 100644 index 0000000..e75053c Binary files /dev/null and b/public/images/activity/活动切图-轮播区.png differ diff --git a/public/images/activity/活动图1.png b/public/images/activity/活动图1.png new file mode 100644 index 0000000..91bf39f Binary files /dev/null and b/public/images/activity/活动图1.png differ diff --git a/public/images/activity/活动图2.png b/public/images/activity/活动图2.png new file mode 100644 index 0000000..b3227d7 Binary files /dev/null and b/public/images/activity/活动图2.png differ diff --git a/public/images/activity/活动图3.png b/public/images/activity/活动图3.png new file mode 100644 index 0000000..26e834f Binary files /dev/null and b/public/images/activity/活动图3.png differ diff --git a/src/api/examples/usage.ts b/src/api/examples/usage.ts index 889cdaf..d74cda2 100644 --- a/src/api/examples/usage.ts +++ b/src/api/examples/usage.ts @@ -73,13 +73,13 @@ export const getCoursesExample = async () => { const response = await CourseApi.getCourses({ page: 1, pageSize: 20, - category: '前端开发', - level: 'intermediate', - sortBy: 'rating' + categoryId: 1, + difficulty: 1, + sortBy: 'createdAt' }) if (response.code === 200) { - const { list, total, page, pageSize } = response.data + const { list, total } = response.data console.log('课程列表:', list) console.log('总数:', total) return response.data @@ -98,7 +98,7 @@ export const searchCoursesExample = async () => { level: 'intermediate', price: 'paid', rating: 4, - sortBy: 'rating', + sortBy: 'newest', page: 1, pageSize: 10 }) diff --git a/src/api/modules/auth.ts b/src/api/modules/auth.ts index 9d3abda..8a54e77 100644 --- a/src/api/modules/auth.ts +++ b/src/api/modules/auth.ts @@ -33,6 +33,7 @@ export class AuthApi { nickname: '用户', avatar: '', role: 'student', + status: 'active', createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }, diff --git a/src/api/modules/course.ts b/src/api/modules/course.ts index 2063067..df09693 100644 --- a/src/api/modules/course.ts +++ b/src/api/modules/course.ts @@ -13,7 +13,6 @@ import type { BackendCourseSection, BackendCourseSectionListResponse, Quiz, - QuizQuestion, LearningProgress, SearchRequest, Instructor, @@ -30,12 +29,23 @@ export class CourseApi { /** * 格式化时间戳为ISO字符串 */ - private static formatTimestamp(timestamp: number | null | undefined): string { - if (!timestamp || timestamp <= 0) { + private static formatTimestamp(timestamp: number | string | null | undefined): string { + if (!timestamp) { return new Date().toISOString() } try { + // 如果是字符串,尝试解析 + if (typeof timestamp === 'string') { + const date = new Date(timestamp) + return isNaN(date.getTime()) ? new Date().toISOString() : date.toISOString() + } + + // 如果是数字时间戳 + if (timestamp <= 0) { + return new Date().toISOString() + } + // 如果时间戳是秒级的,转换为毫秒级 const ms = timestamp < 10000000000 ? timestamp * 1000 : timestamp const date = new Date(ms) @@ -181,8 +191,8 @@ export class CourseApi { content: response.data.outline, // 使用 outline 作为课程内容 thumbnail: response.data.cover, coverImage: response.data.cover, - price: parseFloat(response.data.price), - originalPrice: parseFloat(response.data.price), + price: parseFloat(response.data.price || '0'), + originalPrice: parseFloat(response.data.price || '0'), currency: 'CNY', rating: 4.5, ratingCount: 0, @@ -214,8 +224,8 @@ export class CourseApi { certifications: [] }, status: 'published' as const, - createdAt: this.formatTimestamp(response.data.createdAt), - updatedAt: this.formatTimestamp(response.data.updatedAt), + createdAt: this.formatTimestamp(response.data.createdTime), + updatedAt: this.formatTimestamp(response.data.updatedTime), publishedAt: response.data.startTime } diff --git a/src/api/modules/order.ts b/src/api/modules/order.ts index b9ed0d8..ea9a6d9 100644 --- a/src/api/modules/order.ts +++ b/src/api/modules/order.ts @@ -4,7 +4,7 @@ import type { ApiResponse, PaginationResponse, Order, - OrderItem, + } from '../types' /** diff --git a/src/api/modules/upload.ts b/src/api/modules/upload.ts index b7f6f02..7c99cda 100644 --- a/src/api/modules/upload.ts +++ b/src/api/modules/upload.ts @@ -53,7 +53,7 @@ export class UploadApi { headers: { 'Content-Type': 'multipart/form-data', }, - onUploadProgress: (progressEvent) => { + onUploadProgress: (progressEvent: any) => { if (onProgress && progressEvent.total) { const progress = Math.round( (progressEvent.loaded * 100) / progressEvent.total @@ -90,7 +90,7 @@ export class UploadApi { headers: { 'Content-Type': 'multipart/form-data', }, - onUploadProgress: (progressEvent) => { + onUploadProgress: (progressEvent: any) => { if (onProgress && progressEvent.total) { const progress = Math.round( (progressEvent.loaded * 100) / progressEvent.total @@ -130,7 +130,7 @@ export class UploadApi { headers: { 'Content-Type': 'multipart/form-data', }, - onUploadProgress: (progressEvent) => { + onUploadProgress: (progressEvent: any) => { if (onProgress && progressEvent.total) { const progress = Math.round( (progressEvent.loaded * 100) / progressEvent.total @@ -155,7 +155,7 @@ export class UploadApi { error?: string }>>> { const formData = new FormData() - files.forEach((file, index) => { + files.forEach((file) => { formData.append(`files`, file) }) @@ -163,7 +163,7 @@ export class UploadApi { headers: { 'Content-Type': 'multipart/form-data', }, - onUploadProgress: (progressEvent) => { + onUploadProgress: (progressEvent: any) => { if (onProgress && progressEvent.total) { const progress = Math.round( (progressEvent.loaded * 100) / progressEvent.total @@ -255,7 +255,7 @@ export class UploadApi { headers: { 'Content-Type': 'multipart/form-data', }, - onUploadProgress: (progressEvent) => { + onUploadProgress: (progressEvent: any) => { if (onProgress && progressEvent.total) { const progress = Math.round( (progressEvent.loaded * 100) / progressEvent.total @@ -291,7 +291,7 @@ export class UploadApi { headers: { 'Content-Type': 'multipart/form-data', }, - onUploadProgress: (progressEvent) => { + onUploadProgress: (progressEvent: any) => { if (onProgress && progressEvent.total) { const progress = Math.round( (progressEvent.loaded * 100) / progressEvent.total diff --git a/src/api/request.ts b/src/api/request.ts index 092f478..181c4ff 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -1,7 +1,7 @@ // HTTP 请求封装文件 -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios' +import axios, { AxiosInstance, InternalAxiosRequestConfig, AxiosRequestConfig, AxiosResponse } from 'axios' import { useUserStore } from '@/stores/user' -import router from '@/router' +// import router from '@/router' import type { ApiResponse } from './types' // 消息提示函数 - 使用window.alert作为fallback,实际项目中应该使用UI库的消息组件 @@ -27,21 +27,15 @@ const request: AxiosInstance = axios.create({ // 请求拦截器 request.interceptors.request.use( - (config: AxiosRequestConfig) => { + (config: InternalAxiosRequestConfig) => { // 添加认证token const userStore = useUserStore() if (userStore.token) { - config.headers = { - ...config.headers, - Authorization: `Bearer ${userStore.token}`, - } + config.headers.Authorization = `Bearer ${userStore.token}` } // 添加请求时间戳 - config.headers = { - ...config.headers, - 'X-Request-Time': Date.now().toString(), - } + config.headers['X-Request-Time'] = Date.now().toString() // 开发环境下打印请求信息 if (import.meta.env.DEV) { @@ -77,7 +71,7 @@ request.interceptors.response.use( // 检查业务状态码 if (data.code === 200 || data.code === 0) { - return data + return response } // 处理业务错误 diff --git a/src/api/types.ts b/src/api/types.ts index 6d2f56d..05628d9 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -23,6 +23,7 @@ export interface User { username: string email: string phone?: string + nickname?: string avatar?: string role: 'student' | 'teacher' | 'admin' status: 'active' | 'inactive' | 'banned' diff --git a/src/components/VideoPlayer.vue b/src/components/VideoPlayer.vue index e72bf69..6e4f335 100644 --- a/src/components/VideoPlayer.vue +++ b/src/components/VideoPlayer.vue @@ -57,7 +57,7 @@ -