소스 검색

调整艺术评测学生端页面加载

XW 5 달 전
부모
커밋
34820b7656
1개의 변경된 파일76개의 추가작업 그리고 58개의 파일을 삭제
  1. 76 58
      TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/ArtTestReport.vue

+ 76 - 58
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/ArtTestReport.vue

@@ -1,14 +1,15 @@
 <template>
     <div class="art-paper-content">
-        <div v-show="isLoad">
+        <div v-show="isLoadQues">
             <Spin fix class="art-spin" style="background-color: rgba(0, 0, 0, 0.6); color: #07ac88; font-size: 20px;">
                 <i-circle :percent="quesProcess" stroke-color="#07ac88" trail-color="#fff" :size="120">
                     <span class="demo-Circle-inner" style="font-size: 30px">{{ quesProcess }}%</span>
                 </i-circle>
                 <div>试题载入中,请耐心等待</div>
+                <span style="font-size: 12px;color: #666 !important;">若长时间卡住,请 <a href="#" @click.prevent="handleLink()">刷新页面</a> 后重试 </span>
             </Spin>
         </div>
-        <!-- <Loading v-show="isLoad" bgColor="rgba(0, 0, 0, 0.3)"></Loading> -->
+        <Loading v-show="isLoad" bgColor="rgba(0, 0, 0, 0.3)"></Loading>
         <vuescroll>
             <EventBasicInfo :info="nowActive" />
             <div class="art-box">
@@ -23,26 +24,20 @@
                             </h2>
                         </div>
                         <div class="scoreboard">
-                            <div v-if="!item.paperInfo.length" style="padding: 25px;">
-                                <Icon type="md-alert" size="18" color="orange" class="warm-icon" style="margin-right: 5px;" />
-                                <span class="warm-hint">
-                                    试卷载入中,请耐心等待...
-                                </span>
-                            </div>
-                            <template v-else>
-                                <div v-show="item.testState === 1" @click="showTest(item)" style="width: 100%; font-size: 25px; font-weight: 800; padding: 17px;cursor: pointer;">
+                            <div v-show="item.testState === 1">
+                                <div @click="onLoadQues(item)" style="width: 100%; font-size: 25px; font-weight: 800; padding: 17px;cursor: pointer;">
                                     <Icon custom="iconfont icon-dianji" size="30" color="#03966a" />
                                     <span style="color: #03966a; margin-left: 10px;">{{ $t("studentWeb.exam.report.anwser") }}</span>
                                     <Icon custom="iconfont icon-weizuoda" size="50" style="margin-left: 50px;" />
                                 </div>
-                                <h4 v-show="item.testState === 2 || item.testState === 3" style="padding: 25px;">
-                                    <Icon type="md-checkmark-circle-outline" class="warm-icon" color="green" />
-                                    {{ $t("studentWeb.exam.report.noRes") }}
-                                    <!-- <Icon type="md-ribbon" size="50" color="#03966a" style="margin-left: 20px;" /> -->
-                                    <!-- <Icon type="md-thumbs-up" size="50" color="#03966a" style="margin-left: 20px;" /> -->
-                                    <Icon custom="iconfont icon-yiwancheng" size="50" color="#01adff" style="margin-left: 50px;" />
-                                </h4>
-                            </template>
+                            </div>
+                            <h4 v-show="item.testState === 2 || item.testState === 3" style="padding: 25px;">
+                                <Icon type="md-checkmark-circle-outline" class="warm-icon" color="green" />
+                                {{ $t("studentWeb.exam.report.noRes") }}
+                                <!-- <Icon type="md-ribbon" size="50" color="#03966a" style="margin-left: 20px;" /> -->
+                                <!-- <Icon type="md-thumbs-up" size="50" color="#03966a" style="margin-left: 20px;" /> -->
+                                <Icon custom="iconfont icon-yiwancheng" size="50" color="#01adff" style="margin-left: 50px;" />
+                            </h4>
                         </div>
                         <template v-if="item.homework.length">
                             <div v-for="(hw, index) in item.homework" :key="index">
