第一版

This commit is contained in:
17792275749
2025-03-25 20:52:15 +08:00
commit 04d373b84e
88 changed files with 4539 additions and 0 deletions
@@ -0,0 +1,115 @@
const app = getApp();
Page({
data: {
userInfo: null,
subUser: {
i: 0,
data: []
},
ssid: ""
},
onLoad(options) {
this.setData({
userInfo: wx.getStorageSync("userInfo"),
ssid: app.globalData.ppScale.wifi.ssid
});
},
completeClick() {
let userInfo = this.data.userInfo;
// 设置主用户时userID为小程序的用户IDmemberID为空
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
userID: userInfo.id,
userName: userInfo.realname,
memberID: "",
age: this.getAge(userInfo.birthday), //
gender: userInfo.sex, //
height: userInfo.height, //
isAthleteMode: 0,
currentWeight: userInfo.weight, //
deviceHeaderIndex: 0,
targetWeight: "",
idealWeight: "",
recentData: [],
}, (res) => {
console.log("dataSyncUserInfo", res);
if(this.data.subUser.data && this.data.subUser.data.length) {
wx.showLoading({
title: "正在同步用户信息,请稍等...",
mask: true
});
setSubUser();
} else {
app.globalData.ppScale.plugin.Blue.stop();
wx.switchTab({
url: "/pages/home/home"
})
}
})
},
setSubUser() {
let userInfo = this.data.userInfo;
let i = this.data.subUser.i;
let subUser = this.data.subUser.data;
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
userID: userInfo.id,
userName: subUser[i].realname,
memberID: subUser[i].id,
age: this.getAge(subUser[i].birthday), //
gender: subUser[i].sex, //
height: subUser[i].height, //
isAthleteMode: 0,
currentWeight: subUser[i].weight, //
deviceHeaderIndex: 0,
targetWeight: "",
idealWeight: "",
recentData: [],
}, (res) => {
console.log("dataSyncSubUserInfo", res);
if(i < subUser.length) {
this.setData({
['subUser.i']: i + 1
})
setSubUser();
} else {
app.globalData.ppScale.plugin.Blue.stop();
wx.hideLoading();
wx.switchTab({
url: "/pages/home/home"
})
}
})
},
// 获取家庭成员列表
getSubUser() {
let params = {};
$.ajax("weighingScale/list/subUser", params, "GET", true, "正在获取成员列表...").then(res => {
this.setData({
['subUser.data']: res.result
})
})
},
// 根据生日获取年龄
getAge(birthDateString) {
const birthDate = new Date(birthDateString);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
const dayDiff = today.getDate() - birthDate.getDate();
// 如果当前月份小于出生月份,或者同月但当前日期小于出生日期,年龄需要减 1
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
return age;
}
})
@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "绑定成功",
"disableScroll": true
}
@@ -0,0 +1,21 @@
<view class="icon">
<view>
<image src="/images/setNetworkSuccessful/icon.png" />
</view>
<view>配网成功</view>
</view>
<view class="info">
<view>当前设备配置Wi-Fi</view>
<view>
<view>
<image src="/images/setNetworkSuccessful/wifi.png" />
</view>
<view>{{ssid}}</view>
<view>
<image src="/images/setNetworkSuccessful/success.png" />
</view>
</view>
</view>
<view class="btn" bind:tap="completeClick">完成</view>
@@ -0,0 +1,93 @@
page {
width: 100%;
padding: 200rpx 85rpx 0;
box-sizing: border-box;
background-color: #ffffff;
}
.icon {
width: 100%;
margin-bottom: 120rpx;
}
.icon>view:first-of-type {
width: 360rpx;
height: 295rpx;
margin: 0 auto 50rpx;
}
.icon>view:last-of-type {
color: #252535;
width: 100%;
height: 40rpx;
font-size: 40rpx;
font-weight: bold;
line-height: 40rpx;
text-align: center;
}
.info {
width: 100%;
margin-bottom: 380rpx;
}
.info>view:first-of-type {
color: #B6B6B6;
width: 100%;
height: 30rpx;
font-size: 30rpx;
line-height: 30rpx;
margin-bottom: 40rpx;
}
.info>view:last-of-type {
width: 100%;
height: 80rpx;
margin: 30rpx 0;
display: flex;
flex-wrap: nowrap;
align-items: center;
}
.info>view:last-of-type>view:nth-of-type(1) {
width: 80rpx;
height: 80rpx;
margin-right: 24rpx;
}
.info>view:last-of-type>view:nth-of-type(2) {
color: #252535;
flex: 1;
width: 0;
height: 80rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 80rpx;
}
.info>view:last-of-type>view:nth-of-type(3) {
width: 32rpx;
height: 32rpx;
}
.describe {
color: #B6B6B6;
width: 100%;
height: 26rpx;
font-size: 28rpx;
line-height: 28rpx;
text-align: center;
margin-bottom: 46rpx;
}
.btn {
color: #FFFFFF;
width: 100%;
height: 88rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 88rpx;
text-align: center;
border-radius: 44rpx;
background-color: #1385FA;
}