333
This commit is contained in:
@@ -3,7 +3,11 @@
|
||||
import FooterNavigation from '@/components/FooterNavigation.vue'
|
||||
import GenerateLoading from '@/views/asistant/components/GenerateLoading.vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { generateTryOnEffect, setTryOnEffectFavorite, cancelTryOnEffectFavorite } from '@/api/workshop'
|
||||
import {
|
||||
generateTryOnEffect,
|
||||
setTryOnEffectFavorite,
|
||||
cancelTryOnEffectFavorite
|
||||
} from '@/api/workshop'
|
||||
const emit = defineEmits(['viewType'])
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGenerateStore } from '@/stores'
|
||||
@@ -11,18 +15,19 @@
|
||||
|
||||
const router = useRouter()
|
||||
const inputText = ref('')
|
||||
const isLoved = ref(false)
|
||||
const isFavorite = ref(false)
|
||||
const tryOnUrl = ref('')
|
||||
const loading = ref(false)
|
||||
const onSend = () => {
|
||||
if (inputText.value === '') return
|
||||
generate();
|
||||
generate()
|
||||
const text = inputText.value
|
||||
inputText.value = ''
|
||||
console.log('发送消息:', text)
|
||||
// console.log('发送消息:', text)
|
||||
}
|
||||
const onReload = () => {
|
||||
inputText.value = ''
|
||||
generate(true);
|
||||
generate(true)
|
||||
}
|
||||
|
||||
// 生成结果
|
||||
@@ -35,30 +40,30 @@
|
||||
customerPhotoId: store.customerPhotoId,
|
||||
originalTryOnId: store.originalTryOnId,
|
||||
isRegenerated: isRegenerated ? 1 : 0,
|
||||
prompt: inputText.value,
|
||||
|
||||
};
|
||||
prompt: inputText.value
|
||||
}
|
||||
loading.value = true
|
||||
generateTryOnEffect(data)
|
||||
.then(res => {
|
||||
console.log(res)
|
||||
.then((res) => {
|
||||
tryOnUrl.value = res.tryOnUrl
|
||||
isFavorite.value = !!res.isFavorite
|
||||
loading.value = false
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
generate();
|
||||
generate()
|
||||
|
||||
// 喜欢
|
||||
const isLoveLoading = ref(false)
|
||||
const onLove = () => {
|
||||
if (isLoveLoading.value) return
|
||||
const http = isLoved.value ? cancelTryOnEffectFavorite : setTryOnEffectFavorite
|
||||
const http = isFavorite.value ? cancelTryOnEffectFavorite : setTryOnEffectFavorite
|
||||
isLoveLoading.value = true
|
||||
isLoved.value = !isLoved.value
|
||||
http("tryOnId")
|
||||
isFavorite.value = !isFavorite.value
|
||||
http('tryOnId')
|
||||
.then(() => {
|
||||
isLoveLoading.value = false
|
||||
})
|
||||
@@ -96,14 +101,14 @@
|
||||
<div class="send" @click="onSend"><SvgIcon name="send" size="48" /></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<img src="@/assets/images/workshop/posture/posture_1.png" />
|
||||
<img :src="tryOnUrl" />
|
||||
<!-- <div class="select-box">
|
||||
<div class="icon"><SvgIcon name="history" size="35" /></div>
|
||||
<div class="label">History</div>
|
||||
<div class="icon"><SvgIcon name="xialajiantou" size="29" /></div>
|
||||
</div> -->
|
||||
<div class="icons">
|
||||
<div @click="onLove"><SvgIcon :name="`love_${isLoved ? 1 : 0}`" size="35" /></div>
|
||||
<div @click="onLove"><SvgIcon :name="`love_${isFavorite ? 1 : 0}`" size="35" /></div>
|
||||
<div @click="onReload"><SvgIcon name="reload" size="35" /></div>
|
||||
<!-- <div @click="onDownload"><SvgIcon name="download" size="35" /></div> -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user