Compare commits
	
		
			2 Commits
		
	
	
		
			3d44efacb7
			...
			93a685e6b7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 93a685e6b7 | |||
| 94a8e3928f | 
| @ -38,6 +38,7 @@ const ipcApiRoute = { | ||||
|   editGlobalProxyInfo: 'controller/window/editGlobalProxyInfo', | ||||
|   saveProxyInfo: 'controller/window/saveProxyInfo', | ||||
|   testProxy: 'controller/window/testProxy', | ||||
|   checkProxyStatus: 'controller/window/checkProxyStatus', | ||||
|   openSessionDevTools: 'controller/window/openSessionDevTools', | ||||
|   closeGlobalProxyPasswordVerification: 'controller/window/closeGlobalProxyPasswordVerification', | ||||
|  | ||||
|  | ||||
| @ -114,6 +114,7 @@ | ||||
|       </div> | ||||
|     </div> | ||||
|     <div style="text-align:right;margin-top:16px;"> | ||||
|       <el-button type="warning" size="small" @click="testProxy" style="margin-right: 8px;">{{ t('session.testProxy') || '测试代理' }}</el-button> | ||||
|       <el-button type="primary" size="small" @click="handleSave">{{ t('common.save') }}</el-button> | ||||
|     </div> | ||||
|   </div> | ||||
| @ -159,6 +160,27 @@ const getConfigInfo = async () => { | ||||
|   } catch (err) {} | ||||
| } | ||||
|  | ||||
| const testProxy = async () => { | ||||
|   const args = { | ||||
|     proxyType: proxyInfo.value.proxyType, | ||||
|     proxyIp: proxyInfo.value.proxyIp, | ||||
|     proxyPort: proxyInfo.value.proxyPort, | ||||
|     userVerifyStatus: proxyInfo.value.userVerifyStatus, | ||||
|     username: proxyInfo.value.username, | ||||
|     password: proxyInfo.value.password, | ||||
|   }; | ||||
|   try { | ||||
|     const res = await ipc.invoke(ipcApiRoute.testProxy, args); | ||||
|     if (res.status) { | ||||
|       ElMessage.success(res.message || '代理连接成功'); | ||||
|     } else { | ||||
|       ElMessage.error(res.message || '代理连接失败'); | ||||
|     } | ||||
|   } catch (e) { | ||||
|     ElMessage.error('代理连接失败'); | ||||
|   } | ||||
| } | ||||
|  | ||||
| const handleSave = async () => { | ||||
|   const args = { ...proxyInfo.value }; | ||||
|   await ipc.invoke(ipcApiRoute.editProxyInfo, args); | ||||
|  | ||||
| @ -41,6 +41,20 @@ const filteredTableData = computed(() => { | ||||
| const tableData = ref([]); | ||||
| const getTableData = async () => { | ||||
|   tableData.value = await menuStore.getCurrentChildren(); | ||||
|   // 获取每个会话的代理状态 | ||||
|   const rows = Array.isArray(tableData.value) ? tableData.value : []; | ||||
|   for (const row of rows) { | ||||
|     try { | ||||
|       const res = await ipc.invoke(ipcApiRoute.checkProxyStatus, { partitionId: row.partitionId, platform: row.platform }); | ||||
|       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) { | ||||
|       row._proxyShould = false; | ||||
|       row._proxyReachable = false; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| onMounted(async () => { | ||||
|   await getTableData(); | ||||
| @ -665,6 +679,18 @@ const handleBatchProxySave = async () => { | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column align="center" label="代理状态" width="140"> | ||||
|           <template #default="{ row }"> | ||||
|             <template v-if="row._proxyShould === false"> | ||||
|               <el-tag type="info" size="small">未启用</el-tag> | ||||
|             </template> | ||||
|             <template v-else> | ||||
|               <el-tag v-if="row._proxyReachable === true" type="success" size="small">成功</el-tag> | ||||
|               <el-tag v-else-if="row._proxyReachable === false" type="danger" size="small">失败</el-tag> | ||||
|               <el-tag v-else type="warning" size="small">检测中</el-tag> | ||||
|             </template> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column align="center" prop="isTop" label="置顶" width="70"> | ||||
|           <template #default="{ row }"> | ||||
|             <el-checkbox v-model="row.isTop" @change="toggleTop(row)" :true-label="'true'" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	