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
@@ -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 || ''
@@ -119,6 +119,12 @@ module.exports = { hex: hex, tags: tags }
<view wx:else class="ph icon icon-hanger"></view>
</view>
<!-- 示例内容说明:游客态只读浏览,不要求登录 -->
<view wx:if="{{demo}}" class="cd-demo">
<view class="icon icon-info"></view>
<text>示例内容 · 登录后可上传并识别你自己的衣物</text>
</view>
<!-- 名称:编辑态给标签 + 浅填充输入框,一眼看出可输入 -->
<view class="cd-name">
<block wx:if="{{editMode}}">
@@ -176,3 +176,22 @@
width: auto;
display: block;
}
/* 示例内容说明:游客态只读浏览(不引导、不打断) */
.cd-demo {
display: flex;
align-items: center;
gap: 12rpx;
margin: 28rpx var(--pad) 0;
font-size: 22rpx;
line-height: 1.5;
color: var(--ink-3);
letter-spacing: .01em;
}
.cd-demo .icon {
width: 28rpx;
height: 28rpx;
color: var(--ink-4);
flex-shrink: 0;
}