This commit is contained in:
2026-09-13 01:51:09 +08:00
parent b1a664a768
commit afd0973ce5
32 changed files with 935 additions and 171 deletions
+20 -5
View File
@@ -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()
},
})
},