index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="box">
  3. <div class="content-box">
  4. <div class="v-content">
  5. <el-row :gutter="20">
  6. <el-col :span="6" :xl="6" :lg="6" :md="8" :sm="8" :xs="12" v-for="(nav, i) in list" :key="i" class="list">
  7. <div>
  8. <div class="profile-box">
  9. <img class="profile-img" :src="nav.url" />
  10. <div class="between" style="opacity:0.9;">
  11. <a @click="downloadPdf(nav.link, nav.title)" class="center" style="cursor: pointer;">
  12. <img class="x_z" src="@/assets/img/download.png" />
  13. <span class="xz_text" style="margin-left:10px;">{{$t('Download.Download')}}</span>
  14. </a>
  15. </div>
  16. </div>
  17. <p class="v-text-size">{{nav.title}}</p>
  18. </div>
  19. </el-col>
  20. </el-row>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. export default {
  27. name: "profile",
  28. data() {
  29. return {
  30. list: this.$t("downloadList.list")
  31. };
  32. },
  33. methods: {
  34. downloadPdf(pdfUrl, title) {
  35. const loading = this.$loading({
  36. lock: true,
  37. text: this.$t('Download.loading') + '...',
  38. background: 'rgba(0, 0, 0, 0.7)'
  39. });
  40. const xhr = new XMLHttpRequest();
  41. xhr.open('GET', pdfUrl, true);
  42. xhr.responseType = 'blob';
  43. xhr.onload = () => {
  44. if (xhr.status === 200) {
  45. const blob = new Blob([xhr.response], { type: 'application/pdf' });
  46. const url = URL.createObjectURL(blob);
  47. const link = document.createElement('a');
  48. link.href = url;
  49. link.download = title +'.pdf';
  50. link.click();
  51. URL.revokeObjectURL(url);
  52. setTimeout(() => {
  53. // 关闭Loading
  54. loading.close();
  55. }, 1000);
  56. }
  57. };
  58. xhr.send()
  59. }
  60. },
  61. mounted() {},
  62. created() {
  63. }
  64. };
  65. </script>
  66. <style lang="scss" scoped>
  67. .content-box{
  68. background: #F4FAFF;
  69. .v-content{
  70. margin: auto;
  71. .list{
  72. margin-bottom: 40px;
  73. height: 478px;
  74. }
  75. .profile-box{
  76. position: relative;
  77. border-bottom-right-radius: 40px;
  78. overflow: hidden;
  79. .profile-img{
  80. max-width: 100%;
  81. transform: scale(1);
  82. transition: transform .6s linear;
  83. cursor: pointer;
  84. &:hover{
  85. transform: scale(1.1);
  86. transition: transform .6s linear;
  87. border: 1px solid #006ad7;
  88. }
  89. }
  90. .between{
  91. width: 100%;
  92. height: 56px;
  93. // opacity: 0.9;
  94. padding: 0 20px;
  95. background-color: rgba(65,145,226,1);
  96. display: flex;
  97. align-items: center;
  98. justify-content: space-between;
  99. position: absolute;
  100. left: 0;
  101. bottom: 0;
  102. z-index: 10;
  103. .center{
  104. display: flex;
  105. align-items: center;
  106. .x_z{
  107. width: 24px;
  108. height: 24px;
  109. }
  110. .xz_text{
  111. color: #fff;
  112. font-size: 16px;
  113. margin-left: 10px;
  114. }
  115. }
  116. }
  117. }
  118. .v-text-size{
  119. height: 80px;
  120. font-size: 18px;
  121. text-align: center;
  122. padding-top: 20px;
  123. }
  124. }
  125. }
  126. </style>