This commit is contained in:
李志鹏
2025-11-18 11:40:49 +08:00
parent 4598bce188
commit 42c7fff73a
4 changed files with 72 additions and 39 deletions

View File

@@ -37,32 +37,56 @@
const generate = (type?: 'reload') => {
customizeInfo.oldInputText = customizeInfo.inputText
customizeInfo.oldTryOnId = customizeInfo.tryOnId
const data = {
customerId: generateStore.customerId,
visitRecordId: generateStore.visitRecordId,
styleId: generateStore.styleId,
// modelPhotoId: generateStore.modelPhotoId,
originalTryOnId: type === 'reload' ? customizeInfo.oldTryOnId : generateStore.originalTryOnId,
isRegenerated: 1,
prompt: customizeInfo.inputText
loading.value = true
if (isDemo.value) {
const data = {
prompt: customizeInfo.inputText,
tryonUrl: customizeInfo.tryOnUrl
}
if (generateStore.customerPhotoId && customizeInfo.count === 0) {
data['customerPhotoId'] = generateStore.customerPhotoId
}
generateTryOnEffectDemo(data)
.then((res: any) => {
customizeInfo.count++
// customizeInfo.tryOnId = res.tryOnId
customizeInfo.tryOnUrl = res.tryOnUrl
// customizeInfo.styleUrl = res.styleUrl
// customizeInfo.isRegenerated = res.isRegenerated
// customizeInfo.isFavorite = !!res.isFavorite
loading.value = false
})
.catch((err) => {
console.error(err)
loading.value = false
})
} else {
const data = {
customerId: generateStore.customerId,
visitRecordId: generateStore.visitRecordId,
styleId: generateStore.styleId,
// modelPhotoId: generateStore.modelPhotoId,
originalTryOnId: type === 'reload' ? customizeInfo.oldTryOnId : generateStore.originalTryOnId,
isRegenerated: 1,
prompt: customizeInfo.inputText
}
if (generateStore.customerPhotoId && customizeInfo.count === 0)
data['customerPhotoId'] = generateStore.customerPhotoId
generateTryOnEffect(data)
.then((res: any) => {
customizeInfo.count++
customizeInfo.tryOnId = res.tryOnId
customizeInfo.tryOnUrl = res.tryOnUrl
customizeInfo.styleUrl = res.styleUrl
customizeInfo.isRegenerated = res.isRegenerated
customizeInfo.isFavorite = !!res.isFavorite
loading.value = false
})
.catch((err) => {
console.error(err)
loading.value = false
})
}
if (generateStore.customerPhotoId && customizeInfo.count === 0)
data['customerPhotoId'] = generateStore.customerPhotoId
loading.value = true;
(isDemo.value ? generateTryOnEffectDemo : generateTryOnEffect)(data)
.then((res: any) => {
customizeInfo.count++
customizeInfo.tryOnId = res.tryOnId
customizeInfo.tryOnUrl = res.tryOnUrl
customizeInfo.styleUrl = res.styleUrl
customizeInfo.isRegenerated = res.isRegenerated
customizeInfo.isFavorite = !!res.isFavorite
loading.value = false
})
.catch((err) => {
console.error(err)
loading.value = false
})
}
if (customizeInfo.tryOnId === '') generate()
@@ -96,6 +120,10 @@
router.push({ name: 'creation' })
}
}
// 选择另一个穿搭
const onChooseAnotherOutfit = () => {
router.push({ name: 'SelectStyle' })
}
</script>
<template>
@@ -132,6 +160,8 @@
</div>
</div>
<div class="btns">
<button v-show="!isDemo" @click="onChooseAnotherOutfit">Choose another outfit</button>
<span></span>
<button @click="onFinish">Finish</button>
</div>
</div>
@@ -262,16 +292,18 @@
}
> .btns {
margin-top: 5rem;
width: 100%;
width: 85%;
display: flex;
justify-content: center;
// justify-content: center;
justify-content: space-between;
> button {
box-sizing: content-box;
font-family: satoshiRegular;
// margin: 0 1.8rem;
border: none;
margin: 0 5.2rem 0 auto;
width: 23.8rem;
// margin: 0 5.2rem 0 auto;
min-width: 18rem;
padding: 0 3.5rem;
height: 6.9rem;
border-radius: 1.3rem;
background: #000;