故障上报时向调试控制台输出日志
This commit is contained in:
parent
89ee08789d
commit
d1f0d2e719
@ -40,7 +40,7 @@ export function initialize(): void {
|
||||
return helperDescrip ? helperDescrip.Descrip : null;
|
||||
});
|
||||
|
||||
// Get zoom factor
|
||||
// Get zoom factor by url
|
||||
ipcMain.handle('get-zoom-factor-by-url', async (event, url: string): Promise<number> => {
|
||||
const display: Electron.Display = screen.getPrimaryDisplay();
|
||||
const physicalSize: Electron.Size = {
|
||||
@ -153,7 +153,7 @@ export function initialize(): void {
|
||||
}
|
||||
});
|
||||
|
||||
// Set webview‘s cookie
|
||||
// Set webview's cookie
|
||||
ipcMain.handle('set-webview-cookie', async (event, url: string, cookie: string): Promise<boolean> => {
|
||||
try {
|
||||
const parsedUrl = new URL(url);
|
||||
@ -188,12 +188,24 @@ export function initialize(): void {
|
||||
}
|
||||
|
||||
const base64 = await captureWindowAsBase64(win);
|
||||
console.log('base64:', base64);
|
||||
console.debug('base64:', base64);
|
||||
|
||||
const account: string = memoryCache.get('Account');
|
||||
if (!account) {
|
||||
throw new Error('Not found account');
|
||||
}
|
||||
console.log('account:', account);
|
||||
|
||||
const ip: string = getLocalIPAddress();
|
||||
if (!ip) {
|
||||
throw new Error('Not found ip');
|
||||
}
|
||||
console.log('ip:', ip);
|
||||
|
||||
try {
|
||||
const response: ApiResponse<FaultReportingResponse> = await EIACDesktopApi.Help.FaultReportingAsync({
|
||||
Account: memoryCache.get('Account'),
|
||||
IP: getLocalIPAddress(),
|
||||
Account: account,
|
||||
IP: ip,
|
||||
Url: url,
|
||||
ImgBase64: base64,
|
||||
Explain: `message: ${message}, status: ${status}`
|
||||
|
@ -124,13 +124,14 @@ async function addTabAsync(tabGroup: TabGroup, menuItem: MenuItem): Promise<Tab
|
||||
if (result.ok && result.status >= 200 && result.status < 400) {
|
||||
console.log(`✅ URL ${url} 可访问:`, result.status);
|
||||
lastInvalidUrlResult = null;
|
||||
|
||||
const cookies: string = window.electronAPI.getSessionStorage('cookies');
|
||||
await window.electronAPI.setWebviewCookie(url, cookies);
|
||||
} else {
|
||||
console.warn(`❌ URL ${url} 不可访问:`, result.message ?? `status ${result.status}`);
|
||||
lastInvalidUrlResult = { url, message: result.message, status: result.status };
|
||||
|
||||
const helpDescrip: string = await window.electronAPI.getHelperDescripAsync(result.status.toString()) ?? `无法访问 {URL}\r\n异常原因:${result.message ?? `status ${result.status}`}\r\n${helpDescrip ?? ''}`;
|
||||
const helpDescrip: string = await window.electronAPI.getHelperDescripAsync(result.status.toString()) ?? `无法访问{URL}\r\n异常原因:${result.message ?? `status ${result.status}`}\r\n请联系技术支持。`;
|
||||
showErrorModal(helpDescrip.replace('{URL}', url));
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user