Parcourir la source

答题卡小题显示分数时同时显示对错

liurongli il y a 5 mois
Parent
commit
7f627e54f0

+ 22 - 6
src/components/PaperImage.vue

@@ -75,6 +75,10 @@ export default {
     scoreFontSize:{
       type:Number,
       default:50
+    },
+    rtOrWrSize:{
+      type:Number,
+      default:2
     }
   },
   computed:{
@@ -667,14 +671,14 @@ export default {
               ctx.strokeStyle = ctx.fillStyle; // 使用与文字相同的颜色
               ctx.lineWidth = 4;
               ctx.stroke();
-              if(item.displayType === 0 || item.displayType === 2){
+              if(item.displayType === 0 || item.displayType === 2){//0-分数 1-对错 2-等级
                 ctx.fillText(item.displayName,obj.x+35*this.zoomRate*this.scale,obj.y);
               }else{
                 //判断是什么类型 scoreType 分数类型1:全对 2:半对 3: 全错
                 const iconX=obj.x +35*this.zoomRate*this.scale;
-                const iconY=obj.y-fontSize*this.zoomRate*this.scale;
-                const iconWidth = 2 * fontSize*this.zoomRate*this.scale; 
-                const iconHeight = 2 * fontSize*this.zoomRate*this.scale;
+                const iconY=obj.y-this.rtOrWrSize*fontSize*this.zoomRate*this.scale;
+                const iconWidth = this.rtOrWrSize * fontSize*this.zoomRate*this.scale; 
+                const iconHeight = this.rtOrWrSize * fontSize*this.zoomRate*this.scale;
                 if(item.correctType==0){
                   //0 分全错
                   ctx.drawImage(this.CacheAllWrong, iconX, iconY, iconWidth, iconHeight);
@@ -705,15 +709,27 @@ export default {
               if(item.displayType === 2){
                 ctx.fillText(item.displayName,obj.x+35*this.zoomRate*this.scale,obj.y);
               }else{
-                if(item.correctType==0){
+                if(item.correctType===0){
                   //0 分全错
                   ctx.drawImage(this.CacheAllWrong, iconX, iconY, iconWidth, iconHeight);
                 }else if(item.correctType==2){
                   //满分 全对
                   ctx.drawImage(this.CacheAllRight, iconX, iconY, iconWidth, iconHeight);
-                }else{
+                }else if(item.correctType==1){
                   //半对
                   ctx.drawImage(this.CacheHalfRight, iconX, iconY, iconWidth, iconHeight);
+                }else{
+                  const displayName = isNaN(item.displayName)?0:Number(item.displayName);
+                  if(displayName==0){
+                    //0 分全错
+                    ctx.drawImage(this.CacheAllWrong, iconX, iconY, iconWidth, iconHeight);
+                  }else if(displayName==item.fullScore){
+                    //满分全对
+                    ctx.drawImage(this.CacheAllRight, iconX, iconY, iconWidth, iconHeight);
+                  }else{
+                    //半对
+                    ctx.drawImage(this.CacheHalfRight, iconX, iconY, iconWidth, iconHeight);
+                  }
                 }
                 if(item.displayType === 0){//0-分数 显示分数和对错
                   ctx.fillText(item.displayName,obj.x+35*this.zoomRate*this.scale,obj.y);

+ 1 - 1
src/views/analysisReport/studentPage/scrolReport/transcript_single.vue

@@ -131,7 +131,7 @@
       <div class="module_table">
         <div class="answer_sheet" v-if="answerCard.paperImageList.length">
           <div class="item" v-for="(item, index) in answerCard.paperImageList">
-            <PaperImage :imageIndex="index" :scoreFontSize="20" :paperImgUrl="item.picUrl" :drawData="item.questionVOS || []"></PaperImage>
+            <PaperImage :imageIndex="index" v-if="item.picUrl" :scoreFontSize="20" :rtOrWrSize="10" :paperImgUrl="item.picUrl" :drawData="item.questionVOS || []"></PaperImage>
             <div class="item_hover">
               <div class="show_view" @click="OpenStudentPaper(index)">
                 <img src="@/assets/icon/pic_show_view.png" />