indexs.vue 1.8 KB

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