【PT.SCC实名制管理系统】24.10.01 -30天,考勤打卡小程序
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.

69 lines
1.4 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. function query(self, queryParams){
  2. // return (self.beforeGetData && self.beforeGetData()) ||
  3. // queryParams || self.queryParams
  4. // 深度合并对象
  5. return self.$utils.deepMergeObject(
  6. self.$utils.deepMergeObject(self.queryParams,
  7. (self.beforeGetData && self.beforeGetData()) || {}),
  8. queryParams)
  9. }
  10. export default {
  11. data() {
  12. return {
  13. queryParams: {
  14. pageNo: 1,
  15. pageSize: 10,
  16. },
  17. total : 0,
  18. list : [],
  19. }
  20. },
  21. onPullDownRefresh() {
  22. this.getData()
  23. },
  24. onReachBottom() {
  25. this.loadMoreData()
  26. },
  27. onShow() {
  28. this.getData()
  29. },
  30. methods: {
  31. getData(queryParams){
  32. return new Promise((success, error) => {
  33. if(!this.mixinsListApi){
  34. return console.error('mixinsListApi 缺失');
  35. }
  36. this.$api(this.mixinsListApi,
  37. query(this, queryParams), res => {
  38. uni.stopPullDownRefresh()
  39. if(res.code == 200){
  40. this.getDataThen && this.getDataThen(res.result.records, res.result.total, res.result)
  41. success(res.result)
  42. this[this.mixinsListKey || 'list'] = res.result.records || res.result
  43. this.total = res.result.total || res.result.length
  44. }
  45. })
  46. })
  47. },
  48. loadMoreData(){
  49. console.log('loadMoreData----', this.queryParams.pageSize < this.total);
  50. if(this.queryParams.pageSize < this.total){
  51. this.queryParams.pageSize += 10
  52. this.getData()
  53. }
  54. },
  55. }
  56. }