Browse Source

处理个人评测渲染

liqk 4 years ago
parent
commit
f187be87e1

+ 6 - 0
TEAMModelOS/ClientApp/src/view/learnactivity/MgtPrivEva.less

@@ -258,3 +258,9 @@
     color: white;
     color: white;
     border-radius: 2px;
     border-radius: 2px;
 }
 }
+.mock-stu-answer{
+    margin-right: 20px;
+}
+.mock-tea-scoring{
+    margin-right: 40px;
+}

+ 66 - 4
TEAMModelOS/ClientApp/src/view/learnactivity/MgtPrivEva.vue

@@ -54,6 +54,15 @@
                     <span :class="curBarIndex == 1 ? 'evalustion-bar-item line-bottom-active line-bottom':'evalustion-bar-item line-bottom'" @click="selectBar(1)">
                     <span :class="curBarIndex == 1 ? 'evalustion-bar-item line-bottom-active line-bottom':'evalustion-bar-item line-bottom'" @click="selectBar(1)">
                         {{$t('learnActivity.mgtScEv.tab2')}}
                         {{$t('learnActivity.mgtScEv.tab2')}}
                     </span>
                     </span>
+                    <!-- <div style="float:right;" v-show="evaListShow[curEvaIndex] && evaListShow[curEvaIndex].progress == 'going'"> -->
+                    <div style="float:right;">
+                        <Tooltip :content="$t('learnActivity.mgtScEv.autoTips1')" :max-width="240">
+                            <Button type="success" size="small" :loading="answerLoading" class="mock-stu-answer" @click="mockAnswer">{{$t('learnActivity.mgtScEv.autoAnswer')}}</Button>
+                        </Tooltip>
+                        <Tooltip :content="$t('learnActivity.mgtScEv.autoTips2')" :max-width="240">
+                            <Button type="warning" size="small" :loading="scoreLoading" class="mock-tea-scoring" @click="mockScoring">{{$t('learnActivity.mgtScEv.autoScore')}}</Button>
+                        </Tooltip>
+                    </div>
                 </div>
                 </div>
                 <!--试卷信息-->
                 <!--试卷信息-->
                 <div :class="curBarIndex == 1 ? 'animated fadeIn evaluation-base-info':'evaluation-base-info animated fadeOutRight'" v-show="curBarIndex == 1">
                 <div :class="curBarIndex == 1 ? 'animated fadeIn evaluation-base-info':'evaluation-base-info animated fadeOutRight'" v-show="curBarIndex == 1">
@@ -86,6 +95,7 @@ export default {
         TestPaper,
         TestPaper,
         Scoring
         Scoring
     },
     },
