球星卡微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.0 KiB

  1. <template>
  2. <view style="padding-bottom: 30px;">
  3. <view class="notify-panel" v-for="(item,index) in datas" :key="index" @click="toDetail(item)">
  4. <view class="notify-panel-top">
  5. <view class="notify-dot"></view>
  6. <view class="notify-tips">收到一条新消息</view>
  7. <view class="notify-time">{{item.create_time}}</view>
  8. </view>
  9. <view class="notify-panel-bottom">{{item.title}}</view>
  10. </view>
  11. <u-loadmore :status="status" />
  12. </view>
  13. </template>
  14. <script>
  15. import { notify } from '@/service/index.js';
  16. export default {
  17. onReachBottom(){
  18. console.log("onReachBottom")
  19. if(this.status == 'loadmore'){
  20. this.fetchDatas(this.page + 1)
  21. }
  22. },
  23. onLoad(){
  24. this.fetchDatas()
  25. },
  26. data() {
  27. return {
  28. datas:[],
  29. page:1,
  30. status: 'nomore',
  31. }
  32. },
  33. methods: {
  34. async fetchDatas(page = 1){
  35. let res = await notify(page)
  36. if(res.data.datas.current_page == 1){
  37. this.datas = res.data.datas.data
  38. }else{
  39. this.datas = this.datas.concat(res.data.datas.data)
  40. }
  41. if(res.data.datas.prev_page_url){
  42. this.status ='loadmore'
  43. }else{
  44. this.status = 'nomore'
  45. }
  46. this.page = res.data.datas.current_page
  47. console.log("fetchDatas",res)
  48. },
  49. toDetail(item){
  50. this.$url('/packages/article/article?type=notify_detail&id='+item.id)
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="scss">
  56. .notify-panel{
  57. display: flex;
  58. flex-direction: column;
  59. background-color: white;
  60. margin-bottom: 10rpx;
  61. }
  62. .notify-panel-top{
  63. display: flex;
  64. align-items: center;
  65. margin-left: 32rpx;
  66. padding-top: 20rpx;
  67. padding-bottom: 20rpx;
  68. }
  69. .notify-dot {
  70. width: 12rpx;
  71. height: 12rpx;
  72. background-color: red;
  73. border-radius: 6rpx;
  74. margin-right: 10rpx;
  75. }
  76. .notify-panel-bottom{
  77. margin-left: 32rpx;
  78. margin-bottom: 30rpx;
  79. font-size: 28rpx;
  80. line-height: 40rpx;
  81. color: #222222;
  82. }
  83. .notify-tips{
  84. margin-right: 110rpx;
  85. font-size: 32rpx;
  86. font-weight: 500;
  87. color: #222222;
  88. line-height: 44rpx;
  89. }
  90. .notify-time{
  91. font-size: 28rpx;
  92. font-weight: 400;
  93. color: #777777;
  94. line-height: 40rpx;
  95. }
  96. </style>