Browse Source

试卷管理新增标记

zhangjie 3 years ago
parent
commit
22abe74dcf

+ 3 - 0
src/api.js

@@ -66,6 +66,9 @@ export const rotatePaper = (imageId, degree) => {
 export const absentPaper = imageId => {
 export const absentPaper = imageId => {
   return $post(`/api/score/missing/${imageId}`, {});
   return $post(`/api/score/missing/${imageId}`, {});
 };
 };
+export const markPaper = ({ paperId, isMark }) => {
+  return $post(`/api/papers/mark_paper`, { paperId, isMark });
+};
 
 
 // client-monitor
 // client-monitor
 export const clientMonitorList = datas => {
 export const clientMonitorList = datas => {

+ 12 - 12
src/assets/styles/main.less

@@ -316,19 +316,19 @@
     bottom: 0;
     bottom: 0;
     height: 52px;
     height: 52px;
     padding: 10px;
     padding: 10px;
-    .ivu-btn[class^="view-action"] {
-      position: absolute;
-      top: 10px;
-      left: 50%;
-    }
-    .view-action-save {
-      margin-left: -78px;
-    }
-    .view-action-rotate {
-      margin-left: -16px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+
+    .view-action-mark {
+      .ivu-icon {
+        color: @dark-color-lighter;
+      }
     }
     }
-    .view-action-absent {
-      margin-left: 26px;
+    .mark-act {
+      .ivu-icon {
+        color: @warning-color;
+      }
     }
     }
   }
   }
   &-multibar {
   &-multibar {

+ 1 - 0
src/assets/styles/variables.less

@@ -11,6 +11,7 @@
 
 
 @purple-color: #6d32f9;
 @purple-color: #6d32f9;
 @brown-color: #dd7755;
 @brown-color: #dd7755;
+@warning-color: #ff9900;
 
 
 @dark-color: #353d57;
 @dark-color: #353d57;
 @dark-color-light: #7c86a3;
 @dark-color-light: #7c86a3;

+ 21 - 20
src/modules/main/PaperManage.vue

@@ -150,7 +150,8 @@ export default {
         scanUserId: "",
         scanUserId: "",
         isManual: null,
         isManual: null,
         missing: null,
         missing: null,
-        isRelate: null
+        isRelate: null,
+        isMark: null
       },
       },
       SORT_RULE_TYPE,
       SORT_RULE_TYPE,
       CAFA_EXCEPTION_TYPE: {},
       CAFA_EXCEPTION_TYPE: {},
@@ -170,11 +171,17 @@ export default {
   },
   },
   computed: {
   computed: {
     actions() {
     actions() {
-      return this.confirmPaperType === "1" ? [] : ["rotate", "absent"];
+      return this.confirmPaperType === "1"
+        ? ["mark"]
+        : ["rotate", "absent", "mark"];
     }
     }
   },
   },
   mounted() {
   mounted() {
-    this.CAFA_EXCEPTION_TYPE = { ...CAFA_EXCEPTION_TYPE, 9: "全部" };
+    this.CAFA_EXCEPTION_TYPE = {
+      ...CAFA_EXCEPTION_TYPE,
+      8: "已标记",
+      9: "全部"
+    };
     this.initData();
     this.initData();
   },
   },
   methods: {
   methods: {
@@ -204,10 +211,12 @@ export default {
           : paper.examNumber;
           : paper.examNumber;
         return {
         return {
           id: paper.id,
           id: paper.id,
+          key: this.$randomCode(),
           title,
           title,
           imgSrc: paper.imgSrc,
           imgSrc: paper.imgSrc,
           thumbSrc: paper.thumbSrc,
           thumbSrc: paper.thumbSrc,
           missing: paper.missing,
           missing: paper.missing,
+          isMark: paper.isMark,
           stage: paper.stage,
           stage: paper.stage,
           styles: {},
           styles: {},
           deg: 0
           deg: 0
@@ -256,23 +265,15 @@ export default {
       this.scanUsers = data.data;
       this.scanUsers = data.data;
     },
     },
     typeChange() {
     typeChange() {
-      if (this.paperType === "2") {
-        this.filter.isManual = null;
-        this.filter.missing = null;
-        this.filter.isRelate = true;
-      } else if (this.paperType === "1") {
-        this.filter.isManual = true;
-        this.filter.missing = null;
-        this.filter.isRelate = null;
-      } else if (this.paperType === "0") {
-        this.filter.isManual = null;
-        this.filter.missing = true;
-        this.filter.isRelate = null;
-      } else {
-        this.filter.isManual = null;
-        this.filter.missing = null;
-        this.filter.isRelate = null;
-      }
+      const typeToField = {
+        0: "missing",
+        1: "isManual",
+        2: "isRelate",
+        8: "isMark"
+      };
+      Object.values(typeToField).forEach(val => {
+        this.filter[val] = typeToField[this.paperType] === val ? true : null;
+      });
     },
     },
     // paper view
     // paper view
     toReview(index) {
     toReview(index) {

+ 1 - 0
src/modules/main/StudentScore.vue

@@ -218,6 +218,7 @@ export default {
       data.map(student => {
       data.map(student => {
         student.scores.map(score => {
         student.scores.map(score => {
           score.title = score.subjectName;
           score.title = score.subjectName;
+          score.key = this.$randomCode();
         });
         });
       });
       });
       this.students = data;
       this.students = data;

+ 48 - 26
src/modules/main/components/ImageActionList.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
   <div :class="classes">
   <div :class="classes">
-    <div class="image-view" v-for="(image, index) in data" :key="image.id">
+    <div class="image-view" v-for="(image, index) in data" :key="image.key">
       <div class="image-view-container">
       <div class="image-view-container">
         <h5 class="image-view-title">{{ image.title }}</h5>
         <h5 class="image-view-title">{{ image.title }}</h5>
         <image-view-contain
         <image-view-contain
@@ -18,30 +18,42 @@
           />
           />
         </div>
         </div>
         <div class="image-view-actions" v-if="actions.length">
         <div class="image-view-actions" v-if="actions.length">
-          <Button
-            class="view-action-save"
-            size="small"
-            type="primary"
-            @click="toSaveRotate(image)"
-            :disabled="saving"
-            v-if="canRotate && image['stepDeg']"
-            >保存</Button
-          >
-          <Button
-            class="view-action-rotate"
-            size="small"
-            icon="md-refresh"
-            @click="toRotate(image)"
-            v-if="canRotate"
-          ></Button>
-          <Button
-            class="view-action-absent"
-            :type="image.missing ? 'error' : 'default'"
-            size="small"
-            @click="toSignAbsent(image)"
-            v-if="canAbsent"
-            >缺考</Button
-          >
+          <div>
+            <Button
+              class="view-action-rotate"
+              size="small"
+              icon="md-refresh"
+              @click="toRotate(image)"
+              v-if="canRotate"
+            ></Button>
+            <Button
+              class="view-action-save"
+              size="small"
+              type="primary"
+              @click="toSaveRotate(image)"
+              :disabled="saving"
+              v-if="canRotate && image['stepDeg']"
+              >保存</Button
+            >
+          </div>
+          <div>
+            <Button
+              class="view-action-absent"
+              :type="image.missing ? 'error' : 'default'"
+              size="small"
+              @click="toSignAbsent(image)"
+              v-if="canAbsent"
+              >缺考</Button
+            >
+            <Button
+              v-if="canMark"
+              :class="['view-action-mark', { 'mark-act': image.isMark }]"
+              :type="image.missing ? 'error' : 'default'"
+              size="small"
+              icon="md-bookmark"
+              @click="toMark(image)"
+            ></Button>
+          </div>
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
@@ -49,7 +61,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { rotatePaper, absentPaper } from "@/api";
+import { rotatePaper, absentPaper, markPaper } from "@/api";
 import ImageViewContain from "../../../components/ImageViewContain";
 import ImageViewContain from "../../../components/ImageViewContain";
 
 
 export default {
 export default {
@@ -93,6 +105,9 @@ export default {
     },
     },
     canAbsent() {
     canAbsent() {
       return this.actions.includes("absent");
       return this.actions.includes("absent");
+    },
+    canMark() {
+      return this.actions.includes("mark");
     }
     }
   },
   },
   methods: {
   methods: {
@@ -126,6 +141,13 @@ export default {
       await absentPaper(image.id);
       await absentPaper(image.id);
       image.missing = !image.missing;
       image.missing = !image.missing;
     },
     },
+    async toMark(image) {
+      await markPaper({
+        paperId: image.id,
+        isMark: !image.isMark
+      });
+      image.isMark = !image.isMark;
+    },
     toReview(index) {
     toReview(index) {
       this.$emit("on-review", index);
       this.$emit("on-review", index);
     }
     }

+ 1 - 0
src/modules/quality/Quality.vue

@@ -226,6 +226,7 @@ export default {
       this.papers = data.data.map(paper => {
       this.papers = data.data.map(paper => {
         return {
         return {
           id: paper.id,
           id: paper.id,
+          key: this.$randomCode(),
           title: paper.examNumber,
           title: paper.examNumber,
           imgSrc: paper.imgSrc,
           imgSrc: paper.imgSrc,
           thumbSrc: paper.thumbSrc,
           thumbSrc: paper.thumbSrc,