zhangjie 4 jaren geleden
bovenliggende
commit
0cea317553

+ 3 - 0
src/assets/styles/common-component.less

@@ -266,6 +266,9 @@
   .ivu-upload {
     display: inline-block;
   }
+  > p[class^="cc-tips"] {
+    margin-top: 10px;
+  }
 }
 
 // rich-editor

+ 15 - 8
src/components/PaperCarousel.vue

@@ -3,7 +3,7 @@
     <div class="carousel-body image-view-contain">
       <img
         :src="curPaper.thumbSrc"
-        :alt="curPaper.title"
+        :alt="curPaper.sn"
         v-if="curPaper.thumbSrc"
         @click="clickHandle"
       />
@@ -57,15 +57,22 @@ export default {
   },
   methods: {
     initIndex() {
-      this.curIndex = 0;
-      if (this.papers.length) {
-        this.setCurPaper(0);
-      } else {
-        this.curPaper = {};
-      }
+      this.setCurPaper(0);
+    },
+    updateIndex() {
+      this.setCurPaper(this.curIndex);
     },
     setCurPaper(index) {
-      this.curPaper = this.papers[index];
+      let nindex = index;
+      if (!this.papers.length) {
+        nindex = 0;
+      } else if (index > this.papers.length - 1) {
+        nindex = this.papers.length - 1;
+      } else if (index < 0) {
+        nindex = 0;
+      }
+      this.curIndex = nindex;
+      this.curPaper = this.papers[nindex] ? { ...this.papers[nindex] } : {};
       this.$emit("on-paper-change", this.curPaper);
     },
     handleLeft() {

+ 4 - 0
src/components/UploadButton.vue

@@ -127,6 +127,10 @@ export default {
       this.uploadDataDict = { ...this.uploadData, md5 };
       if (this.addFilenameParam)
         this.uploadDataDict[this.addFilenameParam] = file.name;
+      this.res = {
+        success: true,
+        msg: ""
+      };
       this.$emit("file-change", file);
 
       if (!this.autoUpload) {

+ 2 - 1
src/modules/grading/GradingDetail.vue

@@ -71,6 +71,7 @@
             :question-id="filter.questionId"
             @on-paper-click="toViewCarouselPaper"
             v-if="levels.length && filter.questionId"
+            ref="GradeStandardPaper"
           ></grade-standard-paper>
           <grade-history-paper
             :question-id="filter.questionId"
@@ -476,7 +477,7 @@ export default {
     },
     leaderGradingSuccess(datas, paper) {
       if (datas.action === "sampling") {
-        // TODO:设定标准卷之后
+        this.$refs.GradeStandardPaper.updateLevelPapers(datas.level);
       }
       this.getStepLevels();
       this.updateHistory();

+ 1 - 1
src/modules/grading/components/GradeHistoryPaper.vue

@@ -60,7 +60,7 @@ export default {
 
       this.papers = await actionHistory(datas);
       this.$nextTick(() => {
-        this.$refs.PaperCarousel.initIndex();
+        this.$refs.PaperCarousel.updateIndex();
       });
     },
     setCurPaper(paper) {

+ 21 - 2
src/modules/grading/components/GradeStandardPaper.vue

@@ -107,11 +107,30 @@ export default {
       this.papers = data.data;
       this.paperMap[this.curLevel] = data.data;
     },
-    prevLevel() {
+    async updateLevelPapers(level) {
+      const datas = {
+        questionId: this.questionId,
+        level: this.curLevel,
+        sort: "secretNumber",
+        isSample: true,
+        page: 0,
+        size: 100
+      };
+      const data = await paperList(datas).catch(() => {});
+      this.isLoading = false;
+      if (!data) return;
+      this.paperMap[this.curLevel] = data.data;
+      if (this.curLevel === level) {
+        this.papers = data.data;
+        this.$refs.PaperCarousel.updateIndex();
+      }
+    },
+    async prevLevel() {
       if (this.isFirstLevel) return;
       this.curLevelIndex--;
       this.setCurLevel(this.curLevelIndex);
-      this.updatePapers();
+      await this.getPapers();
+      this.$refs.PaperCarousel.setCurPaper(this.papers.length - 1);
     },
     nextLevel() {
       if (this.isLastLevel) return;