Textbook.vue 4.2 KB

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