新增衣服设置优先级,相同衣服id导致优先级相同问题

This commit is contained in:
X1627315083
2023-12-21 17:26:49 +08:00
parent b06ea39f03
commit 70e2fe094b
16 changed files with 99 additions and 60 deletions

View File

@@ -384,24 +384,26 @@ export default defineComponent({
let num = 10
arr.forEach((item)=>{
item.priority = num++
item.similarity = false//新增衣服传的是衣服id会存在两件衣服id相同所以设置为false让每次赋值都是不一样的
})
data.designSingleItemDTOList.forEach((item)=>{
let front = arr
let imageCategory1 = arr[1].imageCategory
arr.forEach((i)=>{
let imageCategory = i.imageCategory.split('_')[0]
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
for (let index = 0; index < arr.length; index++) {
if(item.id == arr[index].id && !arr[index].similarity){
let y = ((arr[index]?.style?.top.replace(/px/g,'')*ratio).toFixed(0) - arr[index]?.position[0])
let x = ((arr[index]?.style?.left.replace(/px/g,'')*ratio).toFixed(0) - arr[index]?.position[1])
let scale = arr[index]?.imageSize?Number(((arr[index]?.style?.width.replace(/px/g,'')*ratio)/(arr[index]?.imageSize[0]/arr[index].scale)).toFixed(2)):1
item.scale = scale
let top = y == 0 ? item.offset[1]:y+item.offset[1]
let left = x == 0 ? item.offset[0]:x+item.offset[0]
item.offset = [left,top]
item.priority = i.priority
// item.offset = [(i?.style?.left.replace(/px/g,'')*ratio).toFixed(0),(i?.style?.top.replace(/px/g,'')*ratio).toFixed(0)]
item.priority = arr[index].priority
arr[index].similarity = true
// item.offset = [(arr[index]?.style?.left.replace(/px/g,'')*ratio).toFixed(0),(i?.style?.top.replace(/px/g,'')*ratio).toFixed(0)]
break
}
})
}
if(item.type == this.capitalizeFirstLetter(imageCategory1)){
item.scale = front?.imageSize?Number(((front?.style?.width.replace(/px/g,'')*ratio)/front?.imageSize[0]).toFixed(2)):1
}

View File

@@ -337,19 +337,19 @@ export default defineComponent({
let isTest = getCookie('isTest')
// console.log(getCookie("token"));
if(JSON.parse(isTest)){
Https.axiosGet(Https.httpUrls.trialUserLogout,).then((rv) => {
await Https.axiosGet(Https.httpUrls.trialUserLogout,).then((rv) => {
Https.axiosPost(Https.httpUrls.accountLogout, data).then((rv) => {
this.$router.replace("/login");
WriteCookie("token");
});
})
}else{
Https.axiosPost(Https.httpUrls.accountLogout, data).then((rv) => {
await Https.axiosPost(Https.httpUrls.accountLogout, data).then((rv) => {
this.$router.replace("/login");
WriteCookie("token");
});
}
window.location.reload()
},

View File

@@ -313,6 +313,8 @@ export default defineComponent({
color: rgba(0,0,0,.65);
z-index: 2;
align-items: center;
width: 35rem;
justify-content: space-between;
.collection_progress{
width: 8rem;
height: 8rem;
@@ -326,7 +328,7 @@ export default defineComponent({
}
}
.collection_title_text{
margin-right: 4rem;
// margin-right: 4rem;
}
.collection_title_text_intro{
font-size: var(--aida-fsize1-4);

View File

@@ -39,7 +39,7 @@
<div>
<input v-show="openType" type="text" class="inputName" v-model="itemName" @keydown.enter="putName(-1,'affirm','')">
<i @click.stop="putName(-1,'affirm','')" v-show="openType" class="fi fi-br-check"></i>
<div class="addLabel" v-show="!openType" @click="newLabel('','')">+</div>
<div class="addLabel" v-show="!openType" @click.stop="newLabel('','')">+</div>
</div>
<div class="started_btn" @click="removeLabel(options)">Delete</div>
</li>
@@ -160,6 +160,7 @@ export default defineComponent({
}
},
clearOpenType(){
this.openType = false
this.options.forEach((optionsItem:any) => {
optionsItem.openType = false
optionsItem.addOpenType = false
@@ -169,7 +170,6 @@ export default defineComponent({
});
}
});
this.openType = false
},
putName(index:number,v:string,item:any){
let e:any = window.event
@@ -186,12 +186,11 @@ export default defineComponent({
input.focus()
})
}else if(v == 'affirm'){
if(index == -1){
if(this.itemName == ''){
message.warning(this.t('setLabel.jsContent1'));
return
}else{
if(this.itemName == ''){
message.warning(this.t('setLabel.jsContent1'));
return
}else{
if(index == -1){
if(item){
item.addOpenType = false
data = {
@@ -205,15 +204,17 @@ export default defineComponent({
parentId:''
}
}
}else{
data = {
id:item.id,
classificationName:this.itemName,
}
item.classificationName = this.itemName
item.openType = false
}
}else{
data = {
id:item.id,
classificationName:this.itemName,
}
item.classificationName = this.itemName
item.openType = false
}
this.addLabel(data)
document.removeEventListener('click',this.clearOpenType)
}
@@ -372,7 +373,8 @@ export default defineComponent({
flex-direction: row;
align-items: center;
padding: .5rem 1rem;
width: 16rem;
// width: 16rem;
width: auto;
margin: 2rem 1rem;
border-radius: 1rem;
justify-content: space-between;
@@ -384,11 +386,19 @@ export default defineComponent({
display: flex;
}
>span{
max-width: 60%;
// max-width: 60%;
margin: 0 2rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
div.setLabel_text{
>input{
margin: 0 2rem;
width: 14rem;
}
}
}
@@ -434,6 +444,7 @@ export default defineComponent({
background: #f0f0f0;
// background: #d5d5d5;
font-size: 1.4rem;
width: 16rem;
label{
transform: scale(.8);
@@ -490,6 +501,7 @@ export default defineComponent({
.newLabel{
text-align: center;
justify-content: center;
width: 16rem;
&.optionsItem_title{
width: 100%;
margin: 0;