Files
bodyWeight/pages/deviceInfo/deviceInfo.js
T
2025-05-29 08:45:04 +08:00

40 lines
893 B
JavaScript

const app = getApp();
import $ from "../../utils/request";
Page({
data: {
deviceInfo: null,
},
onLoad(options) {
this.getDevice();
},
// 获取已经绑定的设备列表
getDevice() {
let params = {};
$.ajax("weighingScale/list/device", params, "GET", false).then((res) => {
this.setData({
deviceInfo: res.result[0]
})
})
},
delDevice() {
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);
});
}
})