inbox.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view>
  3. <view style="padding: 20rpx;background-color: #fff;">
  4. <u-search v-model="model.mainTitle" placeholder="请输入邮件标题" :showAction="true" actionText="搜索"
  5. :animation="true" @custom="search" @clear="search">
  6. </u-search>
  7. </view>
  8. <view style="background-color: #fff;">
  9. <u-cell-group>
  10. <u-cell v-for="(v,i) in list" :key="v.mailId" :title="v.mainTitle" :titleStyle="{fontSize:'30rpx'}"
  11. :value="showtime($u.timeFormat(v.sendTime, 'yyyy-mm-dd'))" @click="emailInfo(v.mailId,i)">
  12. </u-cell>
  13. </u-cell-group>
  14. </view>
  15. <view style="padding: 20rpx;" v-show="status != 'loadmore'">
  16. <u-loadmore :status="status" fontSize="28rpx" />
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {showtime} from "@/utils/wjw.js"
  22. export default {
  23. data() {
  24. return {
  25. model: {
  26. pageNum: 1,
  27. pageSize: 20,
  28. mainTitle: null
  29. },
  30. total: 0,
  31. //加载状态
  32. status: 'loadmore',
  33. //邮件列表
  34. list: [],
  35. //搜索
  36. keyword: null,
  37. showtime:showtime,
  38. }
  39. },
  40. onLoad() {
  41. let that = this
  42. this.getList()
  43. },
  44. onShow() {
  45. },
  46. onPullDownRefresh() {
  47. this.model.pageNum = 1
  48. this.list = []
  49. this.getList()
  50. },
  51. onReachBottom() {
  52. if (this.model.pageNum == this.total) {
  53. this.status = 'nomore'
  54. } else {
  55. this.model.pageNum++
  56. this.getList()
  57. }
  58. },
  59. methods: {
  60. //查询邮件列表
  61. getList() {
  62. let that = this
  63. uni.$u.http.get('/oa/mail/yfList', {
  64. params: that.model
  65. }).then(res => {
  66. uni.hideLoading()
  67. that.list = [...that.list, ...res.rows]
  68. if (res.total < this.model.pageSize) {
  69. that.status = "nomore"
  70. } else {
  71. that.status = "loadmore"
  72. }
  73. if (that.model.pageNum === 1) {
  74. that.total = Math.ceil(res.total / that.model.pageSize)
  75. uni.stopPullDownRefresh()
  76. }
  77. })
  78. },
  79. //查看邮件详细信息
  80. emailInfo(id, i) {
  81. if (this.list[i].isRead == 'N') {
  82. this.list[i].isRead = 'Y'
  83. }
  84. uni.navigateTo({
  85. url: "/pages/emailInfo/emailInfo?id=" + id+'&type=2'
  86. })
  87. },
  88. //根据标题搜索邮件内容
  89. search() {
  90. uni.showLoading({
  91. title: "搜索中...",
  92. mask: true
  93. })
  94. this.pageNum = 1
  95. this.list = []
  96. this.getList()
  97. }
  98. }
  99. }
  100. </script>
  101. <style>
  102. </style>