access-record.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. }
  40. if (this.loginType==this.$loginType.AGENCY) {
  41. //管理员
  42. params.tenantId=this.$cache.get('agencyTenantId')
  43. }else if (this.loginType==this.$loginType.STAFF) {
  44. //员工
  45. params.userId=this.$cache.get('userId')
  46. }else if (this.loginType==this.$loginType.ENTERPRISE) {
  47. //企业
  48. params.enterpriseId=this.$cache.get('enterpriseId')
  49. }
  50. try{
  51. this.$api.accessrecord.page(params).then(res=>{
  52. let data=res.data.records
  53. this.mescroll.endBySize(data.length, res.total)
  54. if (mescroll.num==1) this.dataList=[]
  55. this.dataList=this.dataList.concat(data)
  56. setTimeout(()=>{
  57. this.mescroll.endBySize(data.length, res.total)
  58. },20)
  59. })
  60. }catch(e){
  61. this.mescroll.endErr();
  62. }
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss">
  68. page{
  69. background-color: #FFFFFF;
  70. }
  71. </style>