|
@@ -1,8 +1,7 @@
|
|
|
const app = getApp();
|
|
|
import strings from '../../utils/strings.js';
|
|
|
-const {
|
|
|
- BtHelper
|
|
|
-} = require('../../devices/bt_helper');
|
|
|
+import route_util from '../../utils/route_util.js';
|
|
|
+import route_constant from '../../utils/route_constant.js'
|
|
|
const {
|
|
|
BleUtil
|
|
|
} = require('../../utils/blue_ble/util');
|
|
@@ -82,57 +81,48 @@ Page({
|
|
|
});
|
|
|
clearInterval(percentIn);
|
|
|
}
|
|
|
- });
|
|
|
+ }, function (connected) {
|
|
|
+ var deviceId = that.data.name;
|
|
|
+ var device = {
|
|
|
+ connectType: 3,
|
|
|
+ devName: "",
|
|
|
+ state: "online",
|
|
|
+ name: deviceId,
|
|
|
+ deviceId: deviceId,
|
|
|
+ mac: deviceId,
|
|
|
+ imageUrl: that.data.imageUrl,
|
|
|
+ // imageUrl: "./../../img/min.png",
|
|
|
+ }
|
|
|
+ getCurrentPages()[0].addWifiDevice(device);
|
|
|
+ // [{"deviceId":"BLUFI_7cdfa1fcbb24","name":"BLUFI_7cdfa1fcbb24","state":"online"}]
|
|
|
+ // 记住密码
|
|
|
+ wx.setStorage({
|
|
|
+ key: "wifiInfo",
|
|
|
+ data: JSON.stringify({
|
|
|
+ "password": app.globalData.pwdData,
|
|
|
+ "ssid": app.globalData.ssid
|
|
|
+ }),
|
|
|
+ });
|
|
|
|
|
|
- // BtHelper.getInstance().startScan(device,
|
|
|
- // async function (b) {
|
|
|
- // if (!b) {
|
|
|
- // that.setData({
|
|
|
- // connected: false
|
|
|
- // })
|
|
|
- // that.setData({
|
|
|
- // ruterStatus: 2
|
|
|
- // });
|
|
|
- // }
|
|
|
+ setTimeout(() => {
|
|
|
+ if (percentIn != null) {
|
|
|
+ clearInterval(percentIn);
|
|
|
+ that.setData({
|
|
|
+ percent: 100,
|
|
|
+ ruterStatus: 1,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- // setTimeout(function () {
|
|
|
- // BleUtil.getInstance().startConnect(device, function (changed) {
|
|
|
- // if (changed) {
|
|
|
- // BleUtil.getInstance().sendData(device, app.globalData.ssid, app.globalData.pwdData);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }, 10 * 1000);
|
|
|
- // },
|
|
|
- // async function (res) {
|
|
|
- // var deviceId = that.data.name;
|
|
|
- // var device = {
|
|
|
- // connectType: 3,
|
|
|
- // devName: "",
|
|
|
- // state: "online",
|
|
|
- // name: deviceId,
|
|
|
- // deviceId: deviceId,
|
|
|
- // mac: deviceId,
|
|
|
- // imageUrl: that.data.imageUrl,
|
|
|
- // // imageUrl: "./../../img/min.png",
|
|
|
- // }
|
|
|
- // getCurrentPages()[0].addWifiDevice(device);
|
|
|
- // // 记住密码
|
|
|
- // wx.setStorage({
|
|
|
- // key: "wifiInfo",
|
|
|
- // data: JSON.stringify({
|
|
|
- // "password": app.globalData.pwdData,
|
|
|
- // "ssid": app.globalData.ssid
|
|
|
- // }),
|
|
|
- // });
|
|
|
+ egen() {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- // setTimeout(() => {
|
|
|
- // clearInterval(percentIn);
|
|
|
- // that.setData({
|
|
|
- // percent: 100,
|
|
|
- // ruterStatus: 1,
|
|
|
- // });
|
|
|
- // }, 500);
|
|
|
- // }
|
|
|
- // );
|
|
|
+ goIndex() {
|
|
|
+ route_util.goBackRoute(route_constant.indexRoot);
|
|
|
},
|
|
|
})
|