courseMenuCollapse.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="courseMenuCollapse">
  3. <div
  4. class="courseMenuItem"
  5. :class="item.useFlag ? 'current' : ''"
  6. v-for="item in props.courseMenuList"
  7. :key="item.id"
  8. :name="item.id"
  9. @click="handleClick(item)"
  10. >
  11. <div class="cover">
  12. <img :src="item.coverImg" />
  13. <div class="current" v-if="item.useFlag">当前</div>
  14. </div>
  15. <div class="text">
  16. <ellipsisScroll :autoScroll="item.useFlag" :title="item.lessonCoursewareName" />
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script lang="ts" setup>
  22. // import { ref, watch } from "vue"
  23. type courseMenuListType = {
  24. id: string
  25. lessonCoursewareId: string
  26. lessonCoursewareName: string
  27. coverImg: string
  28. courseTypeCode: string
  29. lockFlag: boolean | null
  30. useFlag: boolean
  31. }[]
  32. const props = defineProps<{
  33. courseMenuList: courseMenuListType
  34. }>()
  35. const emits = defineEmits<{
  36. (e: "handleClick", value: any): void
  37. }>()
  38. function handleClick(value: any) {
  39. emits("handleClick", value)
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .courseMenuCollapse {
  44. display: flex;
  45. flex-wrap: wrap;
  46. .courseMenuItem {
  47. width: 89px;
  48. margin-top: 24px;
  49. margin-left: 24px;
  50. box-sizing: content-box;
  51. cursor: pointer;
  52. &.current {
  53. .text {
  54. color: #131415;
  55. }
  56. }
  57. .cover {
  58. position: relative;
  59. width: 100%;
  60. height: 110px;
  61. &::before {
  62. position: absolute;
  63. top: 0;
  64. left: 0;
  65. bottom: 0;
  66. z-index: 9;
  67. content: "";
  68. width: 4px;
  69. height: 100%;
  70. background: url("@/img/coursewarePlay/book-cover-line.png");
  71. }
  72. img {
  73. width: inherit;
  74. height: inherit;
  75. }
  76. .current {
  77. position: absolute;
  78. top: 4px;
  79. left: 4px;
  80. z-index: 9;
  81. background: rgba(0, 0, 0, 0.5);
  82. border-radius: 3px;
  83. font-weight: 500;
  84. font-size: 13px;
  85. color: #ffffff;
  86. line-height: 17px;
  87. padding: 0 5px;
  88. }
  89. }
  90. .text {
  91. padding-top: 6px;
  92. font-weight: 600;
  93. font-size: 14px;
  94. color: rgba(0, 0, 0, 0.5);
  95. line-height: 20px;
  96. overflow: hidden;
  97. }
  98. }
  99. }
  100. </style>