access-record-staff.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view>
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  4. <card :list="dataList"></card>
  5. </mescroll-body>
  6. </view>
  7. </template>
  8. <script>
  9. import card from "./comps/card.vue"
  10. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  11. export default {
  12. mixins: [MescrollMixin],
  13. components:{
  14. card
  15. },
  16. data() {
  17. return {
  18. loginType:'',
  19. downOption: {
  20. auto:false
  21. },
  22. dataList:[],
  23. }
  24. },
  25. onLoad() {
  26. this.loginType=this.$cache.get('loginType')
  27. },
  28. methods: {
  29. downCallback(){
  30. setTimeout(()=>{
  31. uni.showToast({title:"刷新成功",icon:"none"})
  32. this.mescroll.resetUpScroll();
  33. },1500)
  34. },
  35. upCallback(mescroll){
  36. let params={
  37. current:mescroll.num,
  38. size:mescroll.size,
  39. userId:this.$cache.get('userId')
  40. }
  41. try{
  42. this.$api.accessrecord.page(params).then(res=>{
  43. let data=res.data.records
  44. this.mescroll.endBySize(data.length, res.total)
  45. if (mescroll.num==1) this.dataList=[]
  46. this.dataList=this.dataList.concat(data)
  47. setTimeout(()=>{
  48. this.mescroll.endBySize(data.length, res.total)
  49. },20)
  50. })
  51. }catch(e){
  52. this.mescroll.endErr();
  53. }
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. page{
  60. background-color: #FFFFFF;
  61. }
  62. </style>