person.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. // pages/person/person.js
  2. // const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. hasUserInfo: false
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad: async function (options) {
  14. // let userInfo = await app.getWxUserInfo()
  15. // if (userInfo) {
  16. // this.setData({
  17. // userInfo: userInfo,
  18. // hasUserInfo: true,
  19. // hasMobile: userInfo.mobile ? true : false
  20. // })
  21. // }
  22. },
  23. /**
  24. * 生命周期函数--监听页面初次渲染完成
  25. */
  26. onReady: function () {
  27. },
  28. /**
  29. * 生命周期函数--监听页面显示
  30. */
  31. onShow: async function () {
  32. // let userInfo = await app.getWxUserInfo()
  33. // if (userInfo) {
  34. // this.setData({
  35. // userInfo: userInfo,
  36. // hasUserInfo: true,
  37. // hasMobile: userInfo.mobile ? true : false
  38. // })
  39. // }
  40. },
  41. /**
  42. * 生命周期函数--监听页面隐藏
  43. */
  44. onHide: function () {
  45. },
  46. /**
  47. * 生命周期函数--监听页面卸载
  48. */
  49. onUnload: function () {
  50. },
  51. /**
  52. * 页面相关事件处理函数--监听用户下拉动作
  53. */
  54. onPullDownRefresh: function () {
  55. },
  56. /**
  57. * 页面上拉触底事件的处理函数
  58. */
  59. onReachBottom: function () {
  60. },
  61. /**
  62. * 用户点击右上角分享
  63. */
  64. onShareAppMessage: function () {
  65. },
  66. getInfo: async function (e) {
  67. const _self = this
  68. let userInfo = e.detail.userInfo
  69. userInfo['encryptedData'] = e.detail.encryptedData
  70. userInfo['iv'] = e.detail.iv
  71. let info = await app.wxLogin(userInfo);
  72. let hasMobile = false;
  73. if (info.mobile) {
  74. hasMobile = true
  75. }
  76. _self.setData({
  77. hasUserInfo: true,
  78. userInfo: info,
  79. hasMobile: hasMobile,
  80. })
  81. },
  82. gotoCollection: async function (e) {
  83. // const isAuth = await app.isAuth()
  84. // if (!isAuth) {
  85. // wx.redirectTo({
  86. // url: '/pages/prompt/prompt?page=pages/collection/collection',
  87. // })
  88. // return
  89. // }
  90. wx.navigateTo({
  91. url: '../collection/collection',
  92. })
  93. },
  94. gotoPersonInfo: function (e) {
  95. wx.navigateTo({
  96. url: '../personinfo/personinfo',
  97. })
  98. },
  99. gotoRecord: function (e) {
  100. wx.navigateTo({
  101. url: '../record/record',
  102. })
  103. },
  104. gotoResume:function(){
  105. wx.navigateTo({
  106. url: '../resume/resume',
  107. })
  108. }
  109. // getMobile: async function (params) {
  110. // console.log(params);
  111. // let _self = this
  112. // const data = {
  113. // encryptedData:params.detail.encryptedData,
  114. // iv: params.detail.iv
  115. // }
  116. // const userInfo = await app.getPhoneNumber(data)
  117. // console.log(userInfo)
  118. // let hasMobile = false
  119. // if (userInfo.mobile > 1) {
  120. // hasMobile:true
  121. // }
  122. // _self.setData({
  123. // hasMobile: hasMobile,
  124. // mobile: userInfo.mobile,
  125. // userInfo
  126. // })
  127. // },
  128. })