message.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view class="content">
  3. <navBar title="消息通知" color="#000" />
  4. <view v-for="(item, index) in list" :key="index" class="item" @click="goDet(item.content)">
  5. <view class="flex justify-between"
  6. style="font-size: 30upx;width: 100%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap">
  7. <view>{{ item.title }}</view>
  8. <view v-if="item.isSee == 0"
  9. style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
  10. </view>
  11. </view>
  12. <view style="color: #999999;font-size: 28upx;margin-top: 10upx;">{{ item.content }}</view>
  13. <view style="margin-top: 10upx;color: #999999;font-size: 28upx;text-align: right;">{{ item.createAt }}
  14. </view>
  15. </view>
  16. <!-- <view v-if="list.length === 0" style="background: #1c1b20;text-align: center;padding-top: 140upx;color: #FFFFFF;">暂无消息</view> -->
  17. <empty v-if="list.length === 0" des="暂无消息" show="false"></empty>
  18. </view>
  19. </template>
  20. <script>
  21. import navBar from "@/components/nav-bar/index.vue";
  22. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  23. import empty from '@/components/empty';
  24. export default {
  25. components: {
  26. uniLoadMore,
  27. empty,
  28. navBar
  29. },
  30. data() {
  31. return {
  32. tabFromIndex: 5,
  33. tabCurrentIndex: 0,
  34. fromInfo: 5,
  35. list: [],
  36. page: 1,
  37. limit: 10,
  38. scrollTop: false,
  39. tabList: [{
  40. state: 5,
  41. text: '用户消息',
  42. totalElements: 0
  43. },
  44. {
  45. state: 4,
  46. text: '订单消息',
  47. totalElements: 0
  48. }
  49. ]
  50. };
  51. },
  52. onPageScroll: function(e) {
  53. this.scrollTop = e.scrollTop > 200;
  54. },
  55. onReachBottom: function() {
  56. this.page = this.page + 1;
  57. this.loadData();
  58. },
  59. onPullDownRefresh: function() {
  60. this.page = 1;
  61. this.loadData();
  62. },
  63. onLoad(options) {
  64. this.$queue.showLoading("加载中...")
  65. this.loadData();
  66. },
  67. methods: {
  68. goDet(e) {
  69. console.log(e.indexOf('下单'))
  70. if (e.indexOf('下单') != -1) {
  71. uni.navigateTo({
  72. url: '/my/order/index'
  73. })
  74. } else if (e.indexOf('接单') != -1) {
  75. uni.navigateTo({
  76. url: '/my/takeOrder/index'
  77. })
  78. } else if (e.indexOf('订单审核通过') != -1) {
  79. uni.navigateTo({
  80. url: '/my/publish/index'
  81. })
  82. }
  83. },
  84. goBack() {
  85. uni.navigateBack();
  86. },
  87. //顶部渠道点击
  88. tabClicks(index) {
  89. this.list = [];
  90. this.page = 1;
  91. this.tabFromIndex = index;
  92. this.$queue.showLoading("加载中...")
  93. this.loadData();
  94. },
  95. //获取消息列表
  96. loadData() {
  97. let that = this;
  98. let number = 10;
  99. let token = this.$queue.getData('token');
  100. if (token) {
  101. let data = {
  102. page: this.page,
  103. limit: this.limit,
  104. // state: this.tabFromIndex
  105. }
  106. this.$Request.getT('/app/message/selectMessageByUserId', data).then(res => {
  107. if (res.code === 0) {
  108. if (this.page == 1) {
  109. this.list = res.data.list
  110. } else {
  111. res.data.list.forEach(d => {
  112. this.list.push(d);
  113. });
  114. }
  115. }
  116. uni.hideLoading();
  117. uni.stopPullDownRefresh();
  118. });
  119. }
  120. }
  121. }
  122. };
  123. </script>
  124. <style lang="scss">
  125. page,
  126. page {
  127. background: #ffffff;
  128. }
  129. .content {
  130. background: #ffffff;
  131. height: 100vh;
  132. }
  133. .list-scroll-content {
  134. height: 100%;
  135. }
  136. .uni-swiper-item {
  137. height: auto;
  138. }
  139. .fixed-nav {
  140. height: 88rpx;
  141. display: flex;
  142. flex-direction: column;
  143. }
  144. .item {
  145. background: #FFFFFF;
  146. padding: 16rpx;
  147. // margin: 16rpx;
  148. margin: 0 16rpx 16rpx 16rpx;
  149. font-size: 28rpx;
  150. // box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
  151. // border-radius: 16upx;
  152. border-bottom: 1rpx solid #E6E6E6;
  153. }
  154. /* load-more */
  155. .uni-load-more {
  156. display: flex;
  157. flex-direction: row;
  158. height: 40px;
  159. align-items: center;
  160. justify-content: center;
  161. }
  162. .uni-load-more__text {
  163. font-size: 14px;
  164. // color: #999;
  165. }
  166. .uni-load-more__img {
  167. height: 24px;
  168. width: 24px;
  169. margin-right: 10px;
  170. }
  171. .uni-load-more__img>view {
  172. position: absolute;
  173. }
  174. .uni-load-more__img>view view {
  175. width: 6px;
  176. height: 2px;
  177. border-top-left-radius: 1px;
  178. border-bottom-left-radius: 1px;
  179. background: #999;
  180. position: absolute;
  181. opacity: 0.2;
  182. transform-origin: 50%;
  183. animation: load 1.56s ease infinite;
  184. }
  185. .uni-load-more__img>view view:nth-child(1) {
  186. transform: rotate(90deg);
  187. top: 2px;
  188. left: 9px;
  189. }
  190. .uni-load-more__img>view view:nth-child(2) {
  191. transform: rotate(180deg);
  192. top: 11px;
  193. right: 0;
  194. }
  195. .uni-load-more__img>view view:nth-child(3) {
  196. transform: rotate(270deg);
  197. bottom: 2px;
  198. left: 9px;
  199. }
  200. .uni-load-more__img>view view:nth-child(4) {
  201. top: 11px;
  202. left: 0;
  203. }
  204. .load1,
  205. .load2,
  206. .load3 {
  207. height: 24px;
  208. width: 24px;
  209. }
  210. .load2 {
  211. transform: rotate(30deg);
  212. }
  213. .load3 {
  214. transform: rotate(60deg);
  215. }
  216. .load1 view:nth-child(1) {
  217. animation-delay: 0s;
  218. }
  219. .load2 view:nth-child(1) {
  220. animation-delay: 0.13s;
  221. }
  222. .load3 view:nth-child(1) {
  223. animation-delay: 0.26s;
  224. }
  225. .load1 view:nth-child(2) {
  226. animation-delay: 0.39s;
  227. }
  228. .load2 view:nth-child(2) {
  229. animation-delay: 0.52s;
  230. }
  231. .load3 view:nth-child(2) {
  232. animation-delay: 0.65s;
  233. }
  234. .load1 view:nth-child(3) {
  235. animation-delay: 0.78s;
  236. }
  237. .load2 view:nth-child(3) {
  238. animation-delay: 0.91s;
  239. }
  240. .load3 view:nth-child(3) {
  241. animation-delay: 1.04s;
  242. }
  243. .load1 view:nth-child(4) {
  244. animation-delay: 1.17s;
  245. }
  246. .load2 view:nth-child(4) {
  247. animation-delay: 1.3s;
  248. }
  249. .load3 view:nth-child(4) {
  250. animation-delay: 1.43s;
  251. }
  252. @-webkit-keyframes load {
  253. 0% {
  254. opacity: 1;
  255. }
  256. 100% {
  257. opacity: 0.2;
  258. }
  259. }
  260. </style>