UnitTestDetail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <page-header
  4. :loading="testDetailLoading"
  5. :routes="[
  6. { name: '代码作业', path: 'code' },
  7. { name: '项目列表', path: `code/${$route.params.homeworkId}` },
  8. {
  9. name: '项目详情',
  10. path: `code/${$route.params.homeworkId}/${
  11. $route.params.projectId
  12. }/test`
  13. },
  14. { name: '单元测试' }
  15. ]"
  16. >
  17. <template slot="title">
  18. 单元测试 #{{ testDetail.id }}
  19. </template>
  20. <template slot="content">
  21. <pass-tag :pass="testDetail.isPassAll" />
  22. </template>
  23. <template slot="extraContent">
  24. <div class="tag">{{ displayUnixTime(testDetail.time) }}</div>
  25. </template>
  26. </page-header>
  27. <page-body>
  28. <div v-if="testDetailLoading"><page-section-loading show /></div>
  29. <div v-else>
  30. <div
  31. v-for="item in testDetail.detail"
  32. :key="item.id"
  33. class="gap-section"
  34. >
  35. <div class="page-section">
  36. <div>
  37. <pass-tag :pass="item.isPass" />
  38. <strong style="padding-left: 10px">
  39. 页面测试用例 : #{{ item.id }}
  40. </strong>
  41. </div>
  42. <div class="code-section">{{ item.message }}</div>
  43. </div>
  44. </div>
  45. </div>
  46. </page-body>
  47. </div>
  48. </template>
  49. <script>
  50. import PageHeader from "@/components/PageHeader";
  51. import PageBody from "@/components/PageBody/index";
  52. import { getUnitTestDetail } from "@/api/codehw";
  53. import timeMixins from "@/mixins/time";
  54. import PassTag from "@/views/student/Code/ProjectDetail/components/PassTag";
  55. import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
  56. export default {
  57. components: { PageSectionLoading, PassTag, PageBody, PageHeader },
  58. data() {
  59. return {
  60. testDetail: { detail: [] },
  61. testDetailLoading: false
  62. };
  63. },
  64. mixins: [timeMixins],
  65. mounted() {
  66. const { unitTestId } = this.$route.params;
  67. this.testDetailLoading = true;
  68. getUnitTestDetail(unitTestId).then(value => {
  69. this.testDetail = value.data;
  70. this.testDetailLoading = false;
  71. });
  72. }
  73. };
  74. </script>
  75. <style lang="scss" scoped>
  76. @import "../../../../../assets/scss/app";
  77. .gap-section {
  78. padding-bottom: $default-margin-between;
  79. }
  80. .gap-section:last-child {
  81. padding-bottom: 0;
  82. }
  83. .code-section {
  84. margin: $default-margin-between -#{$default-margin-between} -#{$default-margin-between};
  85. padding: $default-margin-between;
  86. background-color: #2d3044;
  87. color: #cacff1;
  88. }
  89. </style>