e-file.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view>
  3. <view class="fileList">
  4. <view class="title" v-if="fileList[0].title">{{fileList[0].title}}</view>
  5. <view class="list">
  6. <view class="item" v-for="item in fileList" :key="item.id" @click="detail(item.filePath,item.fileName)">
  7. <view class="icon">
  8. <!-- <uni-icons type="paperplane" size="30" color="#009FE8"></uni-icons> -->
  9. <image v-if="item.filePath.indexOf('.doc') != -1" src="./icon/wj-doc.png"></image>
  10. <image v-if="item.filePath.indexOf('.xls') != -1" src="./icon/wj-xls.png"></image>
  11. <image v-if="item.filePath.indexOf('.pdf') != -1" src="./icon/wj-pdf.png"></image>
  12. <image v-if="item.filePath.indexOf('.ppt') != -1" src="./icon/wj-ppt.png"></image>
  13. </view>
  14. <view>
  15. <view class="name">{{item.fileName}}</view>
  16. <view class="size">{{item.fileSize}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. props: [
  26. "fileList"
  27. ],
  28. data() {
  29. return {
  30. };
  31. },
  32. methods: {
  33. detail(filePath,name) {
  34. uni.downloadFile({
  35. url: filePath,
  36. success: function(res) {
  37. var filePath = res.tempFilePath;
  38. uni.openDocument({
  39. filePath: filePath,
  40. success: function(res) {
  41. console.log('打开文档成功');
  42. }
  43. });
  44. }
  45. });
  46. // #ifndef APP-PLUS
  47. uni.navigateTo({
  48. // url:"../../pages/file/file?path=" + filePath + "&name=" + name,
  49. url:"../../pages/record/record_link/record_link?name=" + name + "&url=" + filePath
  50. })
  51. // #endif
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .fileList {
  58. .title {
  59. line-height: 30px;
  60. border-left: 4px solid #009FE8;
  61. border-radius: 4px;
  62. padding-left: 10px;
  63. margin-bottom: 10px;
  64. }
  65. .list {
  66. .item {
  67. padding: 20rpx 25rpx;
  68. border-bottom: 1px solid #f4f4f4;
  69. display: flex;
  70. align-items: center;
  71. .icon {
  72. padding-right: 30rpx;
  73. image{
  74. width: 52rpx;
  75. height: 72rpx;
  76. }
  77. }
  78. .name {
  79. width: 540rpx;
  80. white-space: nowrap;
  81. overflow: hidden;
  82. text-overflow: ellipsis;
  83. }
  84. .size {
  85. font-size: 14px;
  86. color: #999;
  87. }
  88. }
  89. }
  90. }
  91. </style>