GradingDetail.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="grading-detail">
  3. <grade-step @on-change="stepChange"></grade-step>
  4. <div class="detail-body" v-if="curStep.name !== 'analysis'">
  5. <div class="detail-part detail-carousel">
  6. <grade-standard-paper ref="GradeStandardPaper"></grade-standard-paper>
  7. <paper-carousel
  8. :papers="papers"
  9. v-if="curUserRoleType !== 'ADMIN'"
  10. ></paper-carousel>
  11. </div>
  12. <div class="detail-part detail-paper">
  13. <div class="detail-filter">
  14. <Form ref="FilterForm" label-position="left" inline>
  15. <FormItem>
  16. <Select v-model="filter.areaCode" placeholder="请选择考区">
  17. <Option value=""></Option>
  18. </Select>
  19. </FormItem>
  20. <FormItem>
  21. <Button type="primary" icon="ios-search" @click="toPage(1)"
  22. >查询</Button
  23. >
  24. </FormItem>
  25. </Form>
  26. </div>
  27. <div class="detail-paper-list image-view-list image-view-list-3">
  28. <div class="image-view" v-for="(image, index) in papers" :key="index">
  29. <h5 class="image-view-title">{{ image.title }}</h5>
  30. <div class="image-view-contain" @click="toReview(index)">
  31. <img :src="image.thumbUrl" :alt="image.title" />
  32. </div>
  33. </div>
  34. </div>
  35. <div class="part-page">
  36. <Page
  37. :current="current"
  38. :total="total"
  39. :page-size="size"
  40. show-total
  41. show-elevator
  42. :show-sizer="curUserRoleType === 'MARKER'"
  43. :page-size-opts="[4, 6, 8]"
  44. @on-page-size-change="pageSizeChange"
  45. @on-change="toPage"
  46. ></Page>
  47. </div>
  48. </div>
  49. <div class="detail-part detail-action">
  50. <grade-action
  51. :paper="curPage"
  52. @on-confirm="gradeCurPaper"
  53. ref="GradeAction"
  54. ></grade-action>
  55. </div>
  56. </div>
  57. <div class="detail-body" v-else>
  58. <grade-analysis ref="GradeAnalysis"></grade-analysis>
  59. </div>
  60. <!-- image-preview -->
  61. <image-preview
  62. class="grading-detail-image-preview"
  63. :image-list="papers"
  64. :init-index="curPaperIndex"
  65. @on-prev="paperPrev"
  66. @on-next="paperNext"
  67. @page-prev="prevPage"
  68. @page-next="nextPage"
  69. header-hide
  70. ref="ImagePreview"
  71. v-if="papers.length"
  72. ></image-preview>
  73. </div>
  74. </template>
  75. <script>
  76. import { paperPageList } from "@/api";
  77. import ImagePreview from "@/components/common/ImagePreview";
  78. import GradeStep from "./components/GradeStep";
  79. import GradeStandardPaper from "./components/GradeStandardPaper";
  80. import PaperCarousel from "./components/PaperCarousel";
  81. import GradeAction from "./components/GradeAction";
  82. import GradeAnalysis from "./components/GradeAnalysis";
  83. // 三种情况:
  84. // 管理员(ADMIN),科组长(MARK_LEADER),评卷员(MARKER)
  85. export default {
  86. name: "grading-detail",
  87. components: {
  88. ImagePreview,
  89. PaperCarousel,
  90. GradeStep,
  91. GradeStandardPaper,
  92. GradeAction,
  93. GradeAnalysis
  94. },
  95. data() {
  96. return {
  97. filter: {
  98. workId: this.$route.params.workId,
  99. subjectId: this.$route.params.subjectId,
  100. areaCode: ""
  101. },
  102. curUserRoleType: "",
  103. current: 1,
  104. size: 6,
  105. total: 0,
  106. totalPage: 1,
  107. curStep: {},
  108. curStandardGradeId: "",
  109. grades: [],
  110. papers: [],
  111. curPage: {},
  112. curPaperIndex: 0
  113. };
  114. },
  115. mounted() {
  116. this.curUserRoleType = this.$ls.get("user", { role: "" }).role;
  117. this.initData();
  118. },
  119. methods: {
  120. initData() {
  121. this.papers = "#"
  122. .repeat(this.size)
  123. .split("")
  124. .map((item, index) => {
  125. return {
  126. id: index,
  127. subjectName: "素描",
  128. title: "2020105133",
  129. score: "95",
  130. grade: "A",
  131. url:
  132. "http://127.0.0.1:9000/api/file/image/download/33/1/833/1?random=fa8244bb-8ec4-46c1-a16e-1bd6f3b8848e",
  133. thumbUrl:
  134. "http://127.0.0.1:9000/api/file/image/download/33/1/833/2?random=497cc903-c01a-458a-9b4e-82b391cef176"
  135. };
  136. });
  137. },
  138. async getList() {
  139. const datas = {
  140. ...this.filter,
  141. page: this.current - 1,
  142. size: this.size
  143. };
  144. const data = await paperPageList(datas);
  145. this.papers = data.data.map(paper => {
  146. return {
  147. id: paper.id,
  148. title: paper.examNumber,
  149. url: paper.imgSrc,
  150. thumbUrl: paper.thumbSrc,
  151. missing: paper.missing,
  152. stage: paper.stage,
  153. style: {},
  154. deg: 0
  155. };
  156. });
  157. this.total = data.totalCount;
  158. },
  159. toPage(page) {
  160. this.current = page;
  161. this.getList();
  162. },
  163. pageSizeChange(size) {
  164. this.size = size;
  165. this.toPage(1);
  166. },
  167. stepChange(step) {
  168. this.curStep = step;
  169. },
  170. toReview(index) {
  171. this.curPage = { ...this.papers[index] };
  172. this.curPaperIndex = index;
  173. this.$refs.ImagePreview.open();
  174. },
  175. paperPrev(index) {
  176. this.curPage = { ...this.papers[index] };
  177. this.curPaperIndex = index;
  178. },
  179. paperNext(index) {
  180. this.curPage = { ...this.papers[index] };
  181. this.curPaperIndex = index;
  182. },
  183. prevPage() {
  184. if (this.current === 1) {
  185. this.$Message.warning("当前已经是第一条数据了");
  186. return;
  187. }
  188. this.current--;
  189. this.getList();
  190. },
  191. nextPage() {
  192. if (this.current === this.totalPage) {
  193. this.$Message.warning("当前已经是最后一条数据了");
  194. return;
  195. }
  196. this.current++;
  197. this.getList();
  198. },
  199. gradeCurPaper(grade) {
  200. // TODO:to grade
  201. if (this.curPaperIndex === this.size - 1) {
  202. this.nextPage();
  203. return;
  204. } else {
  205. this.paperNext(this.curPaperIndex + 1);
  206. }
  207. }
  208. }
  209. };
  210. </script>