commit
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
class="habit_Overal_Single_text"
|
||||
:class="{ active: !overallSingle }"
|
||||
>
|
||||
Overal
|
||||
Overall
|
||||
</div>
|
||||
<a-switch v-model:checked="overallSingle" @change="setOveralSingle"/>
|
||||
<div
|
||||
@@ -49,7 +49,7 @@
|
||||
<i class="fi fi-rr-trash" @click="deletePrint"></i>
|
||||
</div>
|
||||
<div class="designOpenrtion_nav">
|
||||
<div class="designOpenrtion_single" v-show="overallSingle" v-for="item,index in designOpenrtionList" :key="item" :class="{active:printStyleList[index].designOpenrtionBtn}">
|
||||
<div class="designOpenrtion_single" v-show="overallSingle" v-for="item,index in designOpenrtionList" :key="item" :class="{active:printStyleList[index]?.designOpenrtionBtn?printStyleList[index]?.designOpenrtionBtn:false}">
|
||||
<img :src="item.path" @click="setpitch(item,index)">
|
||||
</div>
|
||||
<div class="designOpenrtion_overall" v-show="!overallSingle">
|
||||
@@ -60,23 +60,24 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="designOpenrtion_centent" id="designOpenrtionCentent">
|
||||
<div class="designOpenrtion_imgMask" :style="sketch">
|
||||
<!-- <div class="designOpenrtion_imgMask" :style="sketch"> -->
|
||||
<div class="designOpenrtion_imgMask">
|
||||
<div class="designOpenrtion_print" v-show="overallSingle">
|
||||
<div
|
||||
v-for="item,index in designOpenrtionList"
|
||||
:key="item"
|
||||
:style="[printStyleList[index].style]"
|
||||
:style="[printStyleList?.[index]?.style]"
|
||||
@mousedown.stop="itemMoveMousedown(index,$event)"
|
||||
class="modal_imgItem"
|
||||
@click="setpitch(item,index)" ref="content" >
|
||||
<img crossOrigin="anonymous" :src="item.path" :style="{transform:`rotateZ(${printStyleList[index].transform.rotateZ}deg)`}" class="designOpenrtion_imgItme" draggable="false">
|
||||
<img crossOrigin="anonymous" :src="item?.path" :style="{transform:`rotateZ(${printStyleList[index]?.transform?.rotateZ}deg)`}" class="designOpenrtion_imgItme" draggable="false">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <img v-if="overallSingle" :src="current?.layersObject?.[1]?.maskUrl" alt="" class="designOpenrtion_sketch"> -->
|
||||
<img :src="current?.layersObject?.[1]?.imageUrl" alt="" class="designOpenrtion_sketch">
|
||||
<img :src="current?.path" alt="" class="designOpenrtion_sketch">
|
||||
<img v-show="overallSingle" :src="current?.layersObject?.[1]?.maskUrl" alt="" class="designOpenrtion_sketch_mask">
|
||||
<div class="designOpenrtion_btn">
|
||||
<ul v-if="overallSingle" v-for="item,index in printStyleList" :key="item" :class="{active:item.designOpenrtionBtn}" class="designOpenrtion_Mousingle" :style="item.style" @mousedown.stop="itemMoveMousedown(index,$event)">
|
||||
<ul v-if="overallSingle" v-for="item,index in printStyleList" :key="item" :class="{active:item?.designOpenrtionBtn?item?.designOpenrtionBtn:false}" class="designOpenrtion_Mousingle" :style="item.style" @mousedown.stop="itemMoveMousedown(index,$event)">
|
||||
<li class="designOpenrtion_btn_top" @mousedown.stop="itemSizeMousedown('top',$event)"></li>
|
||||
<li class="designOpenrtion_btn_bottom" @mousedown.stop="itemSizeMousedown('bottom',$event)"></li>
|
||||
<li class="designOpenrtion_btn_left" @mousedown.stop="itemSizeMousedown('left',$event)"></li>
|
||||
@@ -84,7 +85,7 @@
|
||||
<li class="designOpenrtion_rotote" v-rotote.stop="[index,item.transform]"></li>
|
||||
</ul>
|
||||
<div v-show="!overallSingle"></div>
|
||||
<ul v-if="!overallSingle" v-for="item,index in printStyleList" :key="item" :class="{active:item.designOpenrtionBtn}" class="designOpenrtion_Mouoverall" :style="'left:'+item.style.left+';top:'+item.style.top" @mousedown.stop="itemMoveMousedown(index,$event)">
|
||||
<ul v-if="!overallSingle" v-for="item,index in printStyleList" :key="item" :class="{active:item?.designOpenrtionBtn?item?.designOpenrtionBtn:false}" class="designOpenrtion_Mouoverall" :style="'left:'+item.style.left+';top:'+item.style.top" @mousedown.stop="itemMoveMousedown(index,$event)">
|
||||
<i class="fi fi-rr-arrows animtion1"></i>
|
||||
<i class="fi fi-rr-arrows animtion2"></i>
|
||||
</ul>
|
||||
@@ -194,7 +195,6 @@ export default defineComponent({
|
||||
var info = el.getBoundingClientRect();
|
||||
let eX = info.x + info.width / 2;
|
||||
let eY = info.y + info.height / 2;
|
||||
|
||||
document.addEventListener('mousemove', (e) => {
|
||||
if (mouse) {
|
||||
let X = eX
|
||||
@@ -208,41 +208,11 @@ export default defineComponent({
|
||||
});
|
||||
// 添加鼠标松开事件监听器
|
||||
document.addEventListener('mouseup', () => {
|
||||
value.instance.printStyleList[0].transform.rotateZ = angle
|
||||
// console.log(value.instance.printStyleList);
|
||||
mouse = false;
|
||||
});
|
||||
});
|
||||
//缩放
|
||||
// let timeSwitch = true
|
||||
// el.parentNode.addEventListener('mousemove', (e) => {
|
||||
// el.parentNode.addEventListener('mousewheel',(e) => {
|
||||
// if(timeSwitch){
|
||||
// timeSwitch = false
|
||||
// if(e.deltaY > 0){
|
||||
// if(num <= 1){
|
||||
// num -= 0.05
|
||||
// }else{
|
||||
// num -= 0.1
|
||||
// }
|
||||
// }else{
|
||||
// //放大
|
||||
// if(num <= 1){
|
||||
// num += 0.05
|
||||
// }else{
|
||||
// num += 0.1
|
||||
// }
|
||||
// }
|
||||
// if(num >= 3){
|
||||
// num = 3
|
||||
// }else if (num < .2){
|
||||
// num = .2
|
||||
// }
|
||||
// setTimeout(() => {
|
||||
// timeSwitch = true
|
||||
// }, 100);
|
||||
// elParent.firstElementChild.style.transform = "scale("+ num + ") rotateZ("+ angle + "deg)"
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
}
|
||||
|
||||
},
|
||||
@@ -252,35 +222,45 @@ export default defineComponent({
|
||||
let DesignPrintOperationParent = this.$parent
|
||||
this.designOpenrtion = true
|
||||
this.clearModal()
|
||||
this.designOpenrtionList.push(this.current.printObject)
|
||||
this.designOpenrtionList = []
|
||||
this.designOpenrtionList.push(...this.current.printObject.prints)
|
||||
this.overallSingle = DesignPrintOperationParent.overallSingle
|
||||
this.systemDesignerPercentage = DesignPrintOperationParent.systemDesignerPercentage
|
||||
// let skecth = new Image
|
||||
// if(!this.overallSingle){
|
||||
// skecth.src = this.current.layersObject[1].imageUrl
|
||||
// }else{
|
||||
// skecth.src = this.current.layersObject[1].maskUrl
|
||||
// }
|
||||
// skecth.onload=()=>{
|
||||
// this.sketch.width = skecth.width/10+'rem'
|
||||
// this.sketch.height = skecth.height/10+'rem'
|
||||
// }
|
||||
|
||||
this.sketch = {
|
||||
width:this.current.layersObject[1].imageSize[0]/10+'rem',
|
||||
height:this.current.layersObject[1].imageSize[1]/10+'rem'
|
||||
let skecth = new Image
|
||||
skecth.src = this.current.path
|
||||
skecth.onload=()=>{
|
||||
this.sketch.width = skecth.width/10+'rem'
|
||||
this.sketch.height = skecth.height/10+'rem'
|
||||
}
|
||||
// this.sketch = {
|
||||
// width:this.current.layersObject[1].imageSize[0]/10+'rem',
|
||||
// height:this.current.layersObject[1].imageSize[1]/10+'rem'
|
||||
// }
|
||||
let print = new Image
|
||||
print.src = this.current.printObject.path
|
||||
print.src = this.current.printObject.prints[0].path
|
||||
print.onload=()=>{
|
||||
let sketch = document.getElementsByClassName("designOpenrtion_modal")[0]?.getElementsByClassName('designOpenrtion_sketch')[0]
|
||||
let sketchNum = this.sketch.width.replace(/rem/g,'')*10/sketch.offsetWidth
|
||||
this.print.width = print.width+'px'
|
||||
this.print.height = print.height+'px'
|
||||
this.printStyleList[0].style.width = print.width+'px'
|
||||
this.printStyleList[0].style.height = print.height+'px'
|
||||
this.printStyleList[0].designOpenrtionBtn = false
|
||||
if(this.overallSingle){
|
||||
nextTick().then(()=>{
|
||||
if(this.designOpenrtionList[0].scale){
|
||||
this.designOpenrtionList.forEach((item,index)=>{
|
||||
this.setTemplate(item,index)
|
||||
this.printAmount = this.printStyleList.length
|
||||
|
||||
})
|
||||
}else{
|
||||
this.refetchTemplate(0)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if(this.overallSingle){
|
||||
this.refetchTemplate(0)
|
||||
}
|
||||
|
||||
},
|
||||
systemDesigner(num) {
|
||||
let DesignPrintOperationParent = this.$parent
|
||||
@@ -296,18 +276,10 @@ export default defineComponent({
|
||||
if (!this.overallSingle) {
|
||||
this.printAmount = 1
|
||||
this.setprintAmount()
|
||||
}else{
|
||||
this.random()
|
||||
}
|
||||
let skecth = new Image
|
||||
// if(!this.overallSingle){
|
||||
// skecth.src = this.current.layersObject[1].imageUrl
|
||||
// }else{
|
||||
// skecth.src = this.current.layersObject[1].maskUrl
|
||||
// }
|
||||
skecth.src = this.current.layersObject[1].imageUrl
|
||||
skecth.onload=()=>{
|
||||
this.sketch.width = skecth.width/10+'rem'
|
||||
this.sketch.height = skecth.height/10+'rem'
|
||||
}
|
||||
|
||||
},
|
||||
setpitch(item,index){
|
||||
this.printStyleList.forEach((v)=>{
|
||||
@@ -371,7 +343,8 @@ export default defineComponent({
|
||||
//鼠标移动
|
||||
moveMousemove(e) {
|
||||
let imgDomWH = this.imgDom.getBoundingClientRect()
|
||||
let parentNode = document.getElementsByClassName('designOpenrtion_modal')[0].getElementsByClassName("designOpenrtion_imgMask")[0].getBoundingClientRect()
|
||||
let parentNode = document.getElementsByClassName('designOpenrtion_modal')[0].getElementsByClassName("designOpenrtion_imgMask")[0]
|
||||
parentNode = parentNode.getBoundingClientRect()
|
||||
let x = (e.x - this.printStyleList[this.imgDomIndex].centers.left)+'px'
|
||||
let y = ( e.y - this.printStyleList[this.imgDomIndex].centers.top)+'px'
|
||||
this.printStyleList[this.imgDomIndex].style.left = x
|
||||
@@ -464,7 +437,7 @@ export default defineComponent({
|
||||
for (let index = 0; index < num; index++) {
|
||||
this.printStyleList.push(this.printStyleList[this.printStyleList.length-1])
|
||||
this.refetchTemplate(this.printStyleList.length-1)
|
||||
this.designOpenrtionList.push(this.current.printObject)
|
||||
this.designOpenrtionList.push(this.current.printObject.prints[this.current.printObject.prints.length-1])
|
||||
}
|
||||
}else{
|
||||
let num = this.printStyleList.length - this.printAmount
|
||||
@@ -486,23 +459,22 @@ export default defineComponent({
|
||||
this.printAmount = this.designOpenrtionList.length
|
||||
},
|
||||
random(){
|
||||
this.printStyleList.forEach((v,index)=>{
|
||||
this.designOpenrtionList.forEach((v,index)=>{
|
||||
this.refetchTemplate(index)
|
||||
})
|
||||
},
|
||||
//随机重置图片顺序
|
||||
refetchTemplate(index) {
|
||||
// let scale = (Math.trunc(Math.random()*15)+1)*.1
|
||||
|
||||
let rotateZ1 = Math.trunc(Math.random()*360)+1
|
||||
let rotateZ2 = Math.trunc(Math.random()*360)+1
|
||||
let sketch = document.getElementsByClassName('designOpenrtion_sketch')[0]
|
||||
let width = Math.trunc(Math.random()*(sketch.width-sketch.width/3))+1+sketch.width/3
|
||||
let sketch = document.getElementsByClassName("designOpenrtion_modal")[0]?.getElementsByClassName('designOpenrtion_sketch')[0]
|
||||
let width = Math.trunc(Math.random()*(sketch?.width-sketch?.width/3))+1+sketch?.width/3
|
||||
let scale = width / this.print.width.replace(/px/g,'')
|
||||
// let x = sketch.width-Number(this.print.width.replace(/px/g,''))
|
||||
// let y = sketch.height-Number(this.print.height.replace(/px/g,''))
|
||||
let x = sketch.width-20
|
||||
let y = sketch.height-20
|
||||
let x = sketch?.width-20
|
||||
let y = sketch?.height-20
|
||||
this.printStyleList[index]={
|
||||
centers:{
|
||||
left:0,
|
||||
@@ -523,6 +495,35 @@ export default defineComponent({
|
||||
},
|
||||
designOpenrtionBtn:false
|
||||
}
|
||||
},
|
||||
//设置图片
|
||||
setTemplate(item,index) {
|
||||
this.designOpenrtionList
|
||||
let sketch = document.getElementsByClassName("designOpenrtion_modal")[0]?.getElementsByClassName('designOpenrtion_sketch')[0]
|
||||
let sketchNum = this.sketch.width.replace(/rem/g,'')*10/sketch.offsetWidth
|
||||
let scale
|
||||
scale = (this.print.width.replace(/px/g,'')*sketchNum/this.print.width.replace(/px/g,''))
|
||||
let zIndex = 1
|
||||
this.printStyleList[index]={
|
||||
centers:{
|
||||
left:0,
|
||||
top:0,
|
||||
},
|
||||
style:{
|
||||
left:item.location[0]/sketchNum+'px',
|
||||
top:item.location[1]/sketchNum+'px',
|
||||
right:"auto",
|
||||
bottom:"auto",
|
||||
width:this.print.width.replace(/px/g,'')/sketchNum*item.scale+'px',
|
||||
height:this.print.height.replace(/px/g,'')/sketchNum*item.scale+'px',
|
||||
zIndex:zIndex++
|
||||
},
|
||||
transform:{
|
||||
// scale:scale<.2?.2:scale,//0.2-3
|
||||
rotateZ:item.angle,
|
||||
},
|
||||
designOpenrtionBtn:false
|
||||
}
|
||||
},
|
||||
computeZindex(){
|
||||
let arr = JSON.parse(JSON.stringify(this.printStyleList))
|
||||
@@ -549,15 +550,16 @@ export default defineComponent({
|
||||
scale = this.systemDesignerPercentage*3/100
|
||||
location = [arr[index].style.left.replace(/px/g,'')*sketchNum+this.print.width.replace(/px/g,'')/2-7,arr[index].style.top.replace(/px/g,'')*sketchNum+this.print.height.replace(/px/g,'')/2-7]
|
||||
}else{
|
||||
console.log(arr[index].style.width.replace(/px/g,''),this.print.width.replace(/px/g,''));
|
||||
scale = (arr[index].style.width.replace(/px/g,'')/this.print.width.replace(/px/g,''))
|
||||
scale = (arr[index].style.width.replace(/px/g,'')*sketchNum/this.print.width.replace(/px/g,''))
|
||||
location = [arr[index].style.left.replace(/px/g,'')*sketchNum,arr[index].style.top.replace(/px/g,'')*sketchNum]
|
||||
}
|
||||
let obj = {
|
||||
angle : arr[index].transform.rotateZ,
|
||||
angle : !this.overallSingle ? 0:arr[index].transform.rotateZ,
|
||||
location : location,
|
||||
priority:arr[index].style.zIndex,
|
||||
scale:scale,
|
||||
scale: !this.overallSingle? 1:scale,
|
||||
path:this.designOpenrtionList[index].path,
|
||||
minIOPath:this.designOpenrtionList[index].minIOPath,
|
||||
}
|
||||
prints.push(obj)
|
||||
})
|
||||
@@ -581,9 +583,8 @@ export default defineComponent({
|
||||
// timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
// }
|
||||
let data = this.store.state.DesignDetailModule.designPreviewData
|
||||
data.designSingleItemDTOList[0].printObject={
|
||||
data.designSingleItemDTOList[index].printObject={
|
||||
ifSingle:this.overallSingle,
|
||||
path:this.designOpenrtionList[0].path,
|
||||
prints:this.computeZindex(),
|
||||
}
|
||||
data.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||
@@ -591,13 +592,22 @@ export default defineComponent({
|
||||
this.loadingShow = true
|
||||
Https.axiosPost(Https.httpUrls.designSingle, data).then(
|
||||
(rv) => {
|
||||
// this.parentData.design.designItemUrl = rv.designItemUrl
|
||||
// this.$emit('finishRedesign',this.parentData)
|
||||
// this.closeModal()
|
||||
designItemDetail.clothes[index].printObject.path = rv.clothes[0].printObject.path
|
||||
designItemDetail.clothes[index].layersObject = rv.clothes[0].layersObject
|
||||
// designItemDetail.clothes[index].printObject.path = rv.clothes[0].printObject.path
|
||||
|
||||
designItemDetail.currentFullBodyView = rv.currentFullBodyView
|
||||
designItemDetail.clothes[index].printObject.ifSingle = this.overallSingle
|
||||
designItemDetail.clothes[index].layersObject = rv.clothes[index].layersObject
|
||||
designItemDetail.clothes[index].printObject.prints = this.computeZindex()
|
||||
console.log(rv);
|
||||
designItemDetail.clothes.forEach((item,i)=>{
|
||||
let a
|
||||
if(item.layersObject[0].imageCategory.indexOf("back") == -1){
|
||||
a = item.layersObject[0]
|
||||
item.layersObject[0] = item.layersObject[1]
|
||||
item.layersObject[1] = a
|
||||
}
|
||||
item.layersObject[0].id = this.store.state.DesignDetailModule.designItemDetail.clothes[i].layersObject[0].id
|
||||
item.layersObject[1].id = this.store.state.DesignDetailModule.designItemDetail.clothes[i].layersObject[1].id
|
||||
})
|
||||
this.store.commit("setDesignItemDetail", designItemDetail);
|
||||
this.loadingShow = false
|
||||
this.designOpenrtion = false
|
||||
@@ -829,9 +839,13 @@ export default defineComponent({
|
||||
>img{
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 100%;
|
||||
// max-width: 100%;
|
||||
// max-height: 100%;
|
||||
// width: 100%;
|
||||
// height: 50rem;
|
||||
max-height: 50rem;
|
||||
min-height: 30rem;
|
||||
width: auto;
|
||||
}
|
||||
.designOpenrtion_sketch_mask{
|
||||
z-index: 3;
|
||||
|
||||
Reference in New Issue
Block a user