feat(穿搭详情): 支持社区公开穿搭只读访问单品
非属主查看社区公开穿搭时携带 outfit_uuid 凭证请求单品详情, 放行后端只读读取,避免名称退化为「未命名」;单品详情页同步 支持 outfit_uuid 只读凭证。点赞增加防连点,来源胶囊与状态 胶囊文案重复时只保留一个。
This commit is contained in:
@@ -104,8 +104,9 @@ function statusToStep(status: number): number {
|
||||
Page({
|
||||
data: {
|
||||
uuid: '',
|
||||
// 来自穿搭分享的只读查看:携带 share_uuid,隐藏编辑/删除
|
||||
// 只读查看的两个凭证:share_uuid(穿搭分享)/ outfit_uuid(社区公开穿搭),命中即隐藏编辑/删除
|
||||
shareUUID: '',
|
||||
outfitUUID: '',
|
||||
readonly: false,
|
||||
attrGroups: ATTR_GROUPS,
|
||||
colorPresets: COLOR_PRESETS,
|
||||
@@ -145,9 +146,10 @@ Page({
|
||||
onLoad(query: Record<string, string>) {
|
||||
const uuid = query.uuid || ''
|
||||
const shareUUID = query.share_uuid || ''
|
||||
const readonly = !!shareUUID
|
||||
const outfitUUID = query.outfit_uuid || ''
|
||||
const readonly = !!(shareUUID || outfitUUID)
|
||||
logger.debug(LOG, 'onLoad, uuid=', uuid, 'readonly=', readonly)
|
||||
this.setData({ uuid, shareUUID, readonly })
|
||||
this.setData({ uuid, shareUUID, outfitUUID, readonly })
|
||||
if (!uuid) {
|
||||
// uuid 缺失时不请求不轮询,否则会停在空白页且无法退出
|
||||
logger.warn(LOG, 'onLoad 缺少 uuid 参数')
|
||||
@@ -155,7 +157,7 @@ Page({
|
||||
return
|
||||
}
|
||||
this.fetchDetail().then(() => {
|
||||
// 只读(来自穿搭分享)场景无需轮询 AI 处理状态
|
||||
// 只读(来自穿搭分享 / 社区公开穿搭)场景无需轮询 AI 处理状态
|
||||
if (readonly) return
|
||||
// 详情响应已带处理状态:成功/失败等终态直接定态,仅处理中才轮询
|
||||
if (isProcessTerminal(this.data.detail)) return
|
||||
@@ -171,10 +173,10 @@ Page({
|
||||
},
|
||||
|
||||
fetchDetail(): Promise<void> {
|
||||
// 只读场景携带 share_uuid,后端据此放行非属主读取衣物详情
|
||||
const url = this.data.readonly
|
||||
? `/clothes/${this.data.uuid}?share_uuid=${this.data.shareUUID}`
|
||||
: `/clothes/${this.data.uuid}`
|
||||
// 只读场景需携带放行凭证:穿搭分享用 share_uuid,社区公开穿搭用 outfit_uuid
|
||||
let url = `/clothes/${this.data.uuid}`
|
||||
if (this.data.shareUUID) url += `?share_uuid=${this.data.shareUUID}`
|
||||
else if (this.data.outfitUUID) url += `?outfit_uuid=${this.data.outfitUUID}`
|
||||
return request<ClothesItem>({ url })
|
||||
.then((detail) => {
|
||||
logger.debug(LOG, '详情加载成功, name=', detail && detail.name)
|
||||
|
||||
Reference in New Issue
Block a user