2025年12月3日14:14:55

This commit is contained in:
17792275749
2025-12-03 14:14:57 +08:00
parent 3070b2b821
commit efa959d6d3
8 changed files with 247 additions and 204 deletions
+4 -2
View File
@@ -10,10 +10,12 @@ App({
// 秤的所有信息
ppScale: {
version: "",
plugin: null,
activeProtocol: null,
domain: "http://device.shuziweidao.com:80/gateway",
// domain: "http://192.168.1.12:8889",
domain1: "http://device.shuziweidao.com:80/gateway", // 老版本 没有鉴权
domain2: "http://device.shuziweidao.com:80/weight", // 新版本 有鉴权
wifi: {
ssid: "",
password: ""
+2 -2
View File
@@ -32,8 +32,8 @@
"style": "v2",
"plugins": {
"ppScale-plugin": {
"version": "1.2.15",
"provider": "wx0ffb48417ce6345c"
"version": "0.0.16",
"provider": "wx0826af4e4908f524"
}
},
"permission": {
@@ -61,13 +61,34 @@ Component({
progress: 2
})
let version = app.globalData.ppScale.version;
if (version === 'domain1') {
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
domain: app.globalData.ppScale.domain,
domain: app.globalData.ppScale.domain1,
ssid: this.data.selectWifi.ssid,
password: this.data.selectWifiPWD
}, (res) => {
console.log("setNetwork.js dataConfigNetWork", res);
console.log("setNetwork.js dataConfigNetWork 1", res);
this.netWorkCallBack(res);
})
}
if (version === 'domain2') {
app.globalData.ppScale.activeProtocol.dataConfigUserNetWork({
domain: app.globalData.ppScale.domain2,
ssid: this.data.selectWifi.ssid,
password: this.data.selectWifiPWD,
userName: "apiUser",
userPassword: "3acebb95eb49577e9c2a2082589b9bd6",
}, (res) => {
console.log("setNetwork.js dataConfigUserNetWork 2", res);
this.netWorkCallBack(res);
})
}
},
netWorkCallBack(res) {
if(res === 23) {
app.globalData.ppScale.wifi.ssid = this.data.selectWifi.ssid;
app.globalData.ppScale.wifi.password = this.data.selectWifiPWD;
@@ -151,7 +172,6 @@ Component({
})
}, 1500)
}
})
}
}
});
@@ -32,13 +32,34 @@ Component({
setNerwork() {
let ssid = this.properties.ssid;
let password = this.properties.password;
let version = app.globalData.ppScale.version;
if (version === 'domain1') {
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
domain: app.globalData.ppScale.domain,
ssid: ssid,
password: password
domain: app.globalData.ppScale.domain1,
ssid: this.data.selectWifi.ssid,
password: this.data.selectWifiPWD
}, (res) => {
console.log("setNetwork.js dataConfigNetWork", res);
console.log("setNetwork.js dataConfigNetWork 1", res);
this.netWorkCallBack(res);
})
}
if (version === 'domain2') {
app.globalData.ppScale.activeProtocol.dataConfigUserNetWork({
domain: app.globalData.ppScale.domain2,
ssid: ssid,
password: password,
userName: "apiUser",
userPassword: "3acebb95eb49577e9c2a2082589b9bd6"
}, (res) => {
console.log("setNetwork.js dataConfigUserNetWork 2", res);
this.netWorkCallBack(res);
})
}
},
netWorkCallBack(res) {
if(res === 23) {
app.globalData.ppScale.wifi.ssid = ssid;
app.globalData.ppScale.wifi.password = password;
@@ -67,7 +88,6 @@ Component({
});
}, 1500)
}
})
}
}
});
+5 -4
View File
@@ -13,9 +13,10 @@ Page({
},
onLoad() {
ppScale.plugin.bus.subscribe("devicesModel", (res) => {
console.log("===》devicesModel", res);
ppScale.device.mac = res.deviceMac;
ppScale.plugin.bus.subscribe("deviceInfo", (res) => {
console.log("===》deviceInfo", res);
ppScale.device.mac = res.serialNumber;
});
ppScale.plugin.bus.subscribe("deviceConnect", (res) => {
console.log('===》deviceConnect', res);
@@ -83,6 +84,7 @@ Page({
} else {
ppScale.device.name = this.data.device.name;
ppScale.device.connection = this.data.device;
ppScale.version = this.data.device.name.includes("YX") ? "domain2" : "domain1";
if(this.data.progressNext) {
let scaleDeviceId = ppScale.device.mac.replace(/:/g, '');
let params = {
@@ -117,7 +119,6 @@ Page({
})
});
});
});
},
// 选择了某个设备
+1 -2
View File
@@ -27,9 +27,8 @@ Page({
},
delDevice() {
let scaleDeviceId = this.data.deviceInfo.macAddress.replace(/:/g, '');
let params = {
equipmentCode: scaleDeviceId,
equipmentCode: this.data.deviceInfo.equipmentCode,
};
$.ajax("weighingScale/del/device", params, "POST", true, "正在解绑设备...").then(res_ => {
wx.showToast({
+1
View File
@@ -36,6 +36,7 @@ Page({
app.globalData.ppScale.device.name = this.data.device.name;
app.globalData.ppScale.device.connection = this.data.device;
app.globalData.ppScale.version = this.data.device.name.includes("YX") ? "domain2" : "domain1";
wx.hideLoading();
this.selectComponent('#replaceNetwork1Component').getWiFiList();
+1 -1
View File
@@ -19,6 +19,6 @@
"checkInvalidKey": true,
"ignoreDevUnusedFiles": true
},
"libVersion": "3.8.6",
"libVersion": "3.11.3",
"condition": {}
}