fix
This commit is contained in:
@@ -122,27 +122,41 @@ export function deleteCustomerPhoto(visitRecordId: string | number) {
|
|||||||
// loading: true,
|
// loading: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/** 查询收藏列表
|
|
||||||
* @param visitRecordId 进店记录id
|
|
||||||
*/
|
|
||||||
export function getTryOnEffectFavoriteList(visitRecordId: string | number) {
|
|
||||||
if (!visitRecordId) return Promise.reject('进店记录id不能为空');
|
|
||||||
return request({
|
|
||||||
url: `/api/try-on-effects/favorites/${visitRecordId}`,
|
|
||||||
method: 'get',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/** 查询某套试穿效果列表
|
|
||||||
* @param styleId 服装id
|
|
||||||
*/
|
|
||||||
export function getTryOnEffectStyleList(styleId: string | number) {
|
|
||||||
if (!styleId) return Promise.reject('服装id不能为空');
|
|
||||||
return request({
|
|
||||||
url: `/api/try-on-effects/style/${styleId}`,
|
|
||||||
method: 'get',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// /** 查询收藏列表
|
||||||
|
// * @param visitRecordId 进店记录id
|
||||||
|
// */
|
||||||
|
// export function getTryOnEffectFavoriteList(visitRecordId: string | number) {
|
||||||
|
// if (!visitRecordId) return Promise.reject('进店记录id不能为空');
|
||||||
|
// return request({
|
||||||
|
// url: `/api/try-on-effects/favorites/${visitRecordId}`,
|
||||||
|
// method: 'get',
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// /** 查询某套试穿效果列表
|
||||||
|
// * @param styleId 服装id
|
||||||
|
// */
|
||||||
|
// export function getTryOnEffectStyleList(styleId: string | number) {
|
||||||
|
// if (!styleId) return Promise.reject('服装id不能为空');
|
||||||
|
// return request({
|
||||||
|
// url: `/api/try-on-effects/style/${styleId}`,
|
||||||
|
// method: 'get',
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
/** 获取历史生成记录
|
||||||
|
* @param params 获取历史生成记录参数
|
||||||
|
* @param params.visitRecordId 进店记录id
|
||||||
|
* @param params.type 类型
|
||||||
|
* @param params.isLibrary 是否是收藏
|
||||||
|
*/
|
||||||
|
export function getGenerateHistoricals(params: Object) {
|
||||||
|
if (!params) return Promise.reject('参数不能为空');
|
||||||
|
return request({
|
||||||
|
url: `/api/try-on-effects/getHistoricals`,
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 选择顾客
|
// 选择顾客
|
||||||
interface CustomerInfo {
|
interface CustomerInfo {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted, computed } from 'vue'
|
||||||
import MyList from '@/components/MyList.vue'
|
import MyList from '@/components/MyList.vue'
|
||||||
import { DownloadImages } from '@/utils/tools'
|
import { DownloadImages } from '@/utils/tools'
|
||||||
|
import { showToast } from 'vant'
|
||||||
import { FlowType } from '@/types/enum'
|
import { FlowType } from '@/types/enum'
|
||||||
import {
|
import {
|
||||||
getTryOnEffectFavoriteList,
|
getGenerateHistoricals,
|
||||||
getTryOnEffectStyleList,
|
|
||||||
setTryOnEffectFavorite,
|
setTryOnEffectFavorite,
|
||||||
cancelTryOnEffectFavorite
|
cancelTryOnEffectFavorite
|
||||||
} from '@/api/workshop'
|
} from '@/api/workshop'
|
||||||
@@ -31,32 +31,47 @@
|
|||||||
const isChooseSave = ref(false) //是否选择保存模式
|
const isChooseSave = ref(false) //是否选择保存模式
|
||||||
|
|
||||||
const navLst = [
|
const navLst = [
|
||||||
{ label: 'Outfit', value: 'outfit', flowType: FlowType.H_OUTFIT },
|
{ label: 'Outfit', value: 'Outfit', flowType: FlowType.H_OUTFIT },
|
||||||
{ label: 'Try-on', value: 'tryOn', flowType: FlowType.H_TRYON },
|
{ label: 'Try-on', value: 'Try-on', flowType: FlowType.H_TRYON },
|
||||||
{ label: 'Gen-AI', value: 'genAi', flowType: FlowType.H_AI }
|
{ label: 'Gen-AI', value: 'Gen-AI', flowType: FlowType.H_AI }
|
||||||
]
|
]
|
||||||
const navActive = ref('outfit');
|
const navActive = ref('Outfit')
|
||||||
navLst.forEach((v) => {
|
navLst.forEach((v) => {
|
||||||
if (v.flowType === query.value.flowType) navActive.value = v.value
|
if (v.flowType === query.value.flowType) navActive.value = v.value
|
||||||
})
|
})
|
||||||
const clickNav = (v) => {
|
const clickNav = (v) => {
|
||||||
|
if (v.value === navActive.value || loading.value) return
|
||||||
navActive.value = v.value
|
navActive.value = v.value
|
||||||
console.log(v)
|
onLoad()
|
||||||
}
|
}
|
||||||
const onLoad = () => {
|
const onLoad = () => {
|
||||||
console.log(navActive.value)
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const http = visitRecordId.value ? getTryOnEffectFavoriteList : getTryOnEffectStyleList
|
finish.value = false
|
||||||
const id = visitRecordId.value || generateStore.styleId
|
list.splice(0, list.length)
|
||||||
http(id)
|
const params = {
|
||||||
|
customerId: generateStore.customerId,
|
||||||
|
type: navActive.value,
|
||||||
|
isLibrary: false
|
||||||
|
}
|
||||||
|
if (props.isChooseOne) {
|
||||||
|
params['visitRecordId'] = ''
|
||||||
|
} else if (visitRecordId.value) {
|
||||||
|
params['visitRecordId'] = visitRecordId.value
|
||||||
|
params.isLibrary = true
|
||||||
|
} else {
|
||||||
|
params['visitRecordId'] = generateStore.visitRecordId
|
||||||
|
}
|
||||||
|
getGenerateHistoricals(params)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
data?.forEach((v) => {
|
data?.forEach((v) => {
|
||||||
const obj = {
|
const obj = {
|
||||||
tryOnId: v.tryOnId,
|
// tryOnId: v.tryOnId,
|
||||||
tryOnUrl: v.tryOnUrl,
|
tryOnUrl: v.tryOnUrl,
|
||||||
styleUrl: v.styleUrl,
|
styleUrl: v.styleUrl,
|
||||||
isFavorite: !!v.isFavorite,
|
isFavorite: !!v.isFavorite,
|
||||||
isRegenerated: !!v.isRegenerated,
|
isRegenerated: !!v.isRegenerated,
|
||||||
|
url: v.url,
|
||||||
|
id: v.id,
|
||||||
|
|
||||||
selected: false,
|
selected: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -203,15 +218,22 @@
|
|||||||
if (props.isChooseOne) {
|
if (props.isChooseOne) {
|
||||||
const selectedItem = list.find((v) => v.selected)
|
const selectedItem = list.find((v) => v.selected)
|
||||||
const nav = navLst.find((v) => v.value === navActive.value)
|
const nav = navLst.find((v) => v.value === navActive.value)
|
||||||
if (!selectedItem || !nav) return
|
if (!selectedItem || !nav) return showToast({ message: 'Please select one only.' })
|
||||||
generateStore.clearCustomizeInfoDemo();
|
if (nav.flowType !== FlowType.H_OUTFIT) {
|
||||||
generateStore.uploadCustomizeInfoDemo({
|
generateStore.clearCustomizeInfoDemo()
|
||||||
tryOnId: selectedItem.tryOnId,
|
generateStore.uploadCustomizeInfoDemo({
|
||||||
tryOnUrl: selectedItem.tryOnUrl,
|
tryOnId: selectedItem.id,
|
||||||
styleUrl: selectedItem.styleUrl,
|
tryOnUrl: selectedItem.tryOnUrl,
|
||||||
isFavorite: selectedItem.isFavorite,
|
styleUrl: selectedItem.styleUrl,
|
||||||
isRegenerated: selectedItem.isRegenerated,
|
isFavorite: selectedItem.isFavorite,
|
||||||
})
|
isRegenerated: selectedItem.isRegenerated
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// style
|
||||||
|
// selectedItem.id
|
||||||
|
// selectedItem.url
|
||||||
|
// selectedItem.isFavorite
|
||||||
|
}
|
||||||
router.push({ name: 'HomeNav', query: { flowType: nav.flowType } })
|
router.push({ name: 'HomeNav', query: { flowType: nav.flowType } })
|
||||||
} else {
|
} else {
|
||||||
router.push({ name: 'end' })
|
router.push({ name: 'end' })
|
||||||
@@ -236,8 +258,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<my-list v-model:loading="loading" v-model:finish="finish" @load="onLoad">
|
<my-list v-model:loading="loading" v-model:finish="finish" @load="onLoad">
|
||||||
<div class="item" v-for="(v, i) in list" :key="i" @click="onItem(v)">
|
<div class="item" v-for="(v, i) in list" :key="i" @click="onItem(v)" :type="navActive">
|
||||||
<img v-lazy="v.tryOnUrl" />
|
<img v-lazy="v.tryOnUrl || v.url" />
|
||||||
<!-- <div class="corner">
|
<!-- <div class="corner">
|
||||||
<div class="ai" v-if="v.isRegenerated">Gen-AI</div>
|
<div class="ai" v-if="v.isRegenerated">Gen-AI</div>
|
||||||
<div class="tryon" v-else>Try-on</div>
|
<div class="tryon" v-else>Try-on</div>
|
||||||
@@ -340,6 +362,12 @@
|
|||||||
margin-bottom: 4rem;
|
margin-bottom: 4rem;
|
||||||
border: 0.1rem solid #000;
|
border: 0.1rem solid #000;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
&[type='Outfit'] {
|
||||||
|
height: 50rem;
|
||||||
|
> img {
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
}
|
||||||
> img {
|
> img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
Reference in New Issue
Block a user