message.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in tabList" :key="index" class="flex-sub" style="position: relative;"
  5. @click="tabClicks(item.state)">
  6. <view class="nav-item" :class="{ current: tabFromIndex === item.state }">{{ item.text }}<view class="ban" v-if="tabFromIndex === item.state"></view></view>
  7. <!-- <view class="text-center" style="margin-top: -30upx;">
  8. <image v-if="tabFromIndex === item.state " src="../../static/image/index/wx.png" style="width: 55upx;height: 16upx;margin-top: -5upx;"></image>
  9. </view> -->
  10. </view>
  11. </view>
  12. <view style="position: fixed; top: 80rpx;width: 100%; height: 100%; left: 0%;">
  13. <view v-for="(item, index) in list" :key="index" class="item" @click="goDet(item)">
  14. <view class="flex justify-between"
  15. style="font-size: 30upx;width: 100%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap">
  16. <view style="color: #333333;">{{ item.title }}</view>
  17. <view v-if="item.isSee == 0"
  18. style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
  19. </view>
  20. </view>
  21. <view style="color: #999999;font-size: 28upx;margin-top: 10upx;">{{ item.content }}</view>
  22. <view style="margin-top: 10upx;color: #999999;font-size: 28upx;text-align: right;">{{ item.createAt }}
  23. </view>
  24. <view v-if="list.length-1!=index" style="width: 100%;height: 1rpx;background: #f5f5f5;margin-top: 30upx;"></view>
  25. </view>
  26. </view>
  27. <!-- <view v-if="list.length === 0" style="background: #1c1b20;text-align: center;padding-top: 140upx;color: #FFFFFF;">暂无消息</view> -->
  28. <empty v-if="list.length === 0" content="暂无消息" show="false" style="height: 100vh;"></empty>
  29. </view>
  30. </template>
  31. <script>
  32. import empty from '@/components/empty';
  33. export default {
  34. components: {
  35. empty
  36. },
  37. data() {
  38. return {
  39. tabFromIndex: 0,
  40. tabCurrentIndex: 0,
  41. fromInfo: 5,
  42. list: [],
  43. page: 1,
  44. limit: 10,
  45. scrollTop: false,
  46. tabList: [
  47. {
  48. state: 0,
  49. text: '全部',
  50. totalElements: 0
  51. },
  52. {
  53. state: 7,
  54. text: '订单消息',
  55. totalElements: 0
  56. },
  57. {
  58. state: 5,
  59. text: '系统通知',
  60. totalElements: 0
  61. },
  62. {
  63. state: 19,
  64. text: '乘客消息',
  65. totalElements: 0
  66. },
  67. {
  68. state: 20,
  69. text: '活动通知',
  70. totalElements: 0
  71. },
  72. ]
  73. };
  74. },
  75. onPageScroll: function(e) {
  76. this.scrollTop = e.scrollTop > 200;
  77. },
  78. onReachBottom: function() {
  79. this.page = this.page + 1;
  80. this.loadData();
  81. },
  82. onPullDownRefresh: function() {
  83. this.page = 1;
  84. this.loadData();
  85. },
  86. onLoad(options) {
  87. this.$queue.showLoading("加载中...")
  88. this.loadData();
  89. },
  90. methods: {
  91. goDet(item) {
  92. if(item.platform){
  93. if(item.title === '消息未读通知'){
  94. uni.navigateTo({
  95. url: '/my/kefu/im?chatConversationId=' + item.platform +
  96. '&byUserId=' + item.byUserId + '&ordersId=' + (item.ordersId ? item.ordersId : '')
  97. })
  98. }
  99. }
  100. },
  101. //顶部渠道点击
  102. tabClicks(index) {
  103. this.list = [];
  104. this.page = 1;
  105. this.tabFromIndex = index;
  106. this.$queue.showLoading("加载中...")
  107. this.loadData();
  108. },
  109. //获取消息列表
  110. loadData() {
  111. let that = this;
  112. let number = 10;
  113. let token = this.$queue.getData('token');
  114. if (token) {
  115. let data = {
  116. page: this.page,
  117. limit: this.limit,
  118. state: this.tabFromIndex
  119. }
  120. this.$Request.getT('/app/message/selectMessageByUserId', data).then(res => {
  121. if (res.code === 0) {
  122. if (this.page == 1) {
  123. this.list = res.data.records
  124. } else {
  125. res.data.records.forEach(d => {
  126. this.list.push(d);
  127. });
  128. }
  129. }
  130. uni.hideLoading();
  131. uni.stopPullDownRefresh();
  132. });
  133. }
  134. }
  135. }
  136. };
  137. </script>
  138. <style lang="scss">
  139. page,
  140. page {
  141. background: #ffffff;
  142. }
  143. .content {
  144. background: #ffffff;
  145. height: 100%;
  146. }
  147. .swiper-box {
  148. height: calc(100% - 40px);
  149. }
  150. .list-scroll-content {
  151. height: 100%;
  152. }
  153. .navbar {
  154. display: flex;
  155. height: 40px;
  156. padding: 0 5px;
  157. // background: #1E1F31;
  158. // box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  159. color: #000000;
  160. position: relative;
  161. background: #FFFFFF;
  162. position: fixed;
  163. /* #ifdef H5 */
  164. top:80upx;
  165. /* #endif */
  166. /* #ifndef H5 */
  167. top: 0;
  168. /* #endif */
  169. left: 0;
  170. right: 0;
  171. z-index: 10;
  172. .nav-item {
  173. display: flex;
  174. justify-content: center;
  175. align-items: center;
  176. height: 100%;
  177. font-size: 15px;
  178. // color: #FFFFFF;
  179. position: relative;
  180. &.current {
  181. color: #fe6b01;
  182. // &:after {
  183. // content: '';
  184. // position: absolute;
  185. // left: 50%;
  186. // bottom: 0;
  187. // transform: translateX(-50%);
  188. // width: 44px;
  189. // height: 0;
  190. // border-bottom: 2px solid #557EFD;
  191. // }
  192. }
  193. }
  194. }
  195. .uni-swiper-item {
  196. height: auto;
  197. }
  198. page {
  199. background-color: #F7F7F7;
  200. }
  201. .item {
  202. background: #FFFFFF;
  203. padding: 16rpx;
  204. margin: 16rpx;
  205. font-size: 28rpx;
  206. // box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
  207. border-radius: 16upx;
  208. }
  209. /* load-more */
  210. .uni-load-more {
  211. display: flex;
  212. flex-direction: row;
  213. height: 40px;
  214. align-items: center;
  215. justify-content: center;
  216. }
  217. .uni-load-more__text {
  218. font-size: 14px;
  219. // color: #999;
  220. }
  221. .uni-load-more__img {
  222. height: 24px;
  223. width: 24px;
  224. margin-right: 10px;
  225. }
  226. .uni-load-more__img>view {
  227. position: absolute;
  228. }
  229. .uni-load-more__img>view view {
  230. width: 6px;
  231. height: 2px;
  232. border-top-left-radius: 1px;
  233. border-bottom-left-radius: 1px;
  234. background: #999;
  235. position: absolute;
  236. opacity: 0.2;
  237. transform-origin: 50%;
  238. animation: load 1.56s ease infinite;
  239. }
  240. .uni-load-more__img>view view:nth-child(1) {
  241. transform: rotate(90deg);
  242. top: 2px;
  243. left: 9px;
  244. }
  245. .uni-load-more__img>view view:nth-child(2) {
  246. transform: rotate(180deg);
  247. top: 11px;
  248. right: 0;
  249. }
  250. .uni-load-more__img>view view:nth-child(3) {
  251. transform: rotate(270deg);
  252. bottom: 2px;
  253. left: 9px;
  254. }
  255. .uni-load-more__img>view view:nth-child(4) {
  256. top: 11px;
  257. left: 0;
  258. }
  259. .load1,
  260. .load2,
  261. .load3 {
  262. height: 24px;
  263. width: 24px;
  264. }
  265. .load2 {
  266. transform: rotate(30deg);
  267. }
  268. .load3 {
  269. transform: rotate(60deg);
  270. }
  271. .load1 view:nth-child(1) {
  272. animation-delay: 0s;
  273. }
  274. .load2 view:nth-child(1) {
  275. animation-delay: 0.13s;
  276. }
  277. .load3 view:nth-child(1) {
  278. animation-delay: 0.26s;
  279. }
  280. .load1 view:nth-child(2) {
  281. animation-delay: 0.39s;
  282. }
  283. .load2 view:nth-child(2) {
  284. animation-delay: 0.52s;
  285. }
  286. .load3 view:nth-child(2) {
  287. animation-delay: 0.65s;
  288. }
  289. .load1 view:nth-child(3) {
  290. animation-delay: 0.78s;
  291. }
  292. .load2 view:nth-child(3) {
  293. animation-delay: 0.91s;
  294. }
  295. .load3 view:nth-child(3) {
  296. animation-delay: 1.04s;
  297. }
  298. .load1 view:nth-child(4) {
  299. animation-delay: 1.17s;
  300. }
  301. .load2 view:nth-child(4) {
  302. animation-delay: 1.3s;
  303. }
  304. .load3 view:nth-child(4) {
  305. animation-delay: 1.43s;
  306. }
  307. .ban {
  308. width: 50%;
  309. height: 5rpx;
  310. background: #fe6b01;
  311. opacity: 0.7;
  312. position: absolute;
  313. top: 62rpx;
  314. // margin-left: 25%;
  315. }
  316. @-webkit-keyframes load {
  317. 0% {
  318. opacity: 1;
  319. }
  320. 100% {
  321. opacity: 0.2;
  322. }
  323. }
  324. </style>