messageDetail.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="msg">
  3. <view class="pt-32 pl-20 pr-20">
  4. <view class="item" v-for="(item,index) in messageList" :key="index">
  5. <view class="flex-x-center fs-22 lh-30rpx text--w111-999">{{ item.add_time }}</view>
  6. <view class="w-full bg--w111-fff rd-24rpx mt-24 p-32">
  7. <view class="fs-32 lh-44rpx">{{item.title}}</view>
  8. <view class="fs-28 lh-44rpx mt-24">{{item.content}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import { messageSystem } from '@/api/user.js';
  16. export default {
  17. data() {
  18. return {
  19. page: 1,
  20. limit: 20,
  21. loading: false,
  22. finished: false,
  23. messageList: []
  24. }
  25. },
  26. onLoad() {
  27. this.getMessageList()
  28. },
  29. onReachBottom() {
  30. this.getMessageList()
  31. },
  32. methods: {
  33. getMessageList() {
  34. if (this.loading || this.finished) return
  35. this.loading = true;
  36. uni.showLoading({
  37. title: '加载中'
  38. });
  39. messageSystem({
  40. page: this.page,
  41. limit: this.limit
  42. })
  43. .then(res => {
  44. let data = res.data.list;
  45. uni.hideLoading();
  46. this.loading = false;
  47. this.messageList = this.messageList.concat(data);
  48. this.finished = data.length < this.limit;
  49. this.page += 1;
  50. })
  51. .catch(err => {
  52. uni.showToast({
  53. title: err.msg,
  54. icon: 'none'
  55. })
  56. })
  57. },
  58. }
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. .left-pic{
  63. background: linear-gradient(180deg, #FFC657 0%, #FE653B 100%);
  64. }
  65. .dot{
  66. width: 20rpx;
  67. height: 20rpx;
  68. border-radius: 50%;
  69. background-color: #e93323;
  70. }
  71. .item ~ .item{
  72. margin-top: 40rpx;
  73. }
  74. </style>