修复选择衣服后刷新进入tryOn的衣服和生成的不一致
This commit is contained in:
@@ -25,7 +25,7 @@ const setLike = (item,str)=>{
|
||||
}
|
||||
|
||||
const setSelectList = (item)=>{
|
||||
emit('selectItem', item)
|
||||
if(item.status == 'SUCCEEDED')emit('selectItem', item)
|
||||
}
|
||||
|
||||
const deleteStyle = (index)=>{
|
||||
@@ -57,6 +57,9 @@ const {} = toRefs(data);
|
||||
<div class="mask running" v-if="item.status == 'RUNNING'">
|
||||
<van-loading type="spinner" size="20rem"/>
|
||||
</div>
|
||||
<div class="mask failed" v-if="item.status == 'FAILED'">
|
||||
Generation failed. Please click refresh to try again.
|
||||
</div>
|
||||
<div class="mask" v-if="item.id == select?.oldId"></div>
|
||||
</div>
|
||||
<div class="btn">
|
||||
@@ -116,6 +119,13 @@ const {} = toRefs(data);
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
top: 0;
|
||||
left: 0;
|
||||
&.failed{
|
||||
color: #fff;
|
||||
font-size: 2rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.van-loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
@@ -70,19 +70,21 @@ export const useGenerateStore = defineStore({
|
||||
actions: {
|
||||
selectStyle(data: any) {
|
||||
this.style.id = data.id
|
||||
console.log(this)
|
||||
},
|
||||
//生成后去掉id 设置oldId来修改样式
|
||||
useStyleGenerate() {
|
||||
if (!this.style.id) return
|
||||
this.style.oldId = this.style.id
|
||||
this.style.id = ''
|
||||
// this.style.id = ''
|
||||
},
|
||||
updateStyle(data) {
|
||||
console.log(data)
|
||||
if (data.id == this.style.oldId) {
|
||||
this.style.oldId = ''
|
||||
}
|
||||
if(data.id == this.style.id) {
|
||||
this.style.id = ''
|
||||
}
|
||||
console.log(this.style)
|
||||
},
|
||||
//模特相关
|
||||
selectModel(data: any) {
|
||||
|
||||
@@ -24,7 +24,7 @@ let data = reactive({
|
||||
let getGenerateTime = null as any
|
||||
|
||||
const selectItem = (item)=>{
|
||||
if((item.id == data.select?.oldId) || !item.id || item.status != 'SUCCEEDED'){
|
||||
if(!item.id || item.status != 'SUCCEEDED'){
|
||||
return
|
||||
}
|
||||
generateStore.selectStyle(item)
|
||||
@@ -37,11 +37,11 @@ const updateStyle = ({item,index})=>{
|
||||
}
|
||||
|
||||
const toProduct = ()=>{
|
||||
if(!generateStore.style.id && !generateStore.style.oldId){
|
||||
if(!generateStore.style.id){
|
||||
showToast({ message: 'Please select a style.' });
|
||||
return
|
||||
}
|
||||
if(generateStore.style.id){
|
||||
if(generateStore.style.id != generateStore.style.oldId){
|
||||
generateStore.setIsGenerate(true)
|
||||
}
|
||||
router.push({ path: 'product' })
|
||||
@@ -94,7 +94,6 @@ onMounted(()=>{
|
||||
emit('view-type', 1)
|
||||
// if(!data.styleList[0]?.id)getRequestOutfitList(0)
|
||||
if(getGenerateTime)clearTimeout(getGenerateTime)
|
||||
console.log(data.styleList)
|
||||
if(!data.styleList[0]?.taskId){
|
||||
requestOutfit({num:4,index:0})
|
||||
}else if(data.styleList.filter((item)=>item?.status != 'SUCCEEDED').length > 0){
|
||||
|
||||
@@ -32,6 +32,7 @@ const options = ref<any[]>([
|
||||
])
|
||||
|
||||
const handleSelect = (value: string) => {
|
||||
if(value == 'meal')return
|
||||
const generateParams = userInfoStore.getGenerateParams()
|
||||
generateParams.sex = value
|
||||
userInfoStore.setGenerateParams(generateParams)
|
||||
|
||||
Reference in New Issue
Block a user