C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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