|
|
|
|
@@ -129,6 +129,7 @@ import { Modal,message } from 'ant-design-vue';
|
|
|
|
|
import {getUploadUrl,segmentImage,setGradual,rgbToHsv,rgbaToHex} from '@/tool/util'
|
|
|
|
|
import { useStore } from "vuex";
|
|
|
|
|
import { openGuide,driverObj__ } from "@/tool/guide";
|
|
|
|
|
import { KeyValueDB } from "@/tool/indexedDB";
|
|
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
components:{
|
|
|
|
|
@@ -198,9 +199,9 @@ export default defineComponent({
|
|
|
|
|
provide('getCanvasIfEdit',detailData.getCanvasIfEdit)
|
|
|
|
|
provide('singleOveral',detailData.singleOveral)
|
|
|
|
|
provide('isEditPattern',detailData.isEditPattern)
|
|
|
|
|
const closeModal = ()=>{
|
|
|
|
|
sessionStorage.removeItem('oppositeRevocation')
|
|
|
|
|
sessionStorage.removeItem('revocation')
|
|
|
|
|
const closeModal = async ()=>{
|
|
|
|
|
await KeyValueDB.remove('oppositeRevocation')
|
|
|
|
|
await KeyValueDB.remove('revocation')
|
|
|
|
|
detailData.designDetailShow = false
|
|
|
|
|
emit('destroy')
|
|
|
|
|
}
|
|
|
|
|
@@ -214,10 +215,9 @@ export default defineComponent({
|
|
|
|
|
Https.axiosGet(url).then(
|
|
|
|
|
async (rv: any) => {
|
|
|
|
|
//清除画布JSON数据
|
|
|
|
|
sessionStorage.removeItem('canvasList');
|
|
|
|
|
sessionStorage.removeItem('revocation');
|
|
|
|
|
sessionStorage.removeItem('oppositeRevocation');
|
|
|
|
|
sessionStorage.setItem('key', 'value');
|
|
|
|
|
await KeyValueDB.remove('canvasList');
|
|
|
|
|
await KeyValueDB.remove('revocation');
|
|
|
|
|
await KeyValueDB.remove('oppositeRevocation');
|
|
|
|
|
store.commit('DesignDetail/setDesignDetail',rv)
|
|
|
|
|
rv.clothes.forEach((item:any)=>{
|
|
|
|
|
let a
|
|
|
|
|
@@ -272,24 +272,26 @@ export default defineComponent({
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//撤回
|
|
|
|
|
const setRevocation = ()=>{//设置撤销
|
|
|
|
|
const setRevocation = async ()=>{//设置撤销
|
|
|
|
|
let itemDetail = JSON.parse(JSON.stringify(detailData.designDetail))
|
|
|
|
|
let revocation:any = JSON.parse((sessionStorage.getItem("revocation") as any))
|
|
|
|
|
let revocation:any = JSON.parse((await KeyValueDB.get("revocation") as any) || 'null')
|
|
|
|
|
console.log(itemDetail,revocation,'=========')
|
|
|
|
|
if(!revocation)revocation = []
|
|
|
|
|
// let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
|
|
|
|
|
// let oppositeRevocation = JSON.parse((await KeyValueDB.get("oppositeRevocation") as any))
|
|
|
|
|
// if(revocation?.[0]?.designItemId != itemDetail.designItemId || revocation?.[0]?.designItemId == undefined){
|
|
|
|
|
// revocation = []
|
|
|
|
|
// }
|
|
|
|
|
revocation.push({designData:itemDetail,position:null})
|
|
|
|
|
detailData.revocationShow = revocation?.length
|
|
|
|
|
sessionStorage.setItem('revocation', JSON.stringify(revocation));
|
|
|
|
|
sessionStorage.setItem('oppositeRevocation',JSON.stringify([]));
|
|
|
|
|
await KeyValueDB.set('revocation', JSON.stringify(revocation));
|
|
|
|
|
await KeyValueDB.set('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))
|
|
|
|
|
const revocation = async ()=>{//撤回
|
|
|
|
|
let oppositeRevocation = JSON.parse((await KeyValueDB.get("oppositeRevocation") as any) || 'null')
|
|
|
|
|
let revocation = JSON.parse((await KeyValueDB.get("revocation") as any) || 'null')
|
|
|
|
|
console.log(oppositeRevocation,revocation,'=========')
|
|
|
|
|
if(revocation.length <= 1)return
|
|
|
|
|
oppositeRevocation.push(revocation[revocation.length-1])
|
|
|
|
|
revocation.splice(revocation.length-1,1)
|
|
|
|
|
@@ -301,14 +303,14 @@ export default defineComponent({
|
|
|
|
|
store.commit('DesignDetail/setFrontBack',revocation[revocation.length-1].position)
|
|
|
|
|
}
|
|
|
|
|
store.commit('DesignDetail/setDesignColthes',detailData.selectDetail.id)
|
|
|
|
|
sessionStorage.setItem('oppositeRevocation', JSON.stringify(oppositeRevocation));
|
|
|
|
|
sessionStorage.setItem('revocation', JSON.stringify(revocation));
|
|
|
|
|
await KeyValueDB.set('oppositeRevocation', JSON.stringify(oppositeRevocation));
|
|
|
|
|
await KeyValueDB.set('revocation', JSON.stringify(revocation));
|
|
|
|
|
// clearSelect()
|
|
|
|
|
detailData.positionKey++
|
|
|
|
|
}
|
|
|
|
|
const oppositeRevocation = ()=>{//反撤回
|
|
|
|
|
let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
|
|
|
|
|
let revocation = JSON.parse((sessionStorage.getItem("revocation") as any))
|
|
|
|
|
const oppositeRevocation = async ()=>{//反撤回
|
|
|
|
|
let oppositeRevocation = JSON.parse((await KeyValueDB.get("oppositeRevocation") as any) || 'null')
|
|
|
|
|
let revocation = JSON.parse((await KeyValueDB.get("revocation") as any) || 'null')
|
|
|
|
|
// if(!oppositeRevocation[oppositeRevocation.length-1].designData)return
|
|
|
|
|
if(oppositeRevocation.length < 1)return
|
|
|
|
|
if(oppositeRevocation[oppositeRevocation.length-1]?.designData){
|
|
|
|
|
@@ -321,8 +323,8 @@ export default defineComponent({
|
|
|
|
|
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));
|
|
|
|
|
await KeyValueDB.set('oppositeRevocation', JSON.stringify(oppositeRevocation));
|
|
|
|
|
await KeyValueDB.set('revocation', JSON.stringify(revocation));
|
|
|
|
|
// this.clearSelect()
|
|
|
|
|
detailData.positionKey++
|
|
|
|
|
}
|
|
|
|
|
@@ -499,7 +501,7 @@ export default defineComponent({
|
|
|
|
|
Https.axiosPost(Https.httpUrls.designSingle, data).then(async (rv)=>{
|
|
|
|
|
saveCanvasJSONToSession()
|
|
|
|
|
// store.commit('DesignDetail/setPraeview',rv)
|
|
|
|
|
const sessionCanvasList = sessionStorage.getItem('canvasList');
|
|
|
|
|
const sessionCanvasList = await KeyValueDB.get('canvasList');
|
|
|
|
|
const canvasList = sessionCanvasList ? JSON.parse(sessionCanvasList) : []
|
|
|
|
|
for (let i = 0; i < canvasList.length; i++) {
|
|
|
|
|
const index = detailData.designDetail.clothes.findIndex(item => item.id === canvasList[i].id);
|
|
|
|
|
@@ -574,9 +576,9 @@ export default defineComponent({
|
|
|
|
|
img.src = detailData.selectDetail.path
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const saveCanvasJSONToSession = ()=>{
|
|
|
|
|
const saveCanvasJSONToSession = async ()=>{
|
|
|
|
|
let canvasJSON = detailDom.canvasBox.getCanvasJSON()
|
|
|
|
|
const sessionCanvasList = sessionStorage.getItem('canvasList');
|
|
|
|
|
const sessionCanvasList = await KeyValueDB.get('canvasList');
|
|
|
|
|
const list = sessionCanvasList ? JSON.parse(sessionCanvasList) : []
|
|
|
|
|
let index = -1
|
|
|
|
|
list.forEach((item:any,i:number)=>{
|
|
|
|
|
@@ -589,7 +591,7 @@ export default defineComponent({
|
|
|
|
|
}else{
|
|
|
|
|
list[index].canvasJSON = canvasJSON
|
|
|
|
|
}
|
|
|
|
|
sessionStorage.setItem('canvasList', JSON.stringify(list));
|
|
|
|
|
await KeyValueDB.set('canvasList', JSON.stringify(list));
|
|
|
|
|
}
|
|
|
|
|
const detailEdit = async (str:any)=>{
|
|
|
|
|
if(str){
|
|
|
|
|
@@ -727,12 +729,12 @@ export default defineComponent({
|
|
|
|
|
coverRevocation()
|
|
|
|
|
detailDom.detailLeft.sketchSysToLibrary()
|
|
|
|
|
}
|
|
|
|
|
const coverRevocation = ()=>{
|
|
|
|
|
const coverRevocation = async ()=>{
|
|
|
|
|
let itemDetail = JSON.parse(JSON.stringify(detailData.designDetail))
|
|
|
|
|
let revocation = JSON.parse((sessionStorage.getItem("revocation") as any))
|
|
|
|
|
let revocation = JSON.parse((await KeyValueDB.get("revocation") as any) || 'null')
|
|
|
|
|
revocation.splice(revocation.length-1,1,{designData:itemDetail,position:null})
|
|
|
|
|
sessionStorage.setItem('revocation', JSON.stringify(revocation));
|
|
|
|
|
sessionStorage.setItem('oppositeRevocation',JSON.stringify([]));
|
|
|
|
|
await KeyValueDB.set('revocation', JSON.stringify(revocation));
|
|
|
|
|
await KeyValueDB.set('oppositeRevocation',JSON.stringify([]));
|
|
|
|
|
}
|
|
|
|
|
const setSloganData = (data:any)=>{
|
|
|
|
|
detailData.selectDetail.sketchString = data
|
|
|
|
|
@@ -742,9 +744,9 @@ export default defineComponent({
|
|
|
|
|
}
|
|
|
|
|
onMounted(()=>{
|
|
|
|
|
})
|
|
|
|
|
onBeforeUnmount(()=>{
|
|
|
|
|
sessionStorage.removeItem('oppositeRevocation')
|
|
|
|
|
sessionStorage.removeItem('revocation')
|
|
|
|
|
onBeforeUnmount(async ()=>{
|
|
|
|
|
await KeyValueDB.remove('oppositeRevocation')
|
|
|
|
|
await KeyValueDB.remove('revocation')
|
|
|
|
|
store.commit('DesignDetail/clearDetailData')
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|