|
@@ -19,20 +19,20 @@ Page({
|
|
model: 0,
|
|
model: 0,
|
|
connectDevice: {},
|
|
connectDevice: {},
|
|
typeList: [{
|
|
typeList: [{
|
|
- "icon": "../../images/device/mode_2.png",
|
|
|
|
- "text": "WiFi模式",
|
|
|
|
- "type": 2,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- "icon": "../../images/device/mode_1.png",
|
|
|
|
- "text": "蓝牙模式",
|
|
|
|
- "type": 1,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- "icon": "../../images/device/mode_4.png",
|
|
|
|
- "text": "4G模式",
|
|
|
|
- "type": 4,
|
|
|
|
- },
|
|
|
|
|
|
+ "icon": "../../images/device/mode_2.png",
|
|
|
|
+ "text": "WiFi模式",
|
|
|
|
+ "type": 2,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "icon": "../../images/device/mode_1.png",
|
|
|
|
+ "text": "蓝牙模式",
|
|
|
|
+ "type": 1,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "icon": "../../images/device/mode_4.png",
|
|
|
|
+ "text": "4G模式",
|
|
|
|
+ "type": 4,
|
|
|
|
+ },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
|
|
|
|
@@ -103,16 +103,29 @@ Page({
|
|
},
|
|
},
|
|
|
|
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
- let json = JSON.parse(options.param)
|
|
|
|
|
|
+ let json = JSON.parse(options.param) || {}
|
|
console.log(json)
|
|
console.log(json)
|
|
let device = json
|
|
let device = json
|
|
|
|
+ if (Object.keys(device).length === 0) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '设备数据为空,返回刷新列表试试看',
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ var list = []
|
|
|
|
+ var typeList = device.typeList.map(element => {
|
|
|
|
+ return element.connectType;
|
|
|
|
+ });
|
|
|
|
+ this.data.typeList.forEach(element => {
|
|
|
|
+ if (typeList.find(type => type === element.type)) {
|
|
|
|
+ list.push(element)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
this.setData({
|
|
this.setData({
|
|
|
|
+ typeList: list,
|
|
connectDevice: device
|
|
connectDevice: device
|
|
})
|
|
})
|
|
|
|
|
|
- if (getApp().globalData.isIOS) {
|
|
|
|
-
|
|
|
|
- } else {}
|
|
|
|
},
|
|
},
|
|
|
|
|
|
})
|
|
})
|