流程改版
This commit is contained in:
@@ -3,67 +3,13 @@ import $ from "../../utils/request";
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// deviceConnect: false,
|
||||
|
||||
deviceInfo: null,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.getDevice();
|
||||
|
||||
// app.globalData.ppScale.plugin.bus.subscribe("deviceConnect", (res) => {
|
||||
// console.log('deviceInfo ===》deviceConnect', res);
|
||||
|
||||
// app.globalData.ppScale.plugin.ScaleAction.startDataProgress();
|
||||
// app.globalData.ppScale.activeProtocol = app.globalData.ppScale.plugin.ScaleAction.getActiveProtocol();
|
||||
|
||||
// app.globalData.ppScale.activeProtocol.codeUpdateMTU((res) => {
|
||||
// console.log("deviceInfo ===》codeUpdateMTU", res);
|
||||
|
||||
// this.setData({
|
||||
// deviceConnect: true
|
||||
// })
|
||||
// });
|
||||
// });
|
||||
},
|
||||
|
||||
// 初始化蓝牙
|
||||
// initBluetooth() {
|
||||
// wx.openBluetoothAdapter({
|
||||
// success: () => {
|
||||
// this.getDeviceSettingList();
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// if (err.errCode === 10001) {
|
||||
// wx.showModal({
|
||||
// title: "提示",
|
||||
// content: "请打开手机蓝牙",
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
// },
|
||||
|
||||
// getDeviceSettingList() {
|
||||
// let seviceList = [];
|
||||
// app.globalData.ppScale.device.setting.map(item => {
|
||||
// if(this.data.deviceInfo.type === item.deviceName) {
|
||||
// seviceList.push(item);
|
||||
// }
|
||||
// })
|
||||
// if(seviceList && seviceList.length) {
|
||||
// app.globalData.ppScale.plugin.Blue.setDeviceSetting(seviceList);
|
||||
// app.globalData.ppScale.plugin.Blue.start(seviceList[0].deviceName, false);
|
||||
// app.globalData.ppScale.plugin.bus.subscribe("devicesList", (res) => {
|
||||
// let fIndex = res.findIndex(item => item.deviceId === this.data.deviceInfo.deviceId);
|
||||
// if (fIndex > -1) {
|
||||
// app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
|
||||
// app.globalData.ppScale.plugin.Blue.createBLEConnection(res[fIndex]);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
|
||||
// 获取已经绑定的设备列表
|
||||
getDevice() {
|
||||
let params = {};
|
||||
@@ -71,42 +17,24 @@ Page({
|
||||
this.setData({
|
||||
deviceInfo: res.result[0]
|
||||
})
|
||||
// this.initBluetooth();
|
||||
})
|
||||
},
|
||||
|
||||
delDevice() {
|
||||
// if(this.data.deviceConnect) {
|
||||
// app.globalData.ppScale.activeProtocol.codeClearDeviceData("00", (res) => {
|
||||
// console.log("deviceInfo === codeClearDeviceData", res);
|
||||
|
||||
let scaleDeviceId = this.data.deviceInfo.macAddress.replace(/:/g, '');
|
||||
let params = {
|
||||
equipmentCode: scaleDeviceId,
|
||||
};
|
||||
$.ajax("weighingScale/del/device", params, "POST", true, "正在解绑设备...").then(res_ => {
|
||||
wx.showToast({
|
||||
icon: "none",
|
||||
title: res_.message,
|
||||
})
|
||||
setTimeout(() => {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}, 1500);
|
||||
});
|
||||
// })
|
||||
// } else {
|
||||
// wx.showToast({
|
||||
// icon: "none",
|
||||
// title: "删除失败,请靠近设备并点亮后再试"
|
||||
// })
|
||||
// app.globalData.ppScale.plugin.Blue.stop();
|
||||
// this.getDeviceSettingList();
|
||||
// }
|
||||
},
|
||||
|
||||
// onUnload() {
|
||||
// app.globalData.ppScale.plugin.Blue.stop();
|
||||
// }
|
||||
let scaleDeviceId = this.data.deviceInfo.macAddress.replace(/:/g, '');
|
||||
let params = {
|
||||
equipmentCode: scaleDeviceId,
|
||||
};
|
||||
$.ajax("weighingScale/del/device", params, "POST", true, "正在解绑设备...").then(res_ => {
|
||||
wx.showToast({
|
||||
icon: "none",
|
||||
title: res_.message,
|
||||
})
|
||||
setTimeout(() => {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -27,10 +27,6 @@
|
||||
<view>成员</view>
|
||||
<view>{{deviceInfo.subUserNum}}人</view>
|
||||
</view>
|
||||
<view>
|
||||
<view>MAC地址</view>
|
||||
<view>{{deviceInfo.macAddress}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn" bind:tap="delDevice">删除设备</view>
|
||||
|
||||
Reference in New Issue
Block a user