Commit f0064cfc authored by lyong's avatar lyong

fix:补充上传优化wifi连接同ssid最好信号

parent 56cba56f
......@@ -1086,11 +1086,9 @@
"./../RE860A/images/settings/passwordInvisiable.png",
"./../RE860A/images/settings/passwordVisiable.png",
];
},
updateMainConnectWifiShowUI: function () {
var wifiInfo = wifiEventJS.getWifiInfo(this.initWifissid);
},
updateMainConnectWifiShowUI: function (wifiInfo) {
if (wifiInfo) {
this.initWifipwd = (this.initWifipwd == "") ? "" : this.initWifipwd
this.Reminder_TEXT = "请配置SSID为" + this.initWifissid + "密码为" + this.initWifipwd + "的WIFI路由器,且确保路由器能连上外网";
......@@ -1223,18 +1221,24 @@
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.wifi = 1;
// globalThis.factoryTest.wifi = 1;
var global = require("factory_dataStorage.js");
global.setFactoryData("wifi", 1);
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestWifi);")
yesJumpPage.yesGoToNextPage("factoryTestWifi");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.wifi = 2;
//globalThis.factoryTest.wifi = 2;
var global = require("factory_dataStorage.js");
global.setFactoryData("wifi", 2);
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
//var global = require("factory_dataStorage.js");
// global.setFactoryData("wifi", 3);
router.push({
path: "factory_testList",
});
......@@ -1245,13 +1249,7 @@
this.scanWifiList();
factoryDivPageJump.movePage("id_enableWLANChooseOnDiv");
},
//touchedStartScanWifiButton: function (node, topNode, x, y) {
// router.push({
// path: "factory_testList",
// });
//factoryDivPageJump.movePage("wifiHmoe", "id_enableWLANChooseOnDiv");
// wifiEventJS.enableWLANSwitch();
//},
hideShowConnectbutton: function (option) {
console.log("hideShowConnectbutton option=" + option);
switch (option) {
......@@ -1273,6 +1271,7 @@
console.log("====================================================");
this.$setY("id_yes", -480);
this.goToConnectWifi();
//wifiEventJS.goToConnectWifi(this, this.initWifissid, this.initWifipwd, this.initecnryptedMode);
},
preInitMainConnectWifiShowUI: function () {
......@@ -1289,10 +1288,31 @@
this.preInitMainConnectWifiShowUI();
this.hideShowConnectbutton(0);
wifiEventJS.enableWLANScanValue();
wifiEventJS.connect_wifi(this.initWifissid, this.initWifipwd, this.initencryptedMode);
const list = wifiEventJS.getScanAllWifi() || [];
const best = wifiEventJS.pickStrongestBySsid(list, this.initWifissid);
if (best) {
// 扫描到了目标 SSID → 用信号最好的那台(含 bssid)连接
wifiEventJS.connect_wifi({
ssid: best.ssid,
pwd: this.initWifipwd,
mode: best.encryptedMode,
bssid: best.bssid
});
} else {
// 扫描列表里没找到目标 SSID → 仍尝试传统连接(无 bssid)
wifiEventJS.connect_wifi({
ssid: this.initWifissid,
pwd: this.initWifipwd,
mode: this.initencryptedMode
});
}
setTimeout(() => {
this.hideShowConnectbutton(1);
this.updateMainConnectWifiShowUI();
var wifiInfo = wifiEventJS.getWifiInfo(this.initWifissid, best ? best.bssid : undefined);
this.updateMainConnectWifiShowUI(wifiInfo);
connectWifiFlag = false; // 解锁,允许再次点击
}, 5000);
......@@ -1318,25 +1338,6 @@
noclickBuntton: function (node, topNode, x, y) {
},
// scanWifiList: function () {
// if (scanWifiFlag == true)
// return;
// if (idtimerOutScanWifiList != null) {
// clearTimeout(idtimerOutScanWifiList);
// idtimerOutScanWifiList = null;
// }
// idtimerOutScanWifiList = setTimeout(() => {
// var scanWifiFlag = true;
// console.log("========scanWifiList=======");
// this.hideShowConnectListbutton(0)
// wifiEventJS.enableWLANSwitch();
// setTimeout(() => {
// this.hideShowConnectListbutton(1);
// scanWifiFlag = false;
// }, 5000);
// }, 100);
// },
scanWifiList: function () {
if (scanWifiFlag) return; // 正在扫描中,直接忽略
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment