message.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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>{{ 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 style="color: #999999;font-size: 28upx;margin-top: 10upx;">{{ item.content }}</view>
  18. <view style="margin-top: 10upx;color: #999999;font-size: 28upx;text-align: right;">{{ item.createAt }}
  19. </view>
  20. </view>
  21. <!-- <view v-if="list.length === 0" style="background: #1c1b20;text-align: center;padding-top: 140upx;color: #FFFFFF;">暂无消息</view> -->
  22. <empty v-if="list.length === 0" des="暂无消息" show="false"></empty>
  23. </view>
  24. </template>
  25. <script>
  26. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  27. import empty from '@/components/empty';
  28. export default {
  29. components: {
  30. uniLoadMore,
  31. empty
  32. },
  33. data() {
  34. return {
  35. tabFromIndex: 5,
  36. tabCurrentIndex: 0,
  37. fromInfo: 5,
  38. list: [],
  39. page: 1,
  40. limit: 10,
  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. };
  54. },
  55. onPageScroll: function(e) {
  56. this.scrollTop = e.scrollTop > 200;
  57. },
  58. onReachBottom: function() {
  59. this.page = this.page + 1;
  60. this.loadData();
  61. },
  62. onPullDownRefresh: function() {
  63. this.page = 1;
  64. this.loadData();
  65. },
  66. onLoad(options) {
  67. this.$queue.showLoading("加载中...")
  68. this.loadData();
  69. },
  70. methods: {
  71. goDet(e) {
  72. console.log(e.indexOf('下单'))
  73. if (e.indexOf('下单') != -1) {
  74. uni.navigateTo({
  75. url: '/my/order/index'
  76. })
  77. } else if (e.indexOf('接单') != -1) {
  78. uni.navigateTo({
  79. url: '/my/takeOrder/index'
  80. })
  81. } else if (e.indexOf('订单审核通过') != -1) {
  82. uni.navigateTo({
  83. url: '/my/publish/index'
  84. })
  85. }
  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: 100%;
  132. }
  133. .swiper-box {
  134. height: calc(100% - 40px);
  135. }
  136. .list-scroll-content {
  137. height: 100%;
  138. }
  139. .navbar {
  140. display: flex;
  141. height: 40px;
  142. padding: 0 5px;
  143. // background: #1E1F31;
  144. // box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  145. color: #000000;
  146. position: relative;
  147. z-index: 10;
  148. .nav-item {
  149. flex: 1;
  150. display: flex;
  151. justify-content: center;
  152. align-items: center;
  153. height: 100%;
  154. font-size: 15px;
  155. // color: #FFFFFF;
  156. position: relative;
  157. &.current {
  158. color: #557EFD;
  159. &:after {
  160. content: '';
  161. position: absolute;
  162. left: 50%;
  163. bottom: 0;
  164. transform: translateX(-50%);
  165. width: 44px;
  166. height: 0;
  167. border-bottom: 2px solid #557EFD;
  168. }
  169. }
  170. }
  171. }
  172. .uni-swiper-item {
  173. height: auto;
  174. }
  175. page {
  176. background-color: #F7F7F7;
  177. }
  178. .item {
  179. background: #FFFFFF;
  180. padding: 16rpx;
  181. margin: 16rpx;
  182. font-size: 28rpx;
  183. // box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
  184. border-radius: 16upx;
  185. }
  186. /* load-more */
  187. .uni-load-more {
  188. display: flex;
  189. flex-direction: row;
  190. height: 40px;
  191. align-items: center;
  192. justify-content: center;
  193. }
  194. .uni-load-more__text {
  195. font-size: 14px;
  196. // color: #999;
  197. }
  198. .uni-load-more__img {
  199. height: 24px;
  200. width: 24px;
  201. margin-right: 10px;
  202. }
  203. .uni-load-more__img>view {
  204. position: absolute;
  205. }
  206. .uni-load-more__img>view view {
  207. width: 6px;
  208. height: 2px;
  209. border-top-left-radius: 1px;
  210. border-bottom-left-radius: 1px;
  211. background: #999;
  212. position: absolute;
  213. opacity: 0.2;
  214. transform-origin: 50%;
  215. animation: load 1.56s ease infinite;
  216. }
  217. .uni-load-more__img>view view:nth-child(1) {
  218. transform: rotate(90deg);
  219. top: 2px;
  220. left: 9px;
  221. }
  222. .uni-load-more__img>view view:nth-child(2) {
  223. transform: rotate(180deg);
  224. top: 11px;
  225. right: 0;
  226. }
  227. .uni-load-more__img>view view:nth-child(3) {
  228. transform: rotate(270deg);
  229. bottom: 2px;
  230. left: 9px;
  231. }
  232. .uni-load-more__img>view view:nth-child(4) {
  233. top: 11px;
  234. left: 0;
  235. }
  236. .load1,
  237. .load2,
  238. .load3 {
  239. height: 24px;
  240. width: 24px;
  241. }
  242. .load2 {
  243. transform: rotate(30deg);
  244. }
  245. .load3 {
  246. transform: rotate(60deg);
  247. }
  248. .load1 view:nth-child(1) {
  249. animation-delay: 0s;
  250. }
  251. .load2 view:nth-child(1) {
  252. animation-delay: 0.13s;
  253. }
  254. .load3 view:nth-child(1) {
  255. animation-delay: 0.26s;
  256. }
  257. .load1 view:nth-child(2) {
  258. animation-delay: 0.39s;
  259. }
  260. .load2 view:nth-child(2) {
  261. animation-delay: 0.52s;
  262. }
  263. .load3 view:nth-child(2) {
  264. animation-delay: 0.65s;
  265. }
  266. .load1 view:nth-child(3) {
  267. animation-delay: 0.78s;
  268. }
  269. .load2 view:nth-child(3) {
  270. animation-delay: 0.91s;
  271. }
  272. .load3 view:nth-child(3) {
  273. animation-delay: 1.04s;
  274. }
  275. .load1 view:nth-child(4) {
  276. animation-delay: 1.17s;
  277. }
  278. .load2 view:nth-child(4) {
  279. animation-delay: 1.3s;
  280. }
  281. .load3 view:nth-child(4) {
  282. animation-delay: 1.43s;
  283. }
  284. @-webkit-keyframes load {
  285. 0% {
  286. opacity: 1;
  287. }
  288. 100% {
  289. opacity: 0.2;
  290. }
  291. }
  292. </style>