From 8e6c00d266e37e31d0129c95126dc0accef9e301 Mon Sep 17 00:00:00 2001 From: zhangsir Date: Mon, 9 Sep 2024 09:40:35 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/cases.js | 12 +++++ src/views/portal/case/Charts.vue | 41 ++++++++------ src/views/portal/case/Index.vue | 92 ++++++++++++++++++++------------ 3 files changed, 95 insertions(+), 50 deletions(-) diff --git a/src/api/modules/cases.js b/src/api/modules/cases.js index 88c02e73..ba64b45f 100644 --- a/src/api/modules/cases.js +++ b/src/api/modules/cases.js @@ -88,6 +88,12 @@ const usernameList = function (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 长度 @@ -95,6 +101,9 @@ const queryPraises = function (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}`); +} /** * 专业分类 @@ -202,7 +211,10 @@ export default { query, usernameList, queryPraises, + queryPraisesNew, + queryRecommendRank, queryComments, + queryCommentsNew, majorTypes, details, ids, diff --git a/src/views/portal/case/Charts.vue b/src/views/portal/case/Charts.vue index a2c6162c..49c59005 100644 --- a/src/views/portal/case/Charts.vue +++ b/src/views/portal/case/Charts.vue @@ -23,11 +23,11 @@ @@ -47,11 +47,11 @@ @@ -61,12 +61,12 @@
推荐榜
@@ -87,6 +87,7 @@ import portalHeader from '@/components/PortalHeader.vue' ankingList: [],//排行数据1 Popularity: [],//排行数据2 Positive: [],//排行数据3 + recommendRank: [], switch: { 'total': '总', 'quarter': '季度', @@ -98,21 +99,29 @@ import portalHeader from '@/components/PortalHeader.vue' mounted() { this.getPopularity(); this.getPositive(); + this.getQueryRecommendRank() }, methods: { getPopularity() { - apiCase.queryPraises(5).then(res => { - if (res.status == 200) { - this.Popularity = [...res.result,...res.result]; + apiCase.queryPraisesNew(10,this.popularityName == '季度' ? 1 : 2).then(res => { + if(res.status == 200) { + this.Popularity = res.result } - }); + }) }, getPositive() { - apiCase.queryComments(5).then(res => { - if (res.status == 200) { - this.Positive = [...res.result,...res.result]; + apiCase.queryCommentsNew(10,this.favorableName == '季度' ? 1 : 2).then(res => { + if(res.status == 200) { + this.Positive = res.result } - }); + }) + }, + getQueryRecommendRank(){ + apiCase.queryRecommendRank(10).then(res => { + if(res.status == 200) { + this.recommendRank = res.result + } + }) }, imgNumBlue(index){ return 'listblue0' + (index+1) @@ -129,9 +138,11 @@ import portalHeader from '@/components/PortalHeader.vue' }, positiveReview(e){ this.favorableName = this.switch[e] + this.getPositive() }, popularityReview(e){ this.popularityName = this.switch[e] + this.getPopularity() }, }, } diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index e6625b04..912b6bc1 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -304,7 +304,7 @@ @@ -341,7 +341,7 @@ @@ -365,9 +365,9 @@

推荐榜

@@ -514,6 +514,7 @@ export default { ankingList: [],//排行数据1 Popularity: [],//排行数据2 Positive: [],//排行数据3 + recommendRank: [], protocolDialogVisible: false, protocolConfirmButton: true, years: [], @@ -811,6 +812,7 @@ export default { //打开排行榜下边的两个 this.getPopularity(); this.getPositive(); + this.getQueryRecommendRank() this.couresreso(); // window.addEventListener("scroll", this.handleScroll); // 获取年 @@ -824,9 +826,11 @@ export default { methods: { positiveReview(e){ this.favorableName = this.switch[e] + this.getPositive() }, popularityReview(e){ this.popularityName = this.switch[e] + this.getPopularity() }, handleType(msg){ this.queryCondition.type = msg @@ -1584,40 +1588,58 @@ export default { }); }, getPopularity() { - apiCase.queryPraises(5).then(res => { - if (res.status == 200) { - this.Popularity = res.result.slice(0,3); - // if (res.result.length < 5) { - // for (let i = 0; i = (5 - res.result.length); i++) { - // this.Popularity.push({ - // authorName: '', - // count: 1, - // id: '', - // title: '', - // }) - // } - // } + // apiCase.queryPraises(5).then(res => { + // if (res.status == 200) { + // this.Popularity = res.result.slice(0,3); + // // if (res.result.length < 5) { + // // for (let i = 0; i = (5 - res.result.length); i++) { + // // this.Popularity.push({ + // // authorName: '', + // // count: 1, + // // id: '', + // // title: '', + // // }) + // // } + // // } + // } + // }); + apiCase.queryPraisesNew(3,this.popularityName == '季度' ? 1 : 2).then(res => { + if(res.status == 200) { + this.Popularity = res.result } - }); + }) }, getPositive() { - apiCase.queryComments(5).then(res => { - if (res.status == 200) { - this.Positive = res.result.slice(0,3); - // if (res.result.length < 5) { - // for (let i = 0; i = (5 - res.result.length); i++) { - // this.Positive.push({ - // authorName: '', - // count: 1, - // id: '', - // title: '', - // }) - // } + // apiCase.queryComments(5).then(res => { + // if (res.status == 200) { + // this.Positive = res.result.slice(0,3); + // // if (res.result.length < 5) { + // // for (let i = 0; i = (5 - res.result.length); i++) { + // // this.Positive.push({ + // // authorName: '', + // // count: 1, + // // id: '', + // // title: '', + // // }) + // // } - // } + // // } + // } + // }); + apiCase.queryCommentsNew(3,this.favorableName == '季度' ? 1 : 2).then(res => { + if(res.status == 200) { + this.Positive = res.result } - }); + }) + }, + + getQueryRecommendRank(){ + apiCase.queryRecommendRank(3).then(res => { + if(res.status == 200) { + this.recommendRank = res.result + } + }) }, jumpRouter(item) { From a59d1cea930cfe32453db2a7ca1bcbcfbcc3b5ef Mon Sep 17 00:00:00 2001 From: zhangsir Date: Tue, 10 Sep 2024 11:10:58 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/cases.js | 29 +++- src/components/Portal/authorInfo.vue | 8 +- src/views/case/ManageList.vue | 197 ++++++++++++++++++++++++++- src/views/portal/case/Excellent.vue | 67 +++++---- src/views/portal/case/Index.vue | 94 +++++++++++-- 5 files changed, 340 insertions(+), 55 deletions(-) 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 {