cooperationActiveResults.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="rf-category activityIntroduction" style="margin:20upx 20upx;">
  3. <view style="height:50upx; display: flex;">
  4. <u-image src="@/static/img/cooperationExchange/20200608_03.gif" alt=""
  5. style="height: 100%;vertical-align: middle; width: 10upx;">
  6. </u-image>
  7. <text
  8. style="margin-left: 10px;font-weight: 700;color: #000;font-size: 42upx;">{{i18n("ActivityResults")}}</text>
  9. </view>
  10. <view class="content" v-for="(item,index) in countryList">
  11. <!-- <u-image v-if="state==1" :src="'./api/file/pub/${item.attachmentSavePath}'" alt="" style="width: 20%;height: 20%;"></u-image>
  12. <u-image v-if="state==2" src="@/static/img/cooperationExchange/txt.png" alt="" class="Messicon"></u-image>
  13. <u-image v-if="state==3" src="@/static/img/cooperationExchange/excel.png" alt="" class="Messicon"></u-image>
  14. <u-image v-if="state==6" src="@/static/img/cooperationExchange/powerpoint.png" alt="" class="Messicon"></u-image>
  15. <u-image v-if="state==5" src="@/static/img/cooperationExchange/pdf.png" alt="" class="Messicon"></u-image>
  16. <u-image v-if="state==4" src="@/static/img/cooperationExchange/word.png" alt="" class="Messicon"></u-image> -->
  17. <text class="func_name">{{item.attachmentName}}</text>
  18. <view class="func_dp">
  19. <!-- <text class="func-preview" @click="preview(item.attachmentSavePath)">{{i18n('preview')}}</text> -->
  20. <text class="func-download "
  21. @click="download(item.attachmentSavePath,item.attachmentName)">{{i18n('download')}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. name: "cooperationActiveResults",
  29. props: ["id", "countryList"],
  30. data() {
  31. return {
  32. i: 0,
  33. }
  34. },
  35. methods: {
  36. download(path, fileName) {
  37. uni.downloadFile({
  38. url: websiteUrl + path, //下载地址接口返回
  39. success: (data) => {
  40. if (data.statusCode === 200) {
  41. //文件保存到本地
  42. uni.saveFile({
  43. tempFilePath: data.tempFilePath, //临时路径
  44. success: function(res) {
  45. uni.showToast({
  46. icon: 'none',
  47. mask: true,
  48. title: '文件已保存:' + res.savedFilePath, //保存路径
  49. duration: 3000,
  50. });
  51. setTimeout(() => {
  52. //打开文档查看
  53. uni.openDocument({
  54. filePath: res.savedFilePath,
  55. success: function(res) {
  56. // console.log('打开文档成功');
  57. }
  58. });
  59. }, 3000)
  60. }
  61. });
  62. }
  63. },
  64. fail: (err) => {
  65. console.log(err);
  66. uni.showToast({
  67. icon: 'none',
  68. mask: true,
  69. title: '失败请重新下载',
  70. });
  71. },
  72. });
  73. console.log('下载成功', 'https://localhost:8080/api/file/pub/' + path);
  74. },
  75. preview(url) {
  76. uni.navigateTo({
  77. url: '/pages/public/pdf?links=' + 'api/file/pub/' + url
  78. })
  79. },
  80. i18n(data) {
  81. return this.$t('common.' + data);
  82. },
  83. }
  84. }
  85. </script>
  86. <style scoped lang="scss">
  87. .rf-category {
  88. background-color: $color-white;
  89. /* #ifdef APP-PLUS */
  90. margin-top: calc(20upx + var(--status-bar-height));
  91. /* #endif */
  92. }
  93. .activityIntroduction /deep/ img {
  94. max-width: 700upx !important;
  95. }
  96. .result {
  97. height: 100%;
  98. width: 100%;
  99. margin-top: 30upx;
  100. }
  101. .content {
  102. // height: 100%;
  103. vertical-align: center;
  104. margin: 30upx 2upx;
  105. width: 100%;
  106. position: relative;
  107. display: inline-block;
  108. }
  109. .func_dp {
  110. position: absolute;
  111. top: 50%;
  112. right: 10upx;
  113. transform: translateY(-50%);
  114. display: inline-block;
  115. }
  116. .func-download {
  117. color: rgb(10, 15, 255);
  118. margin: 0upx 36upx;
  119. float: right;
  120. /* line-height: 10upx; */
  121. }
  122. .func-preview {
  123. color: rgb(10, 15, 255);
  124. margin: 0upx 12upx;
  125. cursor: pointer;
  126. // float: right;
  127. }
  128. .func_name {
  129. display: inline-block;
  130. width: 60%;
  131. // overflow: hidden;
  132. white-space: pre-wrap;
  133. }
  134. /* .Messicon {
  135. height: 60upx;
  136. margin-top: 24upx;
  137. float: left;
  138. margin-right: 20upx;
  139. } */
  140. </style>