Compare commits

...

2 Commits

Author SHA1 Message Date
93a685e6b7 Merge branch 'dev_tp' of 47.109.78.3:dev/seabox_fanyi_application into dev_tp 2025-08-25 18:03:50 +08:00
94a8e3928f add update prox 2025-08-25 18:03:30 +08:00
3 changed files with 49 additions and 0 deletions

View File

@ -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',

View File

@ -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);

View File

@ -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'"