textConment.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div>
  3. <!-- -->
  4. <!-- <el-checkbox-group
  5. v-if="subjectList.length > 1"
  6. @change="checkSubject"
  7. v-model="subjectId"
  8. size="medium"
  9. style="margin-bottom: 20px"
  10. >
  11. <el-checkbox-button
  12. :class="subjectList.length == 1 ? 'one' : ''"
  13. v-for="(item, index) in subjectList"
  14. :key="index"
  15. :label="item.id"
  16. >{{ item.name }}</el-checkbox-button
  17. >
  18. </el-checkbox-group> -->
  19. <div v-for="(item, index) in fitterTraining" :key="index">
  20. <el-alert :title="'练习组' + (index + 1)" :closable="false">
  21. {{ item.subjectName }}
  22. </el-alert>
  23. <el-table
  24. :data="item.trainingDetailList"
  25. :show-header="false"
  26. style="width: 100%;margin-bottom: 12px;"
  27. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  28. >
  29. <el-table-column prop="musicScoreName"></el-table-column>
  30. <el-table-column prop="trainingSpeed">
  31. <template slot-scope="scope"
  32. >{{ scope.row.trainingSpeed }}速度</template
  33. >
  34. </el-table-column>
  35. <el-table-column prop="times">
  36. <template slot-scope="scope"
  37. >{{ scope.row.times }}次</template
  38. >
  39. </el-table-column>
  40. </el-table>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { getHomeworkSubjectPublic } from "../api";
  46. export default {
  47. props: ["trainingDetailList", "courseScheduleId"],
  48. data() {
  49. return {
  50. subjectId: [],
  51. list: [],
  52. subjectList: [],
  53. fitterTraining: []
  54. };
  55. },
  56. mounted() {
  57. console.log(this.trainingDetailList);
  58. this.fitterTraining = this.trainingDetailList.map(item => item);
  59. this.getPublicSubject();
  60. },
  61. methods: {
  62. async getPublicSubject() {
  63. try {
  64. const res = await getHomeworkSubjectPublic({
  65. courseScheduleId: this.courseScheduleId,
  66. type: "HOMEWORK"
  67. });
  68. this.subjectList = res.data;
  69. } catch (e) {
  70. console.log(e);
  71. }
  72. },
  73. checkSubject(val) {
  74. console.log(val[0], this.trainingDetailList);
  75. if (this.subjectId.length > 1) {
  76. this.subjectId.shift();
  77. }
  78. if (this.subjectId) {
  79. this.fitterTraining = this.trainingDetailList.filter(item => {
  80. return item.subjectId == this.subjectId[0];
  81. });
  82. } else {
  83. this.fitterTraining = this.trainingDetailList.map(item => item);
  84. }
  85. }
  86. }
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. ::v-deep .el-row {
  91. line-height: 40px !important;
  92. }
  93. ::v-deep .el-alert__content {
  94. display: flex;
  95. align-items: center;
  96. justify-content: space-between;
  97. width: 100%;
  98. padding: 0;
  99. .el-alert__description {
  100. margin-top: 0;
  101. }
  102. }
  103. ::v-deep .el-table {
  104. width: 100% !important;
  105. }
  106. .rowFirst {
  107. // padding-left: 58px;
  108. color: #101010;
  109. }
  110. .rowSecond {
  111. text-align: right;
  112. span {
  113. color: #101010;
  114. }
  115. color: #9a9a9a;
  116. }
  117. .rowlast {
  118. text-align: right;
  119. padding-right: 10px;
  120. color: #101010;
  121. .red {
  122. color: #f44743;
  123. }
  124. span {
  125. color: #101010;
  126. }
  127. color: #9a9a9a;
  128. }
  129. </style>