person.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. hasUserInfo: false
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad: async function (options) {
  13. },
  14. /**
  15. * 生命周期函数--监听页面初次渲染完成
  16. */
  17. onReady: function () {
  18. },
  19. /**
  20. * 生命周期函数--监听页面显示
  21. */
  22. onShow: async function () {
  23. let userInfo = await app.getWxUserInfo()
  24. if (userInfo) {
  25. userInfo.avatarUrl = userInfo.headerImg
  26. this.setData({
  27. userInfo: userInfo,
  28. hasUserInfo: true,
  29. })
  30. }
  31. },
  32. /**
  33. * 生命周期函数--监听页面隐藏
  34. */
  35. onHide: function () {
  36. },
  37. /**
  38. * 生命周期函数--监听页面卸载
  39. */
  40. onUnload: function () {
  41. },
  42. /**
  43. * 页面相关事件处理函数--监听用户下拉动作
  44. */
  45. onPullDownRefresh: function () {
  46. },
  47. /**
  48. * 页面上拉触底事件的处理函数
  49. */
  50. onReachBottom: function () {
  51. },
  52. /**
  53. * 用户点击右上角分享
  54. */
  55. onShareAppMessage: function () {
  56. },
  57. getUserProfile: function(e){
  58. wx.getUserProfile({
  59. desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  60. success: (res) => {
  61. console.log(res);
  62. // res.userInfo['encryptedData'] = res.encryptedData
  63. // res.userInfo['iv'] = res.iv
  64. app.wxLogin(res.userInfo);
  65. this.setData({
  66. userInfo: res.userInfo,
  67. hasUserInfo: true
  68. })
  69. }
  70. })
  71. },
  72. gotoCollection: async function (e) {
  73. wx.navigateTo({
  74. url: '../collection/collection',
  75. })
  76. },
  77. gotoPersonInfo: function (e) {
  78. wx.navigateTo({
  79. url: '../personinfo/personinfo',
  80. })
  81. },
  82. gotoRecord: function (e) {
  83. wx.navigateTo({
  84. url: '../record/record',
  85. })
  86. },
  87. gotoResume:function(){
  88. wx.navigateTo({
  89. url: '../resume/resume?type=1',
  90. })
  91. }
  92. // getMobile: async function (params) {
  93. // console.log(params);
  94. // let _self = this
  95. // const data = {
  96. // encryptedData:params.detail.encryptedData,
  97. // iv: params.detail.iv
  98. // }
  99. // const userInfo = await app.getPhoneNumber(data)
  100. // console.log(userInfo)
  101. // let hasMobile = false
  102. // if (userInfo.mobile > 1) {
  103. // hasMobile:true
  104. // }
  105. // _self.setData({
  106. // hasMobile: hasMobile,
  107. // mobile: userInfo.mobile,
  108. // userInfo
  109. // })
  110. // },
  111. })