| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- // 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 () {
- }
- })
|