|
@@ -112,31 +112,24 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- image-preview -->
|
|
|
- <image-preview
|
|
|
+ <simple-image-preview
|
|
|
class="grading-operation-image-preview"
|
|
|
- :image-list="papers"
|
|
|
- :init-index="curPaperIndex"
|
|
|
- @on-paper-change="selectPaper"
|
|
|
- @on-page-prev="prevPage"
|
|
|
- @on-page-next="nextPage"
|
|
|
+ :cur-image="curPaper"
|
|
|
+ @on-prev="toPrevPaper"
|
|
|
+ @on-next="toNextPaper"
|
|
|
@on-close="isFullscreenMarking = false"
|
|
|
- header-hide
|
|
|
- ref="ImagePreview"
|
|
|
- v-if="papers.length"
|
|
|
- ></image-preview>
|
|
|
+ ref="SimpleImagePreview"
|
|
|
+ ></simple-image-preview>
|
|
|
|
|
|
<!-- carousel paper review -->
|
|
|
- <image-preview
|
|
|
+ <simple-image-preview
|
|
|
class="grading-operation-image-preview"
|
|
|
- :image-list="carouselPapers"
|
|
|
- :init-index="curCarouselPaperIndex"
|
|
|
- @on-paper-change="selectCarouselPaper"
|
|
|
+ :cur-image="curPaper"
|
|
|
+ @on-prev="toCarousePaper('prev')"
|
|
|
+ @on-next="toCarousePaper('next')"
|
|
|
@on-close="carouseImagePreviewClose"
|
|
|
- loop
|
|
|
- header-hide
|
|
|
ref="CarouselPapersPreview"
|
|
|
- v-if="carouselPapers.length"
|
|
|
- ></image-preview>
|
|
|
+ ></simple-image-preview>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -151,7 +144,7 @@ import {
|
|
|
paperSelectLevelOrScore,
|
|
|
paperTaskPass
|
|
|
} from "@/api";
|
|
|
-import ImagePreview from "@/components/common/ImagePreview";
|
|
|
+import SimpleImagePreview from "@/components/SimpleImagePreview";
|
|
|
import MarkStep from "./components/MarkStep";
|
|
|
import GradeHistoryPaper from "../grading/components/GradeHistoryPaper";
|
|
|
import MarkAction from "./components/MarkAction";
|
|
@@ -166,7 +159,7 @@ import MarkAction from "./components/MarkAction";
|
|
|
export default {
|
|
|
name: "mark-operation",
|
|
|
components: {
|
|
|
- ImagePreview,
|
|
|
+ SimpleImagePreview,
|
|
|
MarkStep,
|
|
|
GradeHistoryPaper,
|
|
|
MarkAction
|
|
@@ -216,7 +209,6 @@ export default {
|
|
|
// carousel paper review,
|
|
|
carouselPapers: [],
|
|
|
curCarouselPaperIndex: 0,
|
|
|
- beforeCarouselCurPaperIndex: 0,
|
|
|
isFullscreenMarking: false
|
|
|
};
|
|
|
},
|
|
@@ -359,77 +351,88 @@ export default {
|
|
|
this.getStepLevels();
|
|
|
this.toPage(1);
|
|
|
},
|
|
|
- selectPaper(index) {
|
|
|
- this.curPaperIndex = index;
|
|
|
- this.curPaper = { ...this.papers[index] };
|
|
|
- },
|
|
|
toReview(index) {
|
|
|
this.isFullscreenMarking = true;
|
|
|
this.selectPaper(index);
|
|
|
- this.$refs.ImagePreview.open();
|
|
|
+ this.$refs.SimpleImagePreview.open();
|
|
|
},
|
|
|
- async prevPage() {
|
|
|
- if (this.current === 1) {
|
|
|
- this.$Message.warning("当前已经是第一条数据了");
|
|
|
- return;
|
|
|
+ selectPaper(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.current--;
|
|
|
- await this.getList();
|
|
|
- this.selectPaper(this.papers.length - 1);
|
|
|
- this.$nextTick(() => {
|
|
|
- if (this.papers.length) this.$refs.ImagePreview.initData();
|
|
|
- });
|
|
|
+ this.curPaperIndex = nindex;
|
|
|
+ this.curPaper = this.papers[nindex] ? { ...this.papers[nindex] } : {};
|
|
|
},
|
|
|
- async nextPage() {
|
|
|
- if (this.current === this.totalPage) {
|
|
|
+ async toPrevPaper() {
|
|
|
+ if (this.curPaperIndex === 0) {
|
|
|
if (this.current > 1) {
|
|
|
this.current--;
|
|
|
+ this.curPaperIndex = this.size - 1;
|
|
|
+ await this.getList();
|
|
|
} else {
|
|
|
+ this.$Message.warning("当前已经是第一条数据了");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.curPaperIndex--;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.selectPaper(this.curPaperIndex);
|
|
|
+ },
|
|
|
+ async toNextPaper() {
|
|
|
+ if (this.curPaperIndex === this.papers.length - 1) {
|
|
|
+ if (this.current === this.totalPage) {
|
|
|
this.$Message.warning("当前已经是最后一条数据了");
|
|
|
- this.$refs.ImagePreview.cancel();
|
|
|
- this.$refs.CarouselPapersPreview &&
|
|
|
- this.$refs.CarouselPapersPreview.cancel();
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ this.current++;
|
|
|
+ this.curPaperIndex = 0;
|
|
|
+ await this.getList();
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.curPaperIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.selectPaper(this.curPaperIndex);
|
|
|
+ },
|
|
|
+ async toActionNextPaper() {
|
|
|
+ if (this.current > 1 && this.papers.length === 1) {
|
|
|
+ this.current--;
|
|
|
+ this.curPaperIndex = this.size;
|
|
|
}
|
|
|
- // 下一页时,继续获取当前页数据。
|
|
|
+
|
|
|
await this.getList();
|
|
|
- this.selectPaper(0);
|
|
|
- this.$nextTick(() => {
|
|
|
- if (this.papers.length) this.$refs.ImagePreview.initData();
|
|
|
- });
|
|
|
+ if (!this.papers.length) this.$refs.SimpleImagePreview.cancel();
|
|
|
+ this.selectPaper(this.curPaperIndex);
|
|
|
},
|
|
|
async gradingCurPaper({ selectedLevel }) {
|
|
|
- const data = await paperSelectLevelOrScore(
|
|
|
+ await paperSelectLevelOrScore(
|
|
|
this.curPaper.id, // is taskId
|
|
|
selectedLevel,
|
|
|
"LEVEL"
|
|
|
);
|
|
|
- this.updatePaperList(data);
|
|
|
this.getStepLevels();
|
|
|
this.updateHistory();
|
|
|
- this.toNext();
|
|
|
+ this.toActionNextPaper();
|
|
|
},
|
|
|
async scoreCurPaper(score) {
|
|
|
- const data = await paperSelectLevelOrScore(
|
|
|
+ await paperSelectLevelOrScore(
|
|
|
this.curPaper.id, // is taskId
|
|
|
score,
|
|
|
"SCORE"
|
|
|
);
|
|
|
- this.updatePaperList(data);
|
|
|
this.getStepLevels();
|
|
|
this.updateHistory();
|
|
|
- this.toNext();
|
|
|
- },
|
|
|
- updatePaperList(data) {
|
|
|
- const index = this.papers.findIndex(item => item.id === data.id);
|
|
|
- this.papers[index] = Object.assign(this.papers[index], data);
|
|
|
+ this.toActionNextPaper();
|
|
|
},
|
|
|
async passCurPaper(level) {
|
|
|
await paperTaskPass(this.curPaper.id);
|
|
|
- this.toNext();
|
|
|
- },
|
|
|
- toNext() {
|
|
|
- this.$refs.ImagePreview.showNext();
|
|
|
+ this.toActionNextPaper();
|
|
|
},
|
|
|
updateHistory() {
|
|
|
this.$refs.GradeHistoryPaper.updatePapers();
|
|
@@ -437,8 +440,6 @@ export default {
|
|
|
// paper carousel
|
|
|
toViewCarouselPaper(paperIndex, papers) {
|
|
|
this.isFullscreenMarking = true;
|
|
|
- this.beforeCarouselCurPaperIndex = this.curPaperIndex;
|
|
|
- this.curPaperIndex = null;
|
|
|
this.carouselPapers = papers;
|
|
|
this.selectCarouselPaper(paperIndex);
|
|
|
this.$nextTick(() => {
|
|
@@ -449,9 +450,20 @@ export default {
|
|
|
this.curCarouselPaperIndex = index;
|
|
|
this.curPaper = { ...this.carouselPapers[index] };
|
|
|
},
|
|
|
+ toCarousePaper(type) {
|
|
|
+ if (type === "prev" && this.curCarouselPaperIndex > 0) {
|
|
|
+ this.curCarouselPaperIndex--;
|
|
|
+ } else if (
|
|
|
+ type === "next" &&
|
|
|
+ this.curCarouselPaperIndex < this.carouselPapers.length - 1
|
|
|
+ ) {
|
|
|
+ this.curCarouselPaperIndex++;
|
|
|
+ }
|
|
|
+ this.selectCarouselPaper(this.curCarouselPaperIndex);
|
|
|
+ },
|
|
|
carouseImagePreviewClose() {
|
|
|
this.isFullscreenMarking = false;
|
|
|
- this.selectPaper(this.beforeCarouselCurPaperIndex);
|
|
|
+ this.selectPaper(this.curPaperIndex);
|
|
|
}
|
|
|
}
|
|
|
};
|