Teaching.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <!-- 教学 -->
  3. <div class="Teaching">
  4. <div class="top" v-if="!type">
  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. <!-- <el-image lazy :src="item.picture_url" alt=""></el-image> -->
  17. <img
  18. :src="require('../../assets/teacherdev/' + getimgurl(item) + '.png')"
  19. alt=""
  20. />
  21. <!-- <span v-else>加载失败</span> -->
  22. </div>
  23. <!-- <el-image
  24. lazy
  25. :src="require('../../assets/teacherdev/' + getimgurl(item) + '.png')"
  26. alt=""
  27. ></el-image> -->
  28. <p class="one_name">
  29. {{ item.name }}
  30. </p>
  31. <p class="price" v-if="item.price*1>0">
  32. ¥<span class="price_1" v-html="changePrice(item.price*1,24, 16)"></span>
  33. </p>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. props: ["classList", "type"],
  41. data() {
  42. return {};
  43. },
  44. methods: {
  45. goMore() {
  46. this.$router.push({
  47. path: "/Viewmore",
  48. query: {
  49. classify: "TEACHING",
  50. },
  51. });
  52. },
  53. // 前往预览页面
  54. gopreview(item) {
  55. this.$router.push({
  56. path: "/Preview",
  57. query: {
  58. id: item.id,
  59. allList: this.type ? "allList" : null,
  60. },
  61. });
  62. },
  63. // 根据不同的文件类型展示不同图片
  64. getimgurl(item) {
  65. let index = item.tag.indexOf("downloadable");
  66. let type = "";
  67. if (index != -1) {
  68. type = item.tag[2];
  69. } else {
  70. type = item.tag[1];
  71. }
  72. switch (type) {
  73. case "ppt":
  74. return "ppt";
  75. case "pptx":
  76. return "ppt";
  77. case "pdf":
  78. return "pdf";
  79. case "xlsx":
  80. return "exceil";
  81. case "xls":
  82. return "exceil";
  83. case "doc":
  84. return "word";
  85. case "docx":
  86. return "word";
  87. case "word":
  88. return "word";
  89. default:
  90. return "word";
  91. }
  92. },
  93. changePrice(price, fontSize1, fontSize2) {
  94. price = price ? price : 0;
  95. price = price.toFixed(2);
  96. price = price.toString();
  97. let arr = price.split(".");
  98. let str = `<span style="font-size: ${fontSize1 ? fontSize1 : 16}px;">${
  99. arr[0]
  100. }</span>.<span style="font-size: ${fontSize2 ? fontSize2 : 16}px;">${
  101. arr[1]
  102. }</span>`;
  103. return str;
  104. },
  105. },
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. .Teaching {
  110. .top {
  111. width: 1200px;
  112. margin: 0 auto;
  113. .title {
  114. width: 100%;
  115. height: 90px;
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: center;
  119. .text {
  120. position: relative;
  121. font-size: 24px;
  122. font-weight: bold;
  123. }
  124. .more {
  125. cursor: pointer;
  126. font-size: 16px;
  127. display: flex;
  128. align-items: center;
  129. span {
  130. opacity: 0.4;
  131. }
  132. img {
  133. width: 25px;
  134. height: 19px;
  135. }
  136. }
  137. }
  138. }
  139. .class_list {
  140. width: 1200px;
  141. box-sizing: border-box;
  142. margin: 0 auto;
  143. background: #fff;
  144. display: flex;
  145. flex-wrap: wrap;
  146. justify-content: flex-start;
  147. padding: 50px 20px 8px 20px;
  148. > div {
  149. width: 192px;
  150. margin-left: 20px;
  151. margin-right: 20px;
  152. transition: all 1s;
  153. cursor: pointer;
  154. margin-bottom: 32px;
  155. .one_name {
  156. height: 48px;
  157. margin-top: 16px;
  158. line-height: 150%;
  159. word-break: break-all;
  160. display: -webkit-box;
  161. -webkit-box-orient: vertical;
  162. -webkit-line-clamp: 2;
  163. text-overflow: ellipsis;
  164. overflow: hidden;
  165. font-size: 16px;
  166. color: #2c2c2c;
  167. cursor: pointer;
  168. padding-left: 4px;
  169. }
  170. .price {
  171. font-weight: bold;
  172. color: #2c2c2c;
  173. font-size: 24px;
  174. .price_2 {
  175. font-size: 16px;
  176. }
  177. }
  178. p {
  179. font-size: 16px;
  180. }
  181. .listImage {
  182. display: flex;
  183. justify-content: center;
  184. align-items: center;
  185. width: 100%;
  186. height: 256px;
  187. // border: 1px solid rgba(0, 0, 0, 0.15);
  188. img {
  189. max-width: 100%;
  190. max-height: 100%;
  191. }
  192. color: #c0c4cc;
  193. }
  194. .gray {
  195. color: #a3a3a3;
  196. }
  197. .origin {
  198. color: #ff9900;
  199. }
  200. }
  201. .more {
  202. background: url("../../assets/teacherdev/image 13.png") center;
  203. position: relative;
  204. .shade {
  205. position: absolute;
  206. width: 100%;
  207. height: 100%;
  208. background: #000000;
  209. opacity: 0.6;
  210. cursor: pointer;
  211. display: flex;
  212. justify-content: center;
  213. align-items: center;
  214. > div {
  215. img {
  216. width: 58px;
  217. height: 58px;
  218. }
  219. span {
  220. position: relative;
  221. color: white;
  222. top: -20px;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. </style>