From b7b5a2b68ce5612679ca3c87f424b92aab5ed017 Mon Sep 17 00:00:00 2001 From: luo Date: Wed, 16 Sep 2026 16:50:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=90=8E=E5=8F=B0=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=85=BC=E5=AE=B9ip=5Faddress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index b00f8c8..cac05dc 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -186,6 +186,7 @@ run_time: 0, last_online_time: '-', lan_ip: '-', + ip_address: '-', kf_url: '-', mchList: [], imei: '-', @@ -317,6 +318,7 @@ deviceInfo.ssidName = rt.ssid || '-'; deviceInfo.ssidPwd = rt.wifi_password || '-'; deviceInfo.lan_ip = rt.lan_ip || '-'; + deviceInfo.ip_address = rt.ip_address || '-'; deviceInfo.connCnt = rt.client_number ?? 0; deviceInfo.max_clients = rt.max_clients ?? 1; deviceInfo.run_time = rt.run_time || 0; @@ -329,6 +331,7 @@ deviceInfo.ssidName = '-'; deviceInfo.ssidPwd = '-'; deviceInfo.lan_ip = '-'; + deviceInfo.ip_address = '-'; deviceInfo.connCnt = 0; deviceInfo.max_clients = 1; deviceInfo.run_time = 0; @@ -452,7 +455,11 @@ }; const enterBack = async () => { - if (!deviceInfo.lan_ip || deviceInfo.lan_ip === '-') { + const lanIp = deviceInfo.lan_ip && deviceInfo.lan_ip !== '-' ? deviceInfo.lan_ip : ''; + const remoteIp = deviceInfo.ip_address && deviceInfo.ip_address !== '-' ? deviceInfo.ip_address : ''; + const backIp = lanIp || remoteIp; + + if (!backIp) { uni.showModal({ title: '提示', content: '请将设备开机后, 等待2分钟左右进行连接WiFi', @@ -462,18 +469,21 @@ return; } - await new Promise((resolve) => { - uni.showModal({ - title: '提示', - content: '请先连接当前设备WiFi,否则无法访问后台管理', - cancelText: '取消', - confirmText: '我知道了', - success: (res) => res.confirm && resolve() + // 局域网地址需先连接设备WiFi, 远程地址直接访问 + if (lanIp) { + await new Promise((resolve) => { + uni.showModal({ + title: '提示', + content: '请先连接当前设备WiFi,否则无法访问后台管理', + cancelText: '取消', + confirmText: '我知道了', + success: (res) => res.confirm && resolve() + }); }); - }); + } // 跳转到设备后台管理地址 - const url = deviceInfo.lan_ip.startsWith('http') ? deviceInfo.lan_ip : `http://${deviceInfo.lan_ip}`; + const url = backIp.startsWith('http') ? backIp : `http://${backIp}`; // #ifdef H5 window.location.href = url;