|
|
@@ -299,13 +299,13 @@
|
|
|
<div class="card-row">
|
|
|
<span>答题人数</span>
|
|
|
<span class="highlight-black">
|
|
|
- <count-to :start-val="0" :end-val="answerMemberCount" :duration="3600" class="card-panel-num" />
|
|
|
+ <count-to :key="`answer-${answerMemberCount}`" :start-val="0" :end-val="answerMemberCount" :duration="3600" class="card-panel-num" />
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="card-row">
|
|
|
<span>正确人数</span>
|
|
|
<span class="highlight-black">
|
|
|
- <count-to :start-val="0" :end-val="correctUserCount" :duration="3600" class="card-panel-num" />
|
|
|
+ <count-to :key="correctUserCount" :start-val="0" :end-val="correctUserCount" :duration="3600" class="card-panel-num" />
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="card-row">
|
|
|
@@ -1315,6 +1315,13 @@ export default {
|
|
|
watchCourseTopTen(param).then(res=>{
|
|
|
if(res.code === 200){
|
|
|
let data = res.data;
|
|
|
+ if (!data || data.length === 0) {
|
|
|
+ this.courseWatchChart.clear();
|
|
|
+ this.answerMemberCount = 0;
|
|
|
+ this.correctUserCount = 0;
|
|
|
+ this.correctRate = 0;
|
|
|
+ return;
|
|
|
+ }
|
|
|
let watchUserCountList = data.map(e=>e.watchUserCount);
|
|
|
let completedUserCountList = data.map(e=>e.completedUserCount);
|
|
|
let answerUserCountList = data.map(e=>e.answerUserCount);
|
|
|
@@ -1326,6 +1333,12 @@ export default {
|
|
|
courseWatchOption.series[2].data = answerUserCountList;
|
|
|
courseWatchOption.series[3].data = correctUserCountList;
|
|
|
this.courseWatchChart.setOption(courseWatchOption)
|
|
|
+ this.answerMemberCount = answerUserCountList.reduce((a, b) => a + b, 0);
|
|
|
+ this.correctUserCount = correctUserCountList.reduce((a, b) => a + b, 0);
|
|
|
+ this.correctRate = this.answerMemberCount
|
|
|
+ ? ((this.correctUserCount / this.answerMemberCount) * 100).toFixed(2)
|
|
|
+ : 0;
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|