fix:后台地址兼容ip_address
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user