|
@@ -0,0 +1,53 @@
|
|
|
+const app = getApp();
|
|
|
+import strings from '../../utils/strings.js';
|
|
|
+const {
|
|
|
+ BleUtil
|
|
|
+} = require('../../utils/blue_ble/util');
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ nvabarData: {
|
|
|
+ showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
|
+ title: '连接配网', //导航栏 中间的标题
|
|
|
+ },
|
|
|
+ scopeBluetooth: app.globalData.scopeBluetooth,
|
|
|
+ ssid: app.globalData.ssid,
|
|
|
+ password: app.globalData.pwdData,
|
|
|
+ version: '2.0',
|
|
|
+ name: '',
|
|
|
+ connectedDeviceId: '',
|
|
|
+ connected: true,
|
|
|
+ deviceInfo: null,
|
|
|
+ isInitOK: false,
|
|
|
+ customData: '',
|
|
|
+ percent: 0,
|
|
|
+ ruterStatus: 0, // 0 连接中 // 1 成功 // 2失败
|
|
|
+ imageUrl: "./../../img/g.png",
|
|
|
+ },
|
|
|
+
|
|
|
+ onLoad: function (options) {
|
|
|
+ var that = this;
|
|
|
+ var param = options.param;
|
|
|
+ if (!strings.isEmpty(param)) {
|
|
|
+ param = JSON.parse(param);
|
|
|
+ that.setData({
|
|
|
+ imageUrl: param.img,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // AIrSMArT_861210052356337===D0:31:10:86:AC:9A
|
|
|
+ var name = options.name;
|
|
|
+ var deviceId = options.deviceId;
|
|
|
+ that.setData({
|
|
|
+ name: name,
|
|
|
+ connectedDeviceId: deviceId,
|
|
|
+ });
|
|
|
+
|
|
|
+ var device = {
|
|
|
+ "deviceId": deviceId
|
|
|
+ };
|
|
|
+ console.log("gadsfasdfadfaf===000==" + JSON.stringify(device));
|
|
|
+ BleUtil.getInstance().startConnect(device, function (changed) {
|
|
|
+ console.log("gadsfasdfadfaf===111==" + changed);
|
|
|
+ });
|
|
|
+ },
|
|
|
+})
|