|
@@ -34,27 +34,24 @@ Component({
|
|
|
methods: {
|
|
|
switchTab(e) {
|
|
|
const { index, path } = e.currentTarget.dataset;
|
|
|
- var sessionUser;
|
|
|
- wx.getStorage({
|
|
|
- key: 'userInfo',
|
|
|
- success(res) {
|
|
|
- sessionUser = res.data;
|
|
|
- }
|
|
|
- })
|
|
|
if (index == 3) {
|
|
|
- if (sessionUser) {
|
|
|
- app.globalData.userInfo = sessionUser;
|
|
|
- wx.switchTab({ url: path })
|
|
|
- } else {
|
|
|
- wx.getUserProfile({
|
|
|
- desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
- success: (res) => {
|
|
|
- wx.setStorage({ key: "userInfo", data: res.userInfo })
|
|
|
- app.globalData.userInfo = res.userInfo;
|
|
|
- wx.switchTab({ url: path })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'userInfo',
|
|
|
+ success: function (res) {
|
|
|
+ app.globalData.userInfo = res.data;
|
|
|
+ wx.switchTab({ url: path })
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ wx.getUserProfile({
|
|
|
+ desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
+ success: (res) => {
|
|
|
+ wx.setStorage({ key: "userInfo", data: res.userInfo })
|
|
|
+ app.globalData.userInfo = res.userInfo;
|
|
|
+ wx.switchTab({ url: path })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
wx.switchTab({ url: path })
|
|
|
}
|