fix:配合后端接口变动

This commit is contained in:
小张 2025-09-01 17:56:41 +08:00
parent 590af0951f
commit 8e146666f7
6 changed files with 59 additions and 39 deletions

View File

@ -19,8 +19,8 @@ export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localho
export const API_ENDPOINTS = {
// 认证相关
AUTH: {
LOGIN: '/biz/user/login',
USER_INFO: '/biz/user/info',
LOGIN: '/aiol/aiolUser/login',
USER_INFO: '/aiol/aiolUser/info',
REGISTER: '/auth/register',
LOGOUT: '/auth/logout',
REFRESH: '/auth/refresh',
@ -36,12 +36,12 @@ export const API_ENDPOINTS = {
// 课程相关
COURSES: {
LIST: '/biz/course/list',
LIST: '/aiol/aiolCourse/query_list',
SEARCH: '/courses/search',
POPULAR: '/courses/popular',
LATEST: '/courses/latest',
RECOMMENDED: '/courses/recommended',
DETAIL: '/biz/course/detail',
DETAIL: '/aiol/aiolCourse/detail',
CHAPTERS: '/courses/:id/chapters',
LESSONS: '/courses/:id/lessons',
ENROLL: '/courses/:id/enroll',
@ -54,18 +54,18 @@ export const API_ENDPOINTS = {
// 分类相关
CATEGORIES: {
LIST: '/biz/course/category/list',
LIST: '/aiol/aiolCourse/category/list',
COURSES: '/categories/:id/courses',
},
// 专题相关
SUBJECTS: {
LIST: '/biz/course/subject/list',
LIST: '/aiol/aiolCourse/subject/list',
},
// 难度相关
DIFFICULTIES: {
LIST: '/biz/course/difficulty/list',
LIST: '/aiol/aiolCourse/difficulty/list',
},
// 章节课时相关
@ -187,14 +187,14 @@ export const API_ENDPOINTS = {
// 考试题库相关
EXAM: {
// 题库管理
REPO_CREATE: '/biz/repo/courseAdd',
REPO_LIST: '/biz/repo/repoList',
REPO_CREATE: '/aiol/repo/courseAdd',
REPO_LIST: '/aiol/repo/repoList',
REPO_DELETE: '/gen/repo/repo/delete',
REPO_EDIT: '/gen/repo/repo/edit',
// 题目管理
QUESTION_LIST: '/biz/repo/questionList/:repoId',
QUESTION_DETAIL: '/biz/repo/repoList/:questionId',
QUESTION_LIST: '/aiol/repo/questionList/:repoId',
QUESTION_DETAIL: '/aiol/repo/repoList/:questionId',
QUESTION_ADD: '/gen/question/question/add',
QUESTION_EDIT: '/gen/question/question/edit',
QUESTION_DELETE: '/gen/question/question/delete',

View File

@ -25,10 +25,10 @@ export class AuthApi {
password: data.password
}
console.log('🚀 发送登录请求:', { url: '/biz/user/login', data: { ...loginData, password: '***' } })
console.log('🚀 发送登录请求:', { url: '/aiol/aiolUser/login', data: { ...loginData, password: '***' } })
// 调用后端API
const response = await ApiRequest.post<any>('/biz/user/login', loginData)
const response = await ApiRequest.post<any>('/aiol/aiolUser/login', loginData)
console.log('🔍 Login API Response:', response)
console.log('🔍 Response Code:', response.code)
@ -231,7 +231,7 @@ export class AuthApi {
// 获取当前用户信息 - 使用后端实际接口
static async getUserInfo(): Promise<UserInfoResponse> {
const response = await ApiRequest.get<any>('/biz/user/info')
const response = await ApiRequest.get<any>('/aiol/aiolUser/info')
console.log('🔍 getUserInfo - 原始响应:', response)

View File

@ -12,7 +12,7 @@ export class ContentApi {
static async getContent(contentKey: string): Promise<any> {
try {
console.log(`🚀 调用内容APIcontentKey: ${contentKey}`)
const response = await ApiRequest.get(`/biz/index/content/${contentKey}`)
const response = await ApiRequest.get(`/aiol/index/content/${contentKey}`)
console.log('📋 内容API响应:', response)
return response
} catch (error) {

View File

@ -109,7 +109,7 @@ export class CourseApi {
console.log('🔍 查询参数:', queryParams)
// 调用后端API
const response = await ApiRequest.get<any>('/biz/course/list', queryParams)
const response = await ApiRequest.get<any>('/aiol/aiolCourse/query_list', queryParams)
console.log('🔍 课程列表API响应:', response)
// 处理后端响应格式
@ -187,7 +187,7 @@ export class CourseApi {
console.log('🚀 调用课程详情API课程ID:', id)
// 调用后端API
const response = await ApiRequest.get<any>('/biz/course/detail', { id })
const response = await ApiRequest.get<any>('/aiol/aiolCourse/detail', { id })
console.log('🔍 课程详情API响应:', response)
@ -294,7 +294,7 @@ export class CourseApi {
static async getCourseById(id: string): Promise<ApiResponse<Course>> {
try {
// 调用后端课程详情接口
const response = await ApiRequest.get<any>('/biz/course/detail', { id })
const response = await ApiRequest.get<any>('/aiol/aiolCourse/detail', { id })
console.log('🔍 课程详情API响应:', response)
@ -408,7 +408,7 @@ export class CourseApi {
console.log('🚀 获取课程分类列表')
// 调用后端API不需要token
const response = await ApiRequest.get<any>('/biz/course/category/list')
const response = await ApiRequest.get<any>('/aiol/aiolCourse/category/list')
console.log('🔍 分类API响应:', response)
@ -452,7 +452,7 @@ export class CourseApi {
console.log('🚀 获取课程专题列表')
// 调用后端API不需要token
const response = await ApiRequest.get<any>('/biz/course/subject/list')
const response = await ApiRequest.get<any>('/aiol/aiolCourse/subject/list')
console.log('🔍 专题API响应:', response)
@ -496,7 +496,7 @@ export class CourseApi {
console.log('🚀 获取课程难度列表')
// 调用后端API不需要token
const response = await ApiRequest.get<any>('/biz/course/difficulty/list')
const response = await ApiRequest.get<any>('/aiol/aiolCourse/difficulty/list')
console.log('🔍 难度API响应:', response)
@ -551,9 +551,9 @@ export class CourseApi {
}>> {
try {
console.log('🔍 报名课程课程ID:', courseId)
console.log('🔍 API请求URL: /biz/course/' + courseId + '/enroll')
console.log('🔍 API请求URL: /aiol/aiolCourse/' + courseId + '/enroll')
const response = await ApiRequest.post<any>(`/biz/course/${courseId}/enroll`)
const response = await ApiRequest.post<any>(`/aiol/aiolCourse/${courseId}/enroll`)
console.log('🔍 报名API响应:', response)
// 处理后端响应格式
@ -623,9 +623,9 @@ export class CourseApi {
}>> {
try {
console.log('🔍 检查课程报名状态课程ID:', courseId)
console.log('🔍 API请求URL: /biz/course/' + courseId + '/is_enrolled')
console.log('🔍 API请求URL: /aiol/aiolCourse/' + courseId + '/is_enrolled')
const response = await ApiRequest.get<any>(`/biz/course/${courseId}/is_enrolled`)
const response = await ApiRequest.get<any>(`/aiol/aiolCourse/${courseId}/is_enrolled`)
console.log('🔍 报名状态API响应:', response)
// 处理后端响应格式
@ -695,9 +695,9 @@ export class CourseApi {
static async getCourseSections(courseId: string): Promise<ApiResponse<CourseSectionListResponse>> {
try {
console.log('🔍 获取课程章节数据课程ID:', courseId)
console.log('🔍 API请求URL: /biz/course/' + courseId + '/section')
console.log('🔍 API请求URL: /aiol/aiolCourse/' + courseId + '/section')
const response = await ApiRequest.get<any>(`/biz/course/${courseId}/section`)
const response = await ApiRequest.get<any>(`/aiol/aiolCourse/${courseId}/section`)
console.log('🔍 章节API响应:', response)
// 处理后端响应格式
@ -907,9 +907,9 @@ export class CourseApi {
static async getCourseInstructors(courseId: string): Promise<ApiResponse<Instructor[]>> {
try {
console.log('🔍 获取课程讲师数据课程ID:', courseId)
console.log('🔍 API请求URL: /biz/course/' + courseId + '/teachers')
console.log('🔍 API请求URL: /aiol/aiolCourse/' + courseId + '/teachers')
const response = await ApiRequest.get<any>(`/biz/course/${courseId}/teachers`)
const response = await ApiRequest.get<any>(`/aiol/aiolCourse/${courseId}/teachers`)
console.log('🔍 讲师API响应:', response)
// 处理后端响应格式
@ -968,9 +968,9 @@ export class CourseApi {
static async getSectionVideos(courseId: string, sectionId: string): Promise<ApiResponse<SectionVideo[]>> {
try {
console.log('🔍 获取章节视频数据课程ID:', courseId, '章节ID:', sectionId)
console.log('🔍 API请求URL: /biz/course/' + courseId + '/section_video/' + sectionId)
console.log('🔍 API请求URL: /aiol/aiolCourse/' + courseId + '/section_video/' + sectionId)
const response = await ApiRequest.get<any>(`/biz/course/${courseId}/section_video/${sectionId}`)
const response = await ApiRequest.get<any>(`/aiol/aiolCourse/${courseId}/section_video/${sectionId}`)
console.log('🔍 章节视频API响应:', response)
// 处理后端响应格式
@ -1090,9 +1090,9 @@ export class CourseApi {
static async getCourseComments(courseId: string): Promise<ApiResponse<CourseComment[]>> {
try {
console.log('🔍 获取课程评论数据课程ID:', courseId)
console.log('🔍 API请求URL: /biz/comment/course/' + courseId + '/list')
console.log('🔍 API请求URL: /aiol/aiolComment/course/' + courseId + '/list')
const response = await ApiRequest.get<any>(`/biz/comment/course/${courseId}/list`)
const response = await ApiRequest.get<any>(`/aiol/aiolComment/course/${courseId}/list`)
console.log('🔍 评论API响应:', response)
// 处理后端响应格式

View File

@ -29,7 +29,7 @@ export class ExamApi {
*/
static async createCourseRepo(data: CreateRepoRequest): Promise<ApiResponse<string>> {
console.log('🚀 创建课程题库:', data)
const response = await ApiRequest.post<string>('/biz/repo/courseAdd', data)
const response = await ApiRequest.post<string>('/aiol/repo/courseAdd', data)
console.log('✅ 创建课程题库成功:', response)
return response
}
@ -38,7 +38,7 @@ export class ExamApi {
*
*/
static async getCourseRepoList(): Promise<ApiResponseWithResult<Repo[]>> {
const response = await ApiRequest.get<{ result: Repo[] }>(`/biz/repo/repoList`)
const response = await ApiRequest.get<{ result: Repo[] }>(`/aiol/repo/repoList`)
console.log('✅ 获取课程题库列表成功:', response)
return response
}

View File

@ -1697,9 +1697,10 @@ onMounted(() => {
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 0 32px;
max-width: none;
margin: 0;
padding-left: 120px;
padding-right: 125px;
}
.breadcrumb {
@ -1723,7 +1724,7 @@ onMounted(() => {
.course-content {
display: flex;
gap: 30px;
gap: 64px;
width: 100%;
flex-direction: row-reverse;
}
@ -3635,10 +3636,21 @@ onMounted(() => {
}
/* 响应式设计 */
/* 大屏幕 - 使用120px左右边距 */
@media (min-width: 1400px) {
.container {
padding-left: 120px;
padding-right: 120px;
max-width: none;
margin: 0;
}
}
@media (max-width: 1399px) and (min-width: 1200px) {
.container {
padding: 0 24px;
max-width: 1200px;
margin: 0 auto;
}
.sidebar {
@ -3650,6 +3662,7 @@ onMounted(() => {
.container {
padding: 0 20px;
max-width: 992px;
margin: 0 auto;
}
.course-content {
@ -3666,6 +3679,7 @@ onMounted(() => {
.container {
padding: 0 16px;
max-width: 768px;
margin: 0 auto;
}
.course-content {
@ -3682,6 +3696,7 @@ onMounted(() => {
.container {
padding: 0 16px;
max-width: 576px;
margin: 0 auto;
}
.course-content {
@ -3703,6 +3718,7 @@ onMounted(() => {
.container {
padding: 0 16px;
max-width: 576px;
margin: 0 auto;
}
.video-player.unregistered {
@ -3967,6 +3983,8 @@ onMounted(() => {
@media (max-width: 480px) {
.container {
padding: 0 12px;
margin: 0 auto;
max-width: 480px;
}
.video-player.unregistered {
@ -4025,6 +4043,8 @@ onMounted(() => {
@media (max-width: 360px) {
.container {
padding: 0 8px;
margin: 0 auto;
max-width: 360px;
}
.video-player.unregistered {