fix auto run bug

This commit is contained in:
2026-03-19 16:49:13 +08:00
parent 86203f9b4f
commit c1d5d91d5c
5 changed files with 66 additions and 25 deletions

View File

@@ -296,17 +296,32 @@
cachedDetails = [];
}
let listRes = await eda.sys_ClientUrl.request(SERVER + '/getLeyeList?pageSize=1000&current=1');
let listResult = await listRes.json();
let listResult;
try {
const listRes = await eda.sys_ClientUrl.request(SERVER + '/getLeyeList?pageSize=1000&current=1');
listResult = await listRes.json();
} catch (e) {
listResult = { success: false };
}
if (AUTO_RUN && !listResult.success) {
window.open('leye://open');
eda.sys_Window.open('leye://open');
for (let i = 0; i < 3 && !listResult.success; i++) {
eda.sys_Message.showToastMessage('等待拉起本地服务端...', ESYS_ToastMessageType.INFO);
listRes = await eda.sys_ClientUrl.request(SERVER + '/getLeyeList?pageSize=1000&current=1');
listResult = await listRes.json();
await new Promise((resolve) => setTimeout(resolve, 1500));
try {
const listRes = await eda.sys_ClientUrl.request(SERVER + '/getLeyeList?pageSize=1000&current=1');
listResult = await listRes.json();
} catch (e) {
listResult = { success: false };
}
if (!listResult.success) {
await new Promise((resolve) => setTimeout(resolve, 1500));
}
}
}
if (!listResult.success || !listResult.data) {
throw new Error('同步失败');
}
@@ -365,7 +380,7 @@
} catch (error) {
tableBody.innerHTML = `<tr><td colspan="8" class="text-center py-6 text-red-500">加载失败: ${error.message}</td></tr>`;
console.log('加载失败: ', error);
eda.sys_Log.add('加载失败: ', error.message);
eda.sys_Log.add('加载失败: ' + error.message, ESYS_LogType.ERROR);
}
}