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

应用详情fixed

parent f13a731c
<template>
<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-pagination
:total="commentsTtotal"
......@@ -44,6 +46,32 @@ export default {
pageSizes: [10, 50, 100],
pageSize: 10,
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: {
scoreDetail() {
......@@ -79,27 +107,31 @@ export default {
this.init();
},
init() {
if (this.is_app_detail) {
var temp = {
params: {
let params = {
page: this.currentPage,
limit: this.pageSize,
},
size: this.pageSize,
};
} else {
var temp = {
params: {
if (this.is_app_detail) {
params = {
page: this.currentPage,
size: this.pageSize,
},
limit: this.pageSize,
};
}
this.$http
.get(this.url, temp)
.get(this.url, { params })
.then(({ data }) => {
if (this.is_app_detail) {
this.commentsTtotal = data.data.overview.total;
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 {
this.commentsTtotal = data.total;
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