From ac3575aba9532a58d2c65f35963487ce0e8368f2 Mon Sep 17 00:00:00 2001 From: yy Date: Fri, 16 Apr 2021 11:02:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E3=80=81=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litemall-wx/pages/auth/login/login.js | 32 +++++++++++-------------- litemall-wx/pages/auth/login/login.wxml | 2 +- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/litemall-wx/pages/auth/login/login.js b/litemall-wx/pages/auth/login/login.js index 4a0796ed..0d25e65d 100644 --- a/litemall-wx/pages/auth/login/login.js +++ b/litemall-wx/pages/auth/login/login.js @@ -24,25 +24,21 @@ Page({ }, wxLogin: function(e) { - if (e.detail.userInfo == undefined) { - app.globalData.hasLogin = false; - util.showErrorToast('微信登录失败'); - return; - } - user.checkLogin().catch(() => { - - user.loginByWeixin(e.detail.userInfo).then(res => { - app.globalData.hasLogin = true; - - wx.navigateBack({ - delta: 1 - }) - }).catch((err) => { - app.globalData.hasLogin = false; - util.showErrorToast('微信登录失败'); - }); - + wx.getUserProfile({ + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + user.loginByWeixin(res.userInfo).then(res => { + app.globalData.hasLogin = true; + wx.navigateBack({ + delta: 1 + }) + }).catch((err) => { + app.globalData.hasLogin = false; + util.showErrorToast('微信登录失败'); + }); + } + }) }); }, accountLogin: function() { diff --git a/litemall-wx/pages/auth/login/login.wxml b/litemall-wx/pages/auth/login/login.wxml index c2b604b0..5f615db6 100644 --- a/litemall-wx/pages/auth/login/login.wxml +++ b/litemall-wx/pages/auth/login/login.wxml @@ -1,6 +1,6 @@ \ No newline at end of file From 4a1a172ec4464a0ee59bd0f261725c6289b12023 Mon Sep 17 00:00:00 2001 From: yy Date: Fri, 16 Apr 2021 11:24:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E3=80=81=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litemall-wx/pages/auth/login/login.js | 2 +- litemall-wx/pages/auth/login/login.wxml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litemall-wx/pages/auth/login/login.js b/litemall-wx/pages/auth/login/login.js index 0d25e65d..17ede663 100644 --- a/litemall-wx/pages/auth/login/login.js +++ b/litemall-wx/pages/auth/login/login.js @@ -26,7 +26,7 @@ Page({ wxLogin: function(e) { user.checkLogin().catch(() => { wx.getUserProfile({ - desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + desc: '用于完善会员资料', success: (res) => { user.loginByWeixin(res.userInfo).then(res => { app.globalData.hasLogin = true; diff --git a/litemall-wx/pages/auth/login/login.wxml b/litemall-wx/pages/auth/login/login.wxml index 5f615db6..f092ba44 100644 --- a/litemall-wx/pages/auth/login/login.wxml +++ b/litemall-wx/pages/auth/login/login.wxml @@ -1,6 +1,6 @@ \ No newline at end of file