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: { ppScale: {
version: "",
plugin: null, plugin: null,
activeProtocol: null, activeProtocol: null,
domain: "http://device.shuziweidao.com:80/gateway", domain1: "http://device.shuziweidao.com:80/gateway", // 老版本 没有鉴权
// domain: "http://192.168.1.12:8889", domain2: "http://device.shuziweidao.com:80/weight", // 新版本 有鉴权
wifi: { wifi: {
ssid: "", ssid: "",
password: "" password: ""
+2 -2
View File
@@ -32,8 +32,8 @@
"style": "v2", "style": "v2",
"plugins": { "plugins": {
"ppScale-plugin": { "ppScale-plugin": {
"version": "1.2.15", "version": "0.0.16",
"provider": "wx0ffb48417ce6345c" "provider": "wx0826af4e4908f524"
} }
}, },
"permission": { "permission": {
@@ -61,13 +61,34 @@ Component({
progress: 2 progress: 2
}) })
let version = app.globalData.ppScale.version;
if (version === 'domain1') {
app.globalData.ppScale.activeProtocol.dataConfigNetWork({ app.globalData.ppScale.activeProtocol.dataConfigNetWork({
domain: app.globalData.ppScale.domain, domain: app.globalData.ppScale.domain1,
ssid: this.data.selectWifi.ssid, ssid: this.data.selectWifi.ssid,
password: this.data.selectWifiPWD password: this.data.selectWifiPWD
}, (res) => { }, (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) { if(res === 23) {
app.globalData.ppScale.wifi.ssid = this.data.selectWifi.ssid; app.globalData.ppScale.wifi.ssid = this.data.selectWifi.ssid;
app.globalData.ppScale.wifi.password = this.data.selectWifiPWD; app.globalData.ppScale.wifi.password = this.data.selectWifiPWD;
@@ -151,7 +172,6 @@ Component({
}) })
}, 1500) }, 1500)
} }
})
} }
} }
}); });
@@ -32,13 +32,34 @@ Component({
setNerwork() { setNerwork() {
let ssid = this.properties.ssid; let ssid = this.properties.ssid;
let password = this.properties.password; let password = this.properties.password;
let version = app.globalData.ppScale.version;
if (version === 'domain1') {
app.globalData.ppScale.activeProtocol.dataConfigNetWork({ app.globalData.ppScale.activeProtocol.dataConfigNetWork({
domain: app.globalData.ppScale.domain, domain: app.globalData.ppScale.domain1,
ssid: ssid, ssid: this.data.selectWifi.ssid,
password: password password: this.data.selectWifiPWD
}, (res) => { }, (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) { if(res === 23) {
app.globalData.ppScale.wifi.ssid = ssid; app.globalData.ppScale.wifi.ssid = ssid;
app.globalData.ppScale.wifi.password = password; app.globalData.ppScale.wifi.password = password;
@@ -67,7 +88,6 @@ Component({
}); });
}, 1500) }, 1500)
} }
})
} }
} }
}); });
+5 -4
View File
@@ -13,9 +13,10 @@ Page({
}, },
onLoad() { onLoad() {
ppScale.plugin.bus.subscribe("devicesModel", (res) => { ppScale.plugin.bus.subscribe("deviceInfo", (res) => {
console.log("===》devicesModel", res); console.log("===》deviceInfo", res);
ppScale.device.mac = res.deviceMac; ppScale.device.mac = res.serialNumber;
});
ppScale.plugin.bus.subscribe("deviceConnect", (res) => { ppScale.plugin.bus.subscribe("deviceConnect", (res) => {
console.log('===》deviceConnect', res); console.log('===》deviceConnect', res);
@@ -83,6 +84,7 @@ Page({
} else { } else {
ppScale.device.name = this.data.device.name; ppScale.device.name = this.data.device.name;
ppScale.device.connection = this.data.device; ppScale.device.connection = this.data.device;
ppScale.version = this.data.device.name.includes("YX") ? "domain2" : "domain1";
if(this.data.progressNext) { if(this.data.progressNext) {
let scaleDeviceId = ppScale.device.mac.replace(/:/g, ''); let scaleDeviceId = ppScale.device.mac.replace(/:/g, '');
let params = { let params = {
@@ -117,7 +119,6 @@ Page({
}) })
}); });
}); });
});
}, },
// 选择了某个设备 // 选择了某个设备
+1 -2
View File
@@ -27,9 +27,8 @@ Page({
}, },
delDevice() { delDevice() {
let scaleDeviceId = this.data.deviceInfo.macAddress.replace(/:/g, '');
let params = { let params = {
equipmentCode: scaleDeviceId, equipmentCode: this.data.deviceInfo.equipmentCode,
}; };
$.ajax("weighingScale/del/device", params, "POST", true, "正在解绑设备...").then(res_ => { $.ajax("weighingScale/del/device", params, "POST", true, "正在解绑设备...").then(res_ => {
wx.showToast({ wx.showToast({
+1
View File
@@ -36,6 +36,7 @@ Page({
app.globalData.ppScale.device.name = this.data.device.name; app.globalData.ppScale.device.name = this.data.device.name;
app.globalData.ppScale.device.connection = this.data.device; app.globalData.ppScale.device.connection = this.data.device;
app.globalData.ppScale.version = this.data.device.name.includes("YX") ? "domain2" : "domain1";
wx.hideLoading(); wx.hideLoading();
this.selectComponent('#replaceNetwork1Component').getWiFiList(); this.selectComponent('#replaceNetwork1Component').getWiFiList();
+1 -1
View File
@@ -19,6 +19,6 @@
"checkInvalidKey": true, "checkInvalidKey": true,
"ignoreDevUnusedFiles": true "ignoreDevUnusedFiles": true
}, },
"libVersion": "3.8.6", "libVersion": "3.11.3",
"condition": {} "condition": {}
} }