Textbook.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. <b>{{ $t('Key44') }}</b>
  10. </div>
  11. <div class="more" @click="gotolist">
  12. <span><!-- 查看更多 -->{{ $t('Key47') }}</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> {{ $t('Key323') }}</span>
  22. </div>
  23. <p class="one_name">{{ item.name }}</p>
  24. <p class="price" v-if="item.price > 0 &&item.is_free_license=='false'">
  25. ¥<span class="price_1" v-html="changePrice(item.price)"></span>
  26. </p>
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import { updateWordPack } from '@/utils/i18n'
  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: 'TEXTBOOK' },
  43. })
  44. },
  45. // 处理价格
  46. // 处理价格
  47. changePrice(price) {
  48. let str = ''
  49. price = price ? price.toString() : '0.00'
  50. if (price.indexOf('.') > -1) {
  51. let arr = price.split('.')
  52. str = `<span style="font-size: 24px;">${arr[0]}</span>.<span style="font-size: 16px;">${arr[1]}</span>`
  53. } else {
  54. str = `<span style="font-size: 24px;">${price}</span>.<span style="font-size: 16px;">00</span>`
  55. }
  56. return str
  57. },
  58. // 需要跳到教材系统的教材详情
  59. gotoIntroduce(item) {
  60. sessionStorage.setItem('Bookdetail', JSON.stringify(item))
  61. let href = `/GCLS-Book/#/GoodsDetail?goods_id=${item.id}&goods_type=101&invok_module=GCLS-LC`
  62. window.open(href, '_blank')
  63. },
  64. },
  65. created() {
  66. updateWordPack({
  67. word_key_list: ['Key44', 'Key46'],
  68. })
  69. },
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .Textbook {
  74. .top {
  75. width: 1200px;
  76. margin: 0 auto;
  77. height: 90px;
  78. display: flex;
  79. justify-content: space-between;
  80. align-items: center;
  81. .title {
  82. font-weight: bold;
  83. font-size: 24px;
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. span {
  88. display: inline-block;
  89. width: 42px;
  90. height: 42px;
  91. border-radius: 50%;
  92. background: linear-gradient(28.36deg, #ff7d8a 13.41%, #ff616c 84.14%);
  93. display: flex;
  94. align-items: center;
  95. justify-content: center;
  96. img {
  97. width: 20px;
  98. height: 15px;
  99. }
  100. }
  101. b {
  102. margin: 0 16px;
  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: 1200px;
  134. box-sizing: border-box;
  135. padding: 40px 20px 8px;
  136. > div {
  137. margin: 0 20px 32px 20px;
  138. width: 192px;
  139. cursor: pointer;
  140. .one_name {
  141. width: 100%;
  142. height: 42px;
  143. margin-top: 16px;
  144. line-height: 150%;
  145. word-break: break-all;
  146. display: -webkit-box;
  147. -webkit-box-orient: vertical;
  148. -webkit-line-clamp: 2;
  149. text-overflow: ellipsis;
  150. overflow: hidden;
  151. font-size: 14px;
  152. color: #2c2c2c;
  153. }
  154. .price {
  155. margin-top: 8px;
  156. font-weight: bold;
  157. color: #2c2c2c;
  158. font-size: 24px;
  159. .price_2 {
  160. font-size: 16px;
  161. }
  162. }
  163. p {
  164. font-size: 16px;
  165. }
  166. .listImage {
  167. display: flex;
  168. justify-content: center;
  169. align-items: center;
  170. width: 100%;
  171. height: 256px;
  172. border: 1px solid rgba(0, 0, 0, 0.15);
  173. box-sizing: border-box;
  174. img {
  175. max-width: 100%;
  176. max-height: 100%;
  177. }
  178. color: #c0c4cc;
  179. }
  180. .gray {
  181. color: #a3a3a3;
  182. }
  183. .origin {
  184. color: #ff9900;
  185. }
  186. }
  187. }
  188. }
  189. </style>