现在代码上传逻辑存在问题
This commit is contained in:
@@ -6,7 +6,6 @@ const BaseView_1 = require("./BaseView");
|
||||
class AircraftView extends BaseView_1.BaseView {
|
||||
render(data) {
|
||||
const aircrafts = data?.aircrafts || [];
|
||||
console.log('AircraftView 渲染数据:', aircrafts);
|
||||
const aircraftsHtml = aircrafts.map(aircraft => `
|
||||
<tr>
|
||||
<td>
|
||||
@@ -60,7 +59,7 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0 auto; /* 确保按钮在容器内居中 */
|
||||
margin: 0 auto;
|
||||
}
|
||||
.btn-new:hover {
|
||||
background: var(--vscode-button-hoverBackground);
|
||||
@@ -74,7 +73,6 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
.aircraft-name:hover {
|
||||
background: var(--vscode-input-background);
|
||||
}
|
||||
/* 专门为新建按钮的容器添加样式 */
|
||||
.new-button-container {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
@@ -97,7 +95,6 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
</thead>
|
||||
<tbody>
|
||||
${aircraftsHtml}
|
||||
<!-- 修复:使用专门的容器类确保居中 -->
|
||||
<tr>
|
||||
<td colspan="3" class="new-button-container">
|
||||
<button class="btn-new" onclick="createNewAircraft()">+ 新建飞行器</button>
|
||||
@@ -186,86 +183,6 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 对话框函数
|
||||
function showConfirmDialog(title, message, onConfirm, onCancel) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'confirmModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closeConfirmDialog(false)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closeConfirmDialog(true)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
window.confirmCallback = function(result) {
|
||||
if (result && onConfirm) {
|
||||
onConfirm();
|
||||
} else if (!result && onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
delete window.confirmCallback;
|
||||
};
|
||||
}
|
||||
|
||||
function closeConfirmDialog(result) {
|
||||
const modal = document.getElementById('confirmModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.confirmCallback) {
|
||||
window.confirmCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
function showPromptDialog(title, message, defaultValue, onConfirm) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'promptModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<input type="text" id="promptInput" value="\${defaultValue}" style="width: 100%; margin: 10px 0; padding: 6px; background: var(--vscode-input-background); color: var(--vscode-input-foreground); border: 1px solid var(--vscode-input-border);">
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closePromptDialog(null)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closePromptDialog(document.getElementById('promptInput').value)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('promptInput');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
window.promptCallback = onConfirm;
|
||||
}
|
||||
|
||||
function closePromptDialog(result) {
|
||||
const modal = document.getElementById('promptModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.promptCallback) {
|
||||
window.promptCallback(result);
|
||||
}
|
||||
delete window.promptCallback;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
Reference in New Issue
Block a user