bigfix
This commit is contained in:
@@ -13,17 +13,32 @@ interface GiftItem {
|
||||
Page({
|
||||
data: {
|
||||
loading: false,
|
||||
redirect: '', // 登录后要回跳的页面(如从好友分享链接进入)
|
||||
userInfo: {} as UserInfo,
|
||||
giftVisible: false,
|
||||
giftItems: [] as GiftItem[],
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
onLoad(query: Record<string, string>) {
|
||||
if (query.redirect) this.setData({ redirect: query.redirect })
|
||||
if (auth.isLoggedIn()) {
|
||||
wx.switchTab({ url: '/pages/wardrobe/wardrobe' })
|
||||
this.goAfterLogin()
|
||||
}
|
||||
},
|
||||
|
||||
// 登录完成后的落地页:带 redirect 时回跳来源页(分享详情等),否则进衣橱
|
||||
goAfterLogin(fallback = false) {
|
||||
const redirect = this.data.redirect
|
||||
if (redirect && !fallback) {
|
||||
wx.redirectTo({
|
||||
url: redirect,
|
||||
fail: () => this.goAfterLogin(true),
|
||||
})
|
||||
return
|
||||
}
|
||||
wx.switchTab({ url: '/pages/wardrobe/wardrobe' })
|
||||
},
|
||||
|
||||
onLogin() {
|
||||
if (this.data.loading) return
|
||||
this.setData({ loading: true })
|
||||
@@ -56,7 +71,7 @@ Page({
|
||||
} else if (!data.user_info.birth_day) {
|
||||
this.showBirthGuide()
|
||||
} else {
|
||||
wx.switchTab({ url: '/pages/wardrobe/wardrobe' })
|
||||
this.goAfterLogin()
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
@@ -100,7 +115,7 @@ Page({
|
||||
if (!this.data.userInfo.birth_day) {
|
||||
this.showBirthGuide()
|
||||
} else {
|
||||
wx.switchTab({ url: '/pages/wardrobe/wardrobe' })
|
||||
this.goAfterLogin()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -112,7 +127,7 @@ Page({
|
||||
cancelText: '稍后再说',
|
||||
success: (res) => {
|
||||
if (res.confirm) wx.switchTab({ url: '/pages/profile/profile' })
|
||||
else wx.switchTab({ url: '/pages/wardrobe/wardrobe' })
|
||||
else this.goAfterLogin()
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user