0841b1a103
- 前端:Vue3 + TS + Element Plus,24 个页面路由(课件/组题/教案/动画/思维导图/作文批改/命题/课堂/资源/社区等) - 后端:FastAPI + SQLAlchemy + SQLite,17 个路由模块,AI 服务层含降级模板 - AI:glm-5.x 推理模型已禁用思维链,确保输出真实内容 - 修复:ai_service 两处请求体注入 enable_thinking/thinking disabled - 测试账号:13900999999 / test1234
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import request from '@/utils/request'
|
|
|
|
export const getPosts = (params?: any) =>
|
|
request.get('/api/community/posts', { params })
|
|
|
|
export const getPostRanking = (params?: any) =>
|
|
request.get('/api/community/posts/ranking', { params })
|
|
|
|
export const createPost = (data: any) =>
|
|
request.post('/api/community/posts', data)
|
|
|
|
export const getPost = (id: number) =>
|
|
request.get(`/api/community/posts/${id}`)
|
|
|
|
export const updatePost = (id: number, data: any) =>
|
|
request.put(`/api/community/posts/${id}`, data)
|
|
|
|
export const deletePost = (id: number) =>
|
|
request.delete(`/api/community/posts/${id}`)
|
|
|
|
export const likePost = (id: number) =>
|
|
request.post(`/api/community/posts/${id}/like`)
|
|
|
|
export const unlikePost = (id: number) =>
|
|
request.delete(`/api/community/posts/${id}/like`)
|
|
|
|
export const getComments = (postId: number) =>
|
|
request.get(`/api/community/posts/${postId}/comments`)
|
|
|
|
export const createComment = (postId: number, data: { content: string; parent_id?: number }) =>
|
|
request.post(`/api/community/posts/${postId}/comments`, data)
|
|
|
|
export const deleteComment = (postId: number, commentId: number) =>
|
|
request.delete(`/api/community/posts/${postId}/comments/${commentId}`)
|
|
|
|
export const getFavoritePosts = (params?: any) =>
|
|
request.get('/api/community/posts', { params: { ...(params || {}), scope: 'favorite' } })
|