演示功能
This commit is contained in:
@@ -2,19 +2,22 @@
|
||||
import HeaderTitle from '@/components/HeaderTitle.vue'
|
||||
import FooterNavigation from '@/components/FooterNavigation.vue'
|
||||
import GenerateLoading from '@/views/asistant/components/GenerateLoading.vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import {
|
||||
generateTryOnEffect,
|
||||
generateTryOnEffectDemo,
|
||||
setTryOnEffectFavorite,
|
||||
cancelTryOnEffectFavorite
|
||||
} from '@/api/workshop'
|
||||
const emit = defineEmits(['viewType'])
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useGenerateStore } from '@/stores'
|
||||
const generateStore = useGenerateStore()
|
||||
|
||||
const customizeInfo = generateStore.customizeInfo
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const isDemo = computed(() => route.query.demo === '1')
|
||||
const customizeInfo = isDemo.value ? generateStore.customizeInfoDemo : generateStore.customizeInfo
|
||||
const loading = ref(false)
|
||||
const onSend = () => {
|
||||
if (customizeInfo.inputText === '') return
|
||||
@@ -45,8 +48,8 @@
|
||||
}
|
||||
if (generateStore.customerPhotoId && customizeInfo.count === 0)
|
||||
data['customerPhotoId'] = generateStore.customerPhotoId
|
||||
loading.value = true
|
||||
generateTryOnEffect(data)
|
||||
loading.value = true;
|
||||
(isDemo.value ? generateTryOnEffectDemo : generateTryOnEffect)(data)
|
||||
.then((res: any) => {
|
||||
customizeInfo.count++
|
||||
customizeInfo.tryOnId = res.tryOnId
|
||||
@@ -66,6 +69,7 @@
|
||||
// 喜欢
|
||||
const isLoveLoading = ref(false)
|
||||
const onLove = () => {
|
||||
if (isDemo.value) return
|
||||
if (isLoveLoading.value) return
|
||||
const http = customizeInfo.isFavorite ? cancelTryOnEffectFavorite : setTryOnEffectFavorite
|
||||
customizeInfo.isFavorite = !customizeInfo.isFavorite
|
||||
@@ -86,7 +90,11 @@
|
||||
router.back()
|
||||
}
|
||||
const onFinish = () => {
|
||||
router.push({ name: 'creation' })
|
||||
if (isDemo.value) {
|
||||
router.push({ name: 'end' })
|
||||
} else {
|
||||
router.push({ name: 'creation' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -114,7 +122,7 @@
|
||||
<div class="icon"><SvgIcon name="xialajiantou" size="29" /></div>
|
||||
</div>
|
||||
<div class="icons">
|
||||
<div @click="onLove">
|
||||
<div @click="onLove" v-if="!isDemo">
|
||||
<SvgIcon :name="`love_${customizeInfo.isFavorite ? 1 : 0}`" size="35" />
|
||||
</div>
|
||||
<div @click="onReload" v-show="customizeInfo.oldInputText">
|
||||
|
||||
Reference in New Issue
Block a user