Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

77 Zeilen
1.9 KiB

  1. const app = getApp()
  2. const config = require("../../config/config")
  3. const Http = require("../../utils/HttpBasics.js")
  4. const util = require("../../utils/util.js")
  5. const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
  6. Page({
  7. data:{
  8. imgHttps:app.globalData.imgHttps,
  9. navigationBarHeight,
  10. list:[
  11. ],
  12. credit:"",
  13. pageNum:1,
  14. },
  15. //获取积分信息
  16. getUserData(){
  17. Http.get({
  18. url:config.api.getUserInfo
  19. }).then(res=>{
  20. this.setData({
  21. credit:res.data.credit
  22. })
  23. }).catch(err=>{
  24. tt.showToast({
  25. title: err.message ? err.message : err.data,
  26. icon: "none"
  27. });
  28. })
  29. },
  30. getList(){
  31. tt.showLoading({
  32. title: '加载中...', // 内容
  33. });
  34. Http.get({
  35. url:config.api.creditList,
  36. data:{
  37. pageNum: this.data.pageNum,
  38. pageSize: 10,
  39. }
  40. }).then(res=>{
  41. let tmepLsit = res.data.list
  42. tmepLsit.map(item=>{
  43. item.createDate = util.formatTime(item.createDate,"yyyy-MM-dd hh:mm:ss")
  44. })
  45. if(this.data.pageNum>1){
  46. let arr = this.data.list
  47. this.setData({
  48. list:[...arr,...tmepLsit]
  49. })
  50. }else{
  51. this.setData({
  52. list:tmepLsit
  53. })
  54. }
  55. tt.hideLoading();
  56. }).catch(err=>{
  57. tt.hideLoading();
  58. tt.showToast({
  59. title: err.message?err.message:err.data, // 内容
  60. });
  61. })
  62. },
  63. onLoad: function () {
  64. this.getUserData()
  65. this.getList()
  66. },
  67. onReachBottom(){
  68. console.log("到底了");
  69. this.setData({
  70. pageNum:this.data.pageNum +1
  71. })
  72. this.getList()
  73. }
  74. })