textConment.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. :max="1"
  10. style="margin-bottom: 20px"
  11. >
  12. <el-checkbox-button
  13. :class="subjectList.length == 1 ? 'one' : ''"
  14. v-for="(item, index) in subjectList"
  15. :key="index"
  16. :label="item.id"
  17. >{{ item.name }}</el-checkbox-button
  18. >
  19. </el-checkbox-group>
  20. <el-row :gutter="20" v-for="(item, index) in fitterTraining" :key="index">
  21. <el-col :span="12"
  22. ><div class="rowFirst">{{ item.musicScoreName }}</div></el-col
  23. >
  24. <el-col :span="6"
  25. ><div class="rowSecond">
  26. <span>{{ item.trainingSpeed }}</span> 速度
  27. </div></el-col
  28. >
  29. <el-col :span="6"
  30. ><div class="rowlast">
  31. <!-- <span :class="item.trainingTimes >= item.times ? '' : 'red'">{{
  32. item.trainingTimes
  33. }}</span> /-->
  34. <span> {{ item.times }}</span>
  35. </div></el-col
  36. >
  37. </el-row>
  38. </div>
  39. </template>
  40. <script>
  41. import { getHomeworkSubjectPublic } from "../api";
  42. export default {
  43. props: ["trainingDetailList", "courseScheduleId", "type"],
  44. data() {
  45. return {
  46. subjectId: [],
  47. list: [],
  48. subjectList: [],
  49. fitterTraining: [],
  50. };
  51. },
  52. mounted() {
  53. console.log(this.trainingDetailList);
  54. this.fitterTraining = this.trainingDetailList.map((item) => item);
  55. this.getPublicSubject();
  56. },
  57. methods: {
  58. async getPublicSubject() {
  59. try {
  60. const res = await getHomeworkSubjectPublic({
  61. courseScheduleId: this.courseScheduleId,
  62. type: this.type,
  63. });
  64. this.subjectList = res.data;
  65. } catch (e) {
  66. console.log(e);
  67. }
  68. },
  69. checkSubject(val) {
  70. console.log(val[0], this.trainingDetailList);
  71. if (val[0]) {
  72. this.fitterTraining = this.trainingDetailList.filter((item) => {
  73. return item.subjectId == val[0];
  74. });
  75. } else {
  76. this.fitterTraining = this.trainingDetailList.map((item) => item);
  77. }
  78. },
  79. },
  80. };
  81. </script>
  82. <style lang="scss" scoped>
  83. .rowFirst {
  84. // padding-left: 58px;
  85. color: #101010;
  86. }
  87. .rowSecond {
  88. text-align: right;
  89. span {
  90. color: #101010;
  91. }
  92. color: #9a9a9a;
  93. }
  94. .rowlast {
  95. text-align: right;
  96. padding-right: 10px;
  97. color: #101010;
  98. .red {
  99. color: #f44743;
  100. }
  101. span {
  102. color: #101010;
  103. }
  104. color: #9a9a9a;
  105. }
  106. </style>