diff --git a/src/api/modules/cases.js b/src/api/modules/cases.js index ba64b45f..46ad3d60 100644 --- a/src/api/modules/cases.js +++ b/src/api/modules/cases.js @@ -1,6 +1,6 @@ /* 案例模块的相关处理*/ import ajax from '@/utils/xajax.js' - +import ajaxs from '@/api/ajax.js' /**首页查询 * pageSize * orderField @@ -195,11 +195,30 @@ const endReadTimer = (data)=> ajax.postJson('/xboe/m/boe/cases/recommend/record 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}`) +//浏览量TOP榜单 +const queryPopularityOfMajor = (params) => ajax.get(`/xboe/m/boe/cases/queryPopularityOfMajor?pageSize=${params.pageSize}&rankMonth=${params.rankMonth}&majorId=${params.majorId}`) export default { + getQueryRecommendRank, + queryPopularityOfMajor, + queryViewRecord, + queryFavoriteCaseOfIndex, + riseIntoRank, + cancelRiseIntoRank, + adjustRank, indexList, queryList, queryListV2, diff --git a/src/components/Portal/authorInfo.vue b/src/components/Portal/authorInfo.vue index d2bc7f50..159bade5 100644 --- a/src/components/Portal/authorInfo.vue +++ b/src/components/Portal/authorInfo.vue @@ -15,7 +15,7 @@
{{userName}} {{userInfo}} - 20篇最佳案例 + {{tag}}
@@ -50,6 +50,12 @@ onlyAvatar:{ type:Boolean, default:false + }, + authorTags: { + type:Array, + default(){ + return [] + } } }, data(){ diff --git a/src/views/case/ManageList.vue b/src/views/case/ManageList.vue index 8b82c238..96cf5cfa 100644 --- a/src/views/case/ManageList.vue +++ b/src/views/case/ManageList.vue @@ -32,6 +32,9 @@ +
+ 推荐榜单 +
@@ -49,6 +52,7 @@ @@ -157,6 +164,36 @@ 确 定 + +
+ + + + + + + + + + + +
+ +
@@ -167,8 +204,12 @@ export default { name: 'articleItems', data() { return { + adminList: [], + caseType: process.env.VUE_APP_CASE_TYPE, + RankingShow: false, bestYear: '', bestOrg: '', + bestId: '', bestTextarea: '', bestValue: false, excellent: false, @@ -179,6 +220,8 @@ export default { excellent: '', }, //查询对象 caseList: [], //案例列表 + tableData: [], + caseIds: '', count: 0, recommend: { dlgShow: false, @@ -211,16 +254,149 @@ export default { }, mounted() { this.getData(); + this.getList(); + apiCase.treeList(1,Number(this.caseType ?? 155),1).then(res=>{ + if(res.code == 200){ + this.adminList = res.result; + } + }) + }, + watch:{ + RankingShow(val){ + if(val){ + this.getList() + } + } }, methods: { + orgDomainTranslate(code) { // 组织领域翻译 + if (code == '') { + return + } + let name = ''; + let data = this.adminList.find(item => { + return item.code == code; + }); + if (data) { + name = data.name; + } + return name; + }, + suggest(record){ + this.$confirm('你确认要推荐此案例么?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + apiCase.riseIntoRank({caseId:record.id}).then(res=>{ + if(res.status == 200 ){ + this.$message.success('成功') + this.getData() + } + }).catch(()=>{ + this.$message.error('失败') + }) + }) + }, + handleNotRank(record){ + this.$confirm('你确认要取消推荐么?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + apiCase.cancelRiseIntoRank({caseId:record?.caseId}).then(res=>{ + if(res.status == 200){ + this.$message.success('取消推荐成功') + this.getList() + this.getData() + } + }).catch(()=>{ + this.$message.error('取消推荐失败') + }) + }) + }, + moveUp(row,index){ + console.log(row,index,'index') + if(index == 0){ + this.$message.error('已经排到第一位了') + return + } + this.swapArray(this.tableData,index,index-1) + }, + moveDown(row,index){ + if(index == this.tableData.length - 1){ + this.$message.error('已经排到最后一位了') + return + } + this.swapArray(this.tableData,index,index+1) + }, + swapArray(arr, index1, index2){ + const temp = arr[index1]; + arr.splice(index1, 1); + arr.splice(index2, 0, temp); + }, + getList(){ + apiCase.getQueryRecommendRank({pageSize:3}).then(res=>{ + console.log(res,'res') + if(res.status == 200){ + this.tableData = res.result + this.caseIds = res.result.map(item=>item.caseId).join(',') + } + }) + }, notBest(){ this.bestValue = false this.bestYear = '' this.bestOrg = '' + this.bestId = '' this.bestTextarea = '' }, parameBest(){ - this.notBest() + this.excellent = true; + let data = { + id: this.bestId, + excellent: this.excellent, + excellentReason: this.bestTextarea + } + apiCase.excellent(data).then(res=>{ + if (res.status == 200) { + this.$message({ + type: 'success', + message: '设置最佳案例成功!' + }); + this.getData() + }else{ + this.$message({ + type: 'error', + message: '设置最佳案例失败!' + }); + } + this.notBest() + }) + }, + recoRanking(){ + this.RankingShow = true + }, + closeDrawer(){ + this.RankingShow = false + }, + queryList(){ + if(this.caseIds != this.tableData.map(item=>item.caseId).join(',')){ + apiCase.adjustRank({caseIds:this.tableData.map(item=>item.caseId).join(',')}).then(res=>{ + if(res.status == 200){ + this.$message({ + message: '调整成功', + type: 'success' + }) + } + }).catch(()=>{ + this.$message({ + message: '调整失败', + type: 'error' + }) + }) + } + this.RankingShow = false }, // 导出 importList() { @@ -405,6 +581,9 @@ export default { }, theBest(item){ this.bestValue = true + this.bestId = item.id + this.bestOrg = this.orgDomainTranslate(item.orgDomainParent) + this.bestYear = item.sysCreateTime.split('-')[0] }, //添加推荐 shareItem(item) { @@ -519,6 +698,18 @@ export default {