ExamEvalList.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <el-container>
  3. <el-header height="220">
  4. <el-row>
  5. <el-select
  6. v-model="queryInfo.subjectId"
  7. clearable
  8. placeholder="请选择科目"
  9. style="margin-left: 5px"
  10. @change="subjectChange"
  11. >
  12. <el-option
  13. v-for="item in allSubject"
  14. :key="item.key"
  15. :label="item.value"
  16. :value="item.key"
  17. />
  18. </el-select>
  19. </el-row>
  20. </el-header>
  21. <el-main>
  22. <el-table
  23. :data="dataList"
  24. border
  25. style="width: 100%"
  26. >
  27. <el-table-column
  28. fixed="left"
  29. label="No"
  30. type="index"
  31. />
  32. <el-table-column
  33. prop="examName"
  34. label="测评名称"
  35. width="150"
  36. />
  37. <el-table-column
  38. label="测评码"
  39. width="90"
  40. >
  41. <template slot-scope="scope">
  42. <el-tag
  43. v-if="scope.row.needPasscode"
  44. size="mini"
  45. type="danger"
  46. >需要</el-tag>
  47. <el-tag
  48. v-else
  49. size="mini"
  50. type="success"
  51. >不需要</el-tag>
  52. </template>
  53. </el-table-column>
  54. <el-table-column
  55. prop="startTime"
  56. label="测评时间"
  57. width="150"
  58. />
  59. <el-table-column
  60. prop="duration"
  61. label="测评时长(分钟)"
  62. width="150"
  63. />
  64. <el-table-column
  65. prop="totalScore"
  66. label="试卷总分"
  67. />
  68. <el-table-column
  69. prop="myScore"
  70. label="我的分数"
  71. />
  72. <el-table-column
  73. fixed="right"
  74. label="操作"
  75. width="320"
  76. >
  77. <template slot-scope="scope">
  78. <el-button
  79. v-if="scope.row.evalStatus === 1"
  80. size="mini"
  81. type="primary"
  82. @click="prepareExam(scope.$index, scope.row)"
  83. >去测评</el-button>
  84. <el-button
  85. v-else-if="scope.row.evalStatus === 2"
  86. size="mini"
  87. type="danger"
  88. @click="markPaper(scope.$index, scope.row)"
  89. >去批改</el-button>
  90. <el-button
  91. v-else-if="scope.row.evalStatus === 3"
  92. size="mini"
  93. type="warning"
  94. @click="waitMark(scope.$index, scope.row)"
  95. >待批改</el-button>
  96. <el-button
  97. v-else
  98. size="mini"
  99. type="success"
  100. @click="viewResult(scope.$index, scope.row)"
  101. >看结果</el-button>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <el-pagination
  106. background
  107. :small="screenWidth <= 768"
  108. layout="prev, pager, next"
  109. :page-size="pageSize"
  110. :current-page="currentPage"
  111. :total="totalSize"
  112. @current-change="handleCurrentChange"
  113. @prev-click="handleCurrentChange"
  114. @next-click="handleCurrentChange"
  115. />
  116. </el-main>
  117. <el-dialog
  118. title="测评提示"
  119. :visible.sync="startExamDialog"
  120. center
  121. width="50%"
  122. >
  123. <el-alert
  124. title="点击`开始测评`后将自动进入测评,请诚信测评,测评过程中可能会对用户行为、用户视频进行截图采样,请知悉!"
  125. type="error"
  126. />
  127. <el-card style="margin-top: 25px">
  128. <span>测评名称:</span>{{ currentSelectedExam.examName }}
  129. <br>
  130. <span>测评时长:</span>{{ currentSelectedExam.duration + '分钟' }}
  131. <br>
  132. <span>试卷总分:</span>{{ currentSelectedExam.totalScore }}分
  133. <br>
  134. <span>开放类型:</span> {{ currentSelectedExam.needPasscode ? '需要密码' : '完全公开' }}
  135. <br>
  136. </el-card>
  137. <span slot="footer" class="dialog-footer">
  138. <el-button @click="startExamDialog = false">返 回</el-button>
  139. <el-button type="primary" @click="startExam(currentSelectedExam.examId)">开始测评</el-button>
  140. </span>
  141. </el-dialog>
  142. </el-container>
  143. </template>
  144. <script>
  145. import { getSubjectKV, getExamList } from '@/api/exam'
  146. export default {
  147. name: 'ExamEvalList',
  148. data() {
  149. return {
  150. // 屏幕宽度, 为了控制分页条的大小
  151. screenWidth: document.body.clientWidth,
  152. currentPage: 1,
  153. pageSize: 20,
  154. totalSize: 0,
  155. dataList: [],
  156. // **********************************************************************
  157. queryInfo: {
  158. subjectId: null,
  159. pageNumber: 1,
  160. pageSize: 10
  161. },
  162. allSubject: [],
  163. // 开始测评的提示框
  164. startExamDialog: false,
  165. // 当前选中的测评的信息
  166. currentSelectedExam: {
  167. examId: 114511
  168. }
  169. }
  170. },
  171. created() {
  172. document.title = '我的试卷'
  173. this.getData(this.queryInfo)
  174. this.getSubjects()
  175. // this.getQuestionTypes()
  176. },
  177. methods: {
  178. handleCurrentChange(pageNumber) {
  179. this.currentPage = pageNumber
  180. this.queryInfo.pageNumber = this.currentPage
  181. this.queryInfo.pageSize = this.pageSize
  182. this.getData(this.queryInfo)
  183. // 回到顶部
  184. scrollTo(0, 0)
  185. },
  186. getData(queryInfo) {
  187. getExamList(queryInfo).then(resp => {
  188. if (resp.code === 0) {
  189. this.dataList = resp.data.list
  190. this.totalSize = resp.data.totalSize
  191. } else {
  192. this.$notify({
  193. title: '提示',
  194. message: resp.msg,
  195. type: 'warning',
  196. duration: 3000
  197. })
  198. }
  199. }).catch(error => {
  200. this.$notify({
  201. title: '提示',
  202. message: error.message,
  203. type: 'error',
  204. duration: 3000
  205. })
  206. })
  207. },
  208. getSubjects() {
  209. getSubjectKV().then((resp) => {
  210. if (resp.code === 0) {
  211. this.allSubject = resp.data
  212. }
  213. })
  214. },
  215. // 题库变化
  216. subjectChange(val) {
  217. this.queryInfo.subjectId = val
  218. this.queryInfo.pageNumber = this.currentPage
  219. this.queryInfo.pageSize = this.pageSize
  220. this.getData(this.queryInfo)
  221. },
  222. prepareExam(index, row) {
  223. if (!row.needPasscode) {
  224. this.startExamDialog = true
  225. this.currentSelectedExam = row
  226. return
  227. }
  228. this.$prompt('请提供测评码', 'Tips', {
  229. confirmButtonText: '确定',
  230. cancelButtonText: '取消'
  231. }).then(({ value }) => {
  232. if (value === 123) {
  233. this.$message.error('密码错误o(╥﹏╥)o')
  234. return
  235. }
  236. this.startExamDialog = true
  237. this.currentSelectedExam = row
  238. }).catch(() => {
  239. })
  240. },
  241. startExam(paperId) {
  242. const routeUrl = this.$router.resolve({
  243. path: '/exam/paper/detail',
  244. query: {
  245. paperId: paperId,
  246. viewType: 2,
  247. userId: ''
  248. }
  249. })
  250. window.open(routeUrl.href, '_blank')
  251. },
  252. waitMark(index, row) {
  253. this.$message.info('试卷待批改')
  254. },
  255. markPaper(index, row) {
  256. const paperId = row.examId
  257. const routeUrl = this.$router.resolve({
  258. path: '/exam/paper/detail',
  259. query: {
  260. paperId: paperId,
  261. viewType: 3,
  262. userId: 0
  263. }
  264. })
  265. window.open(routeUrl.href, '_blank')
  266. },
  267. viewResult(index, row) {
  268. const paperId = row.examId
  269. const routeUrl = this.$router.resolve({
  270. path: '/exam/paper/detail',
  271. query: {
  272. paperId: paperId,
  273. viewType: 4,
  274. userId: ''
  275. }
  276. })
  277. window.open(routeUrl.href, '_blank')
  278. }
  279. }
  280. }
  281. </script>
  282. <style>
  283. </style>