mail.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="view">
  3. <cu-custom bgColor="bg-blue" backUrl="/pages/index/index" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content"> 站内信</block>
  6. </cu-custom>
  7. <view class="cu-bar search bg-white">
  8. <view class="search-form round">
  9. <text class="cuIcon-search"></text>
  10. <input :adjust-position="false" v-model="curWord" type="text" @input="inputWord" placeholder="搜索" confirm-type="search"></input>
  11. </view>
  12. <view class="action">
  13. <button class="cu-btn bg-blue shadow-blur round" >搜索</button>
  14. </view>
  15. </view>
  16. <view class="cu-list menu sm-border menuCard card-menu margin-top">
  17. <view class="cu-item arrow" @tap="toInbox">
  18. <view class="content">
  19. <text class="cuIcon-mail text-yellow"></text>
  20. <text class="text-grey">收件箱</text>
  21. </view>
  22. <view class="action">
  23. <view class="text-grey ">{{noReadCount}}/{{mailBoxCount}}</view>
  24. </view>
  25. </view>
  26. <view class="cu-item arrow" @tap="toOutbox">
  27. <view class="content">
  28. <text class="cuIcon-forward text-green"></text>
  29. <text class="text-grey">已发送</text>
  30. </view>
  31. <view class="action">
  32. <view class="text-grey ">{{mailComposeCount}}</view>
  33. </view>
  34. </view>
  35. <view class="cu-item arrow" @tap="toDraft">
  36. <button class="cu-btn content" open-type="contact">
  37. <text class="cuIcon-post text-grey"></text>
  38. <text class="text-grey">草稿箱</text>
  39. </button>
  40. <view class="action">
  41. <view class="text-grey ">{{mailDraftCount}}</view>
  42. </view>
  43. </view>
  44. <view class="cu-item arrow" @tap="toTrash">
  45. <button class="cu-btn content" open-type="contact">
  46. <text class="cuIcon-delete text-red"></text>
  47. <text class="text-grey">已删除</text>
  48. </button>
  49. <view class="action">
  50. <view class="text-grey ">{{mailTrashCount}}</view>
  51. </view>
  52. </view>
  53. </view>
  54. <uni-fab
  55. :pattern=" {
  56. color: '#7A7E83',
  57. backgroundColor: '#fff',
  58. selectedColor: '#007AFF',
  59. buttonColor: '#007AFF'
  60. }"
  61. horizontal="right"
  62. vertical="bottom"
  63. @fabClick="toAdd"
  64. ></uni-fab>
  65. </view>
  66. </template>
  67. <script>
  68. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  69. import uniFab from '@/components/uni-fab/uni-fab.vue';
  70. import mailBoxService from "@/api/mail/mailBoxService";
  71. export default {
  72. mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
  73. data() {
  74. return {
  75. curWord:'',
  76. mailBoxCount: '',
  77. mailComposeCount: '',
  78. mailDraftCount: '',
  79. mailTrashCount: '',
  80. noReadCount: ''
  81. }
  82. },
  83. components:{
  84. uniFab
  85. },
  86. async onShow() {
  87. let {data} = await mailBoxService.queryStatus();
  88. this.mailBoxCount = data.mailBoxCount
  89. this.mailComposeCount = data.mailComposeCount
  90. this.mailDraftCount = data.mailDraftCount
  91. this.noReadCount = data.noReadCount
  92. this.mailTrashCount = data.mailTrashCount
  93. },
  94. methods: {
  95. // 输入监听
  96. inputWord(e){
  97. // this.curWord = e.detail.value // 已使用v-model,无需再次赋值
  98. // 节流,避免输入过快多次请求
  99. this.searchTimer && clearTimeout(this.searchTimer)
  100. this.searchTimer = setTimeout(()=>{
  101. },300)
  102. },
  103. toAdd (){
  104. uni.navigateTo({
  105. url: '/pages/apps/mail/sendEmailForm'
  106. })
  107. },
  108. toInbox (){
  109. uni.navigateTo({
  110. url: '/pages/apps/mail/inbox'
  111. });
  112. },
  113. toDraft () {
  114. uni.navigateTo({
  115. url: '/pages/apps/mail/draft'
  116. });
  117. },
  118. toOutbox () {
  119. uni.navigateTo({
  120. url: '/pages/apps/mail/outbox'
  121. });
  122. },
  123. toTrash () {
  124. uni.navigateTo({
  125. url: '/pages/apps/mail/trash'
  126. });
  127. }
  128. }
  129. }
  130. </script>
  131. <style>
  132. .ellipsis-description {
  133. font-size: 12px;
  134. line-height: $line-height-base;
  135. display: -webkit-box;/*作为弹性伸缩盒子模型显示*/
  136. -webkit-line-clamp: 1; /*显示的行数;如果要设置2行加...则设置为2*/
  137. overflow: hidden; /*超出的文本隐藏*/
  138. text-overflow: ellipsis; /* 溢出用省略号*/
  139. -webkit-box-orient: vertical;/*伸缩盒子的子元素排列:从上到下*/
  140. }
  141. </style>