notifiesPage.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="bg">
  3. <view class="notifies" @click="openDetails(item)" v-for="item in dataList" :key="item.id">
  4. {{item.title}}
  5. </view>
  6. <view class="loadmore" @click="loadmore()" >
  7. {{jiazaitext}}
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import {
  13. notifiesPage
  14. } from '@/http/api/common.js'
  15. import env from "@/http/config/config.js"
  16. import * as util from '@/pages/util/util.js'
  17. export default {
  18. data() {
  19. return {
  20. dataList:[],
  21. status:'',
  22. pageSize:10,
  23. pageNum:1,
  24. jiazaitext:'加载更多',
  25. }
  26. },
  27. onLoad(e) {
  28. this.getnotifiesPage()
  29. },
  30. onReachBottom() {
  31. this.loadmore()
  32. },
  33. methods: {
  34. //加载更多
  35. loadmore(){
  36. console.log('下拉加载',this.jiazaitext);
  37. if (this.jiazaitext=="加载更多") {
  38. this.pageNum=this.pageNum+1
  39. this.jiazaitext="加载中..."
  40. this.getnotifiesPage()
  41. }
  42. },
  43. async getnotifiesPage(){
  44. let res = await notifiesPage({
  45. pageSize:this.pageSize,
  46. pageNum:this.pageNum,
  47. })
  48. if (res.data.code == 200) {
  49. let newrows = res.data.data?.rows || []
  50. this.dataList.push(...newrows)
  51. if(this.dataList.length!=res.data.data.total){
  52. this.jiazaitext="加载更多"
  53. }else{
  54. this.jiazaitext="已经到底"
  55. }
  56. }
  57. },
  58. openDetails(item){
  59. uni.navigateTo({
  60. url: '/pages/myinfo/notifiesPageDetails?id=' + item.id
  61. });
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. .bg{
  68. width: 750rpx;
  69. height: auto;
  70. min-height: 100vh;
  71. background: #F1F1F1;
  72. border-radius: 0rpx 0rpx 0rpx 0rpx;
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. }
  77. .btn{
  78. width: 702rpx;
  79. height: 80rpx;
  80. background: #46A6FF;
  81. border-radius: 64rpx 64rpx 64rpx 64rpx;
  82. opacity: 1;
  83. margin-top: 200rpx;
  84. font-size: 28rpx;
  85. font-weight: 500;
  86. color: #FFFFFF;
  87. line-height: 80rpx;
  88. text-align: center;
  89. }
  90. .loadmore{
  91. height:200rpx;
  92. text-align: center;
  93. font-size: 28rpx;
  94. font-weight: 400;
  95. color: #999;
  96. padding-top: 24rpx;
  97. }
  98. .notifies{
  99. width: 750rpx;
  100. min-height: 100rpx;
  101. line-height: 100rpx;
  102. background-color: white;
  103. text-align: left;
  104. font-size: 28rpx;
  105. margin-top: 24rpx;
  106. padding-left: 24rpx;
  107. }
  108. </style>