index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="news">
  3. <box-list :datainfo="list" :wtdt="wtdt" type="myhd" @getDetail='getDetail'></box-list>
  4. <loading></loading>
  5. </view>
  6. </template>
  7. <script>
  8. import config from '@/config'
  9. const baseUrl = config.baseUrl
  10. import boxList from "@/mine/components/box/list.vue"
  11. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  12. export default{
  13. components:{boxList},
  14. data(){
  15. return{
  16. hrimg:require('@/static/logo.png'),
  17. list:[{tit:"11"}],
  18. pageSize: 10,
  19. pageNum: 1,
  20. reachflag: true,
  21. wtdt:'',
  22. }
  23. },
  24. onLoad: function() {
  25. },
  26. onPageScroll(e) {
  27. var scrollTop = Number(e.scrollTop);
  28. // var listTop=Number(this.listTop)-Number(this.nvaHeight)
  29. if(scrollTop>2){
  30. this.scroflag=true
  31. }else{
  32. this.scroflag=false
  33. }
  34. },
  35. // 上拉触底加载更多触发事件
  36. onReachBottom() {
  37. if (this.reachflag) {
  38. this.pageNum++
  39. this.getDataFn()
  40. }
  41. },
  42. methods:{
  43. checkPermi, checkRole,
  44. // getNextFn(){
  45. // this.$tab.navigateTo("/work/pages/business/add")
  46. // },
  47. getDelFn(id){
  48. var that=this;
  49. reservDel(data).then(res=>{
  50. if(res.code==200){
  51. this.$toast("删除成功");
  52. setTimeout(function(){
  53. that.getrefreshData()
  54. },1500)
  55. }
  56. })
  57. },
  58. getrefreshData(){
  59. this.pageNum=1;
  60. this.list=[];
  61. this.reachflag=true;
  62. this.getDataFn()
  63. },
  64. getDataFn(){
  65. var params={
  66. pageSize:this.pageSize,
  67. pageNum: this.pageNum,
  68. }
  69. params.noticeType=this.tabidx
  70. getNoticeList(params).then(res=>{
  71. if(res.code==200){
  72. if (res.rows.length < this.pageSize) {
  73. this.reachflag = false
  74. this.wtdt = '到底了~';
  75. } else {
  76. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  77. if (num < res.total) {
  78. this.reachflag = true
  79. this.wtdt = ''
  80. } else {
  81. this.reachflag = false
  82. this.wtdt = '到底了~';
  83. }
  84. }
  85. if (this.pageNum == 1) {
  86. this.list = res.rows;
  87. } else {
  88. this.list = this.list.concat(res.rows)
  89. }
  90. }else{
  91. this.$toast(res.msg)
  92. }
  93. })
  94. },
  95. }
  96. }
  97. </script>
  98. <style>
  99. page{background: #F3F3F0;}
  100. </style>
  101. <style lang="scss" scoped>
  102. .news{padding:20rpx 18rpx;}
  103. </style>