const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' Page({ /** * 页面的初始数据 */ data: { menuTop: [ { id: '1', name: '购物车', icon: '../../static/mine/gouwuche.svg' }, { id: '2', name: '我的订单', icon: '../../static/mine/dingdan.svg' }, { id: '3', name: '故障售后', icon: '../../static/mine/shouhou.svg' }, ], menuMiddle: [ { id: '1', name: '待付款', icon: '../../static/mine/daifukuan.svg' }, { id: '1', name: '待服务', icon: '../../static/mine/daifuwu.svg' }, { id: '1', name: '服务中', icon: '../../static/mine/fuwuzhong.svg' }, { id: '1', name: '评价', icon: '../../static/mine/pingjia.svg' } ], menuBottom: [ { id: '1', name: '账号安全' }, { id: '1', name: '账号绑定' }, { id: '1', name: '支付管理' }, { id: '1', name: '地址管理' }, { id: '1', name: '系统设置' }, ], defaultUrl:defaultAvatarUrl, avatarUrl: '', nickname: '微信用户', isShow:true }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, onChooseAvatar(e) { console.log(e) const { avatarUrl } = e.detail this.setData({ avatarUrl, isShow:false }) }, getUserProfile(e) { console.log(e) // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 wx.getUserProfile({ desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 success: (res) => { console.log(res) this.setData({ avatarUrl: res.userInfo.avatarUrl, isShow:false, nickname:res.userInfo.nickName }) } }) } })