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

服务评分

parent cff33b16
<template>
<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
v-if="show_star"
class="item-rate"
......@@ -12,11 +16,15 @@
<span v-else class="data_title">{{ option.title }}</span>
<el-progress
class="item-progress"
:percentage="getPercent(option.count)"
:percentage="Number(getPercent(option.count))"
:show-text="false"
:color="show_star ? color : colors[index]"
></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>
</li>
</ul>
......@@ -27,28 +35,33 @@ export default {
props: {
options: {
type: Array,
default: () => []
default: () => [],
},
total: {
type: Number,
default: () => 10
default: () => 10,
},
show_star: {
type: Boolean,
default: true
}
default: true,
},
},
data() {
return {
color: "#e56600",
colors: ["#25bdb1", "#f5ab4c", "#e15260", "#274fee", "#58617a"]
colors: ["#25bdb1", "#f5ab4c", "#e15260", "#274fee", "#58617a"],
};
},
methods: {
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>
......
......@@ -472,31 +472,31 @@ export default {
starlistData: [
{
star: 5,
count: 5,
count: 0,
unit: "",
},
{
star: 4,
count: 4,
count: 0,
unit: "",
},
{
star: 3,
count: 3,
count: 0,
unit: "",
},
{
star: 2,
count: 2,
count: 0,
unit: "",
},
{
star: 1,
count: 1,
count: 0,
unit: "",
},
], // 服务评分
starlistTotal: 15,
starlistTotal: 0,
hotSearchHeader: [], // 热门搜索 表头
hotSearchData: [], // 热门搜索 数据
graph_arr: {
......@@ -722,11 +722,28 @@ export default {
})
.then((response) => {
if (response.data.success == 1) {
this.commentlistData = response.data.data.concat(
this.commentlistData
);
if (this.right_3_state == 0) {
let data = response.data.data || [];
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)
}
}
});
},
getServiceTransfer() {},
......
......@@ -634,13 +634,28 @@ export default {
})
.then((response) => {
if (response.data.success == 1) {
if (response.data.data) {
this.commentlistData = response.data.data.concat(
this.commentlistData
);
}
if (this.right_3_state == 0) {
let data = response.data.data || [];
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)
}
}
});
},
getServiceApprovalChanges() {
......
......@@ -628,12 +628,27 @@ export default {
})
.then((response) => {
if (response.data.success == 1) {
if (response.data.data) {
this.commentlistData = response.data.data.concat(
this.commentlistData
);
if (this.right_3_state == 0) {
let data = response.data.data || [];
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)
}
}
});
},
......
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