diff --git a/src/api/vpn.ts b/src/api/vpn.ts index 3da51f8..4de2e87 100644 --- a/src/api/vpn.ts +++ b/src/api/vpn.ts @@ -59,6 +59,10 @@ export const GetVPNServerOnlineListHandler = () => { return request.get('/vpn/get_server_online') } +export const GetSurppotVPNServerOnlineListHandler = () => { + return request.get('/vpn/get_support_vpn_server') +} + export const DeleteVPNTunnelHandler = (Data) => { return request.delete('/vpn/delete_vpn_tunnel', { data: Data }) } @@ -78,6 +82,18 @@ export const DeleteVPNServerHandler = (Data) => { return request.delete('/vpn/delete_vpn_server', { data: Data }) } +export const GetClientDownloadURLHandler = () => { + return request.get("/vpn/clients_url") +} + export const LocalClientConnectHandler = (Data) => { return local_request.post('/vpn/connect', Data) +} +export const LocalClientDisConnectHandler = (Data) => { + let url = '/vpn/disconnect?server_id=' + Data.server_id; + return local_request.get(url) +} +//获取本地客户端连接状态 +export const LocalClientStatusHandler = () => { + return local_request.get('/vpn/get_status') } \ No newline at end of file diff --git a/src/utils/local_request.ts b/src/utils/local_request.ts index 67b467e..d239ee6 100644 --- a/src/utils/local_request.ts +++ b/src/utils/local_request.ts @@ -79,7 +79,7 @@ request.interceptors.response.use( } if(result.data.code == 1) { - ElMessage.error('请求失败,请稍后重试!'); + ElMessage.error('请求失败,请运行客户端!'); } else { return result.data; } diff --git a/src/views/system/vpn-online-connect.vue b/src/views/system/vpn-online-connect.vue index ada911e..f836846 100644 --- a/src/views/system/vpn-online-connect.vue +++ b/src/views/system/vpn-online-connect.vue @@ -14,34 +14,35 @@ - +
-

{{ server.name || server.server_name || 'VPN服务器' }}

+

{{ server.name || server.name || 'VPN服务器' }}

IP地址: - {{ server.ip || server.server_ip || 'N/A' }} + {{ server.server_ip || server.server_ip || 'N/A' }} +
+
+ 协议: + {{ server.protocol === 1 ? 'TCP' : 'UDP'}}
端口: - {{ server.port || 'N/A' }} + {{ server.tcp_port || 'N/A' }} + {{ server.udp_port || 'N/A' }}
状态: 在线
-
- 位置: - {{ server.location }} -
-
- 协议: - {{ server.protocol }} +
+ 描述信息: + {{ server.server_info }}
@@ -51,11 +52,32 @@ type="primary" size="small" @click="connectToServer(server)" - :loading="connectingServers.includes(server.id)" + :loading="connectingServers.includes(server.server_id)" + v-if = "clientIsConnectServerID == ''" > 连接 + + + 断开 + + + + 显示在线信息 +
@@ -70,28 +92,15 @@ :before-close="handleDialogClose" >
-

请选择您的操作系统类型:

-
+

{{ clientUrls.length ? '请选择您的操作系统类型:' : '暂不支持下载客户端' }}

+ +
- Windows 客户端 - - - Linux 客户端 - - - macOS 客户端 + {{ clientUrl.platform }} 客户端
@@ -100,37 +109,215 @@ 取消 + + + +
+ + + + + {{ onlineInfoData.online_info.server_id }} + {{ onlineInfoData.online_info.server_ip }} + {{ onlineInfoData.online_info.tcp_port }} + {{ onlineInfoData.online_info.udp_port }} + {{ onlineInfoData.online_info.protocol === 1 ? 'TCP' : 'UDP' }} + {{ onlineInfoData.online_info.ip_type === 46 ? 'IPv4/IPv6' : 'IPv4' }} + {{ onlineInfoData.online_info.private_ipv4 }} + {{ onlineInfoData.online_info.ipv4_prefix }} + {{ onlineInfoData.online_info.gateway }} + {{ onlineInfoData.online_info.encryption }} + {{ onlineInfoData.online_info.hash }} + + {{ onlineInfoData.connect_status.connect_time }} + + + + + + + + + {{ formatBytes(onlineInfoData.connect_status.send_bytes) }} + + + {{ formatBytes(onlineInfoData.connect_status.receive_byes) }} + + {{ onlineInfoData.connect_status.send_packets }} + {{ onlineInfoData.connect_status.receive_packets }} + {{ onlineInfoData.connect_status.private_ip }} + + + + + +
+

IPv4路由表

+ + + + + + + +
+
+ +
+
+
+
+ + +
@@ -372,4 +587,57 @@ onMounted(() => { margin-bottom: 2px; } } + .online-info-content { + max-height: 600px; + overflow-y: auto; + } + + .online-info-content h4 { + margin: 20px 0 10px 0; + color: #303133; + font-size: 16px; + font-weight: 500; + } + + .online-info-content h4:first-child { + margin-top: 0; + } + + /* 自定义标签页样式 */ + .el-tabs--card .el-tabs__item { + height: 36px; + line-height: 36px; + } + + /* 描述列表样式调整 */ + .el-descriptions__body .el-descriptions__table { + table-layout: fixed; + } + + .el-descriptions__label { + font-weight: 500; + color: #606266; + } + + /* 表格样式 */ + .el-table .el-table__header th { + background-color: #f8f9fa; + color: #606266; + font-weight: 500; + } + + /* 响应式设计补充 */ + @media (max-width: 768px) { + .online-info-content { + max-height: 400px; + } + + .el-descriptions :deep(.el-descriptions__body) .el-descriptions__table { + width: 100%; + } + + .el-descriptions :deep(.el-descriptions__body) .el-descriptions__cell { + width: 50%; + } + } \ No newline at end of file diff --git a/src/views/system/vpn-tunnel.vue b/src/views/system/vpn-tunnel.vue index dd34b1d..54504a8 100644 --- a/src/views/system/vpn-tunnel.vue +++ b/src/views/system/vpn-tunnel.vue @@ -27,7 +27,7 @@ IPv6: {{ tunnel.config.auto_ipv6 ? '自动' : tunnel.config.ipv6_address }}
- 上行: {{ tunnel.config.upload_limit }} Mbps | 下行: {{ tunnel.config.download_limit }} Mbps + 上行: {{ tunnel.config.upload_limit }} Kbps | 下行: {{ tunnel.config.download_limit }} Kbps