mine.js 755 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // pages/mine/mine.js
  2. const { apiRequest } = require('../../utils/API.js')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. joinLength: 0,
  9. winLength: 0
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. },
  16. /**
  17. * 生命周期函数--监听页面初次渲染完成
  18. */
  19. onReady: function () {
  20. },
  21. /**
  22. * 生命周期函数--监听页面显示
  23. */
  24. onShow: function () {
  25. let that = this
  26. apiRequest('/user/lotteries').then(data => {
  27. that.setData({
  28. joinLength: data.data.end.length + data.data.not_end.length
  29. })
  30. })
  31. apiRequest('/user/lotteries/win').then(data => {
  32. that.setData({
  33. winLength: data.data.length
  34. })
  35. })
  36. }
  37. })