From ce81a142a71f7ccdfd354585aa245d3449b7816b Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Mon, 10 Feb 2025 09:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98json=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=B0=E6=9C=AC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 2 +- src/views/mapPage/realTimeMap/editMap.vue | 29 ++++++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.env.local b/.env.local index a3752946..f0650411 100644 --- a/.env.local +++ b/.env.local @@ -4,7 +4,7 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://192.168.0.74:48080' +VITE_BASE_URL='http://192.168.0.66:48080' # VITE_BASE_URL='http://192.168.0.189:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 diff --git a/src/views/mapPage/realTimeMap/editMap.vue b/src/views/mapPage/realTimeMap/editMap.vue index 83a3c5ad..75ea888c 100644 --- a/src/views/mapPage/realTimeMap/editMap.vue +++ b/src/views/mapPage/realTimeMap/editMap.vue @@ -99,7 +99,7 @@ class="map-box-inner-dot" @click="mapClick" :class="state.isShowGrid ? 'grid-show' : ''" - v-if="test" + v-if="interfaceRefreshed" > { } // 缩放停止 -const test = ref(true) - +const interfaceRefreshed = ref(true) const resizeEnd = (x, y, w, h, item, index) => { - test.value = false + interfaceRefreshed.value = false console.log('缩放', w, h) nextTick(() => { imgList.value[index].x = x @@ -263,13 +262,8 @@ const addEditHistory = () => { } else { allHistoryList.value.push(JSON.parse(JSON.stringify(imgList.value))) currentIndex.value++ - console.log(currentIndex.value) - console.log( - allHistoryList.value[currentIndex.value][currentItemIndex.value], - allHistoryList.value[currentIndex.value][currentItemIndex.value] - ) } - test.value = true + interfaceRefreshed.value = true console.log(allHistoryList.value, 'allHistoryList') } @@ -544,6 +538,20 @@ const toolbarClick = (item) => { saveMap() break case 3: + //另存为 存为json文件 无法直接访问用户的文件系统 不能选择存在那个文件夹里面 + const jsonString = JSON.stringify(allHistoryList.value[currentIndex.value], null, 2) + const blob = new Blob([jsonString], { type: 'application/json' }) + const url = URL.createObjectURL(blob) + + const a = document.createElement('a') + a.href = url + a.download = 'mapJson.json' + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + URL.revokeObjectURL(url) + + message.success('下载成功') break case 4: break @@ -583,7 +591,6 @@ const toolbarClick = (item) => { case 13: //文字 textFormToolDialogRef.value.open() - // if (toolbarTypeIndex.value === 13) { // state.cursorStyle = `url('${cursorCollection.input}'),auto` // } else {