fcode.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // pages/fcode/fcode.js
  2. const getReq = require('../../config.js').getReq
  3. import recordSource from '../../utils/recordSource'
  4. let app = getApp()
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. special_datas: {},
  11. summery: [],
  12. fromSource: '',
  13. firstLoad: true
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. wx.showLoading({
  20. title: '加载中'
  21. });
  22. let self = this
  23. let fromSource = recordSource(app, `act=member_fcode&op=list&client_type=mini`)
  24. this.setData({
  25. fromSource: app.globalData.fromSource
  26. })
  27. getReq(app,{
  28. act: 'member_fcode',
  29. op: 'list',
  30. from: fromSource
  31. }, function (res) {
  32. if (res.code == 200) {
  33. self.setData({
  34. special_datas: res.datas,
  35. summery: res.datas.summary,
  36. firstLoad: false
  37. });
  38. wx.hideLoading();
  39. }
  40. })
  41. },
  42. /**
  43. * 生命周期函数--监听页面初次渲染完成
  44. */
  45. onReady: function () {
  46. },
  47. /**
  48. * 生命周期函数--监听页面显示
  49. */
  50. onShow: function () {
  51. if(!this.data.firstLoad) {
  52. app.setFromSource(this.data.fromSource)
  53. }
  54. },
  55. /**
  56. * 生命周期函数--监听页面隐藏
  57. */
  58. onHide: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面卸载
  62. */
  63. onUnload: function () {
  64. },
  65. /**
  66. * 页面相关事件处理函数--监听用户下拉动作
  67. */
  68. onPullDownRefresh: function () {
  69. },
  70. /**
  71. * 页面上拉触底事件的处理函数
  72. */
  73. onReachBottom: function () {
  74. }
  75. })