Commit 98672898 authored by 刘殿昕's avatar 刘殿昕

服务评分

parent cff33b16
<template> <template>
<ul class="star_list apaas_scroll"> <ul class="star_list apaas_scroll">
<li class="item_list" v-for="(option, index) in options" :key="'star_info_' + index"> <li
class="item_list"
v-for="(option, index) in options"
:key="'star_info_' + index"
>
<el-rate <el-rate
v-if="show_star" v-if="show_star"
class="item-rate" class="item-rate"
...@@ -12,11 +16,15 @@ ...@@ -12,11 +16,15 @@
<span v-else class="data_title">{{ option.title }}</span> <span v-else class="data_title">{{ option.title }}</span>
<el-progress <el-progress
class="item-progress" class="item-progress"
:percentage="getPercent(option.count)" :percentage="Number(getPercent(option.count))"
:show-text="false" :show-text="false"
:color="show_star ? color : colors[index]" :color="show_star ? color : colors[index]"
></el-progress> ></el-progress>
<span v-if="!show_star" class="item_text_1" v-text="option.percent + '%'"></span> <span
v-if="!show_star"
class="item_text_1"
v-text="option.percent + '%'"
></span>
<span class="item-text" v-text="option.count + '个'"></span> <span class="item-text" v-text="option.count + '个'"></span>
</li> </li>
</ul> </ul>
...@@ -27,28 +35,33 @@ export default { ...@@ -27,28 +35,33 @@ export default {
props: { props: {
options: { options: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
total: { total: {
type: Number, type: Number,
default: () => 10 default: () => 10,
}, },
show_star: { show_star: {
type: Boolean, type: Boolean,
default: true default: true,
} },
}, },
data() { data() {
return { return {
color: "#e56600", color: "#e56600",
colors: ["#25bdb1", "#f5ab4c", "#e15260", "#274fee", "#58617a"] colors: ["#25bdb1", "#f5ab4c", "#e15260", "#274fee", "#58617a"],
}; };
}, },
methods: { methods: {
getPercent(value) { getPercent(value) {
return Math.min((value / this.total) * 100, 100); if (value == 0) {
} return 0;
} } else {
let num = Math.min((value / this.total) * 100, 100);
return num;
}
},
},
}; };
</script> </script>
......
...@@ -472,31 +472,31 @@ export default { ...@@ -472,31 +472,31 @@ export default {
starlistData: [ starlistData: [
{ {
star: 5, star: 5,
count: 5, count: 0,
unit: "", unit: "",
}, },
{ {
star: 4, star: 4,
count: 4, count: 0,
unit: "", unit: "",
}, },
{ {
star: 3, star: 3,
count: 3, count: 0,
unit: "", unit: "",
}, },
{ {
star: 2, star: 2,
count: 2, count: 0,
unit: "", unit: "",
}, },
{ {
star: 1, star: 1,
count: 1, count: 0,
unit: "", unit: "",
}, },
], // 服务评分 ], // 服务评分
starlistTotal: 15, starlistTotal: 0,
hotSearchHeader: [], // 热门搜索 表头 hotSearchHeader: [], // 热门搜索 表头
hotSearchData: [], // 热门搜索 数据 hotSearchData: [], // 热门搜索 数据
graph_arr: { graph_arr: {
...@@ -722,10 +722,27 @@ export default { ...@@ -722,10 +722,27 @@ export default {
}) })
.then((response) => { .then((response) => {
if (response.data.success == 1) { if (response.data.success == 1) {
this.commentlistData = response.data.data.concat( if (this.right_3_state == 0) {
this.commentlistData let data = response.data.data || [];
); this.commentlistData = data.concat(this.commentlistData);
this.last_id = this.commentlistData[0].last_id; if (this.commentlistData && this.commentlistData.length != 0) {
this.last_id = this.commentlistData[0].last_id;
}
} else {
let data = response.data.data;
this.starlistData[0].count = data.score5;
this.starlistData[1].count = data.score4;
this.starlistData[2].count = data.score3;
this.starlistData[3].count = data.score2;
this.starlistData[4].count = data.score1;
this.starlistTotal =
data.score5 +
data.score4 +
data.score3 +
data.score2 +
data.score1;
console.log(this.starlistData, this.starlistTotal)
}
} }
}); });
}, },
......
...@@ -634,12 +634,27 @@ export default { ...@@ -634,12 +634,27 @@ export default {
}) })
.then((response) => { .then((response) => {
if (response.data.success == 1) { if (response.data.success == 1) {
if (response.data.data) { if (this.right_3_state == 0) {
this.commentlistData = response.data.data.concat( let data = response.data.data || [];
this.commentlistData this.commentlistData = data.concat(this.commentlistData);
); if (this.commentlistData && this.commentlistData.length != 0) {
this.last_id = this.commentlistData[0].last_id;
}
} else {
let data = response.data.data;
this.starlistData[0].count = data.score5;
this.starlistData[1].count = data.score4;
this.starlistData[2].count = data.score3;
this.starlistData[3].count = data.score2;
this.starlistData[4].count = data.score1;
this.starlistTotal =
data.score5 +
data.score4 +
data.score3 +
data.score2 +
data.score1;
console.log(this.starlistData, this.starlistTotal)
} }
this.last_id = this.commentlistData[0].last_id;
} }
}); });
}, },
......
...@@ -628,11 +628,26 @@ export default { ...@@ -628,11 +628,26 @@ export default {
}) })
.then((response) => { .then((response) => {
if (response.data.success == 1) { if (response.data.success == 1) {
if (response.data.data) { if (this.right_3_state == 0) {
this.commentlistData = response.data.data.concat( let data = response.data.data || [];
this.commentlistData this.commentlistData = data.concat(this.commentlistData);
); if (this.commentlistData && this.commentlistData.length != 0) {
this.last_id = this.commentlistData[0].last_id; this.last_id = this.commentlistData[0].last_id;
}
} else {
let data = response.data.data;
this.starlistData[0].count = data.score5;
this.starlistData[1].count = data.score4;
this.starlistData[2].count = data.score3;
this.starlistData[3].count = data.score2;
this.starlistData[4].count = data.score1;
this.starlistTotal =
data.score5 +
data.score4 +
data.score3 +
data.score2 +
data.score1;
console.log(this.starlistData, this.starlistTotal)
} }
} }
}); });
......
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