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.

138 lines
2.5 KiB

  1. // pages/users/users.js
  2. const imgurl = require("../../utils/imgurl");
  3. const Http = require("../../utils/HttpBasics");
  4. var config = require("../../config/config.js");
  5. const bgColor = require("../../utils/bgColor.js")
  6. let app = getApp();
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. aboutUs: imgurl.aboutUs.url,
  13. banneColor: "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)",
  14. levelName: "",
  15. levelBg: bgColor.colorFirst.user.levelBg,
  16. score: '0',
  17. curPhone: '',
  18. },
  19. //授权手机号
  20. gotoPhoneInfo() {
  21. // let that = this;
  22. // Http.get({
  23. // url: config.api.checkPhoneStatus,
  24. // data: {}
  25. // }).then(res => {
  26. // return
  27. // }).catch(err => {
  28. // wx.redirectTo({
  29. // url: `/pages/getphoneInfo/getphoneInfo`
  30. // });
  31. // })
  32. wx.redirectTo({
  33. url: `/pages/getphoneInfo/getphoneInfo`
  34. });
  35. },
  36. /* 判断是否授权*/
  37. checkUserStatus() {
  38. Http.get({
  39. url: config.api.checkUserStatus,
  40. data: {
  41. token: app.globalData.token
  42. }
  43. }).then(res => {
  44. this.getUserInfo()
  45. }).catch(err => {
  46. wx.navigateTo({
  47. url: `/pages/getuserinfo/index`,
  48. })
  49. })
  50. // wx.navigateTo({
  51. // url: '/pages/getuserinfo/index',
  52. // })
  53. },
  54. //获取当前登录用户信息
  55. getUserInfo: function () {
  56. let that = this;
  57. // 获取用户信息
  58. Http.get({
  59. url: config.api.getScore,
  60. })
  61. .then(res => {
  62. const { code, data } = res
  63. if (code == 200) {
  64. that.setData({
  65. levelName: data.levelName,
  66. getScore: data.getScore,
  67. })
  68. }
  69. })
  70. },
  71. /**
  72. * 生命周期函数--监听页面加载
  73. */
  74. onLoad: function (options) {
  75. },
  76. /**
  77. * 生命周期函数--监听页面初次渲染完成
  78. */
  79. onReady: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面显示
  83. */
  84. onShow: function () {
  85. this.checkUserStatus()
  86. this.setData({
  87. curPhone: wx.getStorageSync('phone')
  88. })
  89. },
  90. /**
  91. * 生命周期函数--监听页面隐藏
  92. */
  93. onHide: function () {
  94. },
  95. /**
  96. * 生命周期函数--监听页面卸载
  97. */
  98. onUnload: function () {
  99. },
  100. /**
  101. * 页面相关事件处理函数--监听用户下拉动作
  102. */
  103. onPullDownRefresh: function () {
  104. },
  105. /**
  106. * 页面上拉触底事件的处理函数
  107. */
  108. onReachBottom: function () {
  109. },
  110. /**
  111. * 用户点击右上角分享
  112. */
  113. onShareAppMessage: function () {
  114. }
  115. })