enclosures.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="center">
  3. <view class="c-list">
  4. <view class="xinxiup">
  5. <view class='xinxiup-title'>{{title}}</view>
  6. <view style='width:100%;' class='flex justify-between fujian align-item-center' v-for="item in list">
  7. <view style='flex:2;' class="flex align-item-center">
  8. <view><image style='width:25px;height:25px;position:relative;top:2px;' src="../../static/img/contract/pdf@3x.png" mode=""></image></view>
  9. <view>
  10. <text class="tit">{{item.appendixName}}</text>
  11. <view style='color:#B0B3BF;font-size:12px;'>{{item.appendixSize}}</view>
  12. </view>
  13. </view>
  14. <view style='flex:1;'>
  15. <image @click="download(item.appendixPath)" style='width:15px;height:15px;' src="../../static/img/contract/xiazai@3x.png" mode=""></image>
  16. </view>
  17. <!-- <view class="c-row b-b">
  18. <text class="tit">{{item.appendixPath}}</text>
  19. </view> -->
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: "trust",
  28. data() {
  29. return {
  30. list:[],
  31. title:""
  32. };
  33. },
  34. onLoad(param) {
  35. var that = this
  36. this.$api.doRequest('get', '/appendix/query/getFileList', {appendixIds:param.addressUrl}).then(res => {
  37. if (res.data.code == 200) {
  38. that.list = res.data.data
  39. that.title = "共"+that.list.length+"个附件"
  40. } else {
  41. uni.showToast({
  42. title: res.data.message,
  43. icon: 'none',
  44. duration: 2000
  45. })
  46. }
  47. })
  48. .catch(res => {
  49. if(res.errmsg){
  50. uni.showToast({
  51. title: res.errmsg,
  52. icon: 'none',
  53. duration: 2000
  54. })
  55. }
  56. else{
  57. uni.showToast({
  58. title: "系统异常,请联系管理员",
  59. icon: 'none',
  60. duration: 2000
  61. })
  62. }
  63. });
  64. },
  65. methods: {
  66. download(path){
  67. uni.downloadFile({
  68. url: path,
  69. success: function (res) {
  70. var filePath = res.tempFilePath;
  71. uni.saveFile({
  72. tempFilePath: filePath,
  73. success: function (res) {
  74. var savedFilePath = res.savedFilePath;
  75. uni.showModal({
  76. title: '提示',
  77. content: '下载成功,是否打开文件?',
  78. showCancel: true,
  79. success: (e) => {
  80. if (e.confirm) {
  81. uni.openDocument({
  82. filePath: savedFilePath,
  83. success: function (res) {
  84. uni.showToast({
  85. title: "打开成功",
  86. icon: 'none',
  87. duration: 2000
  88. })
  89. }
  90. });
  91. }
  92. },
  93. fail: () => {},
  94. complete: () => {}
  95. })
  96. }
  97. });
  98. },
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped>
  105. page{
  106. background:#F5F6FA;
  107. }
  108. .center{
  109. background:#fff;
  110. margin:10px;
  111. padding:29rpx;
  112. }
  113. .xinxiup-title{
  114. padding-bottom:10px;border-bottom:1px solid #EEEEEE;
  115. }
  116. .fujian{
  117. padding:10px 0;
  118. }
  119. .tit{
  120. font-size:16px;
  121. }
  122. </style>