同步用户信息调好了
This commit is contained in:
@@ -12,7 +12,7 @@ App({
|
|||||||
ppScale: {
|
ppScale: {
|
||||||
plugin: null,
|
plugin: null,
|
||||||
activeProtocol: null,
|
activeProtocol: null,
|
||||||
// domain: "https://device.shuziweidao.com/gateway",
|
// domain: "http://device.shuziweidao.com/gateway",
|
||||||
domain: "http://192.168.10.173:8889",
|
domain: "http://192.168.10.173:8889",
|
||||||
wifi: {
|
wifi: {
|
||||||
ssid: "",
|
ssid: "",
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
"style": "v2",
|
"style": "v2",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"ppScale-plugin": {
|
"ppScale-plugin": {
|
||||||
"version": "0.0.11",
|
"version": "1.2.15",
|
||||||
"provider": "wx0826af4e4908f524"
|
"provider": "wx0ffb48417ce6345c"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sitemapLocation": "sitemap.json",
|
"sitemapLocation": "sitemap.json",
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="btn">
|
<view class="btn" bind:tap="openUserInfo">
|
||||||
<view>
|
<view>
|
||||||
<image src="/images/familyMembers/add.png" />
|
<image src="/images/familyMembers/add.png" />
|
||||||
</view>
|
</view>
|
||||||
<view bind:tap="openUserInfo">添加新成员</view>
|
<view>添加新成员</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -10,41 +10,53 @@ Page({
|
|||||||
ssid: options.ssid,
|
ssid: options.ssid,
|
||||||
password: options.password
|
password: options.password
|
||||||
}, (res) => {
|
}, (res) => {
|
||||||
app.globalData.ppScale.wifi.ssid = ssid;
|
if(res === 23) {
|
||||||
app.globalData.ppScale.wifi.password = password;
|
app.globalData.ppScale.wifi.ssid = ssid;
|
||||||
|
app.globalData.ppScale.wifi.password = password;
|
||||||
|
|
||||||
let mac = app.globalData.ppScale.device.mac;
|
let mac = app.globalData.ppScale.device.mac;
|
||||||
let deviceId = app.globalData.ppScale.device.connection.deviceId;
|
let deviceId = app.globalData.ppScale.device.connection.deviceId;
|
||||||
if(mac && deviceId) {
|
if(mac && deviceId) {
|
||||||
let scaleDeviceId = mac.replace(/:/g, '');
|
let scaleDeviceId = mac.replace(/:/g, '');
|
||||||
let params = {
|
let params = {
|
||||||
equipmentName: app.globalData.ppScale.device.name,
|
equipmentName: app.globalData.ppScale.device.name,
|
||||||
scaleDeviceId: scaleDeviceId,
|
scaleDeviceId: scaleDeviceId,
|
||||||
deviceId: deviceId
|
deviceId: deviceId
|
||||||
};
|
};
|
||||||
$.ajax("weighingScale/binding/device", params, "POST").then(res => {
|
$.ajax("weighingScale/binding/device", params, "POST").then(res => {
|
||||||
app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
|
app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
|
||||||
console.log("setNetwork.js codeSetBindingState", res);
|
console.log("setNetwork.js codeSetBindingState", res);
|
||||||
|
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: "/pages/setNetworkSuccessful/setNetworkSuccessful"
|
url: "/pages/setNetworkSuccessful/setNetworkSuccessful"
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
wx.showToast({
|
||||||
|
icon: "none",
|
||||||
|
title: err.message
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.switchTab({
|
||||||
|
url: "/pages/home/home"
|
||||||
|
})
|
||||||
|
}, 1500)
|
||||||
})
|
})
|
||||||
}).catch(err => {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
icon: "none",
|
icon: "none",
|
||||||
title: err.message
|
title: "Mac 地址与 deviceId 获取失败,请重新绑定"
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
url: "/pages/home/home"
|
url: "/pages/home/home"
|
||||||
})
|
})
|
||||||
}, 1500)
|
}, 1500)
|
||||||
})
|
}
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
icon: "none",
|
icon: "none",
|
||||||
title: "Mac 地址与 deviceId 获取失败,请重新绑定"
|
title: "配网失败,错误码:" + res
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const app = getApp();
|
const app = getApp();
|
||||||
|
import $ from "../../utils/request";
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
@@ -58,35 +59,35 @@ Page({
|
|||||||
let userInfo = this.data.userInfo;
|
let userInfo = this.data.userInfo;
|
||||||
let i = this.data.subUser.i;
|
let i = this.data.subUser.i;
|
||||||
let subUser = this.data.subUser.data;
|
let subUser = this.data.subUser.data;
|
||||||
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
|
if(i < subUser.length) {
|
||||||
userID: userInfo.id,
|
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
|
||||||
userName: subUser[i].realname,
|
userID: userInfo.id,
|
||||||
memberID: subUser[i].id,
|
userName: subUser[i].realname,
|
||||||
age: this.getAge(subUser[i].birthday), //
|
memberID: subUser[i].id,
|
||||||
gender: subUser[i].sex, //
|
age: this.getAge(subUser[i].birthday), //
|
||||||
height: subUser[i].height, //
|
gender: subUser[i].sex, //
|
||||||
isAthleteMode: 0,
|
height: subUser[i].height, //
|
||||||
currentWeight: subUser[i].weight, //
|
isAthleteMode: 0,
|
||||||
deviceHeaderIndex: 0,
|
currentWeight: subUser[i].weight, //
|
||||||
targetWeight: "",
|
deviceHeaderIndex: 0,
|
||||||
idealWeight: "",
|
targetWeight: "",
|
||||||
recentData: [],
|
idealWeight: "",
|
||||||
}, (res) => {
|
recentData: [],
|
||||||
console.log("dataSyncSubUserInfo", res);
|
}, (res) => {
|
||||||
if(i < subUser.length) {
|
console.log("dataSyncSubUserInfo", res);
|
||||||
this.setData({
|
this.setData({
|
||||||
['subUser.i']: i + 1
|
['subUser.i']: i + 1
|
||||||
})
|
})
|
||||||
this.setSubUser();
|
this.setSubUser();
|
||||||
} else {
|
})
|
||||||
this.resetDevice();
|
} else {
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
this.resetDevice();
|
||||||
wx.hideLoading();
|
app.globalData.ppScale.plugin.Blue.stop();
|
||||||
wx.switchTab({
|
wx.hideLoading();
|
||||||
url: "/pages/home/home"
|
wx.switchTab({
|
||||||
})
|
url: "/pages/home/home"
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetDevice() {
|
resetDevice() {
|
||||||
|
|||||||
Reference in New Issue
Block a user