detail调整
This commit is contained in:
@@ -98,9 +98,7 @@
|
||||
<img crossOrigin="anonymous" :src="item?.path" :style="{transform:`rotateZ(${printStyleList[index]?.transform?.rotateZ}deg)`}" class="designOpenrtionMobile_imgItme" draggable="false">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <img v-if="overallSingle" :src="current?.layersObject?.[1]?.maskUrl" alt="" class="designOpenrtionMobile_sketch"> -->
|
||||
<img :src="current?.path" alt="" class="designOpenrtionMobile_sketch">
|
||||
<img v-show="overallSingle" :src="current?.layersObject?.[1]?.maskUrl" alt="" class="designOpenrtionMobile_sketch_mask">
|
||||
<img v-lazy="operationCurrent.undividedLayer || operationCurrent.path" alt="" class="designOpenrtion_sketch">
|
||||
<div class="designOpenrtionMobile_btn">
|
||||
<ul v-if="overallSingle" v-for="item,index in printStyleList[stateOverallSingle]" :key="item" :class="{active:item?.designOpenrtionBtn?item?.designOpenrtionBtn:false}" class="designOpenrtionMobile_Mousingle" :style="item.style" @touchstart.stop="itemMoveMousedown(index,$event)">
|
||||
<li class="designOpenrtionMobile_btn_top" @touchstart.stop="itemSizeMousedown('top',$event)"></li>
|
||||
@@ -199,6 +197,9 @@ export default defineComponent({
|
||||
let sketch = ref({
|
||||
width:'',
|
||||
height:''
|
||||
})
|
||||
let operationCurrent = ref({
|
||||
|
||||
})
|
||||
let loadingShow = ref(false)
|
||||
let currentFullBodyView = ref('')
|
||||
@@ -223,6 +224,7 @@ export default defineComponent({
|
||||
imgDomIndex,
|
||||
print,
|
||||
sketch,
|
||||
operationCurrent,
|
||||
loadingShow,
|
||||
setRevocation,
|
||||
t,
|
||||
@@ -295,11 +297,14 @@ export default defineComponent({
|
||||
if(designItemDetail.others.length == 0){
|
||||
this.body = true
|
||||
}
|
||||
//设置前片后片
|
||||
this.operationCurrent = Object.assign({},this.current)
|
||||
this.designOpenrtion = true
|
||||
this.clearModal()
|
||||
this.overallSingle = this.current.printObject.ifSingle?true:false
|
||||
this.ifListOver()
|
||||
if(this.current.printObject.prints)this.exhibitionOpenrtionList[this.stateOverallSingle] = JSON.parse(JSON.stringify(this.current.printObject.prints))
|
||||
let printList = JSON.parse(JSON.stringify(this.current.printObject.prints))
|
||||
this.setprintList(printList)
|
||||
if(this.$parent.exhibitionList.print)this.designOpenrtionList = JSON.parse(JSON.stringify(this.$parent.exhibitionList.print))
|
||||
if(this.$parent.elementsList)this.designList = JSON.parse(JSON.stringify(this.$parent.printsList))
|
||||
if(this.overallSingle == false && this.designOpenrtionList.length > 0){
|
||||
@@ -314,12 +319,27 @@ export default defineComponent({
|
||||
this.sketch.height = skecth.height/10+'rem'
|
||||
skecth.remove()
|
||||
}
|
||||
if(this.exhibitionOpenrtionList[this.stateOverallSingle].length > 0){
|
||||
this.exhibitionOpenrtionList[this.stateOverallSingle].forEach((item,index)=>{
|
||||
this.setTemplate(item,index)
|
||||
if(this.exhibitionOpenrtionList.overall.length > 0){
|
||||
let str = 'overall'
|
||||
this.exhibitionOpenrtionList[str].forEach((item,index)=>{
|
||||
this.setTemplate(item,index,str)
|
||||
})
|
||||
}else{
|
||||
}
|
||||
if(this.exhibitionOpenrtionList.single.length > 0){
|
||||
let str = 'single'
|
||||
this.exhibitionOpenrtionList[str].forEach((item,index)=>{
|
||||
this.setTemplate(item,index,str)
|
||||
})
|
||||
}
|
||||
},
|
||||
setprintList(arr){
|
||||
arr.forEach(item=>{
|
||||
if(item.ifSingle){
|
||||
this.exhibitionOpenrtionList.single.push(item)
|
||||
}else{
|
||||
this.exhibitionOpenrtionList.overall.push(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
ifListOver(){
|
||||
if(!this.overallSingle){
|
||||
@@ -366,6 +386,7 @@ export default defineComponent({
|
||||
})
|
||||
if(!this.overallSingle){
|
||||
if(item.checked){
|
||||
this.imgDomIndex = 0
|
||||
this.deletePrint()
|
||||
item.checked = false
|
||||
return
|
||||
@@ -388,7 +409,8 @@ export default defineComponent({
|
||||
path:item.path,
|
||||
priority:1,
|
||||
scale:.3,
|
||||
location:[0,0]
|
||||
location:[0,0],
|
||||
ifSingle:false,
|
||||
}
|
||||
this.systemDesignerPercentage = item.scale?item.scale*100:30
|
||||
}else{
|
||||
@@ -402,7 +424,8 @@ export default defineComponent({
|
||||
path:item.path,
|
||||
priority:1,
|
||||
scale:1,
|
||||
location:[0,0]
|
||||
location:[0,0],
|
||||
ifSingle:true,
|
||||
})
|
||||
this.refetchTemplate(currentIndex,false)
|
||||
}
|
||||
@@ -563,26 +586,36 @@ export default defineComponent({
|
||||
let scale
|
||||
if(sketch.width<sketch.height){
|
||||
width = Math.trunc(Math.random()*(sketch?.width-sketch?.width/2))+sketch?.width/4
|
||||
if(boor){
|
||||
width = Math.trunc((sketch?.width-sketch?.width/2))+sketch?.width/4
|
||||
}
|
||||
scale = width / this.print.width.replace(/px/g,'')
|
||||
}else{
|
||||
width = Math.trunc(Math.random()*(sketch?.height-sketch?.height/2))+sketch?.height/4
|
||||
if(boor){
|
||||
width = Math.trunc((sketch?.height-sketch?.height/2))+sketch?.height/4
|
||||
}
|
||||
scale = width / this.print.height.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 - this.print.width.replace(/px/g,'')*scale
|
||||
if(!this.overallSingle){
|
||||
x = sketch?.width - this.print.width.replace(/px/g,'')*scale/2
|
||||
}
|
||||
let y = sketch?.height-this.print.height.replace(/px/g,'')*scale
|
||||
let left = sketch.offsetWidth/2-this.print.width.replace(/px/g,'')*scale/2
|
||||
let top = sketch.offsetHeight/2-this.print.height.replace(/px/g,'')*scale/2
|
||||
if(this.stateOverallSingle == 'overall'){
|
||||
left = sketch.offsetWidth/2-5
|
||||
top = sketch.offsetHeight/2-5
|
||||
}
|
||||
this.printStyleList[this.stateOverallSingle][index]={
|
||||
centers:{
|
||||
left:0,
|
||||
top:0,
|
||||
},
|
||||
style:{
|
||||
left:(boor?sketch.offsetWidth/2:Math.trunc(Math.random()*x)+1)+"px",
|
||||
top:(boor?sketch.offsetHeight/2:Math.trunc(Math.random()*y)+1)+"px",
|
||||
left:(boor?left:Math.trunc(Math.random()*x)+1)+"px",
|
||||
top:(boor?top:Math.trunc(Math.random()*y)+1)+"px",
|
||||
right:"auto",
|
||||
bottom:"auto",
|
||||
width:this.print.width.replace(/px/g,'')*scale+'px',
|
||||
@@ -598,7 +631,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
//设置图片
|
||||
async setTemplate(item,index) {
|
||||
async setTemplate(item,index,str) {
|
||||
await this.setPrintWH(item.path)
|
||||
this.designOpenrtionList
|
||||
let sketch = document.getElementsByClassName("designOpenrtionMobile_modal")[0]?.getElementsByClassName('designOpenrtionMobile_sketch')[0]
|
||||
@@ -614,7 +647,8 @@ export default defineComponent({
|
||||
if(sketch.offsetHeight < item.location[1]/sketchNum){
|
||||
top = sketch.offsetHeight +'px'
|
||||
}
|
||||
this.printStyleList[this.stateOverallSingle][index]={
|
||||
this.systemDesignerPercentage = item.scale?item.scale*100:30
|
||||
this.printStyleList[str][index]={
|
||||
centers:{
|
||||
left:0,
|
||||
top:0,
|
||||
@@ -635,26 +669,34 @@ export default defineComponent({
|
||||
designOpenrtionBtn:false
|
||||
}
|
||||
},
|
||||
computeZindex(){
|
||||
let arr = JSON.parse(JSON.stringify(this.printStyleList[this.stateOverallSingle]))
|
||||
arr.sort((a, b) => {
|
||||
var a_num = a["style"].zIndex;
|
||||
var b_num = b["style"].zIndex;
|
||||
computeZindex(resolve,prints){
|
||||
prints.sort((a, b) => {
|
||||
var a_num = a.priority;
|
||||
var b_num = b.priority;
|
||||
return a_num - b_num;
|
||||
});
|
||||
|
||||
|
||||
let num = 1
|
||||
arr.forEach((v)=>{
|
||||
v.style.zIndex = num++
|
||||
|
||||
prints.forEach((v)=>{
|
||||
v.priority = num++
|
||||
})
|
||||
return this.computeSize(arr)//计算单件衣服初始大小到目前大小的缩放比
|
||||
resolve(prints)
|
||||
},
|
||||
computeSize(arr){
|
||||
// let num = this.sketch/
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let arr = JSON.parse(JSON.stringify(this.printStyleList[this.stateOverallSingle]))
|
||||
let sketch = document.getElementsByClassName("designOpenrtionMobile_sketch")[0]
|
||||
let sketchNum = this.sketch.width.replace(/rem/g,'')*10/sketch.offsetWidth
|
||||
let scale
|
||||
let prints = []
|
||||
prints = this.operationCurrent.printObject.prints.filter(item=>!!!item.ifSingle)
|
||||
if(this.stateOverallSingle == 'overall'){
|
||||
prints = this.operationCurrent.printObject.prints.filter(item=>!!item.ifSingle)
|
||||
}else{
|
||||
prints = this.operationCurrent.printObject.prints.filter(item=>!!!item.ifSingle)
|
||||
}
|
||||
let scale
|
||||
let location
|
||||
for (let index = 0; index < arr.length; index++) {
|
||||
if(!this.overallSingle){
|
||||
@@ -676,10 +718,11 @@ export default defineComponent({
|
||||
level2Type:this.exhibitionOpenrtionList[this.stateOverallSingle][index].level2Type,
|
||||
path:this.exhibitionOpenrtionList[this.stateOverallSingle][index].path,
|
||||
minIOPath:this.exhibitionOpenrtionList[this.stateOverallSingle][index].minIOPath,
|
||||
ifSingle:!!this.exhibitionOpenrtionList[this.stateOverallSingle][index].ifSingle,
|
||||
}
|
||||
prints.push(obj)
|
||||
}
|
||||
resolve(prints)
|
||||
this.computeZindex(resolve,prints)
|
||||
})
|
||||
},
|
||||
async setPreview(){
|
||||
@@ -699,7 +742,7 @@ export default defineComponent({
|
||||
// timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
// }
|
||||
let data = this.store.state.DesignDetailModule.designPreviewData
|
||||
await this.computeZindex().then((rv)=>{
|
||||
await this.computeSize().then((rv)=>{
|
||||
this.setOkData = rv
|
||||
})
|
||||
data.designSingleItemDTOList[index].printObject={
|
||||
@@ -710,6 +753,7 @@ export default defineComponent({
|
||||
this.loadingShow = true
|
||||
Https.axiosPost(Https.httpUrls.designSingle, data).then(
|
||||
(rv) => {
|
||||
this.operationCurrent = Object.assign({},rv.clothes[index])
|
||||
// designItemDetail.clothes[index].printObject.path = rv.clothes[0].printObject.path
|
||||
this.currentFullBodyView = rv.currentFullBodyView
|
||||
this.designItemDetailTS.rv = rv
|
||||
|
||||
Reference in New Issue
Block a user