Teaching.vue 5.3 KB

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