修复元素bug
This commit is contained in:
@@ -473,22 +473,24 @@ export default defineComponent({
|
||||
designElementsBtn:false
|
||||
}
|
||||
},
|
||||
computeZindex(){
|
||||
let arr = JSON.parse(JSON.stringify(this.printStyleList))
|
||||
arr.sort((a, b) => {
|
||||
var a_num = a["style"].zIndex;
|
||||
var b_num = b["style"].zIndex;
|
||||
computeZindex(resolve,prints){
|
||||
console.log(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)
|
||||
// return this.computeSize(arr)//计算单件衣服初始大小到目前大小的缩放比
|
||||
},
|
||||
computeSize(arr){
|
||||
computeSize(){
|
||||
// let num = this.sketch/
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let arr = JSON.parse(JSON.stringify(this.printStyleList))
|
||||
let sketch = document.getElementsByClassName("designElements_sketch")[0]
|
||||
let sketchNum = this.sketch.width.replace(/rem/g,'')*10/sketch.offsetWidth
|
||||
let prints = []
|
||||
@@ -509,7 +511,7 @@ export default defineComponent({
|
||||
}
|
||||
prints.push(obj)
|
||||
}
|
||||
resolve(prints)
|
||||
this.computeZindex(resolve,prints)
|
||||
})
|
||||
},
|
||||
async setPreview(){
|
||||
@@ -525,7 +527,7 @@ export default defineComponent({
|
||||
// priority:priority,
|
||||
// timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
// }
|
||||
await this.computeZindex().then((rv)=>{
|
||||
await this.computeSize().then((rv)=>{
|
||||
this.setOkData = rv
|
||||
})
|
||||
let data = JSON.parse(JSON.stringify(this.store.state.DesignDetailModule.designPreviewData))
|
||||
|
||||
@@ -474,23 +474,25 @@ export default defineComponent({
|
||||
designElementsBtn:false
|
||||
}
|
||||
},
|
||||
computeZindex(){
|
||||
let arr = JSON.parse(JSON.stringify(this.printStyleList))
|
||||
arr.sort((a, b) => {
|
||||
var a_num = a["style"].zIndex;
|
||||
var b_num = b["style"].zIndex;
|
||||
computeZindex(resolve,prints){
|
||||
console.log(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)
|
||||
// return this.computeSize(arr)//计算单件衣服初始大小到目前大小的缩放比
|
||||
},
|
||||
async computeSize(arr){
|
||||
// let num = this.sketch/
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let sketch = document.getElementsByClassName("designElementsMobile_sketch")[0]
|
||||
let arr = JSON.parse(JSON.stringify(this.printStyleList))
|
||||
let sketch = document.getElementsByClassName("designElements_sketch")[0]
|
||||
let sketchNum = this.sketch.width.replace(/rem/g,'')*10/sketch.offsetWidth
|
||||
let prints = []
|
||||
let scale
|
||||
@@ -510,7 +512,7 @@ export default defineComponent({
|
||||
}
|
||||
prints.push(obj)
|
||||
}
|
||||
resolve(prints)
|
||||
this.computeZindex(resolve,prints)
|
||||
})
|
||||
},
|
||||
async setPreview(){
|
||||
@@ -530,7 +532,7 @@ export default defineComponent({
|
||||
// timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
// }
|
||||
let data = JSON.parse(JSON.stringify(this.store.state.DesignDetailModule.designPreviewData))
|
||||
await this.computeZindex().then((rv)=>{
|
||||
await this.computeSize().then((rv)=>{
|
||||
this.setOkData = rv
|
||||
})
|
||||
data.designSingleItemDTOList[index].trims.prints = this.setOkData
|
||||
|
||||
@@ -383,7 +383,6 @@ export default defineComponent({
|
||||
this.printStyleList[this.stateOverallSingle].forEach((v)=>{
|
||||
v.designOpenrtionBtn = false
|
||||
})
|
||||
this.currentPrintStyleList.id = item.id
|
||||
if(!this.overallSingle){
|
||||
if(item.checked){
|
||||
this.imgDomIndex = 0
|
||||
@@ -403,7 +402,6 @@ export default defineComponent({
|
||||
this.refetchTemplate(0,true)
|
||||
this.exhibitionOpenrtionList[this.stateOverallSingle][0] = {
|
||||
angle:0,
|
||||
id:item.id,
|
||||
designType:item.designType,
|
||||
level2Type:item.level2Type,
|
||||
minIOPath:item.minIOPath,
|
||||
@@ -419,7 +417,6 @@ export default defineComponent({
|
||||
let currentIndex = this.printStyleList[this.stateOverallSingle].length-1
|
||||
this.exhibitionOpenrtionList[this.stateOverallSingle].push({
|
||||
angle:0,
|
||||
id:item.id,
|
||||
designType:item.designType,
|
||||
level2Type:item.level2Type,
|
||||
minIOPath:item.minIOPath,
|
||||
@@ -607,7 +604,6 @@ export default defineComponent({
|
||||
top = sketch.offsetHeight/2-5
|
||||
}
|
||||
this.printStyleList[this.stateOverallSingle][index]={
|
||||
id:this.printStyleList[this.stateOverallSingle][index].id,
|
||||
centers:{
|
||||
left:0,
|
||||
top:0,
|
||||
@@ -648,7 +644,6 @@ export default defineComponent({
|
||||
}
|
||||
this.systemDesignerPercentage = item.scale?item.scale*100:30
|
||||
this.printStyleList[str][index]={
|
||||
id:item.id,
|
||||
centers:{
|
||||
left:0,
|
||||
top:0,
|
||||
@@ -699,36 +694,29 @@ export default defineComponent({
|
||||
}
|
||||
let scale
|
||||
let location
|
||||
console.log(this.exhibitionOpenrtionList[this.stateOverallSingle],arr);
|
||||
for (let index = 0; index < arr.length; index++) {
|
||||
for (let i = 0; i < this.exhibitionOpenrtionList[this.stateOverallSingle].length; i++) {
|
||||
if(this.exhibitionOpenrtionList[this.stateOverallSingle][i].id == arr[index].id){
|
||||
if(!this.overallSingle){
|
||||
scale = this.systemDesignerPercentage/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]
|
||||
location = [arr[index].style.left.replace(/px/g,'')*sketchNum,arr[index].style.top.replace(/px/g,'')*sketchNum]
|
||||
}else{
|
||||
await this.setPrintWH(this.exhibitionOpenrtionList[this.stateOverallSingle][index].path)
|
||||
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,
|
||||
designType:this.exhibitionOpenrtionList[this.stateOverallSingle][index].designType,
|
||||
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)
|
||||
}
|
||||
if(!this.overallSingle){
|
||||
scale = this.systemDesignerPercentage/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]
|
||||
location = [arr[index].style.left.replace(/px/g,'')*sketchNum,arr[index].style.top.replace(/px/g,'')*sketchNum]
|
||||
}else{
|
||||
await this.setPrintWH(this.exhibitionOpenrtionList[this.stateOverallSingle][index].path)
|
||||
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,
|
||||
designType:this.exhibitionOpenrtionList[this.stateOverallSingle][index].designType,
|
||||
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)
|
||||
}
|
||||
this.computeZindex(resolve,prints)
|
||||
})
|
||||
|
||||
@@ -384,7 +384,6 @@ export default defineComponent({
|
||||
this.printStyleList[this.stateOverallSingle].forEach((v)=>{
|
||||
v.designOpenrtionBtn = false
|
||||
})
|
||||
this.currentPrintStyleList.id = item.id
|
||||
if(!this.overallSingle){
|
||||
if(item.checked){
|
||||
this.imgDomIndex = 0
|
||||
@@ -400,12 +399,10 @@ export default defineComponent({
|
||||
})
|
||||
item.checked = true
|
||||
}
|
||||
this.currentPrintStyleList.id = item.id
|
||||
this.printStyleList[this.stateOverallSingle][0] = JSON.parse(JSON.stringify(this.currentPrintStyleList))
|
||||
this.refetchTemplate(0,true)
|
||||
this.exhibitionOpenrtionList[this.stateOverallSingle][0] = {
|
||||
angle:0,
|
||||
id:item.id,
|
||||
designType:item.designType,
|
||||
level2Type:item.level2Type,
|
||||
minIOPath:item.minIOPath,
|
||||
@@ -421,7 +418,6 @@ export default defineComponent({
|
||||
let currentIndex = this.printStyleList[this.stateOverallSingle].length-1
|
||||
this.exhibitionOpenrtionList[this.stateOverallSingle].push({
|
||||
angle:0,
|
||||
id:item.id,
|
||||
designType:item.designType,
|
||||
level2Type:item.level2Type,
|
||||
minIOPath:item.minIOPath,
|
||||
@@ -613,7 +609,6 @@ export default defineComponent({
|
||||
top = sketch.offsetHeight/2-5
|
||||
}
|
||||
this.printStyleList[this.stateOverallSingle][index]={
|
||||
id:this.printStyleList[this.stateOverallSingle][index].id,
|
||||
centers:{
|
||||
left:0,
|
||||
top:0,
|
||||
@@ -654,7 +649,6 @@ export default defineComponent({
|
||||
}
|
||||
this.systemDesignerPercentage = item.scale?item.scale*100:30
|
||||
this.printStyleList[str][index]={
|
||||
id:item.id,
|
||||
centers:{
|
||||
left:0,
|
||||
top:0,
|
||||
@@ -705,32 +699,28 @@ export default defineComponent({
|
||||
let scale
|
||||
let location
|
||||
for (let index = 0; index < arr.length; index++) {
|
||||
for (let i = 0; i < this.exhibitionOpenrtionList[this.stateOverallSingle].length; i++) {
|
||||
if(this.exhibitionOpenrtionList[this.stateOverallSingle][i].id == arr[index].id){
|
||||
if(!this.overallSingle){
|
||||
scale = this.systemDesignerPercentage/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]
|
||||
location = [arr[index].style.left.replace(/px/g,'')*sketchNum,arr[index].style.top.replace(/px/g,'')*sketchNum]
|
||||
}else{
|
||||
await this.setPrintWH(this.exhibitionOpenrtionList[this.stateOverallSingle][index].path)
|
||||
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,
|
||||
designType:this.exhibitionOpenrtionList[this.stateOverallSingle][index].designType,
|
||||
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)
|
||||
}
|
||||
if(!this.overallSingle){
|
||||
scale = this.systemDesignerPercentage/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]
|
||||
location = [arr[index].style.left.replace(/px/g,'')*sketchNum,arr[index].style.top.replace(/px/g,'')*sketchNum]
|
||||
}else{
|
||||
await this.setPrintWH(this.exhibitionOpenrtionList[this.stateOverallSingle][index].path)
|
||||
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,
|
||||
designType:this.exhibitionOpenrtionList[this.stateOverallSingle][index].designType,
|
||||
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)
|
||||
}
|
||||
this.computeZindex(resolve,prints)
|
||||
})
|
||||
@@ -793,7 +783,6 @@ export default defineComponent({
|
||||
designItemDetail.currentFullBodyView = this.designItemDetailTS.rv.currentFullBodyView
|
||||
designItemDetail.clothes[index].printObject.ifSingle = this.overallSingle
|
||||
designItemDetail.clothes[index].layersObject = this.designItemDetailTS.rv.clothes[index].layersObject
|
||||
designItemDetail.clothes[index].undividedLayer = this.designItemDetailTS.rv.clothes[index].undividedLayer
|
||||
designItemDetail.clothes[index].trims = this.designItemDetailTS.rv.clothes[index].trims
|
||||
designItemDetail.clothes[index].printObject.prints = this.setOkData
|
||||
// designItemDetail.clothes[index].printObject.prints = this.computeZindex()
|
||||
|
||||
Reference in New Issue
Block a user