From 979abe082ebb3bc9f44231329cb20ac26c720555 Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Wed, 24 Sep 2025 17:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B0=B7=E6=AD=8C=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E3=80=81=E7=BA=A2=E7=BB=BF=E5=9B=BE=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=E3=80=81submit=E5=90=8E=E9=A2=9C=E8=89=B2=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/Detail/DesignDetail.vue | 2 +- src/component/Detail/canvas/index.vue | 5 +- src/component/Detail/model/modelNav.vue | 42 +++++++------- src/component/Detail/model/modelPosition.vue | 61 ++++++++++---------- src/lang/cn.ts | 1 + src/lang/en.ts | 1 + src/store/Detail/designDetail.ts | 15 ++++- src/tool/https.js | 32 +--------- src/views/HomeMain.vue | 8 +-- 9 files changed, 76 insertions(+), 91 deletions(-) diff --git a/src/component/Detail/DesignDetail.vue b/src/component/Detail/DesignDetail.vue index f403661b..0e4dcde1 100644 --- a/src/component/Detail/DesignDetail.vue +++ b/src/component/Detail/DesignDetail.vue @@ -298,7 +298,6 @@ export default defineComponent({ // 0.35822305 // ] let isCurrent = list[i].id == detailData?.selectDetail?.id - console.log(isCurrent,newData) let color = (detailData.currentDetailType == 'color' && isCurrent && !detailData.isEditPattern.value)? (newData?.rgba?.r?`${newData.rgba.r} ${newData.rgba.g} ${newData.rgba.b}`:''): (list[i].color?.rgba?.r? @@ -379,6 +378,7 @@ export default defineComponent({ delete detailData.designDetail.newModel store.commit('DesignDetail/setPraeview',value) detailData.loadingShow = false + canvasReload() // setRevocation() }).catch(res=>{ detailData.loadingShow = false diff --git a/src/component/Detail/canvas/index.vue b/src/component/Detail/canvas/index.vue index 8ac6b936..d096b738 100644 --- a/src/component/Detail/canvas/index.vue +++ b/src/component/Detail/canvas/index.vue @@ -193,7 +193,7 @@ export default defineComponent({ let front = detailData.frontBack.front[detailData.imgDomIndex] let back = detailData.frontBack.back[detailData.imgDomIndex] if(!front?.oldImageUrl)front.oldImageUrl = front.imageUrl - if(!front?.oldMaskUrl)front.oldMaskUrl = front.imageUrl + if(!front?.oldMaskUrl)front.oldMaskUrl = front.maskUrl if(!back?.oldImageUrl)back.oldImageUrl = back.imageUrl if(!front?.oldMaskUrl)store.commit('DesignDetail/updataDetailItem',{maskUrl:front.oldMaskUrl}) @@ -218,7 +218,6 @@ export default defineComponent({ detailData.isShowMark = true } const index = detailData.designDetail.clothes.findIndex(item => item.id === detailData.selectDetail.id); - console.log(index,detailData.selectDetail.id) await new Promise((resolve, reject) => { if(!detailDom?.editCanvas)return resolve() let canvasJSON = detailDom?.editCanvas?.getJSON() @@ -261,7 +260,7 @@ export default defineComponent({ if(front?.oldImageUrl)front.imageUrl = front.oldImageUrl if(front?.oldMaskUrl)front.maskUrl = front.oldMaskUrl if(back?.oldImageUrl)back.imageUrl = back.oldImageUrl - if(front?.oldMaskUrl)store.commit('DesignDetail/updataDetailItem',{maskUrl:front.oldMaskUrl}) + if(front?.oldMaskUrl)store.commit('DesignDetail/updataDetailItem',{maskUrl:front.maskUrl}) sessionStorage.removeItem('frontBackEdit'); sessionStorage.removeItem('sketchEdit'); diff --git a/src/component/Detail/model/modelNav.vue b/src/component/Detail/model/modelNav.vue index 00e6f753..15a611bd 100644 --- a/src/component/Detail/model/modelNav.vue +++ b/src/component/Detail/model/modelNav.vue @@ -74,29 +74,29 @@ export default defineComponent({ },{immediate:true}) const selectDetailItem = (item:any,index:number)=>{ new Promise((resolve, reject) => { - // if(detailData.isEditPattern.value && - // detailData.selectDetail?.id && - // detailData?.getCanvasIfEdit?.fun&&detailData?.getCanvasIfEdit?.fun() > 0 - // ){ - // Modal.confirm({ - // title: t('collectionModal.jsContent2'), - // icon: createVNode(ExclamationCircleOutlined), - // okText: 'Yes', - // cancelText: 'No', - // mask:false, - // centered:true, - // onOk() { - // resolve(true) - // emit('canvasReload') - // }, - // onCancel(){ - // resolve(false) - // } - // }); - // }else{ + if(detailData.isEditPattern.value && + detailData.selectDetail?.id && + detailData?.getCanvasIfEdit?.fun&&detailData?.getCanvasIfEdit?.fun() > 0 + ){ + Modal.confirm({ + title: t('collectionModal.jsContent6'), + icon: createVNode(ExclamationCircleOutlined), + okText: 'Yes', + cancelText: 'No', + mask:false, + centered:true, + onOk() { + resolve(true) + emit('canvasReload') + }, + onCancel(){ + resolve(false) + } + }); + }else{ resolve(true) emit('canvasReload') - // } + } }).then((rv)=>{ if(rv)store.commit('DesignDetail/setDesignColthes',item.id) }) diff --git a/src/component/Detail/model/modelPosition.vue b/src/component/Detail/model/modelPosition.vue index c7edf80a..ffee0398 100644 --- a/src/component/Detail/model/modelPosition.vue +++ b/src/component/Detail/model/modelPosition.vue @@ -236,38 +236,41 @@ export default defineComponent({ // } } const itemMoveMousedown = async (index:any,e:any)=>{ + if(detailData.selectDetail.id != detailData.frontBack.front[index].id)return let isOpen = false let isModal = false await new Promise((resolve, reject) => { - if( - detailData.isEditPattern.value && - selectItem.selectDetail?.id && - (detailData.frontBack.front[index].id != selectItem.selectDetail.id) - ){ - isModal = true - Modal.confirm({ - title: t('collectionModal.jsContent2'), - icon: createVNode(ExclamationCircleOutlined), - okText: 'Yes', - cancelText: 'No', - mask:false, - centered:true, - onOk() { - resolve(true) - isOpen = true - }, - onCancel(){ - resolve(false) - isOpen = false - } - }); - }else{ - if(detailData.frontBack.front[index].id != selectItem.selectDetail.id){ - isOpen = true - } - resolve(true) - isModal = false - } + // if( + // detailData.isEditPattern.value && + // selectItem.selectDetail?.id && + // (detailData.frontBack.front[index].id != selectItem.selectDetail.id) + // ){ + // isModal = true + // Modal.confirm({ + // title: t('collectionModal.jsContent2'), + // icon: createVNode(ExclamationCircleOutlined), + // okText: 'Yes', + // cancelText: 'No', + // mask:false, + // centered:true, + // onOk() { + // resolve(true) + // isOpen = true + // }, + // onCancel(){ + // resolve(false) + // isOpen = false + // } + // }); + // }else{ + // if(detailData.frontBack.front[index].id != selectItem.selectDetail.id){ + // isOpen = true + // } + // resolve(true) + // isModal = false + // } + resolve(true) + isOpen = true }).then((rv)=>{ }) if(isOpen){ diff --git a/src/lang/cn.ts b/src/lang/cn.ts index 868f504b..1c196e21 100644 --- a/src/lang/cn.ts +++ b/src/lang/cn.ts @@ -583,6 +583,7 @@ export default { jsContent2: "上传的文件不会保存,是否继续? ", jsContent3: "您必须选择一种或多种颜色进行下一步。", jsContent5: "我们检测到您的({str})上的PIN数量超过了八个,这可能会导致一些已钉住的项目未被使用。您是否仍要继续?", + jsContent6: "画布内容没有保存,请点击预保存后继续。", }, DesignDetail: { Details: "详情", diff --git a/src/lang/en.ts b/src/lang/en.ts index ba768f27..b770ca3c 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -585,6 +585,7 @@ export default { jsContent2: "The uploaded files will not be saved, being sure to continue? ", jsContent3: "You must choose one or more colors for further process.", jsContent5: "We've detected that the number of pins on your ({str}) exceeds eight, which may result in some pinned items not being used. Would you like to continue anyway?", + jsContent6: 'The content on the canvas has not been saved. Please click "Preview" to continue.', }, DesignDetail: { Details: "Details", diff --git a/src/store/Detail/designDetail.ts b/src/store/Detail/designDetail.ts index adcd1886..dbae1ece 100644 --- a/src/store/Detail/designDetail.ts +++ b/src/store/Detail/designDetail.ts @@ -74,6 +74,7 @@ const DesignDetail : Module = { state.frontBack.back = back }, updataDetailItem(state,data){ + console.log(data) state.designDetail.clothes.forEach((item:any) => { if(item.id == state.selectDetail.id){ for (const key in data) { @@ -230,7 +231,7 @@ const DesignDetail : Module = { left:item.layersObject[i].position?.[1] * scale + 'px', width:item.layersObject[i].imageSize?.[0] * scale + 'px', height:item.layersObject[i].imageSize?.[1] * scale + 'px', - zIndex:v?.style?.zIndex?v.style.zIndex:state.frontBack.front.length + zIndex:v?.style?.zIndex?v.style.zIndex:v.priority?v.priority:state.frontBack.front.length } item.layersObject[i].centers={ left:0, @@ -256,7 +257,7 @@ const DesignDetail : Module = { }) if(state.currentDetailType != 'models'){ state.selectDetail.change = item.change - if(state.selectDetail?.newDetail?.color){ + if(state.selectDetail?.newDetail?.color && currentType != 'color'){ state.selectDetail.color = state.selectDetail?.newDetail?.color state.selectDetail.newDetail.color = null } @@ -273,12 +274,20 @@ const DesignDetail : Module = { state.selectDetail.printObject = item.printObject state.selectDetail.trims = item.trims state.selectDetail.type = item.type + state.selectDetail.color = { + ...item.color, + rgba:{ + r:item.color?.r, + g:item.color?.g, + b:item.color?.b, + } + } state.selectDetail.undividedLayer = item.undividedLayer if(state.selectDetail.newDetail?.sketch?.id && !state.selectDetail.id){ state.designDetail.clothes.push(state.selectDetail) } state.selectDetail.id = item.id - if(currentType)if(state.selectDetail.newDetail?.[currentType])delete state.selectDetail.newDetail[currentType] + if(currentType)if(state.selectDetail.newDetail?.[currentType] && currentType != 'color')delete state.selectDetail.newDetail[currentType] } } if(value.fun)value.fun() diff --git a/src/tool/https.js b/src/tool/https.js index b20e8b98..139c3b9a 100644 --- a/src/tool/https.js +++ b/src/tool/https.js @@ -38,19 +38,7 @@ const CancelToken = axios.CancelToken; const source = CancelToken.source(); // console.log(import.meta.env.VITE_APP_BASE_URL); let isLoginTime = false -const filterHttpsUrl = [ - // '/api/portfolio/page', - '/api/account/resetPwd', - '/api/portfolio/detail', - '/api/account/preLogin', - '/api/account/designWorksRegister', - '/api/account/schoolLogin', - '/api/account/enterpriseLogin', - '/api/account/login', - '/api/account/organizationNameSearch', - '/api/account/designWorksRegisterCode', - '/api/third/party/parseWeChatCode', - '/api/account/sendEmail'] + //POST传参序列化(添加请求拦截器) axios.interceptors.request.use((config) => { //在发送请求之前做某件事 @@ -63,23 +51,7 @@ axios.interceptors.request.use((config) => { // config.data = JSON.stringify(config.data); } // config.headers.Authorization = 'Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA'; - if(filterHttpsUrl.indexOf(config.url) == -1){ - if (!getCookie('token')) { - console.log('无Token,取消请求'); - if(!isLoginTime){ - isLoginTime = true - router.replace('/') - message.warning('Please login and try again~') - setTimeout(()=>[ - isLoginTime = false - ],2000) - } - return Promise.reject(new Error('缺少Token,请求被拦截')); // 阻止请求 - } - config.headers.Authorization = getCookie('token'); - }else{ - config.headers.Authorization = ''; - } + config.headers.Authorization = getCookie('token'); return config; },(error) =>{ return Promise.reject(error); diff --git a/src/views/HomeMain.vue b/src/views/HomeMain.vue index 3588b64a..7395fc87 100644 --- a/src/views/HomeMain.vue +++ b/src/views/HomeMain.vue @@ -398,10 +398,10 @@ export default defineComponent({ homeMainData.openType = Object.keys(query)[0] homeMainData.openTypeChild = query[Object.keys(query)[0]] } - if((query?.id || query?.history) && !await getIdExistToHistory()){ - router.push('/home') - return - } + // if((query?.id || query?.history) && !await getIdExistToHistory()){ + // router.push('/home') + // return + // } }else{ homeMainData.openType = '' homeMainData.openTypeChild = ''