|
@@ -108,62 +108,15 @@ Page({
|
|
|
if (options.data.progress == 100) {
|
|
|
clearTimeout(errTi);
|
|
|
clearInterval(percentIn);
|
|
|
- // 更新数据
|
|
|
- wx.getStorage({
|
|
|
- key: 'devicelist',
|
|
|
- success(res) {
|
|
|
- if (res.data) {
|
|
|
- let arr = JSON.parse(res.data);
|
|
|
- // 同一个设备
|
|
|
- const devicelist = arr.filter((v) => v.deviceId === _this.data.name);
|
|
|
- if (devicelist.length > 0) {
|
|
|
- arr = arr.filter((v) => v.deviceId !== _this.data.name);
|
|
|
- };
|
|
|
|
|
|
- // [{"deviceId":"BLUFI_7cdfa1fcbb24","name":"BLUFI_7cdfa1fcbb24","state":"online"}]
|
|
|
- arr.unshift({
|
|
|
- /// Wifi mqtt-连接
|
|
|
- connectType: 3,
|
|
|
- deviceId: _this.data.name,
|
|
|
- name: _this.data.name,
|
|
|
- state: "online",
|
|
|
- image: "./../../img/min.png",
|
|
|
- });
|
|
|
-
|
|
|
- getCurrentPages()[0].addConnectWifiDevice(arr);
|
|
|
- _this.setData({
|
|
|
- percent: 100,
|
|
|
- ruterStatus: 1
|
|
|
- });
|
|
|
- // wx.setStorage({
|
|
|
- // key: "devicelist",
|
|
|
- // data: JSON.stringify(arr),
|
|
|
- // success() {
|
|
|
- // _this.setData({
|
|
|
- // percent: 100,
|
|
|
- // ruterStatus: 1
|
|
|
- // });
|
|
|
- // }
|
|
|
- // })
|
|
|
- }
|
|
|
- },
|
|
|
- fail() {
|
|
|
- wx.setStorage({
|
|
|
- key: "devicelist",
|
|
|
- data: JSON.stringify([{
|
|
|
- name: _this.data.name,
|
|
|
- deviceId: _this.data.name,
|
|
|
- state: "online"
|
|
|
- }]),
|
|
|
- success() {
|
|
|
- _this.setData({
|
|
|
- percent: 100,
|
|
|
- ruterStatus: 1
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ // [{"deviceId":"BLUFI_7cdfa1fcbb24","name":"BLUFI_7cdfa1fcbb24","state":"online"}]
|
|
|
+ getCurrentPages()[0].addConnectWifiDevice({
|
|
|
+ deviceId: _this.data.name,
|
|
|
+ });
|
|
|
+ _this.setData({
|
|
|
+ percent: 100,
|
|
|
+ ruterStatus: 1
|
|
|
+ });
|
|
|
// 记住密码
|
|
|
wx.setStorage({
|
|
|
key: "wifiInfo",
|