This commit is contained in:
@@ -392,20 +392,26 @@
|
|||||||
|
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
const [err, res] = await uni.getConnectedWifi();
|
const [err, res] = await uni.getConnectedWifi();
|
||||||
|
let needWifiCheck = true;
|
||||||
if (!err && res && res.wifi) {
|
if (!err && res && res.wifi) {
|
||||||
const currentIP = res.wifi.localIp || '';
|
const currentIP = res.wifi.localIp || '';
|
||||||
const lanIP = deviceInfo.lan_ip.replace('http://', '').replace('https://', '').split(':')[0];
|
const lanIP = deviceInfo.lan_ip.replace('http://', '').replace('https://', '').split(':')[0];
|
||||||
const lanIPPrefix = lanIP.split('.').slice(0, 3).join('.');
|
const lanIPPrefix = lanIP.split('.').slice(0, 3).join('.');
|
||||||
const currentIPPrefix = currentIP.split('.').slice(0, 3).join('.');
|
const currentIPPrefix = currentIP.split('.').slice(0, 3).join('.');
|
||||||
if (currentIPPrefix !== lanIPPrefix && lanIPPrefix !== '0.0.0') {
|
if (currentIPPrefix === lanIPPrefix || lanIPPrefix === '0.0.0') {
|
||||||
|
needWifiCheck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needWifiCheck) {
|
||||||
|
await new Promise((resolve) => {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请先连接设备WiFi,否则无法访问后台管理',
|
content: '请先连接设备WiFi,否则无法访问后台管理',
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
buttonText: '我知道了'
|
buttonText: '我知道了',
|
||||||
|
success: () => resolve()
|
||||||
});
|
});
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user