courseList.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div class="listOuer" :style="{ background: outBg }">
  3. <div class="listTit" v-if="title">
  4. <p>{{ title }}</p>
  5. </div>
  6. <div class="listInner">
  7. <div class="listLi" v-for="(item, index) in dataList" :key="index">
  8. <div class="listLiTop">
  9. <img :src="item.url" />
  10. <div class="liInfo">
  11. <div class="courseLiTit">
  12. <p>{{ item.title }}</p>
  13. </div>
  14. <div class="courseLiDesc">
  15. <span>共{{ item.courseNum }}节</span>
  16. <span style="color: #F76146;">¥{{ item.price }}</span>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="courseBtm" v-if="showNum">
  21. <span>剩余名额:{{ item.surplus }}套</span>
  22. <span>已卖出:{{ item.sale }}套</span>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. name: "courseList",
  31. components: {},
  32. props: {
  33. dataList: {
  34. type: Array,
  35. default: []
  36. },
  37. outBg: {
  38. type: String,
  39. default: "#FFF"
  40. },
  41. title: {
  42. type: String,
  43. default: ""
  44. },
  45. showNum: {
  46. type: Boolean,
  47. default: false
  48. }
  49. },
  50. data() {
  51. return {};
  52. },
  53. created() {},
  54. mounted() {},
  55. methods: {},
  56. computed: {}
  57. };
  58. </script>
  59. <style scoped lang="scss">
  60. * {
  61. margin: 0;
  62. padding: 0;
  63. }
  64. .listOuer {
  65. border-radius: 0.1rem;
  66. padding: 0.1rem 0.15rem;
  67. .listTit {
  68. p {
  69. font-size: 0.3rem;
  70. color: #000;
  71. line-height: 2;
  72. font-weight: 600;
  73. overflow: hidden;
  74. text-overflow: ellipsis;
  75. white-space: no-warp;
  76. }
  77. }
  78. .listInner {
  79. .listLi {
  80. padding-top: 0.2rem;
  81. &:not(:nth-last-child(1)) {
  82. padding-bottom: 0.2rem;
  83. border-bottom: 1px solid #999;
  84. }
  85. .listLiTop {
  86. display: flex;
  87. justify-content: space-between;
  88. & > img {
  89. width: 3rem;
  90. height: 2rem;
  91. display: block;
  92. border-radius: 0.1rem;
  93. }
  94. .liInfo {
  95. flex: 1;
  96. margin-left: 0.15rem;
  97. display: flex;
  98. flex-direction: column;
  99. justify-content: space-between;
  100. .courseLiTit {
  101. overflow: hidden;
  102. text-overflow: ellipsis;
  103. display: -webkit-box;
  104. -webkit-line-clamp: 2;
  105. -webkit-box-orient: vertical;
  106. p{
  107. font-size: .3rem;
  108. color:#333;
  109. line-height: 1.5;
  110. font-weight: 600;
  111. }
  112. }
  113. .courseLiDesc {
  114. display: flex;
  115. justify-content: space-between;
  116. span{
  117. font-size: .28rem;
  118. color:#333;
  119. line-height: 1.3;
  120. &:nth-child(1){
  121. margin-right: .3rem;
  122. }
  123. }
  124. }
  125. }
  126. }
  127. .courseBtm {
  128. display: flex;
  129. span{
  130. font-size: .28rem;
  131. color:#0075FC;
  132. line-height: 2;
  133. &:nth-child(1){
  134. margin-right: .3rem;
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. </style>