|
@@ -457,17 +457,36 @@ Page({
|
|
|
}
|
|
|
|
|
|
var deviceList = that.getDeviceList();
|
|
|
- var deviceId = deviceList[index].deviceId;
|
|
|
+ var deviceListSelect = that.getDeviceListSelect();
|
|
|
+ if (deviceListSelect === null || deviceList.length <= deviceListSelect) {
|
|
|
+ return;
|
|
|
+ };
|
|
|
+
|
|
|
+ ///是否删除的当前播放这个
|
|
|
+ var isCurrentIndex = false;
|
|
|
+ var deviceListSelect = that.getDeviceListSelect();
|
|
|
+ if (deviceListSelect != null && deviceList.length > deviceListSelect) {
|
|
|
+ isCurrentIndex = (deviceListSelect == index);
|
|
|
+ };
|
|
|
+
|
|
|
///删除当前设备
|
|
|
+ var deviceId = deviceList[index].deviceId;
|
|
|
deviceList = deviceList.filter((item, i) => {
|
|
|
return deviceId !== item.deviceId;
|
|
|
});
|
|
|
|
|
|
store.setStore("deviceList", deviceList);
|
|
|
- that.setData({
|
|
|
- deviceListSelect: null,
|
|
|
- deviceList: deviceList,
|
|
|
- });
|
|
|
+ if (isCurrentIndex) {
|
|
|
+ that.setData({
|
|
|
+ deviceListSelect: null,
|
|
|
+ deviceList: deviceList,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ deviceList: deviceList,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/// 断开连接wifi
|
|
@@ -486,17 +505,30 @@ Page({
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ ///是否删除的当前播放这个
|
|
|
+ var isCurrentIndex = false;
|
|
|
+ var deviceListSelect = that.getDeviceListSelect();
|
|
|
+ if (deviceListSelect != null && deviceList.length > deviceListSelect) {
|
|
|
+ isCurrentIndex = (deviceListSelect == index);
|
|
|
+ };
|
|
|
+
|
|
|
deviceList = deviceList.filter((item, i) => {
|
|
|
return deviceId !== item.deviceId;
|
|
|
});
|
|
|
|
|
|
store.setStore("deviceList", deviceList);
|
|
|
- that.setData({
|
|
|
- deviceList: deviceList,
|
|
|
- deviceMacId: null,
|
|
|
- actionIndex: null,
|
|
|
- deviceListSelect: null,
|
|
|
- });
|
|
|
+ if (isCurrentIndex) {
|
|
|
+ that.setData({
|
|
|
+ deviceList: deviceList,
|
|
|
+ deviceMacId: null,
|
|
|
+ actionIndex: null,
|
|
|
+ deviceListSelect: null,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ deviceList: deviceList,
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/// 新添加蓝牙设备
|
|
@@ -526,7 +558,6 @@ Page({
|
|
|
var deviceId = device.deviceId;
|
|
|
var addDeviceList = lexin_add.addWifiDevice(device);
|
|
|
that.updateDeviceList(addDeviceList, false, false);
|
|
|
-
|
|
|
that.setData({
|
|
|
deviceListSelect: null,
|
|
|
connectDeviceIding: deviceId,
|