首先看看错误信息:
上面报错的代码(涉及getUserProfile的代码)
loginAfter: function(e) {
var o;
wx.getUserProfile ? (o = getApp(), wx.getUserProfile({
lang: "zh_CN",
desc: "用于登陆",
success: function(e) {
console.log(e), wx.setStorageSync("wxInfo", e), o.checkLogin(e);
},
fail: function(e) {
console.log(e);
}
})) : wx.showModal({
title: "登录出现错误",
content: "请升级至微信最新版本,以便为您提供最优服务",
success: function(e) {}
});
},
登录一直出现这个界面:
这个界面的代码(也就是报错信息undefined的代码):
util.message = function(e, t, n) {
if (!e) return !0;
var a, r, o;
"object" == (void 0 === e ? "undefined" : _typeof(e)) && (t = e.redirect, n = e.type,
e = e.title), t && (a = t.substring(0, 9), o = r = "", "navigate:" == a ? (o = "navigateTo",
r = t.substring(9)) : "redirect:" == a ? (o = "redirectTo", r = t.substring(9)) : (r = t,
o = "redirectTo")), console.log(r), "success" == (n = n || "success") ? wx.showToast({
title: e,
icon: "success",
duration: 2e3,
mask: !!r,
complete: function() {
r && setTimeout(function() {
wx[o]({
url: r
});
}, 1800);
}
}) : "error" == n && wx.showModal({
title: "系统信息",
content: e,
showCancel: !1,
confirmColor: "#f43f6c",
cancelColor: "#f43f6c",
confirmText: "我知道了",
complete: function() {
r && ("back" == r ? wx.navigateBack() : "index" == r ? wx.switchTab({
url: "/first_duoduoke/pages/index/index"
}) : "task" == r ? wx.switchTab({
url: "/first_duoduoke/pages/task/task"
}) : wx[o]({
url: r
}));
}
});
},
checkLogin: function(e) {
var o = getCurrentPages(), s = o[o.length - 1], n = getApp();
n.util.getUserInfo(function(a) {
a && (s.data.showLoginModal && s.setData({
showLoginModal: !1
}), n.util.request({
url: "entry/wxapp/getUserInfo",
showLoading: !1,
success: function(e) {
var o, t;
(e = e.data.data).avatar = void 0 !== a.memberInfo.headimgurl ? a.memberInfo.headimgurl : a.memberInfo.avatar,
e.nickName = a.memberInfo.nickname, n.globalData.userInfo = e, "first_duoduoke/pages/my/my" == s.route && s.setData({
uInfo: e
}, function() {
s.getBdPhone();
}), "first_duoduoke/pages/cash/cash" == s.route && s.setData({
uInfo: e
}), "first_duoduoke/pages/goods/goods" == s.route && s.getGoodsDetail(), "first_duoduoke/pages/find/find" == s.routr && s.zanSaleWallpaper(),
"first_duoduoke/pages/partake/partake" == s.route && s.setData({
isLogin: !0
}), "first_duoduoke/pages/task/task" == s.route && (s.setData({
isLogin: !0
}), o = new _NumberAnimate2.default({
from: e.money,
speed: 600,
refreshTime: 100,
decimals: 2,
onUpdate: function() {
s.setData({
"uInfo.money": o.tempValue