|
@@ -25,6 +25,7 @@ import {
|
|
|
|
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
|
|
+ navBarHeight: app.globalData.navBarHeight,
|
|
nvabarData: {
|
|
nvabarData: {
|
|
showCapsule: 0, //是否显示左上角图标 1表示显示 0表示不显示
|
|
showCapsule: 0, //是否显示左上角图标 1表示显示 0表示不显示
|
|
title: 'OhPlay', //导航栏 中间的标题
|
|
title: 'OhPlay', //导航栏 中间的标题
|
|
@@ -72,6 +73,67 @@ Page({
|
|
deviceMacId: null,
|
|
deviceMacId: null,
|
|
deviceListSelect: null,
|
|
deviceListSelect: null,
|
|
deviceList: [],
|
|
deviceList: [],
|
|
|
|
+ // deviceList: [{
|
|
|
|
+ // "connectType": 3,
|
|
|
|
+ // "devName": "猫王小王子OTR-X",
|
|
|
|
+ // "state": "online",
|
|
|
|
+ // "name": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "mac": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "imageUrl": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100319641863705.png",
|
|
|
|
+ // "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
|
+ // "offlineImg": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100323674404211.png"
|
|
|
|
+ // }, {
|
|
|
|
+ // "connectType": 3,
|
|
|
|
+ // "devName": "猫王小王子OTR-X",
|
|
|
|
+ // "state": "online",
|
|
|
|
+ // "name": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "mac": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "imageUrl": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100319641863705.png",
|
|
|
|
+ // "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
|
+ // "offlineImg": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100323674404211.png"
|
|
|
|
+ // }, {
|
|
|
|
+ // "connectType": 3,
|
|
|
|
+ // "devName": "猫王小王子OTR-X",
|
|
|
|
+ // "state": "online",
|
|
|
|
+ // "name": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "mac": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "imageUrl": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100319641863705.png",
|
|
|
|
+ // "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
|
+ // "offlineImg": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100323674404211.png"
|
|
|
|
+ // }, {
|
|
|
|
+ // "connectType": 3,
|
|
|
|
+ // "devName": "猫王小王子OTR-X",
|
|
|
|
+ // "state": "online",
|
|
|
|
+ // "name": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "mac": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "imageUrl": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100319641863705.png",
|
|
|
|
+ // "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
|
+ // "offlineImg": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100323674404211.png"
|
|
|
|
+ // }, {
|
|
|
|
+ // "connectType": 3,
|
|
|
|
+ // "devName": "猫王小王子OTR-X",
|
|
|
|
+ // "state": "online",
|
|
|
|
+ // "name": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "mac": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "imageUrl": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100319641863705.png",
|
|
|
|
+ // "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
|
+ // "offlineImg": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100323674404211.png"
|
|
|
|
+ // }, {
|
|
|
|
+ // "connectType": 3,
|
|
|
|
+ // "devName": "猫王小王子OTR-X",
|
|
|
|
+ // "state": "online",
|
|
|
|
+ // "name": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "mac": "BLUFI_7cdfa1fcbb24",
|
|
|
|
+ // "imageUrl": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100319641863705.png",
|
|
|
|
+ // "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
|
+ // "offlineImg": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20230310100323674404211.png"
|
|
|
|
+ // }],
|
|
connectDeviceIding: "",
|
|
connectDeviceIding: "",
|
|
},
|
|
},
|
|
|
|
|
|
@@ -588,7 +650,6 @@ Page({
|
|
addWifiDevice(device) {
|
|
addWifiDevice(device) {
|
|
var that = this;
|
|
var that = this;
|
|
var isOK = app.globalData.client && app.globalData.client.connected;
|
|
var isOK = app.globalData.client && app.globalData.client.connected;
|
|
- console.log("gadsfqwerqwr==00==" + app.globalData.client);
|
|
|
|
if (!isOK) {
|
|
if (!isOK) {
|
|
app.connect();
|
|
app.connect();
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -597,12 +658,9 @@ Page({
|
|
return;
|
|
return;
|
|
};
|
|
};
|
|
|
|
|
|
- console.log("gadsfqwerqwr==11==" + isOK);
|
|
|
|
var deviceId = device.deviceId;
|
|
var deviceId = device.deviceId;
|
|
var addDeviceList = lexin_add.addWifiDevice(device);
|
|
var addDeviceList = lexin_add.addWifiDevice(device);
|
|
- console.log("gadsfqwerqwr==22==" + addDeviceList.length);
|
|
|
|
that.updateDeviceList(addDeviceList, false, false);
|
|
that.updateDeviceList(addDeviceList, false, false);
|
|
- console.log("gadsfqwerqwr==333==" + that.data.deviceList.length);
|
|
|
|
|
|
|
|
var indexPage = that.data.indexPage;
|
|
var indexPage = that.data.indexPage;
|
|
that.setData({
|
|
that.setData({
|
|
@@ -615,24 +673,13 @@ Page({
|
|
|
|
|
|
refreshCurrentDevice(device) {
|
|
refreshCurrentDevice(device) {
|
|
var that = this;
|
|
var that = this;
|
|
- var deviceList = that.getDeviceList();
|
|
|
|
- var selectIndex = null;
|
|
|
|
- for (var i = 0; i < deviceList.length; i++) {
|
|
|
|
- if (device.deviceId == deviceList[i].deviceId) {
|
|
|
|
- selectIndex = i;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (selectIndex != null) {
|
|
|
|
- var addDeviceList = lexin_add.addWifiDevice(device);
|
|
|
|
- that.updateDeviceList(addDeviceList, false, false);
|
|
|
|
- that.setData({
|
|
|
|
- autoConnected: true,
|
|
|
|
- deviceListSelect: selectIndex,
|
|
|
|
- connectDeviceIding: "",
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ var addDeviceList = lexin_add.addWifiDevice(device);
|
|
|
|
+ that.updateDeviceList(addDeviceList, false, false);
|
|
|
|
+ that.setData({
|
|
|
|
+ autoConnected: true,
|
|
|
|
+ deviceListSelect: 0,
|
|
|
|
+ connectDeviceIding: "",
|
|
|
|
+ });
|
|
},
|
|
},
|
|
|
|
|
|
/// 手机关闭蓝牙,所有蓝牙设备离线
|
|
/// 手机关闭蓝牙,所有蓝牙设备离线
|