Bläddra i källkod

解决均分统计渲染问题

liqk 4 år sedan
förälder
incheckning
c2366b3eae

+ 4 - 4
TEAMModelOS/ClientApp/src/view/learnactivity/PaperScore.vue

@@ -161,9 +161,9 @@
                                         <div class="item-explain">
                                             <span class="explain-title">{{$t('learnActivity.score.kdLabel')}}</span>
                                             <div class="item-explain-details">
-                                                <span v-if="! (_.compact(item.points).length)">{{$t('learnActivity.score.noKd')}}</span>
+                                                <span v-if="!item.knowledge || (_.compact(item.knowledge).length)">{{$t('learnActivity.score.noKd')}}</span>
                                                 <div v-else>
-                                                    <span v-for="(point,index) in item.points" :key="index" class="item-point-tag">
+                                                    <span v-for="(point,index) in item.knowledge" :key="index" class="item-point-tag">
                                                         {{ point }}
                                                     </span>
                                                 </div>
@@ -279,9 +279,9 @@
                                 <div class="item-explain" v-show="showAnswer">
                                     <span class="explain-title">{{$t('learnActivity.score.kdLabel')}}</span>
                                     <div class="item-explain-details">
-                                        <span v-if="!childItem.points.length">{{$t('learnActivity.score.noKd')}}</span>
+                                        <span v-if="!childItem.knowledge || !childItem.knowledge.length">{{$t('learnActivity.score.noKd')}}</span>
                                         <div v-else>
-                                            <span v-for="(point,index) in childItem.points" :key="index" class="item-point-tag">
+                                            <span v-for="(point,index) in childItem.knowledge" :key="index" class="item-point-tag">
                                                 <span>{{ point }}</span>
                                             </span>
                                         </div>

+ 16 - 15
TEAMModelOS/ClientApp/src/view/learnactivity/echarts/AvgCompare.vue

@@ -39,7 +39,7 @@ export default {
                 },
                 data: []
             },
-            option: {
+            defOption: {
                 color: [
                     "#4ECDC4",
                     "#F72459",
@@ -102,12 +102,13 @@ export default {
                     }
                 },
                 series: []
-            }
+            },
+            newOption:{}
         }
     },
     mounted() {
         this.progressPie = this.$echarts.init(document.getElementById('ev-avg-compare'))
-        this.progressPie.setOption(this.option)
+        // this.progressPie.setOption(this.newOption,true)
         let erd11 = elementResizeDetectorMaker()
         erd11.listenTo(document.getElementById("ev-avg-compare"), () => {
             this.$nextTick(() => {
@@ -116,7 +117,7 @@ export default {
             })
         })
         this.progressPie.on('legendselectchanged', (params) => {
-            let active = this.option.series.filter(item => {
+            let active = this.newOption.series.filter(item => {
                 if (params.selected[item.name]) {
                     return true
                 } else {
@@ -130,22 +131,22 @@ export default {
                     score[index] += scoreItem
                 })
             })
-            let len = this.option.series.length
-            this.option.series[len - 1].data = score
-            this.progressPie.setOption(this.option)
+            let len = this.newOption.series.length
+            this.newOption.series[len - 1].data = score
+            this.progressPie.setOption(this.newOption)
         });
     },
     watch: {
         pieData: {
             handler(n, o) {
                 this.$nextTick(() => {
-                    let newOption = this._.cloneDeep(this.option)
+                    this.newOption = this._.cloneDeep(this.defOption)
                     if (!this.progressPie) {
                         this.progressPie = this.$echarts.init(document.getElementById('ev-avg-compare'))
                     }
-                    // newOption.legend.data = []
+                    //处理
                     this.pieData.forEach(item => {
-                        newOption.legend.data.push({
+                        this.newOption.legend.data.push({
                             name: item.subjectId,
                             textStyle: {
                                 color: '#FFF'
@@ -153,7 +154,7 @@ export default {
                         })
                     })
                     if (this.pieData.length) {
-                        newOption.xAxis.data = this.pieData[0].className.map(item => {
+                        this.newOption.xAxis.data = this.pieData[0].className.map(item => {
                             return item.name
                         })
                     }
@@ -173,7 +174,7 @@ export default {
 
                     }
                     this.pieData.forEach(item => {
-                        newOption.series.push(
+                        this.newOption.series.push(
                             {
                                 name: item.subjectId,
                                 type: 'bar',
@@ -183,9 +184,9 @@ export default {
                             }
                         )
                     })
-                    newOption.series.push(this.defaultSeries)
-                    console.log('option哈哈',newOption)
-                    this.progressPie.setOption(newOption, true)
+                    this.newOption.series.push(this.defaultSeries)
+                    console.log('option哈哈',this.newOption)
+                    this.progressPie.setOption(this.newOption, true)
                 })
             },
             deep: true,