mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 19:06:43 +08:00
254 lines
6.7 KiB
JavaScript
254 lines
6.7 KiB
JavaScript
/* 案例模块的相关处理*/
|
||
import ajax from '@/utils/xajax.js'
|
||
import ajaxs from '@/api/ajax.js'
|
||
/**首页查询
|
||
* pageSize
|
||
* orderField
|
||
* orderAsc
|
||
*/
|
||
const indexList = function (query) {
|
||
return ajax.post('/xboe/m/boe/cases/case-random', query);
|
||
}
|
||
/*
|
||
*案例分页搜索查询 是否推荐
|
||
*@param(String) keyWord 关键词
|
||
*@param(String) orderField 需要排序的字段 不传默认是最新
|
||
*@param (boolean) orderAsc 升序还是倒叙
|
||
*@param(Boolean) breCommend 是否推荐 true或者false
|
||
*@param(String) orgDomain 组织机构
|
||
*@param(String) majorType 专业分类
|
||
* @param(String) majorDomain 专业领域
|
||
*/
|
||
const queryList = function (query) {
|
||
return ajax.post('/xboe/m/boe/cases/queryList', query);
|
||
}
|
||
const queryListV2 = function (query) {
|
||
return ajax.postJson('/xboe/m/boe/cases/queryListV2', query);
|
||
}
|
||
/* 案例分页搜索查询 是否置顶
|
||
*@param(String) keyWord 关键词
|
||
@param(Boolean) isTop 是否置顶 true或false
|
||
@param(String) orgDomain 组织机构
|
||
*@param(String) majorType 专业分类
|
||
* @param(String) majorDomain 专业领域
|
||
*/
|
||
const isTopList = function (query) {
|
||
return ajax.post('/xboe/m/boe/cases/isTopList', query);
|
||
}
|
||
/* 设置置顶 取消置顶
|
||
@param(String) id
|
||
@param(Integer) isTop 是否置顶 0:未置顶,1:已置顶
|
||
*/
|
||
const updateTop = function (id, isTop) {
|
||
return ajax.get(`/xboe/m/boe/cases/updateTop?id=${id}&isTop=${isTop}`);
|
||
}
|
||
/* 删除案例
|
||
*param(String) id 案例的id
|
||
*/
|
||
const del = function (id) {
|
||
return ajax.get('/xboe/m/boe/cases/delete?id=' + id);
|
||
}
|
||
/*案例详情
|
||
@param(String) id 案例的id
|
||
@param(Boolean) addView 是否增加浏览量
|
||
*/
|
||
const detail = function (id, addView) {
|
||
let pars = 'id=' + id;
|
||
if (addView) {
|
||
pars += '&addView=' + addView
|
||
}
|
||
return ajax.get('/xboe/m/boe/cases/detail?' + pars);
|
||
}
|
||
/*推荐
|
||
*@param (String) id 案例的id
|
||
*@param (String) title 案例的标题
|
||
*@param (String) acceptAid 受众id
|
||
*@param (String) recommentThat 推荐说明
|
||
*/
|
||
const savaRecommend = function (data) {
|
||
return ajax.post('/xboe/m/boe/recommend/save', data);
|
||
}
|
||
/* 推荐列表
|
||
*没有参数
|
||
*/
|
||
const query = function () {
|
||
return ajax.get('/xboe/m/boe/recommend/query');
|
||
}
|
||
/*
|
||
*作者排行榜
|
||
@param pageSize 长度
|
||
*/
|
||
const usernameList = function (pageSize) {
|
||
return ajax.get(`/xboe/m/boe/cases/usernamelist?pageSize=${pageSize}`);
|
||
}
|
||
/*
|
||
人气榜
|
||
@param pageSize 长度
|
||
*/
|
||
const queryPraises = function (pageSize) {
|
||
return ajax.get(`/xboe/m/boe/cases/query-praises?pageSize=${pageSize}`);
|
||
}
|
||
const queryPraisesNew = function (pageSize,rankType) {
|
||
return ajax.get(`/xboe/m/boe/cases/queryPopularity?pageSize=${pageSize}&rankType=${rankType}`);
|
||
}
|
||
const queryRecommendRank = function (pageSize) {
|
||
return ajax.get(`/xboe/m/boe/cases/queryRecommendRank?pageSize=${pageSize}`);
|
||
}
|
||
/*
|
||
好评榜
|
||
@param pageSize 长度
|
||
*/
|
||
const queryComments = function (pageSize) {
|
||
return ajax.get(`/xboe/m/boe/cases/query-comments?pageSize=${pageSize}`);
|
||
}
|
||
const queryCommentsNew = function (pageSize,rankType) {
|
||
return ajax.get(`/xboe/m/boe/cases/queryHighOpinion?pageSize=${pageSize}&rankType=${rankType}`);
|
||
}
|
||
|
||
/**
|
||
* 专业分类
|
||
* */
|
||
const majorTypes = function () {
|
||
return ajax.get('/xboe/m/boe/cases/majorTypes');
|
||
}
|
||
|
||
/**
|
||
* 详情新*/
|
||
const details = function (id, addView) {
|
||
let pars = 'id=' + id;
|
||
if (addView) {
|
||
pars += '&addView=' + addView
|
||
}
|
||
return ajax.get('/xboe/m/boe/cases/details?' + pars);
|
||
}
|
||
|
||
/**
|
||
* 二次查询
|
||
* @param{
|
||
* ids
|
||
* }
|
||
* */
|
||
const ids = function (data) {
|
||
return ajax.postJson('/xboe/m/boe/cases/ids', data);
|
||
}
|
||
|
||
/**
|
||
* 设置和取消优秀案例
|
||
* @param{
|
||
* id 案例id
|
||
* excellent true、设置 false 取消
|
||
* }
|
||
* */
|
||
const excellent = function (data) {
|
||
return ajax.post('/xboe/m/boe/cases/excellent', data)
|
||
}
|
||
|
||
|
||
/**
|
||
*我的案例
|
||
* @param{
|
||
* pageIndex
|
||
* pageSize
|
||
* }
|
||
* */
|
||
const mylist = function (query) {
|
||
return ajax.post('/xboe/m/boe/cases/mylist', query);
|
||
}
|
||
|
||
/**
|
||
* 导出
|
||
* @param{
|
||
* pageIndex
|
||
* pageSize
|
||
* }
|
||
* */
|
||
const exportCases = function (query) {
|
||
return ajax.post('/xboe/m/boe/cases/export', query);
|
||
}
|
||
|
||
/**
|
||
* 导出案例后加的
|
||
* */
|
||
const exports = function (query) {
|
||
return ajax.post('/xboe/m/boe/cases/exportCase', query, { responseType: 'blob' });
|
||
}
|
||
/**
|
||
* @param
|
||
* 记录查看开始时间
|
||
* caseRecommendId读取的案例的id
|
||
*/
|
||
const startReadTimer = (caseRecommendId) => ajax.get(`/xboe/m/boe/cases/recommend/startRead?caseRecommendId=${caseRecommendId}`);
|
||
|
||
/**
|
||
* @param
|
||
* 记录查看结束时间
|
||
* data{
|
||
* caseId [案例id]
|
||
* browseDuration [浏览时间秒]
|
||
* }
|
||
*/
|
||
const endReadTimer = (data)=> ajax.postJson('/xboe/m/boe/cases/recommend/recordBrowseDuration',data)
|
||
|
||
/**年份查询
|
||
*
|
||
*/
|
||
const caseYears = function (query = {}) {
|
||
return ajax.post('/xboe/m/boe/cases/caseYears', query);
|
||
}
|
||
//案例推荐榜单
|
||
const getQueryRecommendRank = function (params) {
|
||
return ajax.get(`/xboe/m/boe/cases/queryRecommendRank?pageSize=${params.pageSize}`)
|
||
}
|
||
//案例上榜
|
||
const riseIntoRank = (data) => ajax.post(`/xboe/m/boe/cases/riseIntoRank?caseId=${data.caseId}`)
|
||
//取消上榜
|
||
const cancelRiseIntoRank = (data) => ajax.post(`/xboe/m/boe/cases/cancelRiseIntoRank?caseId=${data.caseId}`)
|
||
//调整榜单
|
||
const adjustRank = (data) => ajax.post(`/xboe/m/boe/cases/adjustRank?caseIds=${data.caseIds}`)
|
||
//收藏案例
|
||
const queryFavoriteCaseOfIndex = (params) => ajax.get(`/xboe/m/boe/cases/queryFavoriteCaseOfIndex?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&orderField=${params.orderField}&orderAsc=${params.orderAsc}`)
|
||
//浏览记录
|
||
const queryViewRecord = (data) => ajaxs.post(`/statApi/xboe/m/stat/userdynamic/list?pageIndex=${data.pageIndex}&pageSize=${data.pageSize}&contentType=${data.contentType}&aid=${data.aid}&hidden=${data.hidden}&eventKey=${data.eventKey}`)
|
||
//浏览量TOP榜单
|
||
const queryPopularityOfMajor = (params) => ajax.get(`/xboe/m/boe/cases/queryPopularityOfMajor?pageSize=${params.pageSize}&rankMonth=${params.rankMonth}&majorId=${params.majorId}`)
|
||
//浏览记录新
|
||
const browsingHistory = (params) => ajax.get(`/xboe/m/boe/cases/browsingHistory?pageIndex=${params.pageIndex}&pageSize=5`)
|
||
//获取所有的专业月份
|
||
const queryAllTimePopularityOfMajor = () => ajax.get('/xboe/m/boe/cases/queryAllTimePopularityOfMajor')
|
||
export default {
|
||
queryAllTimePopularityOfMajor,
|
||
getQueryRecommendRank,
|
||
queryPopularityOfMajor,
|
||
browsingHistory,
|
||
queryViewRecord,
|
||
queryFavoriteCaseOfIndex,
|
||
riseIntoRank,
|
||
cancelRiseIntoRank,
|
||
adjustRank,
|
||
indexList,
|
||
queryList,
|
||
queryListV2,
|
||
isTopList,
|
||
updateTop,
|
||
del,
|
||
detail,
|
||
savaRecommend,
|
||
query,
|
||
usernameList,
|
||
queryPraises,
|
||
queryPraisesNew,
|
||
queryRecommendRank,
|
||
queryComments,
|
||
queryCommentsNew,
|
||
majorTypes,
|
||
details,
|
||
ids,
|
||
excellent,
|
||
mylist,
|
||
exportCases,
|
||
exports,
|
||
startReadTimer,
|
||
endReadTimer,
|
||
caseYears
|
||
}
|