C端小程序
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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