message.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. margin: 0 16rpx 16rpx 16rpx;
  183. font-size: 28rpx;
  184. // box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
  185. // border-radius: 16upx;
  186. border-bottom: 1rpx solid #E6E6E6;
  187. }
  188. /* load-more */
  189. .uni-load-more {
  190. display: flex;
  191. flex-direction: row;
  192. height: 40px;
  193. align-items: center;
  194. justify-content: center;
  195. }
  196. .uni-load-more__text {
  197. font-size: 14px;
  198. // color: #999;
  199. }
  200. .uni-load-more__img {
  201. height: 24px;
  202. width: 24px;
  203. margin-right: 10px;
  204. }
  205. .uni-load-more__img>view {
  206. position: absolute;
  207. }
  208. .uni-load-more__img>view view {
  209. width: 6px;
  210. height: 2px;
  211. border-top-left-radius: 1px;
  212. border-bottom-left-radius: 1px;
  213. background: #999;
  214. position: absolute;
  215. opacity: 0.2;
  216. transform-origin: 50%;
  217. animation: load 1.56s ease infinite;
  218. }
  219. .uni-load-more__img>view view:nth-child(1) {
  220. transform: rotate(90deg);
  221. top: 2px;
  222. left: 9px;
  223. }
  224. .uni-load-more__img>view view:nth-child(2) {
  225. transform: rotate(180deg);
  226. top: 11px;
  227. right: 0;
  228. }
  229. .uni-load-more__img>view view:nth-child(3) {
  230. transform: rotate(270deg);
  231. bottom: 2px;
  232. left: 9px;
  233. }
  234. .uni-load-more__img>view view:nth-child(4) {
  235. top: 11px;
  236. left: 0;
  237. }
  238. .load1,
  239. .load2,
  240. .load3 {
  241. height: 24px;
  242. width: 24px;
  243. }
  244. .load2 {
  245. transform: rotate(30deg);
  246. }
  247. .load3 {
  248. transform: rotate(60deg);
  249. }
  250. .load1 view:nth-child(1) {
  251. animation-delay: 0s;
  252. }
  253. .load2 view:nth-child(1) {
  254. animation-delay: 0.13s;
  255. }
  256. .load3 view:nth-child(1) {
  257. animation-delay: 0.26s;
  258. }
  259. .load1 view:nth-child(2) {
  260. animation-delay: 0.39s;
  261. }
  262. .load2 view:nth-child(2) {
  263. animation-delay: 0.52s;
  264. }
  265. .load3 view:nth-child(2) {
  266. animation-delay: 0.65s;
  267. }
  268. .load1 view:nth-child(3) {
  269. animation-delay: 0.78s;
  270. }
  271. .load2 view:nth-child(3) {
  272. animation-delay: 0.91s;
  273. }
  274. .load3 view:nth-child(3) {
  275. animation-delay: 1.04s;
  276. }
  277. .load1 view:nth-child(4) {
  278. animation-delay: 1.17s;
  279. }
  280. .load2 view:nth-child(4) {
  281. animation-delay: 1.3s;
  282. }
  283. .load3 view:nth-child(4) {
  284. animation-delay: 1.43s;
  285. }
  286. @-webkit-keyframes load {
  287. 0% {
  288. opacity: 1;
  289. }
  290. 100% {
  291. opacity: 0.2;
  292. }
  293. }
  294. </style>