This commit is contained in:
X1627315083
2023-12-13 16:36:54 +08:00
parent a0a8ab9a17
commit 18c298d538
3 changed files with 51 additions and 25 deletions

View File

@@ -79,15 +79,15 @@
<div>{{ $t('DesignDetail.CurrentApparel') }}</div>
<i class="fi fi-rr-edit" @click.stop="openCurrent(1)"></i>
</div>
<div class="centent_div" v-if="current?.path" @click="openCurrent(1)">
<div class="centent_div" v-if="current?.id" @click="openCurrent(1)">
<img :src="current?.path" alt="" class="" @click="openCurrent(1)">
</div>
<i v-else class="fi fi-rr-picture centent" @click="openCurrent(1)"></i>
</div>
<div class="clothes_detail_item clothes_detail_item_print">
<div class="clothes_detail_item clothes_detail_item_print" :class="[current.id?'':'hideCursor']">
<div class="clothes_item_header">
<i class="fi fi-rs-comments"></i>
<i class="fi fi-rs-comments"></i>{{ current.id }}
<div>{{ $t('DesignDetail.CurrentPrint') }}</div>
<i class="fi fi-rr-edit" @click.stop="openCurrent(2)"></i>
</div>
@@ -99,7 +99,7 @@
</div>
</div>
<div class="clothes_detail_item clothes_detail_item_color">
<div class="clothes_detail_item clothes_detail_item_color" :class="[current.id?'':'hideCursor']">
<div class="clothes_item_header">
<i class="fi fi-rs-comments"></i>
<div>{{ $t('DesignDetail.CurrentColor') }}</div>
@@ -172,8 +172,6 @@ export default defineComponent({
// return store.state.DesignDetailModule.designItemDetail
// })
let designItemDetail :any = computed(()=>{
console.log(store.state.DesignDetailModule.designItemDetail,'-=-=--==--==-');
return store.state.DesignDetailModule.designItemDetail
})
let parentData:any = ref({
@@ -331,6 +329,11 @@ export default defineComponent({
methods:{
openCurrent(num: Number) {
let DesignDetailAlter:any = this.$refs.DesignDetailAlter
if(num == 2 || num == 3){
if(!this.current.id){
return
}
}
DesignDetailAlter.init(num)
if(num ==2 ){
if(this.driver__.driver){
@@ -430,6 +433,9 @@ export default defineComponent({
}
});
let ratio:any = await this?.setPostition(body?.layersObject?.[0]?.imageUrl)
if( Number.isNaN(ratio)){
this.setImgSize()
}
let frontIndex = 6
let backIndex = 3
designItemDetail.clothes.forEach((v:any,index:any)=>{
@@ -646,14 +652,14 @@ export default defineComponent({
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(()=>{
// })
console.log(modal_body);
if(modal_body == undefined){
this.setPostition(url)
}
function loadImage(url:any) {
return new Promise((resolve, reject) => {
const img = new Image();
@@ -1149,6 +1155,11 @@ export default defineComponent({
display: flex;
flex-direction: column;
overflow: hidden;
.hideCursor{
*{
cursor: not-allowed !important;
}
}
.clothes_detail_item{
// margin-bottom: 5rem;
flex: 1;
@@ -1165,6 +1176,7 @@ export default defineComponent({
position: relative;
display: inline-block;
}
.clothes_item_header{
// height: 6.4rem;
margin-bottom: 1rem;

View File

@@ -423,7 +423,6 @@ export default defineComponent({
}
})
})
console.log(designItemDetail,'============================');
this.$emit('setDesignCoverage');
this.store.commit("setDesignItemDetail", designItemDetail);
this.setRevocation(designItemDetail,data)

View File

@@ -161,13 +161,20 @@ export default defineComponent({
v.layersObject[i].designOpenrtionBtn = false
if(v.layersObject[i].imageCategory.indexOf("back") == -1){
front[index] = v.layersObject[i]
front[index].style.zIndex = frontIndex-=1
front[index].style.zIndex = v.priority
front[index].id = v.id
}else{
back[index] = v.layersObject[i]
back[index].style.zIndex = backIndex-=1
back[index].style.zIndex = v.priority
back[index].id = v.id
// back[index].style.zIndex = backIndex==0?v.layersObject[i]:backIndex++
}
if(this.printZIndex < v.priority){
this.printZIndex = v.priority
}
}
this.printZIndex++
})
let bodyImgWH = document.getElementsByClassName("design_compile_content")[0].getElementsByClassName("perview_img")[0]
@@ -208,12 +215,13 @@ export default defineComponent({
this.clothesOpenActive(index)
},
// 设置移动
itemMoveMousedown(index,event){
itemMoveMousedown(index,e){
this.imgDomIndex = index
this.frontBack.front.forEach((v)=>{
v.designOpenrtionBtn = false
})
this.clothesOpenActive(index)
let event = e||window.event
this.imgDom = document.getElementsByClassName('design_compile_content')[0].getElementsByClassName("detail_modal_item_front")[this.imgDomIndex]
this.frontBack.front[index].designOpenrtionBtn = true
this.frontBack.front[index].style.zIndex = this.printZIndex++
@@ -357,6 +365,14 @@ export default defineComponent({
})
this.designItemDetail.clothes[index].clothesOpen = true
},
sort(arr){
arr.sort((a, b) => {
var a_num = a.style.zIndex;
var b_num = b.style.zIndex;
return a_num - b_num;
});
return arr
},
async setPreview(data){
let ratio = this.frontBack.body.layersObject[0].imageSize[0]/this.frontBack.body.style.width.replace(/px/g,'')
let designItemDetail = this.store.state.DesignDetailModule.designItemDetail
@@ -365,22 +381,19 @@ export default defineComponent({
// var b_num = b.style.zIndex;
// return a_num - b_num;
// });
let arr = JSON.parse(JSON.stringify(this.frontBack.front))
arr.sort((a, b) => {
var a_num = a.style.zIndex;
var b_num = b.style.zIndex;
return a_num - b_num;
});
let arr = this.sort(JSON.parse(JSON.stringify(this.frontBack.front)))
let num = 10
arr.forEach((item)=>{
item.priority = num++
})
data.designSingleItemDTOList.forEach((item)=>{
let front = this.frontBack.front
let imageCategory1 = front[1].imageCategory
front.forEach((i)=>{
let front = arr
let imageCategory1 = arr[1].imageCategory
arr.forEach((i)=>{
let imageCategory = i.imageCategory.split('_')[0]
if(item.type == this.capitalizeFirstLetter(imageCategory)){
if(item.id == i.id){
let y = ((i?.style?.top.replace(/px/g,'')*ratio).toFixed(0) - i?.position[0])
let x = ((i?.style?.left.replace(/px/g,'')*ratio).toFixed(0) - i?.position[1])
let scale = i?.imageSize?Number(((i?.style?.width.replace(/px/g,'')*ratio)/(i?.imageSize[0]/i.scale)).toFixed(2)):1
@@ -405,8 +418,10 @@ export default defineComponent({
designItemDetail.currentFullBodyView = rv.currentFullBodyView
rv.clothes.forEach((item)=>{
designItemDetail.clothes.forEach((i)=>{
if(item.type === i.type){
if(item.id === i.id){
i.layersObject = item.layersObject
i.priority = item.layersObject[0].priority
console.log(item,i);
}
})
})