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.

120 line
2.6 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. name:"",
  13. birthdate:"",
  14. sex:"",
  15. showEdit:false
  16. },
  17. /**
  18. * 跳转到成长值的页面
  19. */
  20. gotograde:function(){
  21. wx.navigateTo({
  22. url: '/pages/grade/grade',
  23. })
  24. },
  25. // getrun:function(){
  26. // let that = this;
  27. // wx.getWeRunData({
  28. // success: function (res) {
  29. // console.log(res);
  30. // Http.post({
  31. // url: config.api.getWeRunData,
  32. // data: {
  33. // encryptedData: res.encryptedData,
  34. // iv: res.iv
  35. // }
  36. // }).then(res => {
  37. // console.log(res);
  38. // that.setData({
  39. // step: res.data.stepInfoList[30].step
  40. // })
  41. // })
  42. // }
  43. // })
  44. // },
  45. /**
  46. *
  47. */
  48. // getxinghao:function(){
  49. // wx.getSystemInfo({
  50. // success:function(res){
  51. // console.log(res);
  52. // wx.showModal({
  53. // content: res.brand,
  54. // })
  55. // }
  56. // })
  57. // },
  58. navigateTo() {
  59. wx.navigateTo({
  60. url: `/pages/login/index`
  61. });
  62. },
  63. showVersion: function() {
  64. /**
  65. * 长按显示版本号
  66. */
  67. let that = this;
  68. if (that.data.flag == 'hidden') {
  69. that.setData({
  70. flag: 'show'
  71. });
  72. }
  73. console.log(that.data.flag)
  74. },
  75. gotoedit:function(){
  76. wx.navigateTo({
  77. url: '/pages/edit/edit',
  78. })
  79. },
  80. /**
  81. * 生命周期函数--监听页面显示
  82. */
  83. onShow: function() {
  84. let that = this;
  85. let num = wx.getStorageSync('couponNum');
  86. wx.hideTabBarRedDot({
  87. index: 2
  88. });
  89. console.log("我是渲染")
  90. if (num == 'couponNum1') {
  91. wx.setStorage({
  92. key: 'couponNum',
  93. data: "couponNum1",
  94. })
  95. that.setData({
  96. couponNum: "couponNum1"
  97. })
  98. } else if (num == 'couponNum') {
  99. that.setData({
  100. couponNum: "couponNum"
  101. })
  102. };
  103. Http.get({
  104. url: config.api.getScore,
  105. data: {}
  106. }).then(res=>{
  107. console.log(res);
  108. if (res.data.address && res.data.name && res.data.sex && res.data.birthdate){
  109. that.setData({
  110. showEdit:true
  111. })
  112. }
  113. that.setData({
  114. score: res.data.score,
  115. levelName: res.data.levelName
  116. })
  117. });
  118. // that.getrun();
  119. }
  120. });