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.

140 linhas
2.7 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. /**
  69. * 生命周期函数--监听页面加载
  70. */
  71. onLoad: function(options) {
  72. },
  73. /**
  74. * 生命周期函数--监听页面初次渲染完成
  75. */
  76. onReady: function() {},
  77. /**
  78. * 生命周期函数--监听页面显示
  79. */
  80. onShow: function() {
  81. let that = this;
  82. let num = wx.getStorageSync('couponNum');
  83. wx.hideTabBarRedDot({
  84. index: 2
  85. });
  86. console.log("我是渲染")
  87. if (num == 'couponNum1') {
  88. wx.setStorage({
  89. key: 'couponNum',
  90. data: "couponNum1",
  91. })
  92. that.setData({
  93. couponNum: "couponNum1"
  94. })
  95. } else if (num == 'couponNum') {
  96. that.setData({
  97. couponNum: "couponNum"
  98. })
  99. };
  100. Http.get({
  101. url: config.api.getScore,
  102. data: {}
  103. }).then(res=>{
  104. console.log(res);
  105. that.setData({
  106. score: res.data.score,
  107. levelName: res.data.levelName
  108. })
  109. });
  110. // that.getrun();
  111. },
  112. /**
  113. * 生命周期函数--监听页面隐藏
  114. */
  115. onHide: function() {},
  116. /**
  117. * 生命周期函数--监听页面卸载
  118. */
  119. onUnload: function() {},
  120. /**
  121. * 页面相关事件处理函数--监听用户下拉动作
  122. */
  123. onPullDownRefresh: function() {},
  124. /**
  125. * 页面上拉触底事件的处理函数
  126. */
  127. onReachBottom: function() {},
  128. /**
  129. * 用户点击右上角分享
  130. */
  131. onShareAppMessage: function() {}
  132. });