// pages/my/my.js import itt from '../../utils/util' const app = getApp() Page({ /** * 页面的初始数据 */ data: { pageLogin: false, name: '点击授权登录', avatarUrl: '', count: 0 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 获取用户信息 */ getUserProfile() { var that = this; wx.getUserProfile({ desc:"授权信息", success:function(res){ if(res.userInfo){ that.setData({ name:res.userInfo.nickName, avatarUrl:res.userInfo.avatarUrl, pageLogin: true }) app.globalData.userInfo.login = true } }, }) }, /** * 生命周期函数--监听页面显示 */ onShow() { this.setData({ pageLogin: app.globalData.userInfo.login }) }, /* 我的档案 */ handleMyFile () { this.authNavTo('/pages/myFile/myFile') }, /** * 我的预约 */ handleMyAppointment() { this.authNavTo('/pages/myAppointment/myAppointment') }, /** * 点击充值记录 */ handleMyRecord() { this.authNavTo('/pages/myRecord/myRecord') }, /** * 点击开通区域 */ handleOpenarea() { this.authNavTo('/pages/openArea/openArea') }, /** * 点击设置 */ handleSet() { this.authNavTo('/pages/set/set') }, /** * 用户点击地址 */ handleMyAddress() { this.authNavTo('/pages/address/address') }, /** * 我的报告 * **/ handleMyReport () { this.authNavTo('/pages/report/report') }, handleAppoint () { this.authNavTo('/pages/appointment/appointment') }, authNavTo (url) { if (itt.loginAuth()) { wx.navigateTo({ url: url, }) } else { itt.errorToast('请先授权登录') } } })