Course.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <!-- 精品课 -->
  3. <div class="Course">
  4. <div class="top" v-if="!type">
  5. <div class="title">
  6. <span>
  7. <img src="../../assets/learncenter/listTitleImg1.png" alt="" />
  8. </span>
  9. 教学
  10. </div>
  11. <div class="more" @click="gotolist">
  12. <span> 查看更多 </span>
  13. <img src="../../assets/learncenter/moreImage.png" alt="" />
  14. </div>
  15. </div>
  16. <div class="class_list">
  17. <div v-for="(item, i) in classList" :key="i" @click="gotoIntroduce(item)">
  18. <div class="listImage">
  19. <!-- <el-image lazy :src="item.picture_url" alt=""></el-image> -->
  20. <img v-if="item.picture_url" :src="item.picture_url" alt="" />
  21. <span v-else>加载失败</span>
  22. </div>
  23. <p class="one_name">{{ item.name }}</p>
  24. <p class="price">
  25. <span class="price_1" v-text="changePrice('1', item.price)"></span>
  26. <span class="price_2" v-text="changePrice('2', item.price)"></span>
  27. </p>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. props: ["classList", "type"],
  35. data() {
  36. return {};
  37. },
  38. methods: {
  39. gotolist() {
  40. this.$router.push({
  41. path: "/learncenter/ListPage",
  42. query: { id: "COURSE" },
  43. });
  44. },
  45. // 处理价格
  46. changePrice(type, item) {
  47. item = item + "";
  48. if (item.indexOf(".") != -1) {
  49. if (type == 1) {
  50. return item.split(".")[0];
  51. } else if (type == 2) {
  52. return "." + item.split(".")[1];
  53. }
  54. } else {
  55. if (type == 1) {
  56. return item;
  57. }
  58. if (type == 2) {
  59. return ".00";
  60. }
  61. }
  62. },
  63. // 需要跳转到教学系统进行查看详情或者购买
  64. gotoIntroduce(item) {
  65. let href = `/GCLS-Learn/#/GoodsDetail?goods_id=${item.id}&goods_type=201`;
  66. window.open(href, "_blank");
  67. },
  68. },
  69. };
  70. </script>
  71. <style lang="scss" scoped>
  72. .Course {
  73. .top {
  74. width: 1200px;
  75. margin: 0 auto;
  76. height: 90px;
  77. display: flex;
  78. justify-content: space-between;
  79. align-items: center;
  80. .title {
  81. font-weight: bold;
  82. font-size: 24px;
  83. display: flex;
  84. span {
  85. display: inline-block;
  86. width: 42px;
  87. height: 42px;
  88. border-radius: 50%;
  89. background: linear-gradient(
  90. 216.55deg,
  91. #ffef5a 10.18%,
  92. #ffd337 10.19%,
  93. #ffd772 81.9%
  94. );
  95. margin-right: 16px;
  96. display: flex;
  97. align-items: center;
  98. justify-content: center;
  99. img {
  100. width: 20px;
  101. height: 15px;
  102. }
  103. }
  104. }
  105. .title2 {
  106. font-weight: bold;
  107. font-size: 16px;
  108. color: rgba(0, 0, 0, 0.5);
  109. span {
  110. color: black;
  111. }
  112. }
  113. .more {
  114. cursor: pointer;
  115. font-size: 16px;
  116. display: flex;
  117. align-items: center;
  118. span {
  119. opacity: 0.4;
  120. }
  121. img {
  122. width: 25px;
  123. height: 19px;
  124. }
  125. }
  126. }
  127. .class_list {
  128. margin: 0 auto;
  129. background: #fff;
  130. display: flex;
  131. flex-wrap: wrap;
  132. justify-content: flex-start;
  133. width: 1160px;
  134. padding-top: 50px;
  135. padding-left: 20px;
  136. padding-right: 20px;
  137. > div {
  138. margin-left: 20px;
  139. margin-right: 20px;
  140. width: 256px;
  141. cursor: pointer;
  142. .one_name {
  143. width: 100%;
  144. height: 42px;
  145. margin-top: 16px;
  146. line-height: 150%;
  147. word-break: break-all;
  148. display: -webkit-box;
  149. -webkit-box-orient: vertical;
  150. -webkit-line-clamp: 2;
  151. text-overflow: ellipsis;
  152. overflow: hidden;
  153. font-size: 14px;
  154. color: #2c2c2c;
  155. padding-left: 5px;
  156. }
  157. .price {
  158. margin-top: 8px;
  159. font-weight: bold;
  160. color: #2c2c2c;
  161. font-size: 24px;
  162. .price_2 {
  163. font-size: 16px;
  164. }
  165. margin-bottom: 40px;
  166. }
  167. p {
  168. font-size: 16px;
  169. }
  170. .listImage {
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. width: 100%;
  175. height: 144px;
  176. border: 1px solid rgba(0, 0, 0, 0.15);
  177. img {
  178. max-width: 100%;
  179. max-height: 100%;
  180. }
  181. color: #c0c4cc;
  182. }
  183. // img {
  184. // width: 256px;
  185. // height: 114px;
  186. // }
  187. .gray {
  188. color: #a3a3a3;
  189. }
  190. .origin {
  191. color: #ff9900;
  192. }
  193. }
  194. }
  195. }
  196. </style>