From ea9052882f26686e549a3c922948841fb47ad246 Mon Sep 17 00:00:00 2001 From: zhoulingpo Date: Tue, 9 May 2023 15:55:20 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E5=91=8A=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/report.js | 29 ++++++++++++++++++++--------- src/views/Report/ReportDetail.vue | 26 ++++++++++++++++---------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/api/modules/report.js b/src/api/modules/report.js index 3df681a..64e57d0 100644 --- a/src/api/modules/report.js +++ b/src/api/modules/report.js @@ -162,17 +162,12 @@ export default { // 点赞 goodLuck (data) { return request({ - url: '/api/report/praise/'+data, - method: 'get', - }) - }, -// 取消点赞 - NogoodLuck (data) { - return request({ - url: '/api/report/delPraise/'+data, + url: '/api/reportLogBook/thumbUpOrDown', method: 'get', + params:data }) }, + //删除评论 {id} delJuggle (data) { return request({ @@ -204,6 +199,22 @@ export default { params:data }) }, - // 获取 + // 获取评分 + getScore(data) { + return request({ + url: '/api/report-rating/rating', + method: 'get', + params:data + }) + }, + // 获取点赞 + getGood(data){ + + return request({ + url: '/api/reportLogBook/getThumbUpCount', + method: 'get', + params:data + }) + } } diff --git a/src/views/Report/ReportDetail.vue b/src/views/Report/ReportDetail.vue index 293a190..092b979 100644 --- a/src/views/Report/ReportDetail.vue +++ b/src/views/Report/ReportDetail.vue @@ -121,23 +121,27 @@ export default { } }, methods: { + // 获取评分 + getScore(){ + this.$api.report.getScore({reportId:this.reportId}).then(res=>{ + this.userRating=res.data/2 + }) + }, + // 获取点赞数量及其状态 + getGood(){ + this.$api.report.getGood({reportId:this.reportId}).then(res=>{ + + }) + }, //点赞 pointZan(type){ - if(type== 'n'){ - this.$api.report.NogoodLuck(this.reportId).then(res=>{ - this.isShow=!this.isShow - this.$message.success("取消成功") - }).catch(()=>{ - this.$message.warning("操作失败") - }) - }else{ + this.$api.report.goodLuck(this.reportId).then(res=>{ this.isShow=!this.isShow - this.$message.success("点赞成功") + this.$message.success("操作成功") }).catch(()=>{ this.$message.warning("操作失败") }) - } }, //评分 saveScore(){ @@ -248,6 +252,8 @@ export default { // this.previewRow() this.getComment() this.getReportDetail() + this.getScore() + this.getGood() } }