index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="pb_content" style="background: #fff" v-loading="loading">
  3. <div class="pb_content_body" style="position: relative; margin: 0">
  4. <div class="right">
  5. <div class="courseTop">
  6. <div class="stepsNav">
  7. <el-breadcrumb separator-class="el-icon-arrow-right">
  8. <el-breadcrumb-item
  9. :to="{
  10. path:
  11. '/test?userid=' +
  12. userid +
  13. '&oid=' +
  14. oid +
  15. '&org=' +
  16. org +
  17. '&role=' +
  18. role,
  19. }"
  20. >评测管理</el-breadcrumb-item
  21. >
  22. <el-breadcrumb-item>
  23. <span style="color: rgb(15, 126, 255)">查看评测</span>
  24. </el-breadcrumb-item>
  25. </el-breadcrumb>
  26. </div>
  27. <div class="r_pub_button_retrun" @click="retrunCourse">返回</div>
  28. </div>
  29. <div class="step_box" ref="stepBox">
  30. <div class="pb_content_body">
  31. <div class="student_table">
  32. <el-table
  33. ref="table"
  34. :data="tableData"
  35. border
  36. :height="tableHeight"
  37. :fit="true"
  38. v-loading="isLoading"
  39. style="width: 100%"
  40. :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
  41. :row-class-name="tableRowClassName"
  42. >
  43. <el-table-column
  44. prop="username"
  45. label="提交人"
  46. min-width="15"
  47. align="center"
  48. >
  49. </el-table-column>
  50. <el-table-column
  51. prop="time"
  52. label="提交时间"
  53. min-width="15"
  54. align="center"
  55. >
  56. </el-table-column>
  57. <el-table-column
  58. prop="time"
  59. label="是否批改"
  60. min-width="15"
  61. align="center"
  62. >
  63. <template slot-scope="scope">
  64. <div>{{ scope.row.type == 3 ? '是' : '否' }}</div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="操作" width="200px">
  68. <template slot-scope="scope">
  69. <el-button
  70. @click="getTest(scope.row)"
  71. type="primary"
  72. size="small"
  73. >查看</el-button
  74. >
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. </div>
  79. <div class="student_page">
  80. <el-pagination
  81. background
  82. layout="prev, pager, next"
  83. :page-size="pageSize"
  84. :total="total"
  85. @current-change="handleCurrentChange"
  86. >
  87. </el-pagination>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. export default {
  97. components: {},
  98. data() {
  99. return {
  100. userid: this.$route.query.userid,
  101. oid: this.$route.query.oid,
  102. org: this.$route.query.org,
  103. role: this.$route.query.role,
  104. cid: this.$route.query.cid,
  105. title: "",
  106. testType: [],
  107. see: false,
  108. cJson: [],
  109. loading: false,
  110. look: "",
  111. tableHeight: 500,
  112. isLoading: false,
  113. pageSize: 10,
  114. total: 0,
  115. page: 1,
  116. tableData: [],
  117. };
  118. },
  119. watch: {},
  120. methods: {
  121. retrunCourse() {
  122. this.goTo(
  123. "/test?userid=" +
  124. this.userid +
  125. "&oid=" +
  126. this.oid +
  127. "&org=" +
  128. this.org +
  129. "&role=" +
  130. this.role
  131. );
  132. },
  133. goTo(path) {
  134. this.$router.push(path);
  135. },
  136. tableRowClassName({ row, rowIndex }) {
  137. if ((rowIndex + 1) % 2 === 0) {
  138. return "even_row";
  139. } else {
  140. return "";
  141. }
  142. },
  143. changeHeight() {
  144. this.tableHeight = this.$refs.stepBox.offsetHeight - 100;
  145. if (this.tableHeight <= 530) {
  146. this.tableHeight = 530;
  147. }
  148. // 监听窗口大小变化
  149. let self = this;
  150. window.onresize = function () {
  151. self.tableHeight = this.$refs.stepBox.offsetHeight - 100;
  152. if (self.tableHeight <= 530) {
  153. self.tableHeight = 530;
  154. }
  155. };
  156. // this.$refs.table.$el.offsetTop:表格距离浏览器的高度 //200表示你想要调整的表格距离底部的高度(你可以自己随意调整),因为我们一般都有放分页组件的,所以需要给它留一个高度
  157. },
  158. handleCurrentChange(val) {
  159. this.page = val;
  160. this.getData();
  161. },
  162. getTest(row) {
  163. this.$router.push(
  164. "/checkTest2?cid=" +
  165. row.courseid +
  166. "&userid=" +
  167. this.userid +
  168. "&userid2=" +
  169. row.userid +
  170. "&tid=" +
  171. row.id +
  172. "&oid=" +
  173. this.oid +
  174. "&org=" +
  175. this.org +
  176. "&type=2" +
  177. "&role=" +
  178. this.role
  179. );
  180. },
  181. getData() {
  182. this.isLoading = true;
  183. let params = {
  184. cid: this.cid,
  185. page: this.page,
  186. pageSize: this.pageSize,
  187. };
  188. this.ajax
  189. .get(this.$store.state.api + "getTestWorksPage", params)
  190. .then((res) => {
  191. this.isLoading = false;
  192. this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  193. this.tableData = res.data[0];
  194. })
  195. .catch((err) => {
  196. console.error(err);
  197. });
  198. },
  199. },
  200. mounted() {
  201. this.$nextTick(function () {
  202. this.page = 1;
  203. this.changeHeight();
  204. this.getData();
  205. });
  206. },
  207. };
  208. </script>
  209. <style scoped>
  210. .pb_content {
  211. height: 100% !important;
  212. /* margin: 0 20px 0 20px; */
  213. }
  214. .pb_content_body {
  215. width: 100% !important;
  216. height: 100%;
  217. }
  218. .right {
  219. height: 100%;
  220. width: 100%;
  221. display: flex;
  222. overflow: hidden;
  223. flex-direction: column;
  224. }
  225. .basic_box {
  226. margin: 0 auto;
  227. position: relative;
  228. padding: 0 20px 0 20px;
  229. }
  230. .courseTop {
  231. display: flex;
  232. flex-direction: row;
  233. justify-content: space-between;
  234. align-items: center;
  235. width: calc(100% - 40px);
  236. margin: 0 auto;
  237. padding: 10px 0;
  238. }
  239. .stepsNav {
  240. display: flex;
  241. flex-direction: row;
  242. justify-content: flex-start;
  243. align-items: center;
  244. }
  245. .step_box {
  246. width: calc(100% - 40px);
  247. margin: 0 auto;
  248. height: calc(100% - 38px);
  249. overflow: auto;
  250. }
  251. .el-table >>> .even_row {
  252. background-color: #f1f1f1 !important;
  253. }
  254. .student_page {
  255. margin-top: 10px;
  256. }
  257. </style>