hongshu-web v1.0

This commit is contained in:
mayongjian
2024-07-03 16:56:33 +08:00
parent 4fbf472ba0
commit 05f8f39dde
93 changed files with 29139 additions and 71 deletions

11
src/api/category.ts Normal file
View File

@@ -0,0 +1,11 @@
import request from "@/utils/request";
/**
* 获取树形分类数据
* @returns 分类数据
*/
export const getCategoryTreeData = () => {
return request<any>({
url: "/web/category/getCategoryTreeData",
method: "get",
});
};

86
src/api/comment.ts Normal file
View File

@@ -0,0 +1,86 @@
import request from "@/utils/request";
import type { CommentDTO } from "@/type/comment";
/**
* 得到所有的一级评论并携带二级评论
* @param currentPage 当前页
* @param pageSize 分页数
* @param noteId 笔记id
* @returns 评论结果集
*/
export const getCommentWithCommentByNoteId = (
currentPage: number,
pageSize: number,
noteId: string
) => {
return request<any>({
url: `/web/comment/getCommentWithCommentByNoteId/${currentPage}/${pageSize}`,
method: "get",
params: {
noteId,
},
});
};
/**
* 保存评论
* @param data 评论实体
* @returns 增加后的评论实体
*/
export const saveCommentByDTO = (data: CommentDTO) => {
return request<any>({
url: `/web/comment/saveCommentByDTO`,
method: "post",
data: data,
});
};
/**
* 根据评论id同步评论集
* @param data 评论id数据集
* @returns
*/
export const syncCommentByIds = (data: Array<string>) => {
return request<any>({
url: `/web/comment/syncCommentByIds`,
method: "post",
data: data,
});
};
/**
* 根据一级评论id获取所有的二级评论
* @param currentPage 当前页
* @param pageSize 分页数
* @param oneCommentId 一级评论id
* @returns 评论结果集
*/
export const getTwoCommentPageByOneCommentId = (
currentPage: number,
pageSize: number,
oneCommentId: string
) => {
return request<any>({
url: `/web/comment/getTwoCommentPageByOneCommentId/${currentPage}/${pageSize}`,
method: "get",
params: {
oneCommentId,
},
});
};
/**
* 获取当前用户通知的评论集
* @param currentPage 当前页
* @param pageSize 分页数
* @returns 评论结果集
*/
export const getNoticeComment = (
currentPage: number,
pageSize: number,
) => {
return request<any>({
url: `/web/comment/getNoticeComment/${currentPage}/${pageSize}`,
method: "get",
});
};

57
src/api/follower.ts Normal file
View File

@@ -0,0 +1,57 @@
import request from "@/utils/request";
/**
* 得到关注用户的所有动态
* @param currentPage 当前页
* @param pageSize 分页数
* @returns
*/
export const getFollowTrend = (currentPage: number, pageSize: number) => {
return request<any>({
url: `/web/follower/getFollowTrend/${currentPage}/${pageSize}`, // mock接口
method: "get",
});
};
/**
* 关注用户
* @param followerId 关注用户id
* @returns
*/
export const followById = (followerId: string) => {
return request<any>({
url: `/web/follower/followById`, // mock接口
method: "get",
params: {
followerId,
},
});
};
/**
* 当前用户是否关注
* @param followerId 关注的用户id
* @returns
*/
export const isFollow = (followerId: string) => {
return request<any>({
url: `/web/follower/isFollow`, // mock接口
method: "get",
params: {
followerId,
},
});
};
/**
* 得到当前用户的最新关注信息
* @param currentPage 当前页
* @param pageSize 分页数
* @returns FollowerVo
*/
export const getNoticeFollower = (currentPage: number, pageSize: number) => {
return request<any>({
url: `/web/follower/getNoticeFollower/${currentPage}/${pageSize}`, // mock接口
method: "get",
});
};

74
src/api/im.ts Normal file
View File

@@ -0,0 +1,74 @@
import request from "@/utils/request";
/**
* 得到所有聊天的记录数量
* @returns 聊天数量
*/
export const getCountMessage = () => {
return request<any>({
url: "/web/im/chat/getCountMessage", // mock接口
method: "get",
});
};
/**
* 获取当前用户下所有聊天的用户信息
* @returns 聊天的用户信息
*/
export const getChatUserList = () => {
return request<any>({
url: "/web/im/chat/getChatUserList", // mock接口
method: "get",
});
};
/**
* 清除聊天数量
* @param sendUid 发送方的用户id
* @param type 类型
* @returns success
*/
export const clearMessageCount = (sendUid:string,type:number) => {
return request<any>({
url: "/web/im/chat/clearMessageCount", // mock接口
method: "get",
params:{
sendUid,
type
}
});
};
/**
* 获取所有的聊天记录
* @param currentPage 分页
* @param pageSize 分页数
* @param acceptUid 接收方的用户id
* @returns 聊天记录
*/
export const getAllChatRecord = (
currentPage: number,
pageSize: number,
acceptUid: string
) => {
return request<any>({
url: `/web/im/chat/getAllChatRecord/${currentPage}/${pageSize}`, // mock接口
method: "get",
params: {
acceptUid,
},
});
};
/**
* 发送消息
* @param data 消息实体
* @returns success
*/
export const sendMsg = (data: any) => {
return request<any>({
url: "/web/im/chat/sendMsg", // mock接口
method: "post",
data: data,
});
};

View File

@@ -0,0 +1,42 @@
import request from "@/utils/request";
import type { LikeOrCollectionDTO } from "@/type/likeOrCollection";
/**
* 点赞或收藏
* @param data 点赞收藏实体
* @returns success
*/
export const likeOrCollectionByDTO = (data: LikeOrCollectionDTO) => {
return request<any>({
url: `/web/likeOrCollection/likeOrCollectionByDTO`, // mock接口
method: "post",
data: data,
});
};
/**
* 是否点赞或收藏
* @param data 点赞收藏实体
* @returns
*/
export const isLikeOrCollection = (data: LikeOrCollectionDTO) => {
return request<any>({
url: `/web/likeOrCollection/isLikeOrCollection`, // mock接口
method: "post",
data: data,
});
};
/**
* 得到当前用户最新的点赞和收藏信息
* @param currentPage 当前页
* @param pageSize 分页数
* @returns page
*/
export const getNoticeLikeOrCollection = (currentPage: number, pageSize: number) => {
return request<any>({
url: `/web/likeOrCollection/getNoticeLikeOrCollection/${currentPage}/${pageSize}`, // mock接口
method: "get",
});
};

72
src/api/note.ts Normal file
View File

@@ -0,0 +1,72 @@
import request from "@/utils/request";
/**
* 根据笔记id获取笔记
* @param noteId 笔记id
* @returns 笔记
*/
export const getNoteById = (noteId: string) => {
return request<any>({
url: "/web/note/getNoteById", // mock接口
method: "get",
params: {
noteId,
},
});
};
/**
* 保存笔记
* @param data 笔记实体
* @returns 笔记id
*/
export const saveNoteByDTO = (data: any) => {
return request<any>({
url: "/web/note/saveNoteByDTO", // mock接口
method: "post",
data: data,
headers: { "Content-Type": "multipart/form-data;boundary=----WebKitFormBoundaryk4ZvuPo6pkphe7Pl" },
});
};
/**
* 更新笔记
* @param data 笔记实体
* @returns 笔记id
*/
export const updateNoteByDTO = (data: any) => {
return request<any>({
url: "/web/note/updateNoteByDTO", // mock接口
method: "post",
data: data,
headers: { "Content-Type": "multipart/form-data;boundary=----WebKitFormBoundaryk4ZvuPo6pkphe7Pl" },
});
};
/**
* 置顶笔记
* @param noteId
* @returns
*/
export const pinnedNote = (noteId: string) => {
return request<any>({
url: "/web/note/pinnedNote", // mock接口
method: "get",
params: {
noteId,
},
});
};
/**
* 删除笔记
* @param data
* @returns
*/
export const deleteNoteByIds = (data: any) => {
return request<any>({
url: "/web/note/deleteNoteByIds", // mock接口
method: "post",
data: data,
});
};

79
src/api/search.ts Normal file
View File

@@ -0,0 +1,79 @@
import request from "@/utils/request";
import { NoteDTO } from "@/type/note"
/**
*
* @param currentPage
* @param pageSize
* @returns
*/
export const getRecommendNote = (currentPage: number, pageSize: number) => {
return request<any>({
url: `/web/es/note/getRecommendNote/${currentPage}/${pageSize}`, // mock接口
method: "get",
});
};
/**
*
* @param currentPage
* @param pageSize
* @param data
* @returns
*/
export const getNoteByDTO = (currentPage: number, pageSize: number, data: NoteDTO) => {
return request<any>({
url: `/web/es/note/getNoteByDTO/${currentPage}/${pageSize}`, // mock接口
method: "post",
data: data
});
};
export const getCategoryAgg = (data: NoteDTO) => {
return request<any>({
url: `/web/es/note/getCategoryAgg`, // mock接口
method: "post",
data: data
});
};
/**
*
* @param keyword
* @returns
*/
export const getRecordByKeyWord = (keyword: string) => {
return request<any>({
url: `/web/es/record/getRecordByKeyWord`, // mock接口
method: "get",
params: {
keyword
}
});
};
/**
*
* @returns
*/
export const getHotRecord = () => {
return request<any>({
url: `web/es/record/getHotRecord`, // mock接口
method: "get",
});
};
/**
*
* @param keyword
* @returns
*/
export const addRecord = (keyword: string) => {
return request<any>({
url: `/web/es/record/addRecord`, // mock接口
method: "get",
params: {
keyword
}
});
};

18
src/api/tag.ts Normal file
View File

@@ -0,0 +1,18 @@
import request from "@/utils/request";
/**
*
* @param currentPage
* @param pageSize
* @param keyword
* @returns
*/
export const getTagByKeyword = (currentPage: number, pageSize: number,keyword:string) => {
return request<any>({
url: `/web/tag/getTagByKeyword/${currentPage}/${pageSize}`, // mock接口
method: "get",
params:{
keyword
}
});
};

146
src/api/user.ts Normal file
View File

@@ -0,0 +1,146 @@
import request from "@/utils/request";
import type { UserLogin } from "@/type/user";
/**
*
* @param data
* @returns
*/
export const login = (data: any) => {
return request<any>({
url: "/web/auth/login", // mock接口
method: "post",
data,
});
};
/**
*
* @param deptId
* @param file
* @returns
*/
export function importFile(deptId: number, file: File) {
const formData = new FormData();
formData.append("file", file);
return request({
url: "/api/v1/users/_import",
method: "post",
params: { deptId: deptId },
data: formData,
headers: {
"Content-Type": "multipart/form-data",
},
});
}
/**
*
* @param accessToken
* @returns
*/
export const getUserInfoByToken = (accessToken: string) => {
return request<any>({
url: "/web/auth/getUserInfoByToken", // mock接口
method: "get",
params: {
accessToken,
},
});
};
/**
*
* @param refreshToken
* @returns
*/
export const refreshToken = (refreshToken: string) => {
return request<any>({
url: `/web/auth/refreshToken`, // mock接口
method: "get",
params: {
refreshToken,
},
});
};
/**
*
* @param data
* @returns
*/
export const loginByCode = (data: UserLogin) => {
return request<any>({
url: "/web/auth/loginByCode", // mock接口
method: "post",
data,
});
};
/**
*
* @param currentPage
* @param pageSize
* @param userId
* @param type
* @returns
*/
export const getTrendByUser = (currentPage:number,pageSize:number,userId:string,type:number) => {
return request<any>({
url: `/web/user/getTrendByUser/${currentPage}/${pageSize}`, // mock接口
method: "get",
params: {
userId,
type
},
});
};
/**
*
* @param userId
* @returns
*/
export const getUserById = (userId:string) => {
return request<any>({
url: `/web/user/getUserById`, // mock接口
method: "get",
params: {
userId
},
});
};
/**
*
* @param userId
* @returns
*/
export const loginOut = (userId:string) => {
return request<any>({
url: `/web/auth/loginOut`, // mock接口
method: "get",
params: {
userId
},
});
};
export const updateUser = (data: any) => {
return request<any>({
url: "/web/user/updateUser", // mock接口
method: "post",
data,
});
};
export const getUserByKeyword = (currentPage: number, pageSize: number, keyword: string) => {
return request<any>({
url: `/web/user/getUserByKeyword/${currentPage}/${pageSize}`, // mock接口
method: "get",
params: {
keyword
},
});
};

10
src/api/util.ts Executable file
View File

@@ -0,0 +1,10 @@
import request from "@/utils/request";
export const toUp = (data: any) => {
return request<any>({
url: "/util/dm/toUp", // mock接口
method: "post",
data,
});
};