fix:后台地址兼容ip_address
This commit is contained in:
@@ -186,6 +186,7 @@
|
|||||||
run_time: 0,
|
run_time: 0,
|
||||||
last_online_time: '-',
|
last_online_time: '-',
|
||||||
lan_ip: '-',
|
lan_ip: '-',
|
||||||
|
ip_address: '-',
|
||||||
kf_url: '-',
|
kf_url: '-',
|
||||||
mchList: [],
|
mchList: [],
|
||||||
imei: '-',
|
imei: '-',
|
||||||
@@ -317,6 +318,7 @@
|
|||||||
deviceInfo.ssidName = rt.ssid || '-';
|
deviceInfo.ssidName = rt.ssid || '-';
|
||||||
deviceInfo.ssidPwd = rt.wifi_password || '-';
|
deviceInfo.ssidPwd = rt.wifi_password || '-';
|
||||||
deviceInfo.lan_ip = rt.lan_ip || '-';
|
deviceInfo.lan_ip = rt.lan_ip || '-';
|
||||||
|
deviceInfo.ip_address = rt.ip_address || '-';
|
||||||
deviceInfo.connCnt = rt.client_number ?? 0;
|
deviceInfo.connCnt = rt.client_number ?? 0;
|
||||||
deviceInfo.max_clients = rt.max_clients ?? 1;
|
deviceInfo.max_clients = rt.max_clients ?? 1;
|
||||||
deviceInfo.run_time = rt.run_time || 0;
|
deviceInfo.run_time = rt.run_time || 0;
|
||||||
@@ -329,6 +331,7 @@
|
|||||||
deviceInfo.ssidName = '-';
|
deviceInfo.ssidName = '-';
|
||||||
deviceInfo.ssidPwd = '-';
|
deviceInfo.ssidPwd = '-';
|
||||||
deviceInfo.lan_ip = '-';
|
deviceInfo.lan_ip = '-';
|
||||||
|
deviceInfo.ip_address = '-';
|
||||||
deviceInfo.connCnt = 0;
|
deviceInfo.connCnt = 0;
|
||||||
deviceInfo.max_clients = 1;
|
deviceInfo.max_clients = 1;
|
||||||
deviceInfo.run_time = 0;
|
deviceInfo.run_time = 0;
|
||||||
@@ -452,7 +455,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const enterBack = async () => {
|
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({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请将设备开机后, 等待2分钟左右进行连接WiFi',
|
content: '请将设备开机后, 等待2分钟左右进行连接WiFi',
|
||||||
@@ -462,18 +469,21 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await new Promise((resolve) => {
|
// 局域网地址需先连接设备WiFi, 远程地址直接访问
|
||||||
uni.showModal({
|
if (lanIp) {
|
||||||
title: '提示',
|
await new Promise((resolve) => {
|
||||||
content: '请先连接当前设备WiFi,否则无法访问后台管理',
|
uni.showModal({
|
||||||
cancelText: '取消',
|
title: '提示',
|
||||||
confirmText: '我知道了',
|
content: '请先连接当前设备WiFi,否则无法访问后台管理',
|
||||||
success: (res) => res.confirm && resolve()
|
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
|
// #ifdef H5
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|||||||
Reference in New Issue
Block a user