feat(wordcloud): 贴纸持久化(决策#4)+ dispatchOrder/persistDesignMedia 辅助

This commit is contained in:
2026-08-13 01:39:00 +08:00
parent 73fac0cb9c
commit c49ff72f1e
2 changed files with 53 additions and 7 deletions
+5 -7
View File
@@ -4,6 +4,7 @@ import { useState, useEffect } from 'react'
import './index.scss'
import { getProductById } from '../../utils/productConfig'
import { getDesignList, setDesignList, updateDesign, type DesignItem, type StickerItem } from '../../utils/store'
import { persistDesignMedia } from '../../utils/api'
import { useThemeContext } from '../../context/ThemeContext'
import { useSafeArea } from '../../hooks/useSafeArea'
import { useStatusBar } from '../../hooks/useStatusBar'
@@ -241,18 +242,15 @@ export default function DIYPage() {
return base
}
const handleComplete = () => {
const handleComplete = async () => {
if (hasOverlap) {
Taro.showToast({ title: '贴纸不能重叠', icon: 'none' })
return
}
if (designId) {
updateDesign(designId, {
designData: {
stickers,
category
}
})
// 贴纸/底图持久化(决策#4,R4 负责):本地图 → COS 持久 URL,保证后端 WCD 打包可下载素材
const data = await persistDesignMedia({ stickers, category, version: 1 })
updateDesign(designId, { designData: data })
}
setPreviewMode(false)
Taro.navigateTo({ url: `/pages/checkout/index?designId=${designId}` })