Teaching.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <!-- 教学 -->
  3. <div class="Teaching">
  4. <div v-if="!type" class="top">
  5. <div class="title">
  6. <span class="text"> <!-- 教辅资料 -->{{ $t('Key214') }} </span>
  7. <div class="more" @click="goMore">
  8. <span> <!-- 查看更多 -->{{ $t('Key47') }} </span>
  9. <img src="../../assets/teacherdev/moreImage.png" alt="" />
  10. </div>
  11. </div>
  12. </div>
  13. <div class="class_list">
  14. <div v-for="(item, i) in classList" :key="i" @click="gopreview(item)">
  15. <div class="listImage">
  16. <img :src="getCoverImg(item)" alt="" />
  17. </div>
  18. <p class="one_name">
  19. {{ item.name }}
  20. </p>
  21. <p v-if="item.price * 1 > 0" class="price">
  22. ¥<span class="price_1" v-html="changePrice(item.price * 1, 24, 16)"></span>
  23. </p>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import { getCoverImg } from '@/utils/index';
  30. export default {
  31. props: ['classList', 'type'],
  32. data() {
  33. return {
  34. getCoverImg,
  35. };
  36. },
  37. methods: {
  38. goMore() {
  39. this.$router.push({
  40. path: '/Viewmore',
  41. query: {
  42. classify: 'TEACHING',
  43. },
  44. });
  45. },
  46. // 前往预览页面
  47. gopreview(item) {
  48. this.$router.push({
  49. path: '/Preview',
  50. query: {
  51. id: item.id,
  52. allList: this.type ? 'allList' : null,
  53. },
  54. });
  55. },
  56. changePrice(price, fontSize1, fontSize2) {
  57. let _price = price || 0;
  58. _price = _price.toFixed(2).toString();
  59. let arr = _price.split('.');
  60. let str = `<span style="font-size: ${fontSize1 || 16}px;">${arr[0]}</span>.<span style="font-size: ${
  61. fontSize2 || 16
  62. }px;">${arr[1]}</span>`;
  63. return str;
  64. },
  65. },
  66. };
  67. </script>
  68. <style lang="scss" scoped>
  69. .Teaching {
  70. .top {
  71. width: 1200px;
  72. margin: 0 auto;
  73. .title {
  74. display: flex;
  75. align-items: center;
  76. justify-content: space-between;
  77. width: 100%;
  78. height: 90px;
  79. .text {
  80. position: relative;
  81. font-size: 24px;
  82. font-weight: bold;
  83. }
  84. .more {
  85. display: flex;
  86. align-items: center;
  87. font-size: 16px;
  88. cursor: pointer;
  89. span {
  90. opacity: 0.4;
  91. }
  92. img {
  93. width: 25px;
  94. height: 19px;
  95. }
  96. }
  97. }
  98. }
  99. .class_list {
  100. box-sizing: border-box;
  101. display: flex;
  102. flex-wrap: wrap;
  103. justify-content: flex-start;
  104. width: 1200px;
  105. padding: 50px 20px 8px;
  106. margin: 0 auto;
  107. background: #fff;
  108. > div {
  109. width: 192px;
  110. margin-right: 20px;
  111. margin-bottom: 32px;
  112. margin-left: 20px;
  113. cursor: pointer;
  114. transition: all 1s;
  115. .one_name {
  116. display: -webkit-box;
  117. height: 48px;
  118. padding-left: 4px;
  119. margin-top: 16px;
  120. overflow: hidden;
  121. font-size: 16px;
  122. line-height: 150%;
  123. color: #2c2c2c;
  124. text-overflow: ellipsis;
  125. word-break: break-all;
  126. cursor: pointer;
  127. -webkit-box-orient: vertical;
  128. -webkit-line-clamp: 2;
  129. }
  130. .price {
  131. font-size: 24px;
  132. font-weight: bold;
  133. color: #2c2c2c;
  134. .price_2 {
  135. font-size: 16px;
  136. }
  137. }
  138. p {
  139. font-size: 16px;
  140. }
  141. .listImage {
  142. display: flex;
  143. align-items: center;
  144. justify-content: center;
  145. width: 100%;
  146. height: 256px;
  147. color: #c0c4cc;
  148. // border: 1px solid rgba(0, 0, 0, 0.15);
  149. img {
  150. max-width: 100%;
  151. max-height: 100%;
  152. }
  153. }
  154. .gray {
  155. color: #a3a3a3;
  156. }
  157. .origin {
  158. color: #f90;
  159. }
  160. }
  161. .more {
  162. position: relative;
  163. background: url('../../assets/teacherdev/image 13.png') center;
  164. .shade {
  165. position: absolute;
  166. display: flex;
  167. align-items: center;
  168. justify-content: center;
  169. width: 100%;
  170. height: 100%;
  171. cursor: pointer;
  172. background: #000;
  173. opacity: 0.6;
  174. > div {
  175. img {
  176. width: 58px;
  177. height: 58px;
  178. }
  179. span {
  180. position: relative;
  181. top: -20px;
  182. color: white;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. </style>