From 791e034a6b1034a7621781a535ac6338f9c459f2 Mon Sep 17 00:00:00 2001 From: sexygoat <1538832180@qq.com> Date: Fri, 24 Apr 2026 14:15:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B7=B3=E8=BD=AC=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index fee8033..5d04690 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -379,15 +379,36 @@ // #endif }; - const enterBack = () => { + const enterBack = async () => { if (!deviceInfo.lan_ip || deviceInfo.lan_ip === '-') { - uni.showToast({ - title: '暂无后台地址', - icon: 'none' + uni.showModal({ + title: '提示', + content: '请将设备开机后, 等待2分钟左右进行连接WiFi', + showCancel: false, + buttonText: '我知道了' }); return; } + // #ifndef H5 + const [err, res] = await uni.getConnectedWifi(); + if (!err && res && res.wifi) { + const currentIP = res.wifi.localIp || ''; + const lanIP = deviceInfo.lan_ip.replace('http://', '').replace('https://', '').split(':')[0]; + const lanIPPrefix = lanIP.split('.').slice(0, 3).join('.'); + const currentIPPrefix = currentIP.split('.').slice(0, 3).join('.'); + if (currentIPPrefix !== lanIPPrefix && lanIPPrefix !== '0.0.0') { + uni.showModal({ + title: '提示', + content: '请先连接设备WiFi,否则无法访问后台管理', + showCancel: false, + buttonText: '我知道了' + }); + return; + } + } + // #endif + // 跳转到设备后台管理地址 const url = deviceInfo.lan_ip.startsWith('http') ? deviceInfo.lan_ip : `http://${deviceInfo.lan_ip}`;