修复detail打开有时候没有添加衣服成功
This commit is contained in:
@@ -431,7 +431,7 @@ export default defineComponent({
|
||||
}else{
|
||||
this.designShowPrview = 1
|
||||
}
|
||||
await this.setImgSize()
|
||||
// await this.setImgSize()
|
||||
this.generateHighDesignImg = rv.highDesignUrl
|
||||
this.designDetailShow = true
|
||||
this.loadingShow = false
|
||||
@@ -468,11 +468,13 @@ export default defineComponent({
|
||||
designItemDetail?.others?.forEach((item:any) => {
|
||||
if(item.type == 'Body'){
|
||||
body = item
|
||||
this.frontBack.body = item
|
||||
}
|
||||
});
|
||||
let ratio:any = await this?.setPostition(body?.layersObject?.[0]?.imageUrl)
|
||||
if( Number.isNaN(ratio)){
|
||||
if(Number.isNaN(ratio) || ratio == 0){
|
||||
this.setImgSize()
|
||||
return
|
||||
}
|
||||
let frontIndex = 6
|
||||
let backIndex = 3
|
||||
@@ -697,28 +699,30 @@ export default defineComponent({
|
||||
},
|
||||
//按比设置单件衣服宽高位置
|
||||
async setPostition(url:any){
|
||||
let modal_body:any
|
||||
let num:any
|
||||
let img:any = await loadImage(url).then((img:any)=>{
|
||||
modal_body = document.getElementsByClassName('detail_modal_model')[0]
|
||||
if(modal_body == undefined){
|
||||
this.setPostition(url)
|
||||
}
|
||||
num = modal_body?.offsetWidth / img.width;
|
||||
})
|
||||
// nextTick().then(()=>{
|
||||
// })
|
||||
|
||||
function loadImage(url:any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
await nextTick().then(async ()=>{
|
||||
let modal_body:any= document.getElementsByClassName('detail_modal_model')[0]
|
||||
let imgWidth:any
|
||||
await new Promise((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
imgWidth = img.width
|
||||
resolve(img)
|
||||
};
|
||||
img.onerror = reject;
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
// await loadImage(url).then((img:any)=>{
|
||||
// console.log(2);
|
||||
// // modal_body = document.getElementsByClassName('detail_modal_model')[0]
|
||||
// if(modal_body == undefined){
|
||||
// this.setPostition(url)
|
||||
// }
|
||||
// console.log( modal_body?.offsetWidth,imgWidth, img.width);
|
||||
// return num
|
||||
// })
|
||||
num = modal_body?.offsetWidth / imgWidth;
|
||||
})
|
||||
return num
|
||||
},
|
||||
//切换上一张或下一张图的详情
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-show="type_ == 1 || type_ == 3" @click.stop="setPreview" class="subitOkPreviewBtn">{{ $t('DesignDetailEnd.preview') }}</div>
|
||||
<div v-show="type_ == 1 || type_ == 3" @click.stop="setPreview" class="subitOkPreviewBtn" :class="[ !sketchImg.id?!current.id?'active':'':'' ]">{{ $t('DesignDetailEnd.preview') }}</div>
|
||||
<div v-if="type_ == 2 && current?.printObject?.prints?.[0]?.path != null" @click.stop="setPrint" class="subitOkPreviewBtn Guide_1_23">{{ $t('DesignDetailEnd.Layout') }}</div>
|
||||
<div v-else-if="type_ == 2 && designItemDetail?.clothes?.[currentIndex]?.printObject?.prints?.[0]?.path != null && current?.printObject?.prints?.[0]?.path == null" @click.stop="setPreview" class="subitOkPreviewBtn">{{ $t('DesignDetailEnd.preview') }}</div>
|
||||
<DesignPrintOperation v-if="!moible" ref="DesignPrintOperation"></DesignPrintOperation>
|
||||
@@ -548,6 +548,10 @@ export default defineComponent({
|
||||
.subitOkPreviewBtn{
|
||||
bottom: calc(4rem*1.2);
|
||||
position: absolute;
|
||||
&.active{
|
||||
opacity: .5;
|
||||
pointer-events:none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,11 @@ export default defineComponent({
|
||||
this.robotTop = false
|
||||
this.robotInput = false
|
||||
}else{
|
||||
window.location.reload()
|
||||
// window.location.reload()
|
||||
this.$router.push("/home");
|
||||
setTimeout(() => {
|
||||
this.$router.go(0);
|
||||
}, 500);
|
||||
setCookie("isBeginner", true);
|
||||
setCookie("isBeginnerNum", 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user