完成上传下载连接,公告管理与详情页面,求种区页面,轮播图折扣显示,修改部分bug

Change-Id: I86fc294e32911cb3426a8b16f90aca371f975c11
diff --git a/src/api/helpPost.js b/src/api/helpPost.js
index 92d6402..68b37d9 100644
--- a/src/api/helpPost.js
+++ b/src/api/helpPost.js
@@ -1,7 +1,7 @@
 // src/api/helpPost.js

 import { api } from './auth'; // 复用已有的axios实例

 

-export const createPost = (title, content, authorId, selectedImage) => {

+export const createHelpPost = (title, content, authorId, selectedImage) => {

   // 创建 FormData 对象

   const formData = new FormData();

   formData.append('title', title);

@@ -16,44 +16,36 @@
   return api.post('/help/posts', formData);

 };

 

-export const getPosts = (page = 1, size = 5) => {

+export const getHelpPosts = (page = 1, size = 5) => {

   return api.get('/help/posts', {

     params: { page, size }

   });

 };

 

-export const getPostDetail = (postId) => {

+export const getHelpPostDetail = (postId) => {

   return api.get(`/help/posts/${postId}`);

 };

 

-export const likePost = (postId, data) => {

+export const likeHelpPost = (postId, data) => {

   return api.post(`/help/posts/${postId}/like`, null, {

     params: data

   });

 };

 

-export const addPostComment = (postId, commentData) => {

-  // 创建FormData对象来处理文件上传

-  const formData = new FormData();

-  formData.append('authorId', commentData.authorId);

-  formData.append('content', commentData.content);

+export const addHelpPostComment = (postId, commentData) => {

   

-  // 如果有图片,添加到formData

-  if (commentData.commentImage) {

-    formData.append('image', commentData.commentImage);

-  }

 

-  return api.post(`/help/posts/${postId}/comments`, formData);

+  return api.post(`/help/posts/${postId}/comments`, commentData);

 };

 

-export const deletePost = (postId, authorId) => {

+export const deleteHelpPost = (postId, authorId) => {

   return api.delete(`/help/posts/${postId}`, {

     params: { authorId }

   });

 };

 

 

-export const searchPosts = (keyword, page = 1, size = 5) => {

+export const searchHelpPosts = (keyword, page = 1, size = 5) => {

   return api.get('/help/posts/search', {

     params: { keyword, page, size }

   });