@@ -87,6 +82,7 @@ export default {
     data () {
         return {
             isLoad: false,
+            isLoadQues: false,
             paperData: [], //试卷信息:学生作答记录、批注、知识点等
             artExam: [],
             artInfo: undefined, //艺术活动信息
@@ -252,9 +248,9 @@ export default {
                     this.artExam = subList
                     let listss = await this.getSubPaper()
                     console.log('试卷列表', listss);
-                    if(listss.length) {
+                    /* if(listss.length) {
                         let infos = await this.getPaper()
-                    }
+                    } */
                 }
             }).finally(() => {
                 this.isLoad = false
@@ -279,6 +275,7 @@ export default {
                             this.$api.studentWeb.FindStudentPaper(params).then(res => {
                                 if(res.status === 200) {
                                     if(res.papers.length) {
+                                        let date = (new Date()).getTime() //当前时间
                                         let blob = this.stusInfo.find(stu => {
                                             return stu.subject === res.subjects[0].id
                                         })
@@ -300,7 +297,7 @@ export default {
                                                 console.log(res.stuAns, i, res.stuAns[i]);
                                                 if (!res.stuAns[i].length) {
                                                     item.examInfo[i].stuAns = []
-                                                    item.examInfo[i].stuScore = []
+                                                    item.examInfo[i].stuScore = Array(item.examInfo[i].point.length).fill(-1)
                                                 } else {
                                                     item.examInfo[i].stuAns = res.stuAns[i]
                                                     // 批注
@@ -309,9 +306,17 @@ export default {
                                                 }
                                             } else {
                                                 item.examInfo[i].stuAns = []
-                                                item.examInfo[i].stuScore = []
+                                                item.examInfo[i].stuScore = Array(item.examInfo[i].point.length).fill(-1)
                                             }
                                             item.examInfo[i].taskStatus = item.exam[0].taskStatus
+                                            
+                                            let k = 0
+                                            for (let score of item.examInfo[i].stuScore) {
+                                                if (score == -1) {   //有未打分
+                                                    k++
+                                                }
+                                            }
+                                            item.testState = k ? (item.examInfo[i].stuAns ? (this.artInfo.examDeadline && this.artInfo.examDeadline < date) ? 2 : 1 : 2) : 3
                                         }
                                         r(true)
                                     } else {
@@ -337,52 +342,62 @@ export default {
                 })
             })
         },
+        async onLoadQues(art) {
+            // this.artQuesTotal = 0
+            this.processNum = 0
+            this.isLoadQues = true
+            let infos = await this.getPaper(art.subject.id)
+            // this.isLoadQues = false
+            this.showTest(art)
+        },
         // 获取试卷信息
-        getPaper() {
+        getPaper(type) {
             return new Promise((resolve, reject) => {
                 let date = (new Date()).getTime() //当前时间
                 let promiseArr = []
                 this.artExam.forEach(item => {
-                    promiseArr.push(new Promise(async (r, j) => {
-                        let codes = this.getItemTitle.scope == 'school' ? this.getItemTitle.school : this.getItemTitle.creatorId
-                        if(item.examInfo[0]?.blob) {
-                            let code = {
-                                scope: this.getItemTitle.scope,
-                                code: codes,
-                                blob: item.examInfo[0].blob,
-                                examId: codes
-                            }
-                            try {
-                                item.paperInfo.push(await this.getStuPaper(code))
-                            } catch (error) {
-                                this.$Message.error(this.$t("studentWeb.exam.examError"))
-                                this.isLoad = false
-                                r(undefined)
-                            }
-                            if(item.examInfo[0].stuScore != undefined) {
-                                if (item.examInfo[0].stuScore[0] == undefined) {
-                                    let score = []
-                                    for (let info of item.paperInfo[0].slides) {
-                                        if (info.type !== 'compose') {
-                                            score.push(-1)
+                    if(type === item.subject.id) {
+                        promiseArr.push(new Promise(async (r, j) => {
+                            let codes = this.getItemTitle.scope == 'school' ? this.getItemTitle.school : this.getItemTitle.creatorId
+                            if(item.examInfo[0]?.blob) {
+                                let code = {
+                                    scope: this.getItemTitle.scope,
+                                    code: codes,
+                                    blob: item.examInfo[0].blob,
+                                    examId: codes
+                                }
+                                try {
+                                    item.paperInfo.push(await this.getStuPaper(code))
+                                } catch (error) {
+                                    this.$Message.error(this.$t("studentWeb.exam.examError"))
+                                    this.isLoad = false
+                                    r(undefined)
+                                }
+                                if(item.examInfo[0].stuScore != undefined) {
+                                    if (item.examInfo[0].stuScore[0] == undefined) {
+                                        let score = []
+                                        for (let info of item.paperInfo[0].slides) {
+                                            if (info.type !== 'compose') {
+                                                score.push(-1)
+                                            }
                                         }
+                                        item.examInfo[0].stuScore = score
                                     }
-                                    item.examInfo[0].stuScore = score
                                 }
-                            }
-                            let k = 0
-                            for (let score of item.examInfo[0].stuScore) {
-                                if (score == -1) {   //有未打分
-                                    k++
+                                let k = 0
+                                for (let score of item.examInfo[0].stuScore) {
+                                    if (score == -1) {   //有未打分
+                                        k++
+                                    }
                                 }
+                                item.testState = k ? (item.examInfo[0].stuAns ? (this.artInfo.examDeadline && this.artInfo.examDeadline < date) ? 2 : 1 : 2) : 3
+                                console.error('试卷信息', item.paperInfo)
+                                r(true)
+                            } else {
+                                r(undefined)
                             }
-                            item.testState = k ? (item.examInfo[0].stuAns ? (this.artInfo.examDeadline && this.artInfo.examDeadline < date) ? 2 : 1 : 2) : 3
-                            console.error('试卷信息', item.paperInfo)
-                            r(true)
-                        } else {
-                            r(undefined)
-                        }
-                    }))
+                        }))
+                    }
                 })
                 Promise.allSettled(promiseArr).then(result => {
                     console.log('Promise', result);
@@ -518,6 +533,9 @@ export default {
             this.previewFile = item
             this.previewStatus = true
         },
+        handleLink() {
+            window.location.reload()
+        },
     }
 }
 </script>