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.

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