person.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. hasUserInfo: false
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad: async function (options) {
  13. let userInfo = await app.getWxUserInfo()
  14. console.log(userInfo)
  15. if (userInfo) {
  16. this.setData({
  17. userInfo: userInfo,
  18. hasUserInfo: true,
  19. })
  20. }
  21. },
  22. /**
  23. * 生命周期函数--监听页面初次渲染完成
  24. */
  25. onReady: function () {
  26. },
  27. /**
  28. * 生命周期函数--监听页面显示
  29. */
  30. onShow: async function () {
  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. getInfo: async function (e) {
  58. // const _self = this
  59. // let userInfo = e.detail.userInfo
  60. // console.log(userInfo);
  61. // userInfo['encryptedData'] = e.detail.encryptedData
  62. // userInfo['iv'] = e.detail.iv
  63. // let info = await app.wxLogin(userInfo);
  64. // _self.setData({
  65. // hasUserInfo: true,
  66. // userInfo: info,
  67. // })
  68. },
  69. getUserProfile: function(e){
  70. wx.getUserProfile({
  71. desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  72. success: (res) => {
  73. console.log(res);
  74. // res.userInfo['encryptedData'] = res.encryptedData
  75. // res.userInfo['iv'] = res.iv
  76. let info = app.wxLogin(res.userInfo);
  77. this.setData({
  78. userInfo: res.userInfo,
  79. hasUserInfo: true
  80. })
  81. }
  82. })
  83. },
  84. gotoCollection: async function (e) {
  85. // const isAuth = await app.isAuth()
  86. // if (!isAuth) {
  87. // wx.redirectTo({
  88. // url: '/pages/prompt/prompt?page=pages/collection/collection',
  89. // })
  90. // return
  91. // }
  92. wx.navigateTo({
  93. url: '../collection/collection',
  94. })
  95. },
  96. gotoPersonInfo: function (e) {
  97. wx.navigateTo({
  98. url: '../personinfo/personinfo',
  99. })
  100. },
  101. gotoRecord: function (e) {
  102. wx.navigateTo({
  103. url: '../record/record',
  104. })
  105. },
  106. gotoResume:function(){
  107. wx.navigateTo({
  108. url: '../resume/resume?type=1',
  109. })
  110. }
  111. // getMobile: async function (params) {
  112. // console.log(params);
  113. // let _self = this
  114. // const data = {
  115. // encryptedData:params.detail.encryptedData,
  116. // iv: params.detail.iv
  117. // }
  118. // const userInfo = await app.getPhoneNumber(data)
  119. // console.log(userInfo)
  120. // let hasMobile = false
  121. // if (userInfo.mobile > 1) {
  122. // hasMobile:true
  123. // }
  124. // _self.setData({
  125. // hasMobile: hasMobile,
  126. // mobile: userInfo.mobile,
  127. // userInfo
  128. // })
  129. // },
  130. })