From 6816292febd74ac12989211cd96569ac3d459273 Mon Sep 17 00:00:00 2001 From: zhoulexin Date: Mon, 24 Nov 2025 17:30:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Abug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/annotation.js | 3 ++- public/js/header.js | 56 +++++++++++++++++++++++++---------------- public/js/save.js | 5 ++-- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/public/js/annotation.js b/public/js/annotation.js index 1d1b836..29d8cd3 100644 --- a/public/js/annotation.js +++ b/public/js/annotation.js @@ -505,8 +505,9 @@ function Annotation(sceneMeta, world, frameInfo) { if (this.readyState != 4) return; if (this.status == 200) { + console.log('状态??',microData.labelState) // 未标注状态 - if(!microData.labelState || microData.labelState === '0'){ + if(!microData.labelState || microData.labelState !== '1'){ document.getElementById("changed-mark").style.display = "block"; document.getElementById("save-submit").style.display = "block"; } diff --git a/public/js/header.js b/public/js/header.js index 7d28634..f7e0d93 100644 --- a/public/js/header.js +++ b/public/js/header.js @@ -190,29 +190,39 @@ var Header = function ( saveWorldList(this.data.worldList); }; this.ui.querySelector("#save-submit").onclick = () => { - let confirm = window.confirm("确认提交?") + let confirm = window.confirm("请确保每个结构都已保存,确认提交?") const microData = window.microApp.getData() if(confirm){ - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function(){ - if (this.status == 200){ - console.log('提交成功') - window.microApp.dispatch({ type: 'pointCloudBack', time: new Date() }) - } + // 自动保存一次再提交 + const saveButton = document.getElementById('save-button'); + if (saveButton) { + saveButton.click(); } - xhr.open( - "POST", - `${http.requestHttp}/project/label`, - true - ); - xhr.setRequestHeader('Content-Type', 'application/json'); - xhr.setRequestHeader('authorization', http.token); - xhr.send(JSON.stringify({ - dataId:microData.dataId, - type:1, - label:'', - taskId:microData.taskId, - })); + let timeOut = setTimeout(() => { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function(){ + if (this.status == 200){ + console.log('提交成功') + saveButton.style.display = 'none' + document.getElementById('save-submit').style.display = 'none' + // window.microApp.dispatch({ type: 'pointCloudBack', time: new Date() }) + } + } + xhr.open( + "POST", + `${http.requestHttp}/project/label`, + true + ); + xhr.setRequestHeader('Content-Type', 'application/json'); + xhr.setRequestHeader('authorization', http.token); + xhr.send(JSON.stringify({ + id:microData.dataId, + type:1, + label:'', + taskId:microData.taskId, + })); + clearTimeout(timeOut); + }, 1000); } }; // 通过 @@ -228,12 +238,14 @@ var Header = function ( var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if (this.status == 200){ - window.microApp.dispatch({ type: 'pointCloudBack', time: new Date() }) + // window.microApp.dispatch({ type: 'pointCloudBack', time: new Date() }) + document.getElementById('save-pass').style.display = 'none' + document.getElementById('save-reject').style.display = 'none' } } xhr.open( "POST", - `${http.requestHttp}/project/qc?dataId=${microData.dataId}&type=${type}&taskId=${microData.taskId}`, + `${http.requestHttp}/project/qc?id=${microData.dataId}&type=${type}&taskId=${microData.taskId}`, true ); xhr.setRequestHeader('Content-Type', 'application/json'); diff --git a/public/js/save.js b/public/js/save.js index 0dfd8f9..9af9ef1 100644 --- a/public/js/save.js +++ b/public/js/save.js @@ -93,7 +93,6 @@ function doSaveWorldList(worldList, done) { label: JSON.stringify(w.annotation.toBoxAnnotations()), }; }); - console.log(ann,'ann') var xhr = new XMLHttpRequest(); xhr.open("POST", http.requestHttp + "/project/frameSave", true); xhr.setRequestHeader("Content-Type","application/json") @@ -137,9 +136,9 @@ function deduplicatePreferString(array) { const map = new Map(); array.forEach(item => { - const key = String(item.id); + const key = String(item.frameId); // 如果还没有这个key,或者已存在的不是string类型而当前的是string类型 - if (!map.has(key) || (typeof map.get(key).id !== 'string' && typeof item.id === 'string')) { + if (!map.has(key) || (typeof map.get(key).frameId !== 'string' && typeof item.frameId === 'string')) { map.set(key, item); } });