2025年4月2日17:58:50
This commit is contained in:
@@ -5,13 +5,15 @@ App({
|
|||||||
|
|
||||||
globalData: {
|
globalData: {
|
||||||
// wx.request 请求的服务地址
|
// wx.request 请求的服务地址
|
||||||
wxRequestUrl: "https://device.shuziweidao.com/gateway/",
|
// wxRequestUrl: "https://device.shuziweidao.com/gateway/",
|
||||||
|
wxRequestUrl: "http://192.168.10.173:8889/",
|
||||||
|
|
||||||
// 秤的所有信息
|
// 秤的所有信息
|
||||||
ppScale: {
|
ppScale: {
|
||||||
plugin: null,
|
plugin: null,
|
||||||
activeProtocol: null,
|
activeProtocol: null,
|
||||||
domain: "https://device.shuziweidao.com/gateway", // http://192.168.10.173:8889
|
// domain: "https://device.shuziweidao.com/gateway",
|
||||||
|
domain: "http://192.168.10.173:8889",
|
||||||
wifi: {
|
wifi: {
|
||||||
ssid: "",
|
ssid: "",
|
||||||
password: ""
|
password: ""
|
||||||
|
|||||||
@@ -8,13 +8,6 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let name = app.globalData.ppScale.device.name;
|
|
||||||
let deviceSelect = app.globalData.ppScale.device.connection;
|
|
||||||
this.setData({
|
|
||||||
name: name ? name : deviceSelect.name,
|
|
||||||
deviceSelect: deviceSelect
|
|
||||||
})
|
|
||||||
|
|
||||||
app.globalData.ppScale.plugin.bus.subscribe("deviceConnect", (res) => {
|
app.globalData.ppScale.plugin.bus.subscribe("deviceConnect", (res) => {
|
||||||
console.log('connectedDevice ===》deviceConnect', res);
|
console.log('connectedDevice ===》deviceConnect', res);
|
||||||
|
|
||||||
@@ -65,7 +58,7 @@ Page({
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
app.globalData.ppScale.device.name = this.data.name;
|
app.globalData.ppScale.device.name = this.data.name;
|
||||||
wx.navigateTo({
|
wx.redirectTo({
|
||||||
url: "/pages/connectionSuccessful/connectionSuccessful"
|
url: "/pages/connectionSuccessful/connectionSuccessful"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -74,6 +67,14 @@ Page({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
let deviceSelect = app.globalData.ppScale.device.connection;
|
||||||
|
this.setData({
|
||||||
|
name: deviceSelect.name,
|
||||||
|
deviceSelect: deviceSelect
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
nameInput(e) {
|
nameInput(e) {
|
||||||
this.setData({
|
this.setData({
|
||||||
name: e.detail.value
|
name: e.detail.value
|
||||||
@@ -90,6 +91,7 @@ Page({
|
|||||||
title: "蓝牙配对中...",
|
title: "蓝牙配对中...",
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
|
app.globalData.ppScale.device.name = name;
|
||||||
app.globalData.ppScale.plugin.Blue.createBLEConnection(deviceSelect);
|
app.globalData.ppScale.plugin.Blue.createBLEConnection(deviceSelect);
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const app = getApp();
|
|||||||
Page({
|
Page({
|
||||||
// 获取wifi列表
|
// 获取wifi列表
|
||||||
openGetWifiList() {
|
openGetWifiList() {
|
||||||
wx.navigateTo({
|
wx.redirectTo({
|
||||||
url: "/pages/getWifiList/getWifiList"
|
url: "/pages/getWifiList/getWifiList"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,13 +120,13 @@ Page({
|
|||||||
"deviceAccuracyType": 2,
|
"deviceAccuracyType": 2,
|
||||||
"deviceCalcuteType": 3,
|
"deviceCalcuteType": 3,
|
||||||
"deviceConnectType": 2,
|
"deviceConnectType": 2,
|
||||||
"deviceFuncType": 32991,
|
"deviceFuncType": 223,
|
||||||
"deviceName": "CF568_G",
|
"deviceName": "CF568_G",
|
||||||
"devicePowerType": 3,
|
"devicePowerType": 3,
|
||||||
"deviceProtocolType": 3,
|
"deviceProtocolType": 3,
|
||||||
"deviceType": 1,
|
"deviceType": 1,
|
||||||
"deviceUnitType": "0,1,11",
|
"deviceUnitType": "0,1,11",
|
||||||
"id": 7,
|
"id": 65,
|
||||||
"imgUrl": null,
|
"imgUrl": null,
|
||||||
"macAddressStart": 6,
|
"macAddressStart": 6,
|
||||||
"remark": null,
|
"remark": null,
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ Page({
|
|||||||
title: "正在同步用户信息,请稍等...",
|
title: "正在同步用户信息,请稍等...",
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
setSubUser();
|
this.setSubUser();
|
||||||
} else {
|
} else {
|
||||||
|
this.resetDevice();
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
app.globalData.ppScale.plugin.Blue.stop();
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
url: "/pages/home/home"
|
url: "/pages/home/home"
|
||||||
@@ -75,8 +76,9 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
['subUser.i']: i + 1
|
['subUser.i']: i + 1
|
||||||
})
|
})
|
||||||
setSubUser();
|
this.setSubUser();
|
||||||
} else {
|
} else {
|
||||||
|
this.resetDevice();
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
app.globalData.ppScale.plugin.Blue.stop();
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
@@ -86,6 +88,16 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetDevice() {
|
||||||
|
app.globalData.ppScale.device = {
|
||||||
|
setting: [],
|
||||||
|
list: [],
|
||||||
|
mac: null,
|
||||||
|
name: "",
|
||||||
|
connection: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 获取家庭成员列表
|
// 获取家庭成员列表
|
||||||
getSubUser() {
|
getSubUser() {
|
||||||
let params = {};
|
let params = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user