feat(guest): 支持游客态浏览示例衣物与搭配

游客可点开示例衣物详情与搭配抽屉,不再在浏览路径上要求登录。
This commit is contained in:
2026-09-17 11:41:42 +08:00
parent 45222317af
commit f0503c7ad7
30 changed files with 648 additions and 127 deletions
+36 -7
View File
@@ -95,9 +95,35 @@ Page({
this.setData({ scene: e.detail.value })
},
onSkipScene() {
this.setData({ showSceneSheet: false })
this.startGenerate(1, '')
// 取消场景选择:退出 AI 推荐页返回来源页(不再用「每日推荐」自动生成)
onCancelScene() {
logger.info(LOG, '取消场景选择,返回来源页')
this.backToSource()
},
// 取消的统一出口:优先返回来源页(从运势进回运势、从穿搭进回穿搭);
// 页面栈不足(分享卡片/深链直达)时兜底 switchTab 回运势页
backToSource() {
const pages = typeof getCurrentPages === 'function' ? getCurrentPages() : []
if (pages.length > 1) {
wx.navigateBack({
delta: 1,
fail: (e) => {
logger.warn(LOG, 'navigateBack 失败,兜底回运势页, err=', e && e.errMsg)
this.switchToHoroscope()
},
})
return
}
logger.warn(LOG, '页面栈不足,兜底回运势页, 栈深=', pages.length)
this.switchToHoroscope()
},
switchToHoroscope() {
wx.switchTab({
url: '/pages/horoscope/horoscope',
fail: (e) => logger.warn(LOG, 'switchTab 运势失败, err=', e && e.errMsg),
})
},
onStartGenerate() {
@@ -112,16 +138,19 @@ Page({
this.setData({ confirmVisible: true })
},
// 取消生成:回到场景选择抽屉,避免停在无任何可渲染内容的空页
// 取消生成:退出 AI 推荐页返回来源页(与抽屉「取消」语义一致,避免停在空页)
onConfirmCancel() {
this.setData({ confirmVisible: false, showSceneSheet: true })
logger.info(LOG, '确认弹窗取消,返回来源页')
this.setData({ confirmVisible: false })
this.backToSource()
},
onConfirmGenerate(e: WechatMiniprogram.CustomEvent) {
this.setData({ confirmVisible: false })
if (e.detail.value !== 'ok') {
// 兜底:非「开始生成」按钮同样回到场景抽屉(取消按钮已走 cancel 分支)
this.setData({ showSceneSheet: true })
// 兜底:非「开始生成」按钮同样按取消处理(取消按钮已走 cancel 分支)
logger.info(LOG, '确认弹窗非主按钮,按取消处理,返回来源页')
this.backToSource()
return
}
const pending = (this as any).pendingScene || { sceneType: 1, scene: '' }