C端小程序
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

104 linhas
2.0 KiB

  1. var config = require("../../config/config.js");
  2. var app = getApp();
  3. const Http = require("../../utils/HttpBasics");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. canIUse: wx.canIUse('official-account'),
  10. // user: {
  11. // avatar:
  12. // "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg"
  13. // }
  14. flag: 'hidden',
  15. score:'0'
  16. },
  17. navigateTo() {
  18. wx.navigateTo({
  19. url: `/pages/login/index`
  20. });
  21. },
  22. showVersion: function() {
  23. /**
  24. * 长按显示版本号
  25. */
  26. let that = this;
  27. if (that.data.flag == 'hidden') {
  28. that.setData({
  29. flag: 'show'
  30. });
  31. }
  32. console.log(that.data.flag)
  33. },
  34. /**
  35. * 生命周期函数--监听页面加载
  36. */
  37. onLoad: function(options) {
  38. },
  39. /**
  40. * 生命周期函数--监听页面初次渲染完成
  41. */
  42. onReady: function() {},
  43. /**
  44. * 生命周期函数--监听页面显示
  45. */
  46. onShow: function() {
  47. let that = this;
  48. let num = wx.getStorageSync('couponNum');
  49. wx.hideTabBarRedDot({
  50. index: 2
  51. });
  52. console.log("我是渲染")
  53. if (num == 'couponNum1') {
  54. wx.setStorage({
  55. key: 'couponNum',
  56. data: "couponNum1",
  57. })
  58. that.setData({
  59. couponNum: "couponNum1"
  60. })
  61. } else if (num == 'couponNum') {
  62. that.setData({
  63. couponNum: "couponNum"
  64. })
  65. };
  66. Http.get({
  67. url: config.api.getScore,
  68. data: {}
  69. }).then(res=>{
  70. console.log(res);
  71. that.setData({
  72. score: res.data.score
  73. })
  74. })
  75. },
  76. /**
  77. * 生命周期函数--监听页面隐藏
  78. */
  79. onHide: function() {},
  80. /**
  81. * 生命周期函数--监听页面卸载
  82. */
  83. onUnload: function() {},
  84. /**
  85. * 页面相关事件处理函数--监听用户下拉动作
  86. */
  87. onPullDownRefresh: function() {},
  88. /**
  89. * 页面上拉触底事件的处理函数
  90. */
  91. onReachBottom: function() {},
  92. /**
  93. * 用户点击右上角分享
  94. */
  95. onShareAppMessage: function() {}
  96. });