Course.vue 4.4 KB

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