+    inject: ['reload'],
     data() {
     data() {
         return {
         return {
             split1: 0.2,
             split1: 0.2,
@@ -102,10 +112,56 @@ export default {
             filterPeriod: undefined,
             filterPeriod: undefined,
             schoolBase: {
             schoolBase: {
                 period: []
                 period: []
-            }
+            },
+            scoreLoading: false,
+            answerLoading: false
         }
         }
     },
     },
     methods: {
     methods: {
+        // 模拟教师评分数据
+        mockScoring() {
+            this.scoreLoading = true
+            this.$api.learnActivity.mockScoring({
+                id: this.evaListShow[this.curEvaIndex].id,
+                code: this.evaListShow[this.curEvaIndex].code.replace('Exam-', '')
+            }).then(
+                res => {
+                    setTimeout(() => {
+                        this.$Message.success(this.$t('learnActivity.mgtScEv.mockOk'))
+                    }, 500)
+                },
+                err => {
+                    this.$Message.error(this.$t('learnActivity.mgtScEv.mockErr'))
+                }
+            ).finally(() => {
+                setTimeout(() => {
+                    this.scoreLoading = false
+                    this.reload()
+                }, 500)
+            })
+        },
+        // 模拟学生作答数据
+        mockAnswer() {
+            this.answerLoading = true
+            this.$api.learnActivity.mockAnswer({
+                id: this.evaListShow[this.curEvaIndex].id,
+                code: this.evaListShow[this.curEvaIndex].code.replace('Exam-', '')
+            }).then(
+                res => {
+                    setTimeout(() => {
+                        this.$Message.success(this.$t('learnActivity.mgtScEv.mockOk'))
+                    }, 500)
+                },
+                err => {
+                    this.$Message.error(this.$t('learnActivity.mgtScEv.mockErr'))
+                }
+            ).finally(() => {
+                setTimeout(() => {
+                    this.answerLoading = false
+                    this.reload()
+                }, 500)
+            })
+        },
         handleEnd(index) {
         handleEnd(index) {
             this.$Modal.confirm({
             this.$Modal.confirm({
                 title: this.$t('learnActivity.mgtScEv.stopTitle'),
                 title: this.$t('learnActivity.mgtScEv.stopTitle'),
@@ -297,10 +353,16 @@ export default {
                 async res => {
                 async res => {
                     if (!res.error) {
                     if (!res.error) {
                         let resData = res.examInfo[0]
                         let resData = res.examInfo[0]
+                        resData.score = 0
                         for (let index in resData.papers) {
                         for (let index in resData.papers) {
-                            resData.papers[index].scope = resData.scope
-                            resData.papers[index].examId = resData.id
-                            resData.papers[index] = await this.$evTools.getFullPaper(resData.papers[index])
+                            resData.score += resData.papers[index].point.reduce((total, item) => {
+                                return total + parseInt(item)
+                            }, 0)
+                            if (resData.papers[index].blob) {
+                                resData.papers[index].scope = resData.scope
+                                resData.papers[index].examId = resData.id
+                                resData.papers[index] = await this.$evTools.getFullPaper(resData.papers[index])
+                            }
                         }
                         }
                         this.evaListShow.splice(this.curEvaIndex, 1, resData)
                         this.evaListShow.splice(this.curEvaIndex, 1, resData)
                         this.examDetaiInfo = resData
                         this.examDetaiInfo = resData

+ 2 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/Scoring.vue

@@ -259,8 +259,8 @@ export default {
             if (!this.chooseClass) return;
             if (!this.chooseClass) return;
             let requestData = {
             let requestData = {
                 id: this.chooseClass,
                 id: this.chooseClass,
-                scope: this.routerScope,
-                school_code: this.routerScope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
+                scope: this.examInfo.scope == 'private' ? 'private' : 'school',
+                school_code: this.examInfo.scope == 'private' ? this.$store.state.userInfo.TEAMModelId : this.$store.state.userInfo.schoolCode,
             };
             };
             this.$api.schoolSetting.getClassroomStudent(requestData).then((res) => {
             this.$api.schoolSetting.getClassroomStudent(requestData).then((res) => {
                 if (!res.error) {
                 if (!res.error) {

+ 36 - 20
TEAMModelOS/ClientApp/src/view/learnactivity/SimpleAnalysis.vue

@@ -78,6 +78,14 @@
                 </span>
                 </span>
             </div>
             </div>
         </div>
         </div>
+        <div v-show="calculating">
+            <p style="text-align: center;color: white;margin: 20px 0px;">
+                成绩数据结算中,
+                <span style="text-decoration: underline;color: #1cc0f3;cursor: pointer;" @click="reload()">
+                    点此刷新
+                </span>
+            </p>
+        </div>
     </div>
     </div>
 </template>
 </template>
 <script>
 <script>
@@ -88,6 +96,7 @@ export default {
         AvgCompare,
         AvgCompare,
         ScoreMatrix
         ScoreMatrix
     },
     },
+    inject: ['reload'],
     props: {
     props: {
         examInfo: {
         examInfo: {
             default: () => {
             default: () => {
@@ -114,7 +123,8 @@ export default {
     data() {
     data() {
         return {
         return {
             simpleData: {},
             simpleData: {},
-            allData: {}
+            allData: {},
+            calculating: false
         }
         }
     },
     },
     methods: {
     methods: {
@@ -127,20 +137,26 @@ export default {
             this.$api.learnActivity.simpleAna(requestData).then(
             this.$api.learnActivity.simpleAna(requestData).then(
                 res => {
                 res => {
                     if (!res.error) {
                     if (!res.error) {
-                        for (let i in res.averageMap) {
-                            for (let j in res.averageMap[i].ClassAverage) {
-                                res.averageMap[i].ClassAverage[j] = parseFloat(res.averageMap[i].ClassAverage[j].toFixed(2))
-                            }
-                            let subject = this.examInfo.papers.find(item=>{
-                                return item.subjectId == res.averageMap[i].subjectId
-                            })
-                            if(subject){
-                                res.averageMap[i].subjectId = subject.subjectName
+                        if (res.averageMap.length && res.averageMap.length) {
+                            this.calculating = false
+                            for (let i in res.averageMap) {
+                                for (let j in res.averageMap[i].ClassAverage) {
+                                    res.averageMap[i].ClassAverage[j] = parseFloat(res.averageMap[i].ClassAverage[j].toFixed(2))
+                                }
+                                let subject = this.examInfo.papers.find(item => {
+                                    return item.subjectId == res.averageMap[i].subjectId
+                                })
+                                if (subject) {
+                                    res.averageMap[i].subjectId = subject.subjectName
+                                }
                             }
                             }
+                            this.allData[this.examInfo.id] = res
+                            this.simpleData = res
+                        } else {
+                            this.calculating = true
+                            this.$Message.error('数据结算中,请稍后查看')
                         }
                         }
 
 
-                        this.allData[this.examInfo.id] = res
-                        this.simpleData = res
                     } else {
                     } else {
                         this.$Message.error('API ERROR!')
                         this.$Message.error('API ERROR!')
                     }
                     }
@@ -156,7 +172,7 @@ export default {
     watch: {
     watch: {
         examInfo: {
         examInfo: {
             handler() {
             handler() {
-                console.log('评测信息:',this.examInfo)
+                console.log('评测信息:', this.examInfo)
                 if (this.examInfo.progress == 'finish') {
                 if (this.examInfo.progress == 'finish') {
                     if (this.allData[this.examInfo.id]) {
                     if (this.allData[this.examInfo.id]) {
                         this.simpleData = this.allData[this.examInfo.id]
                         this.simpleData = this.allData[this.examInfo.id]
@@ -206,23 +222,23 @@ export default {
             }
             }
         },
         },
         scoreSegment() {
         scoreSegment() {
-            if (this.examScore > 0 && this.stuTotalScores.length) {
+            if (this.stuTotalScores.length) {
                 let segment = []
                 let segment = []
-                let max = Math.max(...this.stuTotalScores)
                 let unit = this.examScore / 10
                 let unit = this.examScore / 10
-                for(let i = 0; i < 10; i++){
+                console.log('unit', unit)
+                for (let i = 0; i < 10; i++) {
                     let startScore = unit * i
                     let startScore = unit * i
                     let endScore = unit * (i + 1)
                     let endScore = unit * (i + 1)
-                    let s = this.stuTotalScores.filter(item=>{
+                    let s = this.stuTotalScores.filter(item => {
                         return item >= startScore && item < endScore
                         return item >= startScore && item < endScore
                     })
                     })
                     segment.push({
                     segment.push({
-                        name:`${startScore}-${endScore}`,
-                        value:s.length
+                        name: `${startScore}-${endScore}`,
+                        value: s.length
                     })
                     })
                 }
                 }
                 return segment
                 return segment
-            }else{
+            } else {
                 return []
                 return []
             }
             }
 
 

+ 1 - 0
TEAMModelOS/ClientApp/src/view/learnactivity/echarts/ScoreMatrix.vue

@@ -92,6 +92,7 @@ export default {
     watch: {
     watch: {
         pieData: {
         pieData: {
             handler(n, o) {
             handler(n, o) {
+                console.log('新的',this.pieData)
                 this.$nextTick(() => {
                 this.$nextTick(() => {
                     if (!this.progressPie) {
                     if (!this.progressPie) {
                         this.progressPie = this.$echarts.init(document.getElementById('ev-score-matrix'))
                         this.progressPie = this.$echarts.init(document.getElementById('ev-score-matrix'))

+ 1 - 1
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -73,7 +73,7 @@ namespace TEAMModelOS.Controllers
                     int count = 0;
                     int count = 0;
                     for (int i = 0; i < request.targetClassIds.Count; i++)
                     for (int i = 0; i < request.targetClassIds.Count; i++)
                     {
                     {
-                        if (request.scope.Equals("private"))
+                        if (request.scope.Equals("private") || request.scope.Equals("teacher"))
                         {
                         {
                              var sresponse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(request.targetClassIds[i], new PartitionKey($"Class-{code}"));
                              var sresponse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(request.targetClassIds[i], new PartitionKey($"Class-{code}"));
                             if (sresponse.Status == 200)
                             if (sresponse.Status == 200)