index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="box">
  3. <banner></banner>
  4. <div class="content-box">
  5. <div class="v-content">
  6. <el-row :gutter="20">
  7. <el-col :span="5" :xl="6" :lg="6" :md="8" :sm="8" :xs="12" v-for="(nav, i) in list" :key="i" class="list">
  8. <div class="content" @click="tapProfile(nav)">
  9. <img class="profile-img" :src="nav.img" />
  10. <p class="text">{{nav.title}}</p>
  11. </div>
  12. </el-col>
  13. </el-row>
  14. </div>
  15. </div>
  16. <!-- 弹框 -->
  17. <div class="pop-up" v-if="popShow">
  18. <div class="pop_content">
  19. <!-- <div class="title">{{ $t("nav.MaterialsDownload") }}</div> -->
  20. <!-- <div class="pop_hea">
  21. <div class="biaoti">{{ profile.title }}</div>
  22. <div class="hea_icon" @click="downloadPdf(profile.link, profile.title)">
  23. <i class="el-icon-download"></i>
  24. </div>
  25. </div> -->
  26. <div class="pop_img">
  27. <div class="hea_icon">
  28. <i @click="downloadPdf(profile.link, profile.title)" class="el-icon-download"></i>
  29. <i @click="popShow = false" class="el-icon-close icon"></i>
  30. </div>
  31. <img class="image" :src="profile.contentImg" alt="">
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import banner from "@/components/banner";
  39. export default {
  40. name: "profile",
  41. components: {
  42. banner
  43. },
  44. data() {
  45. return {
  46. list: this.$t("downloadList.list"),
  47. popShow: false,
  48. profile: null
  49. };
  50. },
  51. methods: {
  52. tapProfile(item) {
  53. this.popShow = true;
  54. this.profile = item;
  55. },
  56. downloadPdf(pdfUrl, title) {
  57. console.log(pdfUrl, title);
  58. const loading = this.$loading({
  59. lock: true,
  60. text: this.$t('Download.loading') + '...',
  61. background: 'rgba(0, 0, 0, 0.7)'
  62. });
  63. const xhr = new XMLHttpRequest();
  64. xhr.open('GET', pdfUrl, true);
  65. xhr.responseType = 'blob';
  66. xhr.onload = () => {
  67. if (xhr.status === 200) {
  68. const blob = new Blob([xhr.response], { type: 'application/pdf' });
  69. const url = URL.createObjectURL(blob);
  70. const link = document.createElement('a');
  71. link.href = url;
  72. link.download = title +'.pdf';
  73. link.click();
  74. URL.revokeObjectURL(url);
  75. setTimeout(() => {
  76. // 关闭Loading
  77. loading.close();
  78. }, 1000);
  79. }
  80. };
  81. xhr.send()
  82. }
  83. },
  84. mounted() {},
  85. created() {
  86. }
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .content-box{
  91. width: 1200px;
  92. margin: 40px auto 0;
  93. .v-content{
  94. margin: auto;
  95. .el-col-5{
  96. width: 20%;
  97. }
  98. .content{
  99. // height: 310px;
  100. background: #F4F8FF;
  101. // border-radius: 20px;
  102. border-radius: 5px 21px 21px 5px;
  103. padding:0 10px 10px;
  104. margin-bottom: 20px;
  105. cursor: pointer;
  106. &:hover{
  107. box-shadow: 0px 0px 18px 0px rgba(0,72,255,0.58);
  108. }
  109. .profile-img{
  110. width: 100%;
  111. }
  112. .text{
  113. font-size: 14px;
  114. line-height: 20px;
  115. word-wrap: break-word;
  116. margin-top: 4px;
  117. display: -webkit-box;
  118. -webkit-box-orient: vertical;
  119. -webkit-line-clamp: 2;
  120. overflow: hidden;
  121. }
  122. }
  123. }
  124. }
  125. // 弹框
  126. .pop-up{
  127. position: fixed;
  128. top: 0;
  129. left: 0;
  130. right: 0;
  131. bottom: 0;
  132. background: rgba(0, 0, 0, 0.5);
  133. z-index: 999;
  134. .pop_content{
  135. max-width: 1200px;
  136. width: 640px;
  137. background: #fff;
  138. position: absolute;
  139. top: 50%;
  140. left: 50%;
  141. transform: translate(-50%, -50%);
  142. padding: 10px;
  143. .pop_img{
  144. box-shadow: 0px 0px 18px 0px rgba(0,0,0,0.3);
  145. // margin-top: 20px;
  146. border-radius: 20px;
  147. position: relative;
  148. .hea_icon{
  149. position: absolute;
  150. top: 10px;
  151. right: 10px;
  152. color: #035AA8;
  153. font-size: 28px;
  154. font-weight: 600;
  155. cursor: pointer;
  156. }
  157. .image{
  158. display: block;
  159. width: 100%
  160. }
  161. }
  162. }
  163. }
  164. </style>