Browse Source

bug修复(index计算错误、切换题目恢复比例、canvas滚动区域)

liqk 4 years ago
parent
commit
351c3f4ed6

+ 3 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/MgtSchoolEva.vue

@@ -127,7 +127,7 @@
                     </div>-->
 
                     <!-- 保存阅卷配置 -->
-                    <div style="float:right;" class="common-save-btn" v-show="curBarIndex == 2">
+                    <div style="float:right;" class="common-save-btn" v-show="curBarIndex == 2 && isSetting">
                         <Button class="mock-stu-answer" type="text" :loading="btnLoading" @click="saveMarkSetting" icon="ios-albums-outline">
                             {{$t('schoolBaseInfo.saveInfo')}}
                         </Button>
@@ -167,7 +167,7 @@
                             {{item.name}}
                         </span>
                     </div> -->
-                    <MarkSetting ref="markSetting" v-if="evaListShow[curEvaIndex]" :evInfo="evaListShow[curEvaIndex]"></MarkSetting>
+                    <MarkSetting ref="markSetting" v-if="evaListShow[curEvaIndex]" :evInfo="evaListShow[curEvaIndex]" v-model="isSetting"></MarkSetting>
                 </div>
                 <!-- 阅卷数据 -->
                 <div :class="curBarIndex == 3 ? 'animated fadeIn evaluation-base-info':'evaluation-base-info animated fadeOutRight'" v-show="curBarIndex == 3">
@@ -189,6 +189,7 @@ export default {
     inject: ['reload'],
     data() {
         return {
+            isSetting:false,
             btnLoading: false,
             keyword: '',
             isSearch: false,

+ 14 - 1
TEAMModelOS/ClientApp/src/view/learnactivity/markpaper/MarkSetting.vue

@@ -152,6 +152,10 @@ import ScanProgress from '../echarts/ScanProgress.vue'
 import CptCount from '../echarts/CptCount.vue'
 import PersonalPhoto from "@/components/public/personalPhoto/Index.vue"
 export default {
+    model: {
+        prop: 'isShow',
+        event: 'statusChange'
+    },
     props: {
         evInfo: {
             type: Object,
@@ -161,7 +165,8 @@ export default {
                     name: ''
                 }
             }
-        }
+        },
+        isShow: Boolean //父组件是否显示保存按钮 对应isSetting的值
     },
     data() {
         let _this = this
@@ -430,6 +435,7 @@ export default {
                 res => {
                     if (res.correct) {
                         this.setting = res.correct
+                        this.isSetting = true
                     } else {
                         this.isSetting = false
                         if (this.evInfo.subjects) {
@@ -486,6 +492,13 @@ export default {
 
             },
             deep: true
+        },
+        isSetting: {
+            handler(n, o) {
+                console.log('watch', n, o)
+                this.$emit('statusChange', this.isSetting)
+            },
+            immediate: true
         }
     },
     computed: {

+ 1 - 2
TEAMModelOS/ClientApp/src/view/task/index.vue

@@ -347,12 +347,10 @@ export default {
                 sId = stuId
             } else {
                 let resData = await this.getNextStu()
-                console.log('API返回了', resData)
                 answer = resData.ans.ans ? JSON.parse(await this.$tools.getFile(`${blobUrl}/exam/${resData.ans.ans}?${sas}`)) : []
                 score = resData.ans.score
                 sId = resData.stuId
             }
-            console.log('跳转了')
             this.$router.push({
                 name: 'ByStu',
                 params: {
@@ -482,6 +480,7 @@ export default {
         selectTask(index) {
             this.curTaskIndex = index
             sessionStorage.setItem('markIndex', index)
+            this.findTaskData()
         },
 
     },

+ 22 - 9
TEAMModelOS/ClientApp/src/view/task/mark/ByQu.vue

@@ -193,15 +193,26 @@ export default {
          * childIndex 小题index 非必传 
          */
         getScoreIndex(index, childIndex) {
-            let realIndex = index
+            let realIndex = 0
             this.paperData.item.forEach((item, itemIndex) => {
-                if (itemIndex < index && item.children.length) {
-                    realIndex += item.children.length
-                } else if (itemIndex == index && item.children.length) {
-                    realIndex += childIndex
+                if(itemIndex <= index){
+                    //综合题
+                    if(item.children.length){
+                        item.children.forEach((childItem,cIndex)=>{
+                            if(itemIndex < index){
+                                realIndex++
+                            }else if(cIndex <= childIndex){
+                                realIndex++
+                            }
+                        })
+                    }
+                    else{
+                        realIndex++
+                    }
                 }
             })
-            return realIndex
+            console.log('输出',realIndex)
+            return --realIndex
         },
         //获取批阅学生数据
         getDefStu() {
@@ -239,7 +250,6 @@ export default {
             }
             this.$api.mark.FindNextStu(requestData).then(
                 async res => {
-                    console.log(res)
                     let sas = this.$store.state.user.schoolProfile.blob_sas //目前只有校本评测安排阅卷任务
                     let blobUrl = JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8")).blob_uri //目前只有校本评测安排阅卷任务
                     this.stusInfo.push({
@@ -282,8 +292,8 @@ export default {
     computed: {
         curAnswer() {
             if (this.stusInfo && this.stusInfo[this.stuIndex]) {
-                if (this.stusInfo[this.stuIndex].ans) {
-                    return this.stusInfo[this.stuIndex].answer[this.getScoreIndex(this.quIndex, this.childIndex)]
+                if (this.stusInfo[this.stuIndex].info.ans) {
+                    return this.stusInfo[this.stuIndex].info.answer[this.getScoreIndex(this.quIndex, this.childIndex)]
                 } else {
                     return this.stusInfo[this.stuIndex].stuId + '未作答'
                 }
@@ -307,6 +317,9 @@ export default {
 }
 </script>
 <style scoped lang="less">
+#container {
+    max-width: 100%;
+}
 .score-setting-wrap {
     margin-top: 50px;
     padding: 0px 5px;

+ 31 - 26
TEAMModelOS/ClientApp/src/view/task/mark/ByStu.vue

@@ -53,7 +53,7 @@
                 <!-- <Icon :custom="isFull ? 'iconfont icon-cancel-full' : 'iconfont icon-full-screen'" class="tool-icon" :title="isFull ? '取消全屏' : '全屏'" @click="togglefull" /> -->
             </div>
             <div class="mark-stage">
-                <MarkCanvas :mouseStatus="mouseStatus" :bgImg="ansImg" :drawImgData="drawImgData"></MarkCanvas>
+                <MarkCanvas :mouseStatus="mouseStatus" :bgImg="ansImg" :drawImgData="drawImgData" style="padding-bottom:85px"></MarkCanvas>
                 <!-- 题号显示部分 -->
                 <div class="qu-index-box">
                     <div class="qu-tips-box">
@@ -91,9 +91,11 @@
                     <Button size="small" type="error" ghost @click="score = 0">零分</Button>
                     <Icon :type="isShowNum ? 'md-eye-off' : 'md-eye'" class="toggle-num-status" @click="isShowNum = !isShowNum" />
                     <div :class="['score-key-box', isShowNum ? '':'hind-key-box']">
-                        <span v-for="(item,index) in quScoreArr" :key="index" :class="['score-key', stuScore[getScoreIndex(quIndex,childIndex)] == index ? 'score-key-active':'']" @click="setScore(index)">
-                            {{item}}
-                        </span>
+                        <vuescroll>
+                            <span v-for="(item,index) in quScoreArr" :key="index" :class="['score-key', stuScore[getScoreIndex(quIndex,childIndex)] == index ? 'score-key-active':'']" @click="setScore(index)">
+                                {{item}}
+                            </span>
+                        </vuescroll>
                     </div>
                 </div>
                 <Button type="success" class="submit-score" @click="submit()">提交分数</Button>
@@ -174,7 +176,7 @@ export default {
             let answerIframe = document.getElementById('markIframe')
             answerIframe.onload = () => {
                 answerIframe.style.width = '850px'
-                answerIframe.contentWindow.document.body.style.margin = '0px 20px'
+                // answerIframe.contentWindow.document.body.style.margin = '0px 20px'
                 answerIframe.contentWindow.document.body.style.padding = '10px'
                 answerIframe.contentWindow.document.body.style.minWidth = '600px'
                 answerIframe.contentWindow.document.body.style.minHeight = '240px'
@@ -183,12 +185,10 @@ export default {
                 let bodyWidth = answerIframe.contentWindow.document.body.clientWidth
                 answerIframe.style.width = (bodyWidth + 20) + 'px'
                 answerIframe.contentWindow.document.body.style.backgroundColor = '#f5f5f5'
-                console.log('markIframe', answerIframe)
                 html2canvas(answerIframe.contentWindow.document.body, {}).then((canvas) => {
                     canvas.id = "canvas" + this.getScoreIndex(this.quIndex, this.childIndex)
                     this.ansImg = canvas.toDataURL()
                     // 将转出来的答案绘制到canvas上
-                    console.log(this.ansImg)
                 })
             }
         },
@@ -200,25 +200,40 @@ export default {
         setScore(score) {
             this.score = score
             this.$set(this.stuScore, this.getScoreIndex(this.quIndex, this.childIndex), score)
+            if (this.autoQu) {
+                this.submit()
+            }
         },
         toQu(index, childIndex) {
             this.quIndex = index
             this.childIndex = childIndex
+            this.score = this.stuScore[this.getScoreIndex(this.quIndex, this.childIndex)] == -1 ? null : this.stuScore[this.getScoreIndex(this.quIndex, this.childIndex)]
         },
         /**
          * index 题目index 必传
          * childIndex 小题index 非必传 
          */
         getScoreIndex(index, childIndex) {
-            let realIndex = index
+            let realIndex = 0
             this.paperData.item.forEach((item, itemIndex) => {
-                if (itemIndex < index && item.children.length) {
-                    realIndex += item.children.length
-                } else if (itemIndex == index && item.children.length) {
-                    realIndex += childIndex
+                if (itemIndex <= index) {
+                    //综合题
+                    if (item.children.length) {
+                        item.children.forEach((childItem, cIndex) => {
+                            if (itemIndex < index) {
+                                realIndex++
+                            } else if (cIndex <= childIndex) {
+                                realIndex++
+                            }
+                        })
+                    }
+                    else {
+                        realIndex++
+                    }
                 }
             })
-            return realIndex
+            console.log('输出', realIndex)
+            return --realIndex
         },
         //提交分数
         submit() {
@@ -259,7 +274,7 @@ export default {
                     }
                     //当前小题是最后一个,需要判断下一个题目类型
                     //下一个题目是综合题
-                    if (this.paperData.item[this.quIndex + 1].children.length) {
+                    else if (this.childIndex == this.paperData.item[this.quIndex].children.length - 1 && this.paperData.item[this.quIndex + 1].children.length) {
                         this.quIndex++
                         this.childIndex = 0
                     }
@@ -330,7 +345,7 @@ export default {
                         })
                     } else {
                         this.$Message.success('已阅完')
-                        if(this.autoStu){
+                        if (this.autoStu) {
                             //TODE 随机获取下一位学生
                         }
                     }
@@ -355,11 +370,9 @@ export default {
     },
     mounted() {
         this.ansToImg()
-
     },
     created() {
         let routeData = this.$route.params
-        console.log('路由数据', routeData)
         this.paperData = routeData.fullPaper
         this.stuAnswer = routeData.answer
         this.stuScore = routeData.score
@@ -466,15 +479,7 @@ export default {
     margin: 10px;
     height: auto;
 }
-.container-box {
-    display: flex;
-    justify-content: center;
-    width: 100%;
-    padding: 10px;
-}
-#container {
-    max-width: 100%;
-}
+
 .qu-tips-box {
     & :nth-child(1)::before {
         background: #19be6b;

+ 9 - 0
TEAMModelOS/ClientApp/src/view/task/mark/MarkCanvas.vue

@@ -444,6 +444,11 @@ export default {
                 this.myScale()
             }
         },
+        //还原比例
+        restore() {
+            this.scaleDefault = 1
+            this.myScale()
+        },
         myScale() {
             this.stage.children.forEach(item => {
                 item.scale({
@@ -635,6 +640,7 @@ export default {
         bgImg: {
             handler(n, o) {
                 this.$nextTick(() => {
+                    // this.restore()
                     this.orgLayer.removeChildren()
                     this.markLayer.removeChildren()
                     let imageObj = new Image()
@@ -680,6 +686,9 @@ export default {
     width: 100%;
     padding: 10px;
 }
+#container {
+    max-width: 100%;
+}
 </style>
 <style>
 .textarea:focus {