index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="content">
  3. <!-- <view class="navbar">
  4. <view v-for="(item, index) in tabList" :key="index" class="nav-item"
  5. :class="{ current: tabFromIndex === item.state }" @click="tabClicks(item.state)">
  6. {{ item.text }}
  7. </view>
  8. </view> -->
  9. <view v-for="(item, index) in list" :key="index" class="item" @click="goDet(item.content)">
  10. <view class="flex justify-between"
  11. style="font-size: 30upx;width: 100%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap">
  12. <view class="text-bold">{{ item.title }}</view>
  13. <!-- <view v-if="item.isSee == 0"
  14. style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
  15. </view> -->
  16. </view>
  17. <view class="flex justify-between">
  18. <view style="color: #999999;font-size: 28upx;margin-top: 10upx;">{{ item.content }}</view>
  19. <view style="margin-top: 10upx;color: #999999;font-size: 28upx;text-align: right;">{{ item.createAt }}
  20. </view>
  21. </view>
  22. </view>
  23. <!-- <view v-if="list.length === 0" style="background: #1c1b20;text-align: center;padding-top: 140upx;color: #FFFFFF;">暂无消息</view> -->
  24. <empty v-if="list.length === 0" des="暂无消息" show="false"></empty>
  25. </view>
  26. </template>
  27. <script>
  28. import empty from '@/components/empty';
  29. export default {
  30. components: {
  31. empty
  32. },
  33. data() {
  34. return {
  35. tabFromIndex: 5,
  36. tabCurrentIndex: 0,
  37. fromInfo: 5,
  38. list: [],
  39. page: 1,
  40. limit: 20,
  41. scrollTop: false,
  42. tabList: [{
  43. state: 5,
  44. text: '用户消息',
  45. totalElements: 0
  46. },
  47. {
  48. state: 4,
  49. text: '订单消息',
  50. totalElements: 0
  51. }
  52. ],
  53. totalCount: 0
  54. };
  55. },
  56. onPageScroll: function(e) {
  57. this.scrollTop = e.scrollTop > 200;
  58. },
  59. onLoad(options) {
  60. this.$queue.showLoading("加载中...")
  61. this.loadData();
  62. },
  63. methods: {
  64. goDet(e) {
  65. console.log(e.indexOf('下单'))
  66. if (e.indexOf('下单') != -1) {
  67. uni.navigateTo({
  68. url: '/my/order/index'
  69. })
  70. } else if (e.indexOf('接单') != -1) {
  71. uni.navigateTo({
  72. url: '/my/takeOrder/index'
  73. })
  74. } else if (e.indexOf('订单审核通过') != -1) {
  75. uni.navigateTo({
  76. url: '/my/publish/index'
  77. })
  78. }
  79. },
  80. //顶部渠道点击
  81. tabClicks(index) {
  82. this.list = [];
  83. this.page = 1;
  84. this.tabFromIndex = index;
  85. this.$queue.showLoading("加载中...")
  86. this.loadData();
  87. },
  88. //获取消息列表
  89. loadData() {
  90. let that = this;
  91. let number = 10;
  92. let token = this.$queue.getData('token');
  93. if (token) {
  94. let data = {
  95. page: this.page,
  96. limit: this.limit,
  97. // state: this.tabFromIndex
  98. }
  99. this.$Request.getT('/app/message/selectMessageByUserId', data).then(res => {
  100. if (res.code === 0) {
  101. this.totalCount = res.data.totalCount
  102. if (this.page == 1) {
  103. this.list = res.data.list
  104. } else {
  105. res.data.list.forEach(d => {
  106. this.list.push(d);
  107. });
  108. }
  109. }
  110. uni.hideLoading();
  111. uni.stopPullDownRefresh();
  112. });
  113. }
  114. }
  115. },
  116. onReachBottom: function() {
  117. if(this.list.length<this.totalCount) {
  118. this.page = this.page + 1;
  119. this.loadData()
  120. } else {
  121. uni.showToast({
  122. title: '已经到底了',
  123. icon: 'none'
  124. })
  125. }
  126. },
  127. };
  128. </script>
  129. <style lang="scss">
  130. page,
  131. page {
  132. // background: #111224;
  133. }
  134. .content {
  135. // background: #111224;
  136. height: 100%;
  137. }
  138. .navbar {
  139. display: flex;
  140. height: 40px;
  141. padding: 0 5px;
  142. // background: #1E1F31;
  143. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  144. position: relative;
  145. z-index: 10;
  146. .nav-item {
  147. flex: 1;
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. height: 100%;
  152. font-size: 15px;
  153. // color: #FFFFFF;
  154. position: relative;
  155. &.current {
  156. color: #5E81F9;
  157. &:after {
  158. content: '';
  159. position: absolute;
  160. left: 50%;
  161. bottom: 0;
  162. transform: translateX(-50%);
  163. width: 44px;
  164. height: 0;
  165. border-bottom: 2px solid #5E81F9;
  166. }
  167. }
  168. }
  169. }
  170. .item {
  171. // background: #1E1F31;
  172. padding: 16rpx 25rpx;
  173. margin: 16rpx;
  174. font-size: 28rpx;
  175. box-shadow: 7rpx 9rpx 34rpx rgba(0, 0, 0, 0.1);
  176. border-radius: 16upx;
  177. background: #fff;
  178. }
  179. </style>