update 1.0.7

This commit is contained in:
2026-02-22 22:11:47 +08:00
parent 6a5f4aaed0
commit 3118185b31
8 changed files with 1299 additions and 966 deletions

View File

@@ -109,16 +109,27 @@
</label>
<input type="checkbox" id="settings-server-auto-run" />
</div>
<div class="flex items-center justify-between mb-4">
<label for="settings-auto-fill-bom" class="text-gray-700">出库自动填充 BOM</label>
<input type="checkbox" id="settings-auto-fill-bom" />
</div>
</div>
<div class="bg-white p-4 rounded-lg w-[400px]">
<h2 class="text-lg font-semibold text-gray-800 mb-4">
高级设置
<span class="text-[12px] text-gray-500 font-light ml-2"> 实验或调试选项 </span>
</h2>
<div class="flex items-center justify-between mb-4">
<label for="settings-auto-check-update" class="text-gray-700">
自动检查更新
<span class="tooltip text-sm text-gray-500 font-light" data-tooltip="允许在启动 EDA 时检查更新">?</span>
</label>
<input type="checkbox" id="settings-auto-check-update" />
</div>
<div class="flex items-center justify-between mb-4">
<label for="settings-clean-cache" class="text-gray-700">
清除缓存
<span class="tooltip text-sm text-gray-500 font-light" data-tooltip="用于移除损坏的缓存数据">?</span>
<span class="tooltip text-sm text-gray-500 font-light" data-tooltip="库存数据异常可尝试使用此功能修复">?</span>
</label>
<button id="settings-clean-cache" class="bg-red-600 text-white px-4 py-1 rounded hover:bg-red-700">清除</button>
</div>
@@ -128,10 +139,14 @@
document.addEventListener('DOMContentLoaded', async () => {
const serverHostInput = document.getElementById('settings-server-host');
const serverAutoRun = document.getElementById('settings-server-auto-run');
const autoFillBomInput = document.getElementById('settings-auto-fill-bom');
const autoCheckUpdateInput = document.getElementById('settings-auto-check-update');
const cleanCacheBtn = document.getElementById('settings-clean-cache');
serverHostInput.value = (await eda.sys_Storage.getExtensionUserConfig('server-host')) ?? 'http://localhost:21816/api';
serverAutoRun.checked = (await eda.sys_Storage.getExtensionUserConfig('server-auto-run')) ?? true;
autoFillBomInput.checked = (await eda.sys_Storage.getExtensionUserConfig('auto-fill-bom')) ?? false;
autoCheckUpdateInput.checked = (await eda.sys_Storage.getExtensionUserConfig('auto-check-update')) ?? true;
serverHostInput.addEventListener('change', async () => {
saveConfig('server-host', serverHostInput.value);
@@ -139,16 +154,22 @@
serverAutoRun.addEventListener('change', async () => {
saveConfig('server-auto-run', serverAutoRun.checked);
});
autoFillBomInput.addEventListener('change', async () => {
saveConfig('auto-fill-bom', autoFillBomInput.checked);
});
autoCheckUpdateInput.addEventListener('change', async () => {
saveConfig('auto-check-update', autoCheckUpdateInput.checked);
});
cleanCacheBtn.addEventListener('click', async () => {
eda.sys_Storage.deleteExtensionUserConfig('cache-leye-device-details').then(s => {
eda.sys_Storage.deleteExtensionUserConfig('cache-leye-device-details').then((s) => {
if (s) {
eda.sys_Message.showToastMessage('缓存清除成功!', ESYS_ToastMessageType.SUCCESS);
} else {
eda.sys_Message.showToastMessage('缓存清除失败...', ESYS_ToastMessageType.ERROR);
}
})
})
});
});
});
function saveConfig(key, value) {