Commit 74db0ba1 authored by 徐一鸣's avatar 徐一鸣

应用详情fixed

parent f13a731c
<template> <template>
<div class="service_tab-comments"> <div class="service_tab-comments">
<comments-score :data="scoreDetail"></comments-score> <comments-score
:data="is_app_detail ? scoreDetail2 : scoreDetail"
></comments-score>
<comments-list :data="commentsList"></comments-list> <comments-list :data="commentsList"></comments-list>
<comments-pagination <comments-pagination
:total="commentsTtotal" :total="commentsTtotal"
...@@ -44,6 +46,32 @@ export default { ...@@ -44,6 +46,32 @@ export default {
pageSizes: [10, 50, 100], pageSizes: [10, 50, 100],
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
scoreDetail2: {
score: 0,
starInfo: [
{
star: 1,
percent: 0,
},
{
star: 2,
percent: 0,
},
{
star: 3,
percent: 0,
},
{
star: 4,
percent: 0,
},
{
star: 5,
percent: 0,
},
],
total: 0,
},
}), }),
computed: { computed: {
scoreDetail() { scoreDetail() {
...@@ -79,27 +107,31 @@ export default { ...@@ -79,27 +107,31 @@ export default {
this.init(); this.init();
}, },
init() { init() {
if (this.is_app_detail) { let params = {
var temp = {
params: {
page: this.currentPage, page: this.currentPage,
limit: this.pageSize, size: this.pageSize,
},
}; };
} else {
var temp = { if (this.is_app_detail) {
params: { params = {
page: this.currentPage, page: this.currentPage,
size: this.pageSize, limit: this.pageSize,
},
}; };
} }
this.$http this.$http
.get(this.url, temp) .get(this.url, { params })
.then(({ data }) => { .then(({ data }) => {
if (this.is_app_detail) { if (this.is_app_detail) {
this.commentsTtotal = data.data.overview.total; this.commentsTtotal = data.data.overview.total;
this.commentsList = data.data.list || []; this.commentsList = data.data.list || [];
this.scoreDetail2.score = data.data.overview.ave;
this.scoreDetail2.total = data.data.overview.total;
data.data.overview.detail_counts.forEach((item) => {
let percent = (item.count / this.scoreDetail2.total) * 100;
this.scoreDetail2.starInfo[item.score - 1].percent = percent;
});
} else { } else {
this.commentsTtotal = data.total; this.commentsTtotal = data.total;
this.commentsList = data.data || []; this.commentsList = data.data || [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment