yijian.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // pages/yijian/yijian.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. userInfo: {},
  8. hasUserInfo: false,
  9. canIUseGetUserProfile: false,
  10. },
  11. getUserProfile(e) {
  12. // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
  13. // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
  14. wx.getUserProfile({
  15. desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  16. success: (res) => {
  17. this.setData({
  18. userInfo: res.userInfo,
  19. hasUserInfo: true
  20. })
  21. }
  22. })
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad() {
  28. if (wx.getUserProfile) {
  29. this.setData({
  30. canIUseGetUserProfile: true
  31. })
  32. }
  33. },
  34. /**
  35. * 生命周期函数--监听页面初次渲染完成
  36. */
  37. onReady() {
  38. },
  39. /**
  40. * 生命周期函数--监听页面显示
  41. */
  42. onShow() {
  43. },
  44. /**
  45. * 生命周期函数--监听页面隐藏
  46. */
  47. onHide() {
  48. },
  49. /**
  50. * 生命周期函数--监听页面卸载
  51. */
  52. onUnload() {
  53. },
  54. /**
  55. * 页面相关事件处理函数--监听用户下拉动作
  56. */
  57. onPullDownRefresh() {
  58. },
  59. /**
  60. * 页面上拉触底事件的处理函数
  61. */
  62. onReachBottom() {
  63. },
  64. /**
  65. * 用户点击右上角分享
  66. */
  67. onShareAppMessage() {
  68. }
  69. })