| getUserProfile(){ ????????wx.getUserProfile({ ????????????desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 ????????????success: (res) => { ????????????????// console.log("获取用户信息成功", res); ????????????????// return; ????????????????wx.showLoading({ ????????????????????title: "加载中" ????????????????}), wx.login({??????????? ????????????????????success: function(t) { ????????????????//???????? console.log(t); ????????????????// return; ????????????????????????n.post("wxapp/login", { ????????????????????????????code: t.code ????????????????????????}, function(t) { ????????????????//???????????? console.log(t.openid); ????????????????// return; ????????????????????????????t.error ? n.alert("获取用户登录态失败:"?+ t.message) : n.get("wxapp/auth", { ????????????????????????????????data: res.encryptedData, ????????????????????????????????iv: res.iv, ????????????????????????????????sessionKey: t.session_key, ????????????????????????????????openId:t.openid ????????????????????????????}, function(n) { ????????????????????????????????1 == n.isblack && wx.showModal({ ????????????????????????????????????title: "无法访问", ????????????????????????????????????content: "您在商城的黑名单中,无权访问!", ????????????????????????????????????success: function(n) { ????????????????????????????????????????n.confirm && e.close(), n.cancel && e.close(); ????????????????????????????????????} ????????????????????????????????}), res.userInfo.openid = n.openId, res.userInfo.id = n.id, res.userInfo.uniacid = n.uniacid, ????????????????????????????????e.setCache("userinfo", res.userInfo), e.setCache("userinfo_openid", res.userInfo.openid), ????????????????????????????????e.setCache("userinfo_id", n.id), e.getSet(), wx.navigateBack({ ????????????????????????????????????changed: !0 ????????????????????????????????}); ????????????????????????????}); ????????????????????????}); ????????????????????}, ????????????????????fail: function() { ????????????????????????n.alert("获取用户信息失败!"); ????????????????????}, ????????????????????complete: function() { ????????????????????????wx.hideLoading(); ????????????????????} ????????????????}); ????????????}, ????????????fail: res => { ????????????????// console.log("获取用户信息失败", res) ????????????????n.alert("获取用户信息失败!"); ????????????} ????????}) ????}, |