C端小程序
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

145 rader
2.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. 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. // getrun:function(){
  22. // let that = this;
  23. // wx.getWeRunData({
  24. // success: function (res) {
  25. // console.log(res);
  26. // Http.post({
  27. // url: config.api.getWeRunData,
  28. // data: {
  29. // encryptedData: res.encryptedData,
  30. // iv: res.iv
  31. // }
  32. // }).then(res => {
  33. // console.log(res);
  34. // that.setData({
  35. // step: res.data.stepInfoList[30].step
  36. // })
  37. // })
  38. // }
  39. // })
  40. // },
  41. getxinghao:function(){
  42. wx.getSystemInfo({
  43. success:function(res){
  44. console.log(res);
  45. wx.showModal({
  46. content: res.brand,
  47. })
  48. }
  49. })
  50. },
  51. navigateTo() {
  52. wx.navigateTo({
  53. url: `/pages/login/index`
  54. });
  55. },
  56. showVersion: function() {
  57. /**
  58. * 长按显示版本号
  59. */
  60. let that = this;
  61. if (that.data.flag == 'hidden') {
  62. that.setData({
  63. flag: 'show'
  64. });
  65. }
  66. console.log(that.data.flag)
  67. },
  68. gotoedit:function(){
  69. wx.navigateTo({
  70. url: '/pages/edit/edit',
  71. })
  72. },
  73. /**
  74. * 生命周期函数--监听页面加载
  75. */
  76. onLoad: function(options) {
  77. },
  78. /**
  79. * 生命周期函数--监听页面初次渲染完成
  80. */
  81. onReady: function() {},
  82. /**
  83. * 生命周期函数--监听页面显示
  84. */
  85. onShow: function() {
  86. let that = this;
  87. let num = wx.getStorageSync('couponNum');
  88. wx.hideTabBarRedDot({
  89. index: 2
  90. });
  91. console.log("我是渲染")
  92. if (num == 'couponNum1') {
  93. wx.setStorage({
  94. key: 'couponNum',
  95. data: "couponNum1",
  96. })
  97. that.setData({
  98. couponNum: "couponNum1"
  99. })
  100. } else if (num == 'couponNum') {
  101. that.setData({
  102. couponNum: "couponNum"
  103. })
  104. };
  105. Http.get({
  106. url: config.api.getScore,
  107. data: {}
  108. }).then(res=>{
  109. console.log(res);
  110. that.setData({
  111. score: res.data.score,
  112. levelName: res.data.levelName
  113. })
  114. });
  115. // that.getrun();
  116. },
  117. /**
  118. * 生命周期函数--监听页面隐藏
  119. */
  120. onHide: function() {},
  121. /**
  122. * 生命周期函数--监听页面卸载
  123. */
  124. onUnload: function() {},
  125. /**
  126. * 页面相关事件处理函数--监听用户下拉动作
  127. */
  128. onPullDownRefresh: function() {},
  129. /**
  130. * 页面上拉触底事件的处理函数
  131. */
  132. onReachBottom: function() {},
  133. /**
  134. * 用户点击右上角分享
  135. */
  136. onShareAppMessage: function() {}
  137. });