emailInfo.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view style="padding:0 40rpx 20rpx;box-sizing: border-box;" v-if="content != null">
  3. <view style="font-size: 34rpx;font-weight: bold;color: #303133;margin-top: 20rpx;">
  4. {{content.mainTitle}}
  5. </view>
  6. <view style="font-size: 30rpx;color:#606266;padding: 20rpx 0;" v-if="type==1">
  7. 发件人:{{content.sendUserName}}
  8. </view>
  9. <view style="font-size: 30rpx;color:#606266;padding: 20rpx 0;" v-else>
  10. 收件人:{{recipient}}
  11. </view>
  12. <view style="font-size: 28rpx;color:#909399;margin-bottom: 20rpx;">
  13. {{$u.timeFormat(content.sendTime, 'yyyy-mm-dd hh:MM:ss')}}
  14. </view>
  15. <u-divider></u-divider>
  16. <view>
  17. <u-parse :content="content.mailContent"></u-parse>
  18. </view>
  19. <view style="border-radius: 8rpx;background-color: #f3f3f3;margin-top: 40rpx;padding: 20rpx 40rpx;" v-if="content.files != null && content.files.length != 0">
  20. <view style="display: flex;align-items: center;margin-bottom: 20rpx;f">
  21. <u-icon name="file-text-fill" color="#000"></u-icon>
  22. 附件
  23. </view>
  24. <view style="margin-bottom: 30rpx;" v-for="v in content.files" :key="v.fileId">
  25. <u--text :lines="1" size="15" color="#2979FF" decoration="underline" :text="v.name" @click="downLoad(v.path)"></u--text>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. content:null,
  35. type:null,
  36. recipient:null,
  37. list1:[],
  38. list2:[]
  39. }
  40. },
  41. onLoad(options){
  42. this.type = options.type
  43. this.getEmailInfo(options.id)
  44. if(options.type==2){
  45. this.getRecipient(options.id)
  46. }
  47. },
  48. methods: {
  49. //查询邮件信息
  50. getEmailInfo(id){
  51. uni.$u.http.get('/oa/mail/detail/'+id).then(res=>{
  52. // console.log(res)
  53. this.content = res.data
  54. })
  55. },
  56. //获取收件人
  57. getRecipient(id){
  58. uni.$u.http.get('/oa/mail/select/users/'+id).then(res=>{
  59. // console.log(res)
  60. this.recipient = res.join('、')
  61. })
  62. },
  63. //下载附件
  64. downLoad(v){
  65. let that = this
  66. uni.showLoading({
  67. title:"打开中...",
  68. })
  69. if(that.list1.indexOf(v) == -1){
  70. uni.downloadFile({
  71. url:getApp().globalData.saveUrl+ v,
  72. success: function(res) {
  73. if (res.statusCode === 200) {
  74. that.list1.push(v)
  75. that.list2.push(res.tempFilePath)
  76. uni.openDocument({
  77. filePath: res.tempFilePath,
  78. success: function (res) {
  79. uni.hideLoading();
  80. }
  81. });
  82. }else{
  83. uni.hideLoading()
  84. uni.showToast({
  85. title:"下载失败",
  86. icon:'none'
  87. })
  88. }
  89. },fail:function(){
  90. uni.hideLoading()
  91. uni.showToast({
  92. title:"下载失败",
  93. icon:'none'
  94. })
  95. }
  96. });
  97. }else{
  98. uni.openDocument({
  99. filePath: that.list2[that.list1.indexOf(v)],
  100. success: function (res) {
  101. uni.hideLoading();
  102. }
  103. });
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. </style>