index.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="messageList_wrap">
  3. <view class="message_item" v-for="item in listData" :key="item.id">
  4. <view class="message_top" :class="{ status_0 : item.status === '0' }">
  5. {{handleMessage(item)}}
  6. </view>
  7. <view class="message_bottom">
  8. <u-icon name="clock" color="#C0C0C7"></u-icon>
  9. <text class="date">{{item.receiveTime}}</text>
  10. </view>
  11. </view>
  12. <u-loadmore :status="finished ? 'nomore' : loadStatus" icon line />
  13. </view>
  14. </template>
  15. <script>
  16. import pullUpRefresh from "@/utils/pullUpRefresh";
  17. export default {
  18. mixins : [pullUpRefresh],
  19. onLoad: function(option) {
  20. this.queryParams.type = option.type;
  21. },
  22. data() {
  23. return {
  24. queryParams: {
  25. pageSize: 10,
  26. pageNum: 1,
  27. receiveUserId : this.$store.state.user.userInfo.userId,
  28. type: undefined
  29. },
  30. }
  31. },
  32. methods : {
  33. handleMessage(item){
  34. return item.sysMessageSend.content ? item.sysMessageSend.content.replace(/<\/?.+?>/g,"").replace(/ /g,"") : "";
  35. },
  36. async getList(){
  37. const { rows } = await uni.$u.api.sysMessageReceive(this.queryParams);
  38. return rows;
  39. }
  40. },
  41. mounted() {
  42. this.handleLoadData();
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .messageList_wrap {
  48. padding: 20rpx 30rpx;
  49. .message_item {
  50. background: #fff;
  51. border-radius: 12rpx;
  52. padding: 40rpx 56rpx;
  53. margin-bottom: 20rpx;
  54. .message_top {
  55. position: relative;
  56. color: #202020;
  57. font-size: 28rpx;
  58. }
  59. .status_0 {
  60. &::before {
  61. content: "";
  62. display: inline-block;
  63. width: 12rpx;
  64. height: 12rpx;
  65. background: #ff2a2a;
  66. border-radius: 50%;
  67. position: absolute;
  68. top: 12rpx;
  69. left: -20rpx;
  70. }
  71. }
  72. .message_bottom {
  73. display: flex;
  74. margin-top: 20rpx;
  75. ::v-deep .u-icon__icon {
  76. font-size: 24rpx !important;
  77. }
  78. .date {
  79. color: #c0c0c7;
  80. font-size: 24rpx;
  81. margin-left: 10rpx;
  82. }
  83. }
  84. }
  85. }
  86. </style>