details功能

This commit is contained in:
X1627315083
2025-03-03 14:52:05 +08:00
parent 6cfcd4ce16
commit 7165e2455f
23 changed files with 1243 additions and 127 deletions

View File

@@ -47,7 +47,14 @@
</div>
<div class="item model">
<model ref="model" @canvasReload="canvasReload" @detailEdit="detailEdit" @addSketch="()=>isEditPattern.value=false"></model>
<model
ref="model"
@canvasReload="canvasReload"
@detailEdit="detailEdit"
@addSketch="()=>isEditPattern.value=false"
@revocation="revocation"
@oppositeRevocation="oppositeRevocation"
></model>
<div class="btn">
<div class="gallery_btn" @click="submit">Submit</div>
<div class="gallery_btn" @click="previwe">Preview</div>
@@ -57,7 +64,7 @@
<div class="submit">
</div>
<div class="contentRight" v-if="currentDetailType && !isEditPattern.value">
<detailRight></detailRight>
<detailRight ref="detailRight"></detailRight>
</div>
<div class="contentRight" v-if="selectDetail && selectDetail.id && currentDetailType && isEditPattern.value">
<canvasBox ref="canvasBox" :key="childKey"></canvasBox>
@@ -104,6 +111,7 @@ export default defineComponent({
const detailDom = reactive({
model:null,
canvasBox,
detailRight,
})
const userDetail = computed(()=>{
return store.state.UserHabit.userDetail
@@ -114,6 +122,8 @@ export default defineComponent({
selectDetail:computed(()=>store.state.DesignDetailCopy.selectDetail),
designDetailShow:false,
loadingShow:false,
oppositeRevocationShow:-1,
revocationShow:-1,
isEditPattern:{
value:false,
},// 是否编辑图案
@@ -121,6 +131,8 @@ export default defineComponent({
})
provide('isEditPattern',detailData.isEditPattern)
const closeModal = ()=>{
sessionStorage.removeItem('oppositeRevocation')
sessionStorage.removeItem('revocation')
detailData.designDetailShow = false
emit('destroy')
}
@@ -157,7 +169,7 @@ export default defineComponent({
store.commit('DesignDetailCopy/setDesignDetail',rv)
// this.deleteShow = false
setRevocation(rv,'')
setRevocation()
detailData.loadingShow = false
// await this.setImgSize()
}
@@ -172,8 +184,49 @@ export default defineComponent({
sessionStorage.removeItem('oppositeRevocation')
sessionStorage.removeItem('revocation')
}
const setRevocation = (designItemDetail:any,data:any)=>{//设置撤销
//撤回
const setRevocation = ()=>{//设置撤销
let itemDetail = JSON.parse(JSON.stringify(detailData.designDetail))
let revocation:any = JSON.parse((sessionStorage.getItem("revocation") as any))
// let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
if(revocation?.[0]?.designItemId != itemDetail.designItemId || revocation?.[0]?.designItemId == undefined){
// sessionStorage.setItem('revocation', JSON.stringify([]));
// sessionStorage.setItem('oppositeRevocation',JSON.stringify([]));
revocation = []
}
revocation.push(itemDetail)
detailData.revocationShow = revocation?.length
detailData.oppositeRevocationShow = 0
sessionStorage.setItem('revocation', JSON.stringify(revocation));
sessionStorage.setItem('oppositeRevocation',JSON.stringify([]));
}
provide('setRevocation',setRevocation)
const revocation = ()=>{//撤回
let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
let revocation = JSON.parse((sessionStorage.getItem("revocation") as any))
if(detailData.revocationShow <= 1)return
oppositeRevocation.push(revocation[revocation.length-1])
detailData.oppositeRevocationShow = oppositeRevocation.length
revocation.splice(revocation.length-1,1)
detailData.revocationShow = revocation.length
store.commit("DesignDetailCopy/setDesignDetail", revocation[revocation.length-1]);
sessionStorage.setItem('oppositeRevocation', JSON.stringify(oppositeRevocation));
sessionStorage.setItem('revocation', JSON.stringify(revocation));
// clearSelect()
}
const oppositeRevocation = ()=>{//反撤回
let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
let revocation = JSON.parse((sessionStorage.getItem("revocation") as any))
if(!oppositeRevocation[oppositeRevocation.length-1])return
store.commit("DesignDetailCopy/setDesignDetail", oppositeRevocation[oppositeRevocation.length-1]);
revocation.push(oppositeRevocation[oppositeRevocation.length-1])
detailData.revocationShow = revocation.length
oppositeRevocation.splice(oppositeRevocation.length-1,1)
detailData.oppositeRevocationShow = oppositeRevocation.length
sessionStorage.setItem('oppositeRevocation', JSON.stringify(oppositeRevocation));
sessionStorage.setItem('revocation', JSON.stringify(revocation));
// this.clearSelect()
}
const setCurrentDetail = (str:string)=>{
store.commit('DesignDetailCopy/setCurrentDetailType',str)
@@ -182,10 +235,12 @@ export default defineComponent({
let clothesList:any = []
for(let i = 0;i<list.length;i++){
let {scale,offset,priority,maskUrl,maskMinioUrl} = (detailDom.model as any).getSubmitData(list[i])
await (detailDom.canvasBox as any).privewDetail()
if(detailDom.canvasBox?.privewDetail)await (detailDom.canvasBox as any).privewDetail()
if(detailDom.detailRight?.privewDetail)await (detailDom.detailRight as any).privewDetail()
let gradient = null
let newData = list[i]?.newDetail?.[detailData.currentDetailType]
let isCurrent = list[i].id == detailData?.selectDetail?.id
let data:any = {
changed:false,
color:(newData && detailData.currentDetailType == 'color' && isCurrent)?`${newData.rgba.r} ${newData.rgba.g} ${newData.rgba.b}`:`${list[i].color.rgba.r} ${list[i].color.rgba.g} ${list[i].color.rgba.b}`,
@@ -193,16 +248,16 @@ export default defineComponent({
id:(newData && detailData.currentDetailType == 'sketch' && isCurrent)?newData.id:list[i].id,
// maskMinioUrl:'',
// maskUrl:'',
maskUrl:list[i].maskUrl?list[i].maskUrl:null,
maskUrl:list[i].maskUrl,
offset,
partialDesign:list[i].partialDesign,
path:(newData && detailData.currentDetailType == 'sketch' && isCurrent)?newData.minIOPath:list[i].minIOPath,
printObject:list[i].printObject?list[i].printObject:{prints:[]},
printObject:(newData && detailData.currentDetailType == 'print' && isCurrent)?{prints:newData}:list[i].printObject?list[i].printObject:{prints:[]},
priority,
scale,
type:(newData && detailData.currentDetailType == 'sketch' && isCurrent)?newData.level2Type:list[i].type,
sketchString:'',
trims:list[i].trims?list[i].trims:{prints:null},
trims:(newData && detailData.currentDetailType == 'element' && isCurrent)?{prints:newData}:list[i].trims?list[i].trims:{prints:[]},
}
if((list[i].color?.gradient || list[i].newDetail?.color?.gradient)){
gradient = list[i].newDetail?.color?.gradient || list[i].color.gradient
@@ -229,7 +284,11 @@ export default defineComponent({
}
detailData.loadingShow = true
Https.axiosPost(Https.httpUrls.designSingle, data).then((rv)=>{
store.commit('DesignDetailCopy/setPraeview',rv)
let value = {
currentType : JSON.parse(JSON.stringify(detailData.currentDetailType)),
rv:rv
}
store.commit('DesignDetailCopy/setPraeview',value)
detailData.loadingShow = false
}).catch(res=>{
detailData.loadingShow = false
@@ -284,6 +343,8 @@ export default defineComponent({
detailData.childKey += 1
}
onBeforeUnmount(()=>{
sessionStorage.removeItem('oppositeRevocation')
sessionStorage.removeItem('revocation')
store.commit('DesignDetailCopy/clearDesignDetail')
})
return{
@@ -294,6 +355,8 @@ export default defineComponent({
setCurrentDetail,
previwe,
submit,
revocation,
oppositeRevocation,
detailEdit,
canvasReload,
}
@@ -402,6 +465,7 @@ export default defineComponent({
> .btn{
display: flex;
justify-content: center;
margin-left: 12rem;
> div{
margin-right: 2rem;
}