fix:bug修复

main
zhoulexin 4 months ago
parent af698f336d
commit 6816292feb

@ -505,8 +505,9 @@ function Annotation(sceneMeta, world, frameInfo) {
if (this.readyState != 4) return; if (this.readyState != 4) return;
if (this.status == 200) { 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("changed-mark").style.display = "block";
document.getElementById("save-submit").style.display = "block"; document.getElementById("save-submit").style.display = "block";
} }

@ -190,29 +190,39 @@ var Header = function (
saveWorldList(this.data.worldList); saveWorldList(this.data.worldList);
}; };
this.ui.querySelector("#save-submit").onclick = () => { this.ui.querySelector("#save-submit").onclick = () => {
let confirm = window.confirm("确认提交?") let confirm = window.confirm("请确保每个结构都已保存,确认提交?")
const microData = window.microApp.getData() const microData = window.microApp.getData()
if(confirm){ if(confirm){
var xhr = new XMLHttpRequest(); // 自动保存一次再提交
xhr.onreadystatechange = function(){ const saveButton = document.getElementById('save-button');
if (this.status == 200){ if (saveButton) {
console.log('提交成功') saveButton.click();
window.microApp.dispatch({ type: 'pointCloudBack', time: new Date() })
}
} }
xhr.open( let timeOut = setTimeout(() => {
"POST", var xhr = new XMLHttpRequest();
`${http.requestHttp}/project/label`, xhr.onreadystatechange = function(){
true if (this.status == 200){
); console.log('提交成功')
xhr.setRequestHeader('Content-Type', 'application/json'); saveButton.style.display = 'none'
xhr.setRequestHeader('authorization', http.token); document.getElementById('save-submit').style.display = 'none'
xhr.send(JSON.stringify({ // window.microApp.dispatch({ type: 'pointCloudBack', time: new Date() })
dataId:microData.dataId, }
type:1, }
label:'', xhr.open(
taskId:microData.taskId, "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(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if (this.status == 200){ 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( xhr.open(
"POST", "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 true
); );
xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json');

@ -93,7 +93,6 @@ function doSaveWorldList(worldList, done) {
label: JSON.stringify(w.annotation.toBoxAnnotations()), label: JSON.stringify(w.annotation.toBoxAnnotations()),
}; };
}); });
console.log(ann,'ann')
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("POST", http.requestHttp + "/project/frameSave", true); xhr.open("POST", http.requestHttp + "/project/frameSave", true);
xhr.setRequestHeader("Content-Type","application/json") xhr.setRequestHeader("Content-Type","application/json")
@ -137,9 +136,9 @@ function deduplicatePreferString(array) {
const map = new Map(); const map = new Map();
array.forEach(item => { array.forEach(item => {
const key = String(item.id); const key = String(item.frameId);
// 如果还没有这个key或者已存在的不是string类型而当前的是string类型 // 如果还没有这个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); map.set(key, item);
} }
}); });

Loading…
Cancel
Save