第一版

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
+112
View File
@@ -0,0 +1,112 @@
import $ from "../../utils/request";
Page({
data: {
userInfo: null,
deviceInfo: null
},
onShow() {
let token = wx.getStorageSync("token") || null;
let userInfo = wx.getStorageSync("userInfo") || null;
this.setData({
userInfo: userInfo
})
if(token && userInfo) {
this.getDevice();
}
},
// 打开用户信息
openUserInfo() {
if(this.data.userInfo) {
wx.navigateTo({
url: "/pages/userInfo/userInfo?initBluetooth=1&customerType=1"
})
} else {
wx.showToast({
icon: "none",
title: "请先登录"
})
}
},
// 打开设备详情
openDeviceInfo() {
if(this.data.userInfo) {
let deviceInfo = this.data.deviceInfo;
if(deviceInfo) {
wx.navigateTo({
url: "/pages/deviceInfo/deviceInfo"
})
} else {
wx.showModal({
title: "提示",
content: "当前暂未绑定设备,需要绑定吗?",
confirmText: "去绑定",
success: (res) => {
if (res.confirm) {
wx.navigateTo({
url: "/pages/searchDevice/searchDevice"
})
}
}
})
}
} else {
wx.showToast({
icon: "none",
title: "请先登录"
})
}
},
// 打开成员管理
openFamilyMembers() {
if(this.data.userInfo) {
wx.navigateTo({
url: "/pages/familyMembers/familyMembers"
})
} else {
wx.showToast({
icon: "none",
title: "请先登录"
})
}
},
// 获取已经绑定的设备列表
getDevice() {
let params = {};
$.ajax("weighingScale/list/device", params, "GET", false).then((res) => {
this.setData({
deviceInfo: res.result && res.result.length ? res.result[0] : null
})
})
},
// 退出登录
exitLogin() {
wx.showModal({
title: "提示",
content: "你确定要退出登录吗?",
success: (res) => {
if (res.confirm) {
$.ajax("weighingScale/logout", {}, "POST", true, "正在退出登录...").then(res => {
wx.showToast({
icon: "none",
title: res.message
})
setTimeout(() => {
wx.clearStorageSync();
wx.switchTab({
url: "/pages/home/home"
})
}, 1500)
})
}
}
})
}
})
+5
View File
@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationStyle": "custom",
"disableScroll": true
}
+59
View File
@@ -0,0 +1,59 @@
<view class="userInfo">
<view class="user arrowAfter" bind:tap="openUserInfo">
<view>
<image src="/images/my/user.png" />
</view>
<view>{{userInfo && userInfo.realname ? userInfo.realname : '未登录'}}</view>
</view>
<view class="info">
<view>
<view>身高(cm)</view>
<view>{{userInfo && userInfo.height ? userInfo.height : '--'}}</view>
</view>
<view></view>
<view>
<view>体重(kg)</view>
<view>{{userInfo && userInfo.weight ? userInfo.weight : '--'}}</view>
</view>
<view></view>
<view>
<view>BMI</view>
<view>{{userInfo && userInfo.bmi ? userInfo.bmi : '--'}}</view>
</view>
</view>
</view>
<view class="content">
<view class="service">
<view class="title">我的服务</view>
<view class="list arrowAfter" bind:tap="openDeviceInfo">
<view>
<image src="/images/my/1.png" />
</view>
<view>设备绑定</view>
<view>{{deviceInfo ? '已绑定('+ deviceInfo.equipmentName +')' : '未绑定'}}</view>
</view>
<view class="list arrowAfter" bind:tap="openFamilyMembers">
<view>
<image src="/images/my/2.png" />
</view>
<view>成员管理</view>
<view></view>
</view>
</view>
<view class="agreement">
<view class="list arrowAfter">
<view>
<image src="/images/my/3.png" />
</view>
<view>隐私协议</view>
<view></view>
</view>
</view>
</view>
<block wx:if="{{userInfo}}">
<view class="btn">
<view bind:tap="exitLogin">退出登录</view>
</view>
</block>
+165
View File
@@ -0,0 +1,165 @@
.userInfo {
width: 100%;
height: 488rpx;
margin-bottom: 24rpx;
box-sizing: border-box;
padding: 185rpx 40rpx 0;
background: linear-gradient(#F3F9FD 0%, #FFFFFF 100%);
}
.user {
width: 100%;
height: 136rpx;
display: flex;
flex-wrap: nowrap;
margin-bottom: 46rpx;
}
.user>view:first-of-type {
width: 126rpx;
height: 126rpx;
margin-right: 24rpx;
border-radius: 50%;
border: 5rpx solid #FFFFFF;
}
.user>view:last-of-type {
color: #252536;
flex: 1;
height: 136rpx;
font-size: 40rpx;
font-weight: bold;
line-height: 136rpx;
}
.info {
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
}
.info>view:nth-of-type(1),
.info>view:nth-of-type(3),
.info>view:nth-of-type(5) {
flex: 1;
}
.info>view:nth-of-type(2n) {
width: 2rpx;
height: 52rpx;
background-color: #EAECF1;
}
.info>view>view:first-of-type {
color: #394356;
width: 100%;
height: 28rpx;
font-size: 28rpx;
line-height: 28rpx;
text-align: center;
margin-bottom: 18rpx;
}
.info>view>view:last-of-type {
color: #394356;
width: 100%;
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
line-height: 36rpx;
text-align: center;
}
.content {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
margin-bottom: 360rpx;
}
.content .arrowAfter::after {
right: 36rpx;
}
.service {
width: 100%;
margin-bottom: 24rpx;
border-radius: 16rpx;
background-color: #FFFFFF;
}
.title {
color: #394356;
width: 100%;
height: 96rpx;
line-height: 96rpx;
padding: 0 30rpx;
font-size: 30rpx;
font-weight: bold;
box-sizing: border-box;
border-bottom: 1rpx solid #EAECF1;
}
.list {
width: 100%;
height: 96rpx;
padding: 0 30rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
box-sizing: border-box;
border-bottom: 1rpx solid #EAECF1;
}
.list:last-of-type {
border-bottom: none;
}
.list>view:nth-of-type(1) {
width: 56rpx;
height: 56rpx;
margin-right: 30rpx;
}
.list>view:nth-of-type(2) {
flex: 1;
color: #394356;
height: 96rpx;
line-height: 96rpx;
font-size: 32rpx;
font-weight: bold;
}
.list>view:nth-of-type(3) {
color: #77849E;
height: 96rpx;
font-size: 28rpx;
line-height: 96rpx;
padding-right: 34rpx;
}
.agreement {
width: 100%;
border-radius: 16rpx;
background-color: #FFFFFF;
}
.btn {
width: 100%;
padding: 0 85rpx;
box-sizing: border-box;
}
.btn>view {
color: #1385FA;
width: 580rpx;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
border-radius: 44rpx;
text-align: center;
background-color: #F5F7FB;
border: 1rpx solid #1385FA;
}