const app = getApp() Page({ /** * 页面的初始数据 */ data: { hasUserInfo: false }, /** * 生命周期函数--监听页面加载 */ onLoad: async function (options) { let userInfo = await app.getWxUserInfo() console.log(userInfo) if (userInfo) { this.setData({ userInfo: userInfo, hasUserInfo: true, }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: async function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, getUserProfile: function(e){ wx.getUserProfile({ desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 success: (res) => { console.log(res); // res.userInfo['encryptedData'] = res.encryptedData // res.userInfo['iv'] = res.iv app.wxLogin(res.userInfo); this.setData({ userInfo: res.userInfo, hasUserInfo: true }) } }) }, gotoCollection: async function (e) { wx.navigateTo({ url: '../collection/collection', }) }, gotoPersonInfo: function (e) { wx.navigateTo({ url: '../personinfo/personinfo', }) }, gotoRecord: function (e) { wx.navigateTo({ url: '../record/record', }) }, gotoResume:function(){ wx.navigateTo({ url: '../resume/resume?type=1', }) } // getMobile: async function (params) { // console.log(params); // let _self = this // const data = { // encryptedData:params.detail.encryptedData, // iv: params.detail.iv // } // const userInfo = await app.getPhoneNumber(data) // console.log(userInfo) // let hasMobile = false // if (userInfo.mobile > 1) { // hasMobile:true // } // _self.setData({ // hasMobile: hasMobile, // mobile: userInfo.mobile, // userInfo // }) // }, })