add proxy check
This commit is contained in:
		| @ -184,9 +184,24 @@ const testProxy = async () => { | ||||
| const handleSave = async () => { | ||||
|   const args = { ...proxyInfo.value }; | ||||
|   await ipc.invoke(ipcApiRoute.editProxyInfo, args); | ||||
|   // 刷新对应会话页面(修复:这里应传 partitionId 而不是 currentMenu) | ||||
|   await ipc.invoke(ipcApiRoute.refreshSession, { | ||||
|     partitionId: menuStore.currentMenu | ||||
|     partitionId: menuStore.currentPartitionId | ||||
|   }); | ||||
|   // 保存后自动刷新当前列表行的代理状态 | ||||
|   try { | ||||
|     const pid = menuStore.currentPartitionId; | ||||
|     const res = await ipc.invoke(ipcApiRoute.checkProxyStatus, { partitionId: pid, platform: menuStore.platform }); | ||||
|     const menu = menuStore.menus.find(m => m.id === menuStore.currentMenu); | ||||
|     const row = menu?.children?.find(c => c.partitionId === pid); | ||||
|     if (row) { | ||||
|       const should = res?.data?.shouldUseProxy; | ||||
|       const using = res?.data?.usingProxy; | ||||
|       row._proxyShould = typeof should === 'boolean' ? should : !!using; | ||||
|       row._proxyReachable = res?.data?.reachable === null ? null : !!res?.data?.reachable; | ||||
|     } | ||||
|   } catch (e) {} | ||||
|  | ||||
|   if (args.defaultLanguage || args.timezone) { | ||||
|     ElMessage({ | ||||
|       message: t('session.restartRequired'), | ||||
|  | ||||
| @ -139,6 +139,20 @@ const saveProxyConfig = async () => { | ||||
|  | ||||
|   // 根据返回结果处理 | ||||
|   if (res.status) { | ||||
|     // 保存成功后,后台会立即应用代理设置。我们顺便刷新当前行状态。 | ||||
|     try { | ||||
|       const pid = proxyForm.value.partitionId || proxyForm.value.id?.partitionId || menuStore.currentPartitionId; | ||||
|       const r = await ipc.invoke(ipcApiRoute.checkProxyStatus, { partitionId: pid, platform: menuStore.platform }); | ||||
|       const menu = menuStore.menus.find(m => m.id === menuStore.currentMenu); | ||||
|       const row = menu?.children?.find(c => c.partitionId === pid); | ||||
|       if (row) { | ||||
|         const should = r?.data?.shouldUseProxy; | ||||
|         const using = r?.data?.usingProxy; | ||||
|         row._proxyShould = typeof should === 'boolean' ? should : !!using; | ||||
|         row._proxyReachable = r?.data?.reachable === null ? null : !!r?.data?.reachable; | ||||
|       } | ||||
|     } catch (e) {} | ||||
|  | ||||
|     ElMessage({ | ||||
|       message: t('session.proxyConfigSaveSuccess'), | ||||
|       type: 'success', | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 unknown
					unknown