attachment.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view>
  3. <!-- <nav-bar title="基本信息"></nav-bar> -->
  4. <view class="contain flex flex-direction">
  5. <view class="title">请选择要发送的文件</view>
  6. <view class="usermain">
  7. <scroll-view scroll-with-animation scroll-y>
  8. <!-- 我的公司 -->
  9. <view @click="select(item)" class="usermain-item item-padding" v-for="item in content">
  10. <view class="usermain-item-title c-flex-center"><image :src="item.attachmentName.split('.').pop().toLowerCase() == 'pdf' ? '../../static/images/pdf.svg' : '../../static/images/docx.svg'" class="header-icon" /></view>
  11. <view class="fileContent c-flex-center">
  12. <view class="fileName m-ellipsis">{{item.attachmentName}}</view>
  13. <view class="filedesc">{{item.attachmentSize}}kb 更新于{{item.createTime}}</view>
  14. </view>
  15. <view @click.stop="seekDoc(item)" class="c-flex-center">
  16. <view class="seekview">预览</view>
  17. </view>
  18. </view>
  19. <empty size="mini" :isShow="false" v-if="content.length==0" />
  20. </scroll-view>
  21. </view>
  22. <view @click="goTo('/pages/my/attachment')" class="footer-btn">
  23. 管理附件 <u-icon name="arrow-right"></u-icon>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. // 引入组件
  30. import empty from './empty.vue'
  31. export default {
  32. components: {
  33. empty
  34. },
  35. props: {
  36. content: {
  37. type: Array,
  38. default: []
  39. }
  40. },
  41. methods: {
  42. seekDoc(it){
  43. //#ifdef APP-PLUS
  44. uni.downloadFile({
  45. url: it.attachmentAddress,
  46. success: function (res) {
  47. var filePath = res.tempFilePath;
  48. uni.openDocument({
  49. filePath: filePath,
  50. showMenu: true,
  51. success: function (res) {
  52. console.log('打开文档成功');
  53. }
  54. });
  55. }
  56. });
  57. return;
  58. //#endif
  59. uni.navigateTo({
  60. url: '/pages/index/webView?url=' + it.attachmentAddress+'&title='+it.attachmentName
  61. });
  62. },
  63. goTo(url){
  64. uni.navigateTo({
  65. url
  66. })
  67. },
  68. select(item){
  69. this.$emit('select',item)
  70. }
  71. },
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. page {
  76. /* background: #f6f6f6; */
  77. }
  78. .contain{
  79. height: 40vh;
  80. .title{
  81. padding: 25rpx 40rpx;
  82. color: #666;
  83. }
  84. }
  85. .usermain {
  86. background: #ffffff;
  87. /* color: #fff; */
  88. height: 100vh;
  89. scroll-view{
  90. height: 100%;
  91. }
  92. }
  93. .usermain-item {
  94. display: flex;
  95. justify-content: space-between;
  96. margin: 0 40rpx;
  97. padding: 30rpx 0;
  98. // border-bottom: 1rpx solid rgba(229, 229, 229, 0.3);
  99. background: #fff;
  100. flex: 1;
  101. .fileContent{
  102. width: 80%;
  103. margin:0 15rpx;
  104. }
  105. .fileName{
  106. color: #222;
  107. font-size: 32rpx;
  108. }
  109. .filedesc{
  110. margin-top: 10rpx;
  111. font-size: 24rpx;
  112. }
  113. .c-flex-center{
  114. align-self: center;
  115. color: #aaa;
  116. flex-shrink: 0;
  117. .seekview{
  118. white-space: nowrap;
  119. color: #888;
  120. }
  121. }
  122. }
  123. .usermain-item-title {
  124. color: rgba(31, 44, 55, 1);
  125. font-family: DM Sans;
  126. font-size: 28rpx;
  127. font-weight: 500;
  128. line-height: 44rpx;
  129. text-align: left;
  130. .header-icon{
  131. width: 50rpx;
  132. height: 50rpx;
  133. display: block;
  134. }
  135. }
  136. .footer-btn {
  137. text-align:center;
  138. padding: 40rpx 0;
  139. color: rgba(1, 107, 246, 1);
  140. }
  141. </style>