Files
learning-system-mobile/api/modules/favorites.js
2022-05-29 18:59:24 +08:00

92 lines
2.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* 收藏的相关处理*/
import ajax from '@/utils/xajax.js'
/*查询收藏
getpost请求都可以
pageIndex 页数
pageSize 每页展示条数
查询条件暂时未确定,后续补充
*/
const querylist=function(query){
return ajax.post('/xboe/m/favorite/mylist',query);
}
/**
* 分页查询 收藏的问答信息
* @param {Object} query
* {
resolve是否已解决如果不查就不要传或传null值
title对应关键字查询
}
*/
const qaPageList=function(query){
return ajax.post('/xboe/m/favorite/myqalist',query);
}
/*分页查询 收藏的案例信息
* @param {Object} query
@param Integer type 根据什么类型搜索,这块暂时可以不传
@param pageIndex 第几页 pageSize 每页展示多少行
title对应关键字查询
*/
const casePageList=function(query){
return ajax.post('/xboe/m/favorite/mycaselist',query);
}
/*分页查询 收藏的文章信息
*@param {Object} query
@param Integer type 根据什么类型搜索,这块暂时不传
@param pageIndex 第几页 pageSize 每页展示多少行
title对应关键字查询
*/
const articlePageList=function(query){
return ajax.post('/xboe/m/favorite/myarticlelist',query);
}
/*分页查询 收藏的课程信息
@param {Object} query
@param Integer type 根据什么类型搜索,暂时不传
@param pageIndex 第几页 pageSize 每页展示多少行
title对应关键字查询
*/
const coursePageList=function(query){
return ajax.post('/xboe/m/favorite/mycourselist',query);
}
/*添加
* objType 点赞对象类型, 1课程 2文章,3案例, 4问答
objId 对象id
title 标题
*/
const save=function(data){
return ajax.post('/xboe/m/favorite/add',data);
}
/*移除收藏
*objType点赞对象类型 1课程 2文章,3案例, 4问答
*objId,点赞对象id
*/
const remove=function(objType,objId){
return ajax.del(`/xboe/m/favorite/remove?objType=${objType}&objId=${objId}`);
}
/*删除收藏
*id 收藏id
*/
const del=function(id){
return ajax.del(`/xboe/m/favorite/delete?id=${id}`)
}
//查询当前用户是否已收藏
// objType 类型 1课程 2文章,3案例, 4问答
// objId 对象id
const has=function(objType,objId){
return ajax.post(`/xboe/m/favorite/has?objType=${objType}&objId=${objId}`);
}
export default{
has,
remove,
del,
save,
querylist,
qaPageList,
casePageList,
articlePageList,
coursePageList
}