feat(设备管理): 重构设备数据管理逻辑,统一使用deviceData对象

- 将分散的设备信息存储改为统一的deviceData对象
- 更新相关API请求参数传递方式
- 增加设备类型支持,动态构建API路径
- 修复设备信息初始化问题,确保数据一致性
This commit is contained in:
2025-06-25 12:43:31 +08:00
parent ea5ed7c9ce
commit fec4276cc8
7 changed files with 45 additions and 27 deletions

View File

@@ -101,7 +101,7 @@ Page({
load: function (e) {
console.log(e);
},
openLocation: function(e) {
openLocation: function (e) {
var latitude = Number(e.currentTarget.dataset.latitude);
var longitude = Number(e.currentTarget.dataset.longitude);
var name = e.currentTarget.dataset.name;
@@ -158,10 +158,12 @@ Page({
console.log(i), wx.showLoading({
title: ""
}), e.globalData.qrcode = i.result, t.request("/v2/miniprogram/identify/index", i, !0).then(function (t) {
console.log("data", t), wx.hideLoading(), e.globalData.devicecode = t.data.devicecode || e.globalData.devicecode,
a.setData({
isScan: !!t.data.devicecode
});
console.log("data", t), wx.hideLoading(),
e.globalData.deviceData = t.data || e.globalData.deviceData || {};
e.globalData.devicecode = t.data.devicecode || e.globalData.devicecode;
a.setData({
isScan: !!t.data.devicecode
});
}).catch(function (e) {
wx.hideLoading();
});
@@ -205,9 +207,7 @@ Page({
success: function (i) {
i.confirm && (a.isSubmit = !0, wx.showLoading({
title: "正在启动"
}), t.request('/v2/miniprogram/machine/startup', {
washcode: a.data.selectID
}, !0).then(function (e) {
}), t.request('/v2/miniprogram/' + e.globalData.deviceData.type + '/startup', e.globalData.deviceData || {}, !0).then(function (e) {
a.isSubmit = !1, wx.hideLoading(), 200 == e.code && (wx.showModal({
title: "",
content: e.message