feat(guest): 支持游客态浏览示例衣物与搭配
游客可点开示例衣物详情与搭配抽屉,不再在浏览路径上要求登录。
This commit is contained in:
@@ -3,6 +3,7 @@ import { ClothesItem } from '../../types/models'
|
||||
import { ProcessStatus } from '../../utils/config'
|
||||
import { isProcessTerminal } from '../../utils/clothes-status'
|
||||
import { removePendingClothes } from '../../utils/pending-clothes'
|
||||
import { findDamoClothes } from '../../damo/damo'
|
||||
import { navScroll } from '../../utils/nav'
|
||||
import { logger } from '../../utils/logger'
|
||||
|
||||
@@ -108,6 +109,8 @@ Page({
|
||||
shareUUID: '',
|
||||
outfitUUID: '',
|
||||
readonly: false,
|
||||
// 游客态示例:由本地 damo 素材渲染的只读详情,零请求
|
||||
demo: false,
|
||||
attrGroups: ATTR_GROUPS,
|
||||
colorPresets: COLOR_PRESETS,
|
||||
detail: {} as ClothesItem,
|
||||
@@ -144,6 +147,25 @@ Page({
|
||||
noop() {},
|
||||
|
||||
onLoad(query: Record<string, string>) {
|
||||
const demo = query.demo || ''
|
||||
// 示例模式:游客从衣橱示例卡片进入,本地数据只读渲染,不发请求、不轮询
|
||||
if (demo) {
|
||||
const detail = findDamoClothes(demo)
|
||||
logger.info(LOG, '示例模式加载, demo=', demo, '命中=', !!detail)
|
||||
if (!detail) {
|
||||
this.setData({ demo: true, readonly: true, loading: false, notFound: true })
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
demo: true,
|
||||
readonly: true,
|
||||
uuid: detail.clothes_uuid,
|
||||
detail,
|
||||
loading: false,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const uuid = query.uuid || ''
|
||||
const shareUUID = query.share_uuid || ''
|
||||
const outfitUUID = query.outfit_uuid || ''
|
||||
|
||||
Reference in New Issue
Block a user