Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/lanecarford_front
All checks were successful
git提交控制 AiDA WEB-Node.js main 分支构建部署 / build (20.19.0) (push) Has been skipped

This commit is contained in:
X1627315083
2025-12-22 13:39:43 +08:00
7 changed files with 76 additions and 49 deletions

View File

@@ -3,7 +3,7 @@ button.sandblasted-blurred {
border: 0.4rem solid #fff;
font-family: satoshiMedium;
font-weight: 500;
font-size: 5.5rem;
font-size: 4rem;
color: #fff;
background-color: transparent;
position: relative;

View File

@@ -3,7 +3,7 @@ button.sandblasted-blurred {
border: 0.4rem solid #fff;
font-family: satoshiMedium;
font-weight: 500;
font-size: 5.5rem;
font-size: 4rem;
color: #fff;
background-color: transparent;
position: relative;

View File

@@ -10,4 +10,9 @@ export const FlowType = {
H_TRYON: 'history-tryon',
/** 历史流程-AI */
H_AI: 'history-ai',
}
/** 是否是历史流程 */
export const IsHistoryFlow = (flowType: any) => {
const arr = [FlowType.HISTORY, FlowType.H_OUTFIT, FlowType.H_TRYON, FlowType.H_AI]
return arr.some((v) => v === flowType)
}

View File

@@ -35,12 +35,16 @@
{ label: 'Try-on', value: 'tryOn', flowType: FlowType.H_TRYON },
{ label: 'Gen-AI', value: 'genAi', flowType: FlowType.H_AI }
]
const navActive = ref('outfit')
const navActive = ref('outfit');
navLst.forEach((v) => {
if (v.flowType === query.value.flowType) navActive.value = v.value
})
const clickNav = (v) => {
navActive.value = v.value
console.log(v)
}
const onLoad = () => {
console.log(navActive.value)
loading.value = true
const http = visitRecordId.value ? getTryOnEffectFavoriteList : getTryOnEffectStyleList
const id = visitRecordId.value || generateStore.styleId
@@ -200,6 +204,7 @@
const selectedItem = list.find((v) => v.selected)
const nav = navLst.find((v) => v.value === navActive.value)
if (!selectedItem || !nav) return
console.log(selectedItem, nav)
router.push({ name: 'HomeNav', query: { flowType: nav.flowType } })
} else {
router.push({ name: 'end' })

View File

@@ -1,6 +1,4 @@
<script setup lang="ts">
import HeaderTitle from '@/components/HeaderTitle.vue'
import FooterNavigation from '@/components/FooterNavigation.vue'
import GenerateLoading from '@/views/asistant/components/GenerateLoading.vue'
import { ref, onMounted, computed } from 'vue'
import {
@@ -12,12 +10,15 @@
const emit = defineEmits(['viewType'])
import { useRouter, useRoute } from 'vue-router'
import { useGenerateStore } from '@/stores'
import { FlowType, IsHistoryFlow } from '@/types/enum'
const generateStore = useGenerateStore()
const router = useRouter()
const route = useRoute()
const isDemo = computed(() => route.query.demo === '1')
const customizeInfo = isDemo.value ? generateStore.customizeInfoDemo : generateStore.customizeInfo
const query = computed(() => route.query)
const isHistoryFlow = computed(() => IsHistoryFlow(query.value.flowType))
const customizeInfo = isHistoryFlow.value
? generateStore.customizeInfoDemo
: generateStore.customizeInfo
const loading = ref(false)
const onSend = () => {
if (customizeInfo.inputText === '') return
@@ -38,7 +39,7 @@
customizeInfo.oldInputText = customizeInfo.inputText
customizeInfo.oldTryOnId = customizeInfo.tryOnId
loading.value = true
if (isDemo.value) {
if (isHistoryFlow.value) {
// const data = {
// prompt: customizeInfo.inputText,
// tryonUrl: customizeInfo.tryOnUrl
@@ -54,9 +55,9 @@
}
generateTryOnEffectDemo(data)
.then((res: any) => {
if(!res) return Promise.reject('生成失败');
if (!res) return Promise.reject('生成失败')
customizeInfo.count++
customizeInfo.tryOnId = "1"
customizeInfo.tryOnId = '1'
customizeInfo.tryOnUrl = res
// customizeInfo.styleUrl = res.styleUrl
// customizeInfo.isRegenerated = res.isRegenerated
@@ -91,7 +92,7 @@
})
.catch((err) => {
console.error(err)
if(data['customerPhotoId']) router.back()
if (data['customerPhotoId']) router.back()
loading.value = false
})
}
@@ -101,7 +102,6 @@
// 喜欢
const isLoveLoading = ref(false)
const onLove = () => {
if (isDemo.value) return
if (isLoveLoading.value) return
const http = customizeInfo.isFavorite ? cancelTryOnEffectFavorite : setTryOnEffectFavorite
customizeInfo.isFavorite = !customizeInfo.isFavorite
@@ -112,6 +112,7 @@
})
.catch((err) => {
console.error(err)
customizeInfo.isFavorite = !customizeInfo.isFavorite
isLoveLoading.value = false
})
}
@@ -122,11 +123,13 @@
router.back()
}
const onFinish = () => {
if (isDemo.value) {
router.push({ name: 'end' })
} else {
router.push({ name: 'creation' })
}
// router.push({ name: 'creation', query: query.value })
router.push({ name: 'creation', query: { flowType: FlowType.H_AI } })
// if (isHistoryFlow.value) {
// router.push({ name: 'end' })
// } else {
// router.push({ name: 'creation' })
// }
}
// 选择另一个穿搭
const onChooseOutfit = () => {
@@ -135,7 +138,6 @@
</script>
<template>
<header-title style-type="2" />
<div class="loading" v-if="loading"><generate-loading /></div>
<div class="customize" v-else>
<div class="title">Customize your Look!</div>
@@ -158,7 +160,7 @@
<div class="icon"><SvgIcon name="xialajiantou" size="29" /></div>
</div>
<div class="icons">
<div @click="onLove" v-if="!isDemo">
<div @click="onLove">
<SvgIcon :name="`love_${customizeInfo.isFavorite ? 1 : 0}`" size="35" />
</div>
<div @click="onReload" v-show="customizeInfo.oldInputText">
@@ -168,12 +170,12 @@
</div>
</div>
<div class="btns">
<button v-show="!isDemo" @click="onChooseOutfit">Choose Outfit</button>
<span></span>
<button @click="onFinish">Finish</button>
<button class="choose-outfit" v-if="!isHistoryFlow" @click="onChooseOutfit">
Choose Outfit
</button>
<button class="finish" @click="onFinish">Finish</button>
</div>
</div>
<footer-navigation />
</template>
<style scoped lang="less">
@@ -299,27 +301,37 @@
}
}
> .btns {
margin-top: 5rem;
margin-top: 4rem;
width: 68%;
display: flex;
// justify-content: center;
justify-content: space-between;
> button {
padding: 0;
box-sizing: content-box;
font-family: satoshiRegular;
border: none;
width: 34rem;
height: 7.4rem;
height: 9.2rem;
border-radius: 1.3rem;
background: #000;
font-weight: 400;
font-size: 3.8rem;
color: #fff;
&:active {
opacity: 0.7;
}
}
> :first-child.finish,
> .choose-outfit {
background-color: transparent;
color: #000;
border: 0.2rem solid #000;
}
> :first-child.finish {
width: 87.5rem;
}
> .finish {
background-color: #000;
color: #fff;
}
}
}
</style>

View File

@@ -2,6 +2,7 @@
import { ref, onMounted, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { useGenerateStore } from '@/stores'
import { IsHistoryFlow } from '@/types/enum'
const generateStore = useGenerateStore()
const emit = defineEmits(['view-type'])
onMounted(() => {
@@ -10,7 +11,7 @@
const router = useRouter()
const route = useRoute()
const query = computed(() => route.query)
const isDemo = computed(() => route.query.demo === '1')
const isHistoryFlow = computed(() => IsHistoryFlow(query.value.flowType))
// 上传照片
const handleUploadFace = () => {
// generateStore.updatePhotoInfo({})
@@ -18,18 +19,14 @@
}
// 跳过上传
const handleFinish = () => {
if (isDemo.value) {
handleUploadFace();
} else {
generateStore.updatePhotoInfo({})
generateStore.clearCustomizeInfo()
generateStore.uploadCustomizeInfo({
tryOnId: generateStore.originalTryOn.id,
tryOnUrl: generateStore.originalTryOn.tryOnUrl,
isFavorite: generateStore.originalTryOn.isLike
})
router.push({ name: 'customize', query: query.value })
}
generateStore.updatePhotoInfo({})
generateStore.clearCustomizeInfo()
generateStore.uploadCustomizeInfo({
tryOnId: generateStore.originalTryOn.id,
tryOnUrl: generateStore.originalTryOn.tryOnUrl,
isFavorite: generateStore.originalTryOn.isLike
})
router.push({ name: 'customize', query: query.value })
}
</script>
@@ -48,7 +45,13 @@
<button class="sandblasted-blurred flex flex-center" @click="handleUploadFace">
<span>Upload Face</span>
</button>
<button class="sandblasted-blurred flex flex-center" @click="handleFinish" v-if="!isDemo"><span>Finish</span></button>
<button
class="sandblasted-blurred flex flex-center"
@click="handleFinish"
v-if="!isHistoryFlow"
>
<span>Finish</span>
</button>
</div>
</div>
</template>
@@ -97,7 +100,7 @@
border-radius: 0.7rem;
margin: 0 1.8rem;
&.sandblasted-blurred {
border-width: 0.2rem;
// border-width: 0.2rem;
}
}
}

View File

@@ -3,6 +3,7 @@
import { useRouter, useRoute } from 'vue-router'
import { uploadCustomerPhoto } from '@/api/workshop'
import { useGenerateStore } from '@/stores'
import { IsHistoryFlow } from '@/types/enum'
const generateStore = useGenerateStore()
const emit = defineEmits(['view-type'])
@@ -12,7 +13,7 @@
const router = useRouter()
const route = useRoute()
const query = computed(() => route.query)
const isDemo = computed(() => route.query.demo === '1')
const isHistoryFlow = computed(() => IsHistoryFlow(query.value.flowType))
const fileData = generateStore.photoInfo
if (!fileData.file?.size) generateStore.updatePhotoInfo({})
// 上传照片
@@ -46,7 +47,7 @@
formData.append('file', fileData.file)
uploadCustomerPhoto(formData).then((res) => {
generateStore.updatePhotoInfo({ ...res, file: fileData.file })
isDemo.value ? generateStore.clearCustomizeInfoDemo() : generateStore.clearCustomizeInfo()
isHistoryFlow.value ? generateStore.clearCustomizeInfoDemo() : generateStore.clearCustomizeInfo()
router.push({ name: 'customize', query: query.value })
})
}
@@ -144,10 +145,11 @@
display: flex;
justify-content: center;
> button {
width: 34.5rem;
height: 8.6rem;
border-radius: 4.3rem;
width: 35rem;
height: 8.3rem;
margin: 0 5rem;
// border-radius: 4.3rem;
border-width: 0.25rem;
}
}
}