// pages/mine/mine.js Page({ /** * 页面的初始数据 */ data: { //id idMyInfo:'idMyInfo', idCompanyInfo: 'idCompanyInfo', idAbout: 'idAbout', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, btnClick: function (event) { var that = this var id = event.currentTarget.id if (id == that.data.idMyInfo){ wx.navigateTo({ url: '../perinfo/perinfo', }) } else if (id == that.data.idCompanyInfo){ } else if (id == that.data.idAbout){ } }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.setData({ isRegistered: wx.getStorageSync('isRegistered'), isLogin: wx.getStorageSync('wxnickName') ? true : false, canIUse: wx.canIUse('button.open-type.getUserInfo'), headerImg: wx.getStorageSync('wxavatarUrl'), wxNickname: wx.getStorageSync('wxnickName'), isRegistered: wx.getStorageSync('isRegistered'), }) }, bindGetUserInfo: function (e) { var that = this var userInfo = e.detail.userInfo // console.log('bindGetUserInfo', userInfo) var nickName = userInfo.nickName var avatarUrl = userInfo.avatarUrl var gender = userInfo.gender //性别 0:未知、1:男、2:女 var province = userInfo.province var city = userInfo.city var country = userInfo.country if (nickName && avatarUrl) { that.setData({ wxNickname: nickName, wxHeader: avatarUrl, isLogin: true }) try { wx.setStorageSync('wxavatarUrl', userInfo.avatarUrl) wx.setStorageSync('wxnickName', userInfo.nickName) } catch (e) { } } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })