C端小程序
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.

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