3 Commits
Author SHA1 Message Date
17792275749 2ecd70765e v2 2025-06-06 18:58:18 +08:00
17792275749 4b0e0eabb2 处理了仁康的 appiD 和图片 2025-06-06 18:31:22 +08:00
17792275749 46266223f1 修改了颜色和图片的颜色 2025-06-05 17:56:50 +08:00
256 changed files with 5940 additions and 34717 deletions
+31
View File
@@ -0,0 +1,31 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}
-31
View File
@@ -1,31 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# 环境变量文件(含敏感配置,禁止提交)
# .env
# .env.*
.mcp.json
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.claude
.turbo
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
-10
View File
@@ -1,10 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 已忽略包含查询文件的默认文件夹
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ClaudeCodeTabState">
<option name="tabCount" value="4" />
</component>
</project>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KubernetesApiPersistence">{}</component>
<component name="KubernetesApiProvider">{
&quot;isMigrated&quot;: true
}</component>
</project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/bodyWeight.iml" filepath="$PROJECT_DIR$/.idea/bodyWeight.iml" />
</modules>
</component>
</project>
Generated
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+1138
View File
File diff suppressed because it is too large Load Diff
+238
View File
@@ -0,0 +1,238 @@
App({
onLaunch() {
this.initPpScale();
},
globalData: {
// wx.request 请求的服务地址
wxRequestUrl: "https://device.shuziweidao.com/gateway/",
// wxRequestUrl: "http://192.168.1.12:8889/",
// 秤的所有信息
ppScale: {
plugin: null,
activeProtocol: null,
domain: "http://device.shuziweidao.com:80/gateway",
// domain: "http://192.168.1.12:8889",
wifi: {
ssid: "",
password: ""
},
options: {
key: "lefudc91611833e18d94",
secret: "eQ50JYimMp0X7uhNLj6D3lTEk4TUUvEG7dvaqKM9t1U="
},
device: {
setting: [{
"advLength": 999,
"calorieStatus": 0,
"createBy": null,
"deviceAccuracyType": 2,
"deviceCalcuteType": 3,
"deviceConnectType": 2,
"deviceFuncType": 223,
"deviceName": "CF568_G",
"devicePowerType": 3,
"deviceProtocolType": 3,
"deviceType": 1,
"deviceUnitType": "0,1,11",
"id": 65,
"imgUrl": null,
"macAddressStart": 6,
"remark": null,
"sign": "FF",
"status": 0,
"uhStatus": 1,
"updateBy": null
}, {
"advLength": 999,
"calorieStatus": 0,
"createBy": null,
"deviceAccuracyType": 2,
"deviceCalcuteType": 3,
"deviceConnectType": 2,
"deviceFuncType": 223,
"deviceName": "YX-B4-568-BW",
"devicePowerType": 3,
"deviceProtocolType": 3,
"deviceType": 1,
"deviceUnitType": "0,1,11",
"id": 65,
"imgUrl": null,
"macAddressStart": 6,
"remark": null,
"sign": "FF",
"status": 0,
"uhStatus": 1,
"updateBy": null
}, {
"advLength": 999,
"calorieStatus": 0,
"createBy": null,
"deviceAccuracyType": 2,
"deviceCalcuteType": 4,
"deviceConnectType": 2,
"deviceFuncType": 65759,
"deviceName": "CF636_G",
"devicePowerType": 3,
"deviceProtocolType": 3,
"deviceType": 1,
"deviceUnitType": "0,1,2",
"id": 216,
"imgUrl": null,
"macAddressStart": 6,
"remark": null,
"sign": "FF",
"status": 0,
"uhStatus": 1,
"updateBy": null
}, {
"advLength": 999,
"calorieStatus": 0,
"createBy": null,
"deviceAccuracyType": 2,
"deviceCalcuteType": 4,
"deviceConnectType": 2,
"deviceFuncType": 65759,
"deviceName": "YX-B8-636-BW",
"devicePowerType": 3,
"deviceProtocolType": 3,
"deviceType": 1,
"deviceUnitType": "0,1,2",
"id": 216,
"imgUrl": null,
"macAddressStart": 6,
"remark": null,
"sign": "FF",
"status": 0,
"uhStatus": 1,
"updateBy": null
}, {
"advLength": 999,
"calorieStatus": 0,
"createBy": null,
"deviceAccuracyType": 2,
"deviceCalcuteType": 4,
"deviceConnectType": 2,
"deviceFuncType": 223,
"deviceName": "CF577",
"devicePowerType": 3,
"deviceProtocolType": 3,
"deviceType": 1,
"deviceUnitType": "0,1,11",
"id": 51,
"imgUrl": null,
"macAddressStart": 6,
"remark": null,
"sign": "FF",
"status": 0,
"uhStatus": 1,
"updateBy": null
}], // 即将要搜索周边秤的配置
list: [], // 根据配置搜索到秤的列表
name: "",
mac: null, // 选中的设备mac地址/SN码
connection: null, // 默认选中连接的设备
connectState: null, // 当前连接设备的状态
}
},
_callbacks: {} // 用于存储所有 globalData 属性的监听回调
},
initPpScale() {
this.globalData.ppScale.plugin = requirePlugin('ppScale-plugin');
// 蓝牙连接状态监听
this.globalData.ppScale.plugin.bus.subscribe("connectState", (res) => {
console.log("app.js ===> connectState", res);
this.setGlobalData('ppScale.device.connectState', res);
// 连接失败则重新连接
if (res == this.globalData.ppScale.plugin.BLUE_STATE.CONNECTFAILED) {
this.reconnectDevice()
}
wx.hideLoading();
});
// 同步时间
this.globalData.ppScale.plugin.bus.subscribe("syncDeviceTimeSuccess", (res) => {
console.log("app.js ===> syncDeviceTimeSuccess", res);
})
// 设备自动断开监听
this.globalData.ppScale.plugin.bus.subscribe("deviceWillDisconnect", (res) => {
console.log("app.js ===> deviceWillDisconnect", res);
this.reconnectDevice();
})
},
reconnectDevice() {
this.globalData.ppScale.plugin.Blue.disconnect((disres) => {
if (disres.errCode == 0) {
this.globalData.ppScale.plugin.Blue.startBluetoothDevicesDiscovery();
} else {
this.reconnectDevice();
}
})
},
/**
* 注册 globalData 某个属性的监听
* @param {string} keyPath 要监听的 globalData 属性路径,例如 'ppScale.device.connectState'
* @param {function} callback 属性变化时执行的回调函数 (newValue, oldValue) => {}
*/
watch(keyPath, callback) {
if (!this.globalData._callbacks[keyPath]) {
this.globalData._callbacks[keyPath] = [];
}
this.globalData._callbacks[keyPath].push(callback);
},
/**
* 取消 globalData 某个属性的监听
* @param {string} keyPath 要取消监听的 globalData 属性路径
* @param {function} callback 之前注册的回调函数
*/
unwatch(keyPath, callback) {
if (this.globalData._callbacks[keyPath]) {
this.globalData._callbacks[keyPath] = this.globalData._callbacks[keyPath].filter(cb => cb !== callback);
}
},
/**
* 设置 globalData 的值并触发所有相关监听器
* 支持点表示法设置嵌套属性,例如 'ppScale.device.connectState'
* @param {string} keyPath 要设置的 globalData 属性路径
* @param {*} value 要设置的新值
*/
setGlobalData(keyPath, value) {
const keys = keyPath.split('.');
let current = this.globalData;
let oldValue = undefined;
// 遍历到目标属性的父级
for (let i = 0; i < keys.length - 1; i++) {
if (!current[keys[i]]) {
current[keys[i]] = {}; // 如果路径不存在,创建空对象
}
current = current[keys[i]];
}
// 获取旧值
oldValue = current[keys[keys.length - 1]];
// 只有当值发生变化时才更新并通知
if (oldValue !== value) {
current[keys[keys.length - 1]] = value; // 设置新值
// 触发监听器
if (this.globalData._callbacks[keyPath]) {
this.globalData._callbacks[keyPath].forEach(callback => {
callback(value, oldValue);
});
}
}
},
})
+49
View File
@@ -0,0 +1,49 @@
{
"pages": [
"pages/home/home",
"pages/searchDevice/searchDevice",
"pages/configureDevice/configureDevice",
"pages/my/my",
"pages/userInfo/userInfo",
"pages/deviceInfo/deviceInfo",
"pages/replaceNetwork/replaceNetwork"
],
"window": {
"navigationBarTitleText": "",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#ffffff"
},
"tabBar": {
"color": "#808080",
"selectedColor": "#8363F9",
"borderStyle": "white",
"list": [{
"pagePath": "pages/home/home",
"iconPath": "/images/tabBar/home.png",
"selectedIconPath": "/images/tabBar/home_.png",
"text": "首页"
}, {
"pagePath": "pages/my/my",
"iconPath": "/images/tabBar/my.png",
"selectedIconPath": "/images/tabBar/my_.png",
"text": "我的"
}]
},
"style": "v2",
"plugins": {
"ppScale-plugin": {
"version": "1.2.15",
"provider": "wx0ffb48417ce6345c"
}
},
"permission": {
"scope.userLocation": {
"desc": "您的位置信息将用于发现附近的蓝牙设备,以便连接蓝牙秤。"
}
},
"requiredPrivateInfos": [
"getLocation"
],
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}
+43
View File
@@ -0,0 +1,43 @@
page {
width: 100%;
height: 100%;
box-sizing: border-box;
background-color: #F5F7FB;
}
image {
width: 100%;
height: 100%;
}
button {
all: unset;
display: inline-block;
}
button::after {
display: none;
}
.scrollView {
width: 100%;
height: 100%;
}
.arrowAfter {
position: relative;
}
.arrowAfter::after {
position: absolute;
right: 6rpx;
top: 0;
bottom: 0;
margin: auto;
content: "";
width: 12rpx;
height: 12rpx;
border-left: 5rpx solid #b6b6b6;
border-top: 5rpx solid #b6b6b6;
transform: rotate(135deg);
}
@@ -0,0 +1,32 @@
const app = getApp();
Component({
data: {
devices: []
},
// 生命周期方法
lifetimes: {
attached() {
this.setData({
devices: app.globalData.ppScale.device.list
})
},
detached() {
this.setData({
devices: []
})
}
},
// 组件的方法
methods: {
selectDevice(e) {
let device = this.data.devices[e.currentTarget.dataset.i];
this.triggerEvent('deviceEvent', {
device: device,
status: true
});
}
}
});
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,17 @@
<view class="configureDevice1">
<view class="title">蓝牙</view>
<view class="describe">可用设备</view>
<view class="deviceName">
<block wx:for="{{devices}}" wx:key="index">
<view data-i="{{index}}" bind:tap="selectDevice">
<view>
<image src="/images/configureDevice/bluetooth.png"/>
</view>
<view>
<view>{{item.name}}</view>
<!-- <view>正在配对</view> -->
</view>
</view>
</block>
</view>
</view>
@@ -0,0 +1,70 @@
.configureDevice1 {
width: 100%;
height: 100%;
padding: 60rpx 60rpx 0;
box-sizing: border-box;
}
.title {
color: #252535;
width: 100%;
height: 48rpx;
font-size: 48rpx;
font-weight: bold;
line-height: 48rpx;
margin-bottom: 48rpx;
}
.describe {
color: #B6B6B6;
width: 100%;
height: 30rpx;
font-size: 30rpx;
line-height: 30rpx;
margin-bottom: 40rpx;
}
.deviceName {
width: 100%;
height: calc(100% - 166rpx);
}
.deviceName>view {
width: 100%;
height: 80rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
margin-bottom: 32rpx;
}
.deviceName>view>view:nth-of-type(1) {
width: 80rpx;
height: 80rpx;
overflow: hidden;
border-radius: 50%;
margin-right: 22rpx;
}
.deviceName>view>view:nth-of-type(2) {
flex: 1;
width: 0;
}
.deviceName>view>view:nth-of-type(2)>view:nth-of-type(1) {
color: #252535;
width: 100%;
height: 32rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 32rpx;
}
.deviceName>view>view:nth-of-type(2)>view:nth-of-type(2) {
color: #808080;
width: 100%;
height: 28rpx;
font-size: 28rpx;
line-height: 28rpx;
margin-top: 10rpx;
}
@@ -0,0 +1,294 @@
const app = getApp();
import $ from "../../utils/request";
Component({
data: {
BLUE_STATE: {},
device: null,
connectState: "",
userId: "",
realname: "",
sex: {
index: "",
data: [{
id: 1,
name: '男'
}, {
id: 2,
name: '女'
}]
},
birthday: {
label: "1980年01月01日",
value: "1980-01-01"
},
height: {
index: 50,
data: Array.from({ length: 200 - 120 + 1 }, (_, i) => i + 120)
},
weight: {
index: [60, 0],
data: [Array.from({ length: 120 + 1 }, (_, i) => i + 10), Array.from({ length: 10 }, (_, i) => i)]
},
},
// 存储回调函数的引用,以便在 detached 时取消监听
_connectStateWatcher: null,
lifetimes: {
attached() {
console.log(`[Component] connectState 获取: ${app.globalData.ppScale.device.connectState}`);
this.setData({
BLUE_STATE: app.globalData.ppScale.plugin.BLUE_STATE,
connectState: app.globalData.ppScale.device.connectState,
device: app.globalData.ppScale.device.connection
})
this._connectStateWatcher = (newValue, oldValue) => {
console.log(`[Component] connectState 变化: ${oldValue} -> ${newValue}`);
this.setData({
connectState: newValue || ''
});
};
app.watch('ppScale.device.connectState', this._connectStateWatcher);
let userInfo = wx.getStorageSync("userInfo") || null;
if(userInfo) {
let [year, month, day] = userInfo.birthday.split("-");
this.setData({
userId: userInfo.userId,
realname: userInfo.realname,
["sex.index"]: this.data.sex.data.findIndex(item => {return item.id === userInfo.sex}),
birthday: {
label: year + "年" + month + "月" + day + "日",
value: userInfo.birthday
},
["height.index"]: this.data.height.data.findIndex(item => {return item === userInfo.height}),
})
if(userInfo.weight) {
const integerPart = Math.floor(userInfo.weight);
const decimalPart = Math.round((userInfo.weight - integerPart) * 10);
const integerIndex = this.data.weight.data[0].indexOf(integerPart);
const decimalIndex = this.data.weight.data[1].indexOf(decimalPart);
this.setData({
["weight.index"]: [integerIndex !== -1 ? integerIndex : null, decimalIndex !== -1 ? decimalIndex : null],
})
}
}
},
detached() {
// 4. 在组件销毁时取消监听,防止内存泄漏
if (this._connectStateWatcher) {
app.unwatch('ppScale.device.connectState', this._connectStateWatcher);
}
}
},
// 组件的方法
methods: {
// 二次连接设备
connectedDevice() {
this.triggerEvent('connectedDeviceEvent', {
device: this.data.device
});
},
// 姓名输入
realnameInput(e) {
let realname = e.detail.value.replace(/\s+/g, '');
this.setData({
realname: realname
})
},
// 性别选择
sexChange(e) {
let sex = e.detail.value;
console.log(sex);
this.setData({
['sex.index']: e.detail.value
})
if(this.data.height.index === null) {
this.setData({
['height.index']: sex == 0 ? 50 : 40
})
}
if(this.data.weight.index === null) {
this.setData({
['weight.index']: sex == 0 ? 20 : 10
})
}
},
// 生日选择
birthdayChange(e) {
let v = e.detail.value;
let [year, month, day] = v.split("-");
this.setData({
birthday: {
label: year + "年" + month + "月" + day + "日",
value: v
}
})
},
// 身高选择
heightChange(e) {
this.setData({
['height.index']: e.detail.value
})
},
// 体重选择
weightChange(e) {
console.log(e.detail.value)
this.setData({
['weight.index']: e.detail.value
})
},
setUserInfo() {
if(this.data.connectState == this.data.BLUE_STATE.CONNECTSUCCESS) {
if(this.data.userId) {
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
userID: this.data.userId,
userName: this.data.realname,
memberID: "",
age: this.getAge(this.data.birthday.value),
gender: this.data.sex.data[this.data.sex.index].id,
height: this.data.height.data[this.data.height.index],
isAthleteMode: 0,
currentWeight: this.data.weight.data[0][this.data.weight.index[0]] + '.' + this.data.weight.data[1][this.data.weight.index[1]],
deviceHeaderIndex: 0,
targetWeight: "",
idealWeight: "",
recentData: [],
}, (res) => {
if(res == 0) {
this.triggerEvent('deviceEvent', {
status: true
});
} else {
console.log("dataSyncUserInfo", res)
wx.showToast({
title: "用户信息下发失败,请重试。",
icon: "none"
})
}
})
} else {
let realname = this.data.realname;
let sex = this.data.sex;
let birthday = this.data.birthday;
let height = this.data.height;
let weight = this.data.weight;
if(!realname) {
wx.showToast({
icon: "none",
title: "姓名不能为空"
})
return false;
}
if(sex.index === "") {
wx.showToast({
icon: "none",
title: "性别不能为空"
})
return false;
}
if(!birthday.value) {
wx.showToast({
icon: "none",
title: "生日不能为空"
})
return false;
}
if(height.index === "") {
wx.showToast({
icon: "none",
title: "身高不能为空"
})
return false;
}
if(weight.index[0] === null && weight.index[1] === null) {
console.log(weight)
wx.showToast({
icon: "none",
title: "体重不能为空"
})
return false;
}
let sn = app.globalData.ppScale.device.mac.replace(/:/g, '');
$.ajax("weighingScale/edit/user", {
sn: sn,
realname: realname,
sex: sex.data[sex.index].id,
birthday: birthday.value,
height: height.data[height.index],
weight: weight.data[0][weight.index[0]] + '.' + weight.data[1][weight.index[1]]
}, "POST", true, "保存中...").then(res => {
$.ajax("weighingScale/select/user", {
sn: sn
}, "GET", true, "更新用户信息中...").then(res_ => {
wx.setStorageSync("userInfo", res_.result);
wx.showToast({
icon: "none",
title: res.message
})
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
userID: res_.result.userId,
userName: res_.result.realname,
memberID: "",
age: this.getAge(res_.result.birthday), //
gender: res_.result.sex, //
height: res_.result.height, //
isAthleteMode: 0,
currentWeight: res_.result.weight, //
deviceHeaderIndex: 0,
targetWeight: "",
idealWeight: "",
recentData: [],
}, (res) => {
if(res == 0) {
this.triggerEvent('deviceEvent', {
status: true
});
} else {
console.log("dataSyncUserInfo", res)
wx.showToast({
title: "用户信息下发失败,请重试。",
icon: "none"
})
}
})
})
})
}
} else {
wx.showToast({
title: "设备连接失败,请重试。",
icon: "none"
})
}
},
// 根据生日获取年龄
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,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,127 @@
<view class="configureDevice2">
<view class="header">
<view>
<view>智能蓝牙秤</view>
<view>型号:{{device.name}}</view>
</view>
<view>
<block wx:if="{{device && connectState == BLUE_STATE.CONNECTSUCCESS}}">
<view style="background-color: #2AC79F;"></view>
<view style="color: #2AC79F;">连接成功</view>
</block>
<block wx:else>
<view style="background-color: #F24439;"></view>
<view bind:tap="connectedDevice" style="color: #F24439;">连接失败,点击重试</view>
</block>
</view>
</view>
<view class="section">
<view class="from">
<view>
<view>姓名</view>
<block wx:if="{{userId}}">
<view class="valueClass">{{realname}}</view>
</block>
<block wx:else>
<view>
<view>
<input
type="text"
value="{{realname}}"
bindinput="realnameInput"
placeholder="请输入您的姓名"
class="valueClass"
placeholder-class="placeholderClass" />
</view>
</view>
</block>
</view>
<view>
<view>性别</view>
<block wx:if="{{userId}}">
<view class="valueClass">{{sex.data[sex.index].name}}</view>
</block>
<block wx:else>
<view class="~arrowAfter">
<view>
<picker mode="selector" bindchange="sexChange" value="{{sex.index}}" range="{{sex.data}}" range-key="name">
<block wx:if="{{sex.index === ''}}">
<view class="placeholderClass">请选择您的性别</view>
</block>
<block wx:else>
<view class="valueClass">{{sex.data[sex.index].name}}</view>
</block>
</picker>
</view>
</view>
</block>
</view>
<view>
<view>生日</view>
<block wx:if="{{userId}}">
<view class="valueClass">{{birthday.label}}</view>
</block>
<block wx:else>
<view class="~arrowAfter">
<view>
<picker mode="date" bindchange="birthdayChange" value="{{birthday.value}}">
<block wx:if="{{birthday.value === ''}}">
<view class="placeholderClass">请选择您的生日</view>
</block>
<block wx:else>
<view class="valueClass">{{birthday.label}}</view>
</block>
</picker>
</view>
</view>
</block>
</view>
<view>
<view>身高</view>
<block wx:if="{{userId}}">
<view class="valueClass">{{height.data[height.index]}}cm</view>
</block>
<block wx:else>
<view class="~arrowAfter">
<view>
<picker mode="selector" bindchange="heightChange" value="{{height.index}}" range="{{height.data}}">
<block wx:if="{{height.index === ''}}">
<view class="placeholderClass">请选择您的身高</view>
</block>
<block wx:else>
<view class="valueClass">{{height.data[height.index]}}</view>
</block>
</picker>
</view>
<view>cm</view>
</view>
</block>
</view>
<view>
<view>体重</view>
<block wx:if="{{userId}}">
<view class="valueClass">{{weight.data[0][weight.index[0]]}}.{{weight.data[1][weight.index[1]]}}kg</view>
</block>
<block wx:else>
<view class="~arrowAfter">
<view>
<picker mode="multiSelector" bindchange="weightChange" value="{{weight.index}}" range="{{weight.data}}">
<block wx:if="{{weight.index && weight.index.length && weight.index[0] !== null && weight.index[1] !== null}}">
<view class="valueClass">{{weight.data[0][weight.index[0]]}}.{{weight.data[1][weight.index[1]]}}</view>
</block>
<block wx:else>
<view class="placeholderClass">请选择您的体重</view>
</block>
</picker>
</view>
<view>kg</view>
</view>
</block>
</view>
</view>
<view class="btn">
<view bind:tap="setUserInfo">下一步</view>
</view>
<view class="describe">请认真填写和完善您家人的健康信息,用于计算身体数据及运动卡路里消耗等,以便准确的分析数据。<text>(填写数据同时,踩亮蓝牙秤并与其保持连接)。</text></view>
</view>
</view>
@@ -0,0 +1,158 @@
input {
width: 100%;
height: 58rpx;
font-size: 28rpx;
line-height: 58rpx;
}
.placeholderClass {
color: #B6B6B6;
height: 58rpx;
font-size: 28rpx;
line-height: 58rpx;
}
.valueClass {
color: #77849E;
height: 58rpx;
font-size: 28rpx;
font-weight: bold;
line-height: 58rpx;
}
.configureDevice2 {
width: 100%;
height: 100%;
}
.header {
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
padding: 30rpx 40rpx;
box-sizing: border-box;
border-bottom: 1rpx solid #EAECF1;
}
.header>view:nth-of-type(1) {
flex: 1;
}
.header>view:nth-of-type(1)>view:nth-of-type(1) {
color: #252535;
height: 32rpx;
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
margin-bottom: 16rpx;
}
.header>view:nth-of-type(1)>view:nth-of-type(2) {
color: #808080;
height: 26rpx;
font-size: 26rpx;
line-height: 26rpx;
}
.header>view:nth-of-type(2) {
height: 28rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
}
.header>view:nth-of-type(2)>view:nth-of-type(1) {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
margin-right: 14rpx;
}
.header>view:nth-of-type(2)>view:nth-of-type(2) {
height: 28rpx;
font-weight: bold;
font-size: 28rpx;
line-height: 28rpx;
}
.section {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
}
.from {
width: 100%;
margin-bottom: 66rpx;
}
.from>view {
width: 100%;
padding: 48rpx 10rpx 0;
box-sizing: border-box;
border-bottom: 1rpx solid #EAECF1;
}
.from>view>view:nth-of-type(1) {
color: #252535;
height: 32rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 32rpx;
margin-bottom: 18rpx;
}
.from>view>view:nth-of-type(2) {
width: 100%;
height: 58rpx;
display: flex;
flex-wrap: nowrap;
padding-right: 26rpx;
box-sizing: border-box;
}
.from>view>view:nth-of-type(2)>view:nth-of-type(1) {
flex: 1;
width: 0;
}
.from>view>view:nth-of-type(2)>view:nth-of-type(2) {
color: #77849E;
height: 58rpx;
font-size: 28rpx;
font-weight: bold;
line-height: 58rpx;
}
.btn {
width: 100%;
padding: 0 26rpx;
box-sizing: border-box;
}
.btn>view {
color: #FFFFFF;
width: 100%;
height: 88rpx;
font-size: 32rpx;
font-weight: bold;
text-align: center;
line-height: 88rpx;
border-radius: 44rpx;
margin-bottom: 40rpx;
background-color: #8363F9;
}
.describe {
color: #77849E;
width: 100%;
font-size: 24rpx;
line-height: 40rpx;
}
.describe text {
color: #F24439;
}
@@ -0,0 +1,157 @@
const app = getApp();
import $ from "../../utils/request";
Component({
data: {
progress: 0,
wifiList: [],
selectWifi: null,
type: true,
selectWifiPWD: ""
},
lifetimes: {
attached() {
this.initWifi();
},
detached() {
// 在组件实例被从页面节点树移除时执行
console.log('MyComponent detached!');
}
},
// 组件的方法
methods: {
initWifi() {
wx.showLoading({
title: "正在获取Wi-Fi列表...",
mask: true
});
app.globalData.ppScale.activeProtocol.dataFindSurroundDevice((res) => {
wx.hideLoading();
this.setData({
wifiList: res
})
})
},
selectDevice(e) {
this.setData({
progress: 1,
selectWifi: e.currentTarget.dataset.item,
})
},
inputTypeChange() {
this.setData({
type: !this.data.type
})
},
passwordInput(e) {
this.setData({
selectWifiPWD: e.detail.value
})
},
setWifiPWD() {
this.setData({
progress: 2
})
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
domain: app.globalData.ppScale.domain,
ssid: this.data.selectWifi.ssid,
password: this.data.selectWifiPWD
}, (res) => {
console.log("setNetwork.js dataConfigNetWork", res);
if(res === 23) {
app.globalData.ppScale.wifi.ssid = this.data.selectWifi.ssid;
app.globalData.ppScale.wifi.password = this.data.selectWifiPWD;
let mac = app.globalData.ppScale.device.mac;
let deviceId = app.globalData.ppScale.device.connection.deviceId;
if(mac && deviceId) {
let scaleDeviceId = mac.replace(/:/g, '');
let params = {
equipmentName: app.globalData.ppScale.device.name,
scaleDeviceId: scaleDeviceId,
deviceId: deviceId
};
$.ajax("weighingScale/binding/device", params, "POST").then(res => {
if (res.success) {
app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
console.log("setNetwork.js codeSetBindingState", res);
if(res == 0) {
this.triggerEvent('deviceEvent', {
status: true
});
} else {
app.globalData.ppScale.plugin.Blue.stop();
wx.showToast({
title: "绑定失败,请重试。",
icon: "none"
})
setTimeout(() => {
wx.navigateBack({
delta: 2
})
}, 1500)
}
})
} else {
app.globalData.ppScale.plugin.Blue.stop();
wx.showToast({
icon: "none",
title: res.message
})
setTimeout(() => {
wx.navigateBack({
delta: 2
})
}, 1500)
}
}).catch(err => {
app.globalData.ppScale.plugin.Blue.stop();
wx.showToast({
icon: "none",
title: err.message
})
setTimeout(() => {
wx.navigateBack({
delta: 2
})
}, 1500)
})
} else {
app.globalData.ppScale.plugin.Blue.stop();
wx.showToast({
icon: "none",
title: "Mac 地址与 deviceId 获取失败,请重新绑定"
})
setTimeout(() => {
wx.navigateBack({
delta: 2
})
}, 1500)
}
} else {
app.globalData.ppScale.plugin.Blue.stop();
wx.showToast({
icon: "none",
title: "配网失败,错误码:" + res
})
setTimeout(() => {
wx.navigateBack({
delta: 2
})
}, 1500)
}
})
}
}
});
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,72 @@
<view class="configureDevice3">
<block wx:if="{{progress === 0}}">
<view class="progress0">
<view class="progress0_title">
<view>可用Wi-Fi</view>
<view>网络列表(设备暂不支持5GWi-Fi网络)</view>
</view>
<view class="progress0_content">
<scroll-view class="scrollView" scroll-y>
<view class="scrollViewContent">
<block wx:for="{{wifiList}}" wx:key="index">
<view data-item="{{item}}" bind:tap="selectDevice" class="~arrowAfter">
<view>
<image src="/images/configureDevice/wifi.png" />
</view>
<view>{{item.ssid}}</view>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
</block>
<block wx:if="{{progress === 1}}">
<view class="progress1">
<view class="progress1_title">输入Wi-Fi密码</view>
<view class="progress1_form">
<view>
<view>
<image src="/images/configureDevice/wifiPwd.png" />
</view>
<view>{{selectWifi.ssid}}</view>
</view>
<view>
<view>密码</view>
<view>
<block wx:if="{{type}}">
<input
password="{{true}}"
value="{{selectWifiPWD}}"
bindinput="passwordInput"
placeholder="输入您的wi-fi密码"
placeholder-class="placeholderClass" />
</block>
<block wx:else>
<input
password="{{false}}"
value="{{selectWifiPWD}}"
bindinput="passwordInput"
placeholder="输入您的wi-fi密码"
placeholder-class="placeholderClass" />
</block>
</view>
<view bind:tap="inputTypeChange">
<image src="/images/configureDevice/{{type ? 'open' : 'close'}}.png" />
</view>
</view>
</view>
<view class="progress1_btn" bind:tap="setWifiPWD">连接</view>
</view>
</block>
<block wx:if="{{progress === 2}}">
<view class="progress2">
<view>
<image src="/images/configureDevice/configureDevice_3_icon.png" />
</view>
<view>设备正在配对网络中,请稍等...</view>
<view>请持续站在秤上,耐心等待</view>
</view>
</block>
</view>
@@ -0,0 +1,207 @@
.configureDevice3 {
width: 100%;
height: 100%;
}
.progress0 {
width: 100%;
height: 100%;
padding-top: 60rpx;
box-sizing: border-box;
}
.progress0_title {
width: 100%;
padding: 0 60rpx;
box-sizing: border-box;
margin-bottom: 40rpx;
}
.progress0_title>view:nth-of-type(1) {
color: #252535;
width: 100%;
height: 48rpx;
font-size: 48rpx;
font-weight: bold;
line-height: 48rpx;
margin-bottom: 48rpx;
}
.progress0_title>view:nth-of-type(2) {
color: #B6B6B6;
width: 100%;
height: 30rpx;
font-size: 30rpx;
line-height: 30rpx;
}
.progress0_content {
width: 100%;
height: calc(100% - 166rpx);
}
.scrollView {
width: 100%;
height: 100%;
}
.scrollViewContent {
width: 100%;
padding: 0 60rpx;
box-sizing: border-box;
}
.scrollViewContent>view {
width: 100%;
height: 80rpx;
display: flex;
flex-wrap: nowrap;
margin-bottom: 32rpx;
}
.scrollViewContent>view>view:nth-of-type(1) {
width: 80rpx;
height: 80rpx;
margin-right: 24rpx;
}
.scrollViewContent>view>view:nth-of-type(2) {
color: #252535;
flex: 1;
width: 0;
height: 80rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 80rpx;
}
.progress1 {
width: 100%;
height: 100%;
padding: 60rpx 30rpx 0;
box-sizing: border-box;
}
.progress1_title {
color: #252535;
width: 100%;
height: 48rpx;
font-size: 48rpx;
font-weight: bold;
line-height: 48rpx;
margin-bottom: 48rpx;
}
.progress1_form {
width: 100%;
margin-bottom: 64rpx;
}
.progress1_form>view {
width: 100%;
height: 96rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
padding: 0 24rpx;
box-sizing: border-box;
border-radius: 16rpx;
background-color: #F6F6F6;
}
.progress1_form>view:first-of-type {
margin-bottom: 32rpx;
}
.progress1_form>view>view:nth-of-type(1) {
color: #252535;
width: 100rpx;
height: 96rpx;
line-height: 96rpx;
font-size: 32rpx;
font-weight: bold;
}
.progress1_form>view:first-of-type>view:nth-of-type(1) {
padding: 24rpx 45rpx 24rpx 7rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.progress1_form>view>view:nth-of-type(2) {
color: #252535;
flex: 1;
width: 0;
height: 96rpx;
font-size: 32rpx;
line-height: 96rpx;
}
.progress1_form>view>view:nth-of-type(2) input {
color: #252535;
width: 100%;
height: 96rpx;
font-size: 32rpx;
line-height: 96rpx;
}
.placeholderClass {
color: #B6B6B6;
height: 96rpx;
font-size: 32rpx;
line-height: 96rpx;
}
.progress1_form>view>view:nth-of-type(3) {
width: 56rpx;
height: 56rpx;
}
.progress1_btn {
color: #FFFFFF;
width: 580rpx;
height: 88rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 88rpx;
margin: 0 auto;
text-align: center;
border-radius: 44rpx;
background-color: #8363F9;
}
.progress2 {
width: 100%;
height: 100%;
padding: 90rpx 62rpx 0;
box-sizing: border-box;
}
.progress2>view:nth-of-type(1) {
width: 565rpx;
height: 500rpx;
margin: 0 auto;
}
.progress2>view:nth-of-type(2) {
color: #8363F9;
width: 100%;
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
line-height: 36rpx;
text-align: center;
margin-bottom: 28rpx;
}
.progress2>view:nth-of-type(3) {
color: #808080;
width: 100%;
height: 30rpx;
font-size: 30rpx;
text-align: center;
line-height: 30rpx;
}
@@ -0,0 +1,9 @@
Component({
methods: {
bindOk() {
this.triggerEvent('deviceEvent', {
status: true
});
}
}
});
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,12 @@
<view class="configureDevice4">
<view class="icon">
<view>
<image src="/images/configureDevice/configureDevice_4_icon.png" />
</view>
<view>绑定成功</view>
</view>
<view class="describe">随时随地同步测量数据</view>
<view class="btn" bind:tap="bindOk">完成</view>
</view>
@@ -0,0 +1,49 @@
.configureDevice4 {
width: 100%;
height: 100%;
padding: 105rpx 55rpx 0;
box-sizing: border-box;
}
.icon {
width: 100%;
margin-bottom: 475rpx;
}
.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;
}
.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: #8363F9;
}
@@ -0,0 +1,42 @@
const app = getApp();
Component({
data: {
wifiList: []
},
// 生命周期方法
lifetimes: {
attached() {
},
detached() {
}
},
// 组件的方法
methods: {
getWiFiList() {
wx.showLoading({
title: "正在获取Wi-Fi列表...",
mask: true
});
app.globalData.ppScale.activeProtocol.dataFindSurroundDevice((res) => {
console.log("connectedDevice ===》dataFindSurroundDevice", res);
wx.hideLoading();
this.setData({
wifiList: res
})
})
},
selectDevice(e) {
this.triggerEvent('wifiEvent', {
status: true,
data: e.currentTarget.dataset.item
});
}
}
});
@@ -1,4 +1,4 @@
{
"component": true,
"usingComponents": {}
}
}
@@ -0,0 +1,20 @@
<view class="replaceNetwork1">
<view class="title">
<view>可用Wi-Fi</view>
<view>网络列表(设备暂不支持5GWi-Fi网络)</view>
</view>
<view class="content">
<scroll-view class="scrollView" scroll-y>
<view class="scrollViewContent">
<block wx:for="{{wifiList}}" wx:key="index">
<view data-item="{{item}}" bind:tap="selectDevice" class="~arrowAfter">
<view>
<image src="/images/replaceNetwork/wifi.png" />
</view>
<view>{{item.ssid}}</view>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
@@ -0,0 +1,71 @@
.replaceNetwork1 {
width: 100%;
height: 100%;
padding-top: 60rpx;
box-sizing: border-box;
}
.title {
width: 100%;
padding: 0 60rpx;
box-sizing: border-box;
margin-bottom: 40rpx;
}
.title>view:nth-of-type(1) {
color: #252535;
width: 100%;
height: 48rpx;
font-size: 48rpx;
font-weight: bold;
line-height: 48rpx;
margin-bottom: 48rpx;
}
.title>view:nth-of-type(2) {
color: #B6B6B6;
width: 100%;
height: 30rpx;
font-size: 30rpx;
line-height: 30rpx;
}
.content {
width: 100%;
height: calc(100% - 166rpx);
}
.scrollView {
width: 100%;
height: 100%;
}
.scrollViewContent {
width: 100%;
padding: 0 60rpx;
box-sizing: border-box;
}
.scrollViewContent>view {
width: 100%;
height: 80rpx;
display: flex;
flex-wrap: nowrap;
margin-bottom: 32rpx;
}
.scrollViewContent>view>view:nth-of-type(1) {
width: 80rpx;
height: 80rpx;
margin-right: 24rpx;
}
.scrollViewContent>view>view:nth-of-type(2) {
color: #252535;
flex: 1;
width: 0;
height: 80rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 80rpx;
}
@@ -0,0 +1,56 @@
const app = getApp();
Component({
properties: {
ssid: {
type: String,
value: ""
}
},
data: {
type: true,
ssid: "",
password: ""
},
// 生命周期方法
lifetimes: {
attached() {
},
detached() {
}
},
// 组件的方法
methods: {
setWiFiName() {
this.setData({
ssid: this.properties.ssid,
type: true,
})
},
passwordInput(e) {
this.setData({
password: e.detail.value
})
},
inputTypeChange() {
this.setData({
type: !this.data.type
})
},
setWifiPWD() {
this.triggerEvent('wifiEvent', {
status: true,
data: this.data.password
});
}
}
});
@@ -1,4 +1,4 @@
{
"component": true,
"usingComponents": {}
}
}
@@ -0,0 +1,36 @@
<view class="replaceNetwork2">
<view class="title">输入Wi-Fi密码</view>
<view class="form">
<view>
<view>
<image src="/images/replaceNetwork/wifiPwd.png" />
</view>
<view>{{ssid}}</view>
</view>
<view>
<view>密码</view>
<view>
<block wx:if="{{type}}">
<input
password="{{true}}"
value="{{password}}"
bindinput="passwordInput"
placeholder="输入您的wi-fi密码"
placeholder-class="placeholderClass" />
</block>
<block wx:else>
<input
password="{{false}}"
value="{{password}}"
bindinput="passwordInput"
placeholder="输入您的wi-fi密码"
placeholder-class="placeholderClass" />
</block>
</view>
<view bind:tap="inputTypeChange">
<image src="/images/replaceNetwork/{{type ? 'open' : 'close'}}.png" />
</view>
</view>
</view>
<view class="btn" bind:tap="setWifiPWD">连接</view>
</view>
@@ -0,0 +1,95 @@
.replaceNetwork2 {
width: 100%;
height: 100%;
padding: 60rpx 30rpx 0;
box-sizing: border-box;
}
.title {
color: #252535;
width: 100%;
height: 48rpx;
font-size: 48rpx;
font-weight: bold;
line-height: 48rpx;
margin-bottom: 48rpx;
}
.form {
width: 100%;
margin-bottom: 64rpx;
}
.form>view {
width: 100%;
height: 96rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
padding: 0 24rpx;
box-sizing: border-box;
border-radius: 16rpx;
background-color: #F6F6F6;
}
.form>view:first-of-type {
margin-bottom: 32rpx;
}
.form>view>view:nth-of-type(1) {
color: #252535;
width: 100rpx;
height: 96rpx;
line-height: 96rpx;
font-size: 32rpx;
font-weight: bold;
}
.form>view:first-of-type>view:nth-of-type(1) {
padding: 24rpx 45rpx 24rpx 7rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.form>view>view:nth-of-type(2) {
color: #252535;
flex: 1;
width: 0;
height: 96rpx;
font-size: 32rpx;
line-height: 96rpx;
}
.form>view>view:nth-of-type(2) input {
color: #252535;
width: 100%;
height: 96rpx;
font-size: 32rpx;
line-height: 96rpx;
}
.placeholderClass {
color: #B6B6B6;
height: 96rpx;
font-size: 32rpx;
line-height: 96rpx;
}
.form>view>view:nth-of-type(3) {
width: 56rpx;
height: 56rpx;
}
.btn {
color: #FFFFFF;
width: 580rpx;
height: 88rpx;
font-size: 32rpx;
font-weight: bold;
line-height: 88rpx;
margin: 0 auto;
text-align: center;
border-radius: 44rpx;
background-color: #8363F9;
}
@@ -0,0 +1,73 @@
const app = getApp();
import $ from "../../utils/request";
Component({
properties: {
ssid: {
type: String,
value: ""
},
password: {
type: String,
value: ""
}
},
data: {
},
// 生命周期方法
lifetimes: {
attached() {
this.setNerwork();
},
detached() {
}
},
// 组件的方法
methods: {
setNerwork() {
let ssid = this.properties.ssid;
let password = this.properties.password;
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
domain: app.globalData.ppScale.domain,
ssid: ssid,
password: password
}, (res) => {
console.log("setNetwork.js dataConfigNetWork", res);
if(res === 23) {
app.globalData.ppScale.wifi.ssid = ssid;
app.globalData.ppScale.wifi.password = password;
let scaleDeviceId = app.globalData.ppScale.device.mac.replace(/:/g, '');
if(scaleDeviceId) {
let params = {
equipmentCode: scaleDeviceId,
wifiName: ssid
};
$.ajax("weighingScale/edit/device", params, "POST").then((res) => {
this.triggerEvent('wifiEvent', {
status: true
});
})
}
} else {
app.globalData.ppScale.plugin.Blue.stop();
wx.showToast({
icon: "none",
title: "配网失败,错误码:" + res
})
setTimeout(() => {
this.triggerEvent('wifiEvent', {
status: false
});
}, 1500)
}
})
}
}
});
@@ -1,4 +1,4 @@
{
"component": true,
"usingComponents": {}
}
}
@@ -0,0 +1,7 @@
<view class="replaceNetwork3">
<view>
<image src="/images/configureDevice/configureDevice_3_icon.png" />
</view>
<view>设备正在配对网络中,请稍等...</view>
<view>请持续站在秤上,耐心等待</view>
</view>
@@ -0,0 +1,32 @@
.replaceNetwork3 {
width: 100%;
height: 100%;
padding: 90rpx 62rpx 0;
box-sizing: border-box;
}
.replaceNetwork3>view:nth-of-type(1) {
width: 565rpx;
height: 500rpx;
margin: 0 auto;
}
.replaceNetwork3>view:nth-of-type(2) {
color: #8363F9;
width: 100%;
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
line-height: 36rpx;
text-align: center;
margin-bottom: 28rpx;
}
.replaceNetwork3>view:nth-of-type(3) {
color: #808080;
width: 100%;
height: 30rpx;
font-size: 30rpx;
text-align: center;
line-height: 30rpx;
}
@@ -0,0 +1,26 @@
const app = getApp();
Component({
data: {
},
// 生命周期方法
lifetimes: {
attached() {
},
detached() {
}
},
// 组件的方法
methods: {
replaceNetworkOk() {
wx.navigateBack({
delta: 1
})
}
}
});
@@ -1,4 +1,4 @@
{
"component": true,
"usingComponents": {}
}
}
@@ -0,0 +1,12 @@
<view class="replaceNetwork4">
<view class="icon">
<view>
<image src="/images/configureDevice/configureDevice_4_icon.png" />
</view>
<view>Wi-Fi 切换成功</view>
</view>
<view class="describe">随时随地同步测量数据</view>
<view class="btn" bind:tap="replaceNetworkOk">完成</view>
</view>
@@ -0,0 +1,49 @@
.replaceNetwork4 {
width: 100%;
height: 100%;
padding: 105rpx 55rpx 0;
box-sizing: border-box;
}
.icon {
width: 100%;
margin-bottom: 475rpx;
}
.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;
}
.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: #8363F9;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Before

Width:  |  Height:  |  Size: 976 B

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

-2
View File
@@ -1,2 +0,0 @@
export { checkOpenIdLogin, getUserInfoByIdCard, updateUser } from './user'
export type { UserInfo, LoginResult } from './user'
-53
View File
@@ -1,53 +0,0 @@
import { get, post, put } from '../utils/request/index'
export interface UserInfo {
id: string
userId: string
parentUserId: string | null
scaleDeviceId: string
deviceId: string | null
deviceType: string
dataType: number
userType: string | null
idCard: string
height: number
weight: number
birthday: string
sex: number
avatar: string | null
phone: string | null
thirdId: string
realname: string
bmi: number
createBy: string
createTime: string
updateBy: string | null
updateTime: string | null
delFlag: number
sn: string | null
workNo: string | null
secondDepart: string | null
thirdDepart: string | null
remark: string | null
relationType: string | null
sex_dictText: string
connectDeviceInfo: string
flag?: number | null
}
export interface LoginResult {
user: UserInfo | null
token: string
}
/** OpenID 登录 */
export const checkOpenIdLogin = (code: string) =>
post<LoginResult>('weighingScale/v2/checkOpenIdLogin', { code })
/** 根据身份证号查询用户信息 */
export const getUserInfoByIdCard = (params: { sn?: string; idCard: string; realname: string }) =>
get<UserInfo | null>('weighingScale/v6/getUserInfoByIdcard', params, { loading: true, loadingTitle: '正在查询用户信息' })
/** 更新当前登录微信用户信息 */
export const updateUser = (data: Record<string, any>) =>
put<UserInfo>('weighingScale/v6/update/user', data)
-80
View File
@@ -1,80 +0,0 @@
{
"pages": [
"pages/login/login",
"pages/supplementPersonal/supplementPersonal",
"pages/connectedDevice/connectedDevice",
"pages/connectedWifi/connectedWifi",
"pages/home/home",
"pages/detailedReport/detailedReport",
"pages/equipment/equipment",
"pages/userManagement/userManagement",
"pages/addUser/addUser",
"pages/data/data",
"pages/my/my",
"pages/personalInformation/personalInformation",
"pages/helpCenter/helpCenter",
"pages/questionDetails/questionDetails"
],
"usingComponents": {
"empty-data": "/components/emptyData/emptyData"
},
"window": {},
"tabBar": {
"color": "#808080",
"selectedColor": "#1385FA",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/home/home",
"text": "首页",
"iconPath": "images/tabBar/home_default.png",
"selectedIconPath": "images/tabBar/home.png"
},
{
"pagePath": "pages/equipment/equipment",
"text": "设备",
"iconPath": "images/tabBar/equipment_default.png",
"selectedIconPath": "images/tabBar/equipment.png"
},
{
"pagePath": "pages/data/data",
"text": "数据",
"iconPath": "images/tabBar/data_default.png",
"selectedIconPath": "images/tabBar/data.png"
},
{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "images/tabBar/my_default.png",
"selectedIconPath": "images/tabBar/my.png"
}
]
},
"style": "v2",
"rendererOptions": {
"skyline": {
"defaultDisplayBlock": true,
"disableABTest": true,
"sdkVersionBegin": "3.0.0",
"sdkVersionEnd": "15.255.255"
}
},
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents",
"plugins": {
"ppScale-plugin": {
"version": "0.0.32",
"provider": "wx0826af4e4908f524"
}
},
"permission": {
"scope.userLocation": {
"desc": "您的位置信息将用于发现附近的蓝牙设备,以便连接蓝牙秤。"
}
},
"requiredPrivateInfos": [
"getLocation"
]
}
-48
View File
@@ -1,48 +0,0 @@
page {
width: 100%;
height: 100vh;
overflow: hidden;
box-sizing: border-box;
background-color: #F5F5F5;
}
/* 需要页面标准边距的业务容器,在 WXML 根节点使用 */
.page-container {
padding-left: 30rpx;
padding-right: 30rpx;
}
image {
width: 100%;
height: 100%;
}
/* 全局 scroll-view 通用样式:同时兼容两种结构
* - page 内直接放 scroll-view:靠 height: 100% 撑满
* - page 内为 flex 列布局(header + scrollView + footer):靠 flex: 1 撑满剩余空间
*/
.scrollView {
flex: 1;
width: 100%;
height: 100%;
overflow: hidden;
box-sizing: border-box;
}
.arrow {
position: relative;
&::after {
position: absolute;
right: 24rpx;
top: 0;
bottom: 0;
margin: auto;
content: "";
width: 10rpx;
height: 10rpx;
border-left: 4rpx solid #b6b6b6;
border-top: 4rpx solid #b6b6b6;
transform: rotate(135deg);
}
}
-54
View File
@@ -1,54 +0,0 @@
import { leFuService } from './lefu/index'
App<IAppOption>({
globalData: {
operationsEngineer: false,
wasConnected: false
},
onLaunch() {
// 已登录则跳过登录页
const token = wx.getStorageSync('token') || null;
const userInfo = wx.getStorageSync('userInfo') || null;
// const userInfo = true;
if (token && userInfo) {
wx.reLaunch({
url: '/pages/home/home'
})
}
},
onHide() {
// 切后台:记录连接状态,挂起(断开但保留缓存设备,回前台可重连)
const wasConnected = leFuService.isConnected
this.globalData.wasConnected = wasConnected
if (wasConnected) {
leFuService.suspend()
}
},
onShow() {
// 回前台:如果之前连接过,自动重连
if (this.globalData.wasConnected) {
this.globalData.wasConnected = false
leFuService.autoConnect()
}
},
getWxLoginCode(): Promise<string> {
return new Promise((resolve, reject) => {
wx.login({
success: (res) => {
if (res.code) {
resolve(res.code)
} else {
reject(new Error('获取登录凭证失败'))
}
},
fail: (err) => {
reject(new Error(err.errMsg || '获取登录凭证失败'))
},
})
})
},
})
@@ -1,4 +0,0 @@
{
"component": true,
"usingComponents": {}
}
@@ -1,18 +0,0 @@
.empty {
display: flex;
flex-direction: column;
align-items: center;
padding-top: 80rpx;
.empty-icon {
width: 193rpx;
height: 138rpx;
margin-bottom: 30rpx;
}
.empty-text {
color: #808080;
font-size: 28rpx;
line-height: 28rpx;
}
}
@@ -1,21 +0,0 @@
// emptyData.ts
Component({
properties: {
text: {
type: String,
value: '暂无数据'
},
iconSrc: {
type: String,
value: '/images/emptyData.png'
},
containerStyle: {
type: String,
value: ''
},
textStyle: {
type: String,
value: ''
}
}
})
@@ -1,6 +0,0 @@
<view class="empty" style="{{containerStyle}}">
<view class="empty-icon">
<image src="{{iconSrc}}" mode="aspectFit" />
</view>
<view class="empty-text" style="{{textStyle}}">{{text}}</view>
</view>
@@ -1,62 +0,0 @@
.equipment-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(37, 37, 53, 0.6);
z-index: 100;
}
.equipment-panel {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 560rpx;
box-sizing: border-box;
background-color: #FFFFFF;
border-radius: 24rpx;
z-index: 101;
display: flex;
flex-direction: column;
align-items: center;
padding: 64rpx 40rpx 56rpx;
.equipment-spinner {
width: 96rpx;
height: 96rpx;
border: 8rpx solid rgba(19, 133, 250, 0.2);
border-top-color: #1385FA;
border-radius: 50%;
animation: equipment-spin 1s linear infinite;
}
.equipment-title {
color: #252535;
height: 32rpx;
font-size: 32rpx;
line-height: 32rpx;
text-align: center;
margin-top: 40rpx;
}
.equipment-content {
color: #808080;
font-size: 24rpx;
line-height: 34rpx;
text-align: center;
margin-top: 24rpx;
white-space: pre-line;
}
}
@keyframes equipment-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@@ -1,26 +0,0 @@
Component({
properties: {
/** 是否显示弹框 */
show: {
type: Boolean,
value: false
},
/** 标题 */
title: {
type: String,
value: ''
},
/** 副标题(支持 \n 换行) */
content: {
type: String,
value: ''
}
},
methods: {
/** 点击遮罩关闭 */
onTapMask() {
this.triggerEvent('close')
}
}
})
@@ -1,8 +0,0 @@
<block wx:if="{{ show }}">
<view class="equipment-mask" bind:tap="onTapMask"></view>
<view class="equipment-panel">
<view class="equipment-spinner"></view>
<view class="equipment-title">{{ title }}</view>
<view class="equipment-content">{{ content }}</view>
</view>
</block>
@@ -1,5 +0,0 @@
{
"component": true,
"usingComponents": {},
"multipleSlots": true
}
-60
View File
@@ -1,60 +0,0 @@
.nav-spacer {
width: 100%;
}
.nav-wrap {
width: 100%;
}
.nav-content {
width: 100%;
display: flex;
align-items: center;
position: relative;
box-sizing: border-box;
}
.nav-left {
height: 100%;
flex-shrink: 0;
z-index: 1;
display: flex;
align-items: center;
}
.back-btn {
width: 60rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back-arrow {
width: 18rpx;
height: 18rpx;
border-left: 4rpx solid #252535;
border-bottom: 4rpx solid #252535;
transform: rotate(45deg);
}
.nav-center {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
z-index: 0;
pointer-events: none;
}
.nav-title {
color: #252535;
font-size: 16px;
font-weight: bold;
line-height: 1;
pointer-events: auto;
}
-61
View File
@@ -1,61 +0,0 @@
import { getNavBarLayout } from '../../utils/navBar/index';
Component({
options: {
multipleSlots: true,
},
properties: {
title: { type: String, value: '' },
back: { type: String, value: 'auto' },
fixed: { type: Boolean, value: false },
zIndex: { type: Number, value: 100 },
bgColor: { type: String, value: 'transparent' },
color: { type: String, value: '#252535' },
arrowColor: { type: String, value: '#252535' },
},
data: {
statusBarHeight: 0,
navBarHeight: 44,
totalNavHeight: 0,
navPaddingRight: 0,
_showBack: false,
_spacerHeight: 'auto',
_navStyle: '',
},
lifetimes: {
attached() {
const layout = getApp<IAppOption>().globalData.navBarLayout || getNavBarLayout();
this._applyLayout(layout);
},
},
observers: {
'fixed, back, zIndex'(_fixed: boolean, _back: string, _zIndex: number) {
const layout = getApp<IAppOption>().globalData.navBarLayout || getNavBarLayout();
this._applyLayout(layout);
},
},
methods: {
_applyLayout(layout: ReturnType<typeof getNavBarLayout>) {
const { fixed, back, zIndex } = this.properties;
const _showBack = back === 'show' || (back === 'auto' && getCurrentPages().length > 1);
this.setData({
...layout,
_showBack,
_spacerHeight: fixed ? layout.totalNavHeight + 'px' : 'auto',
_navStyle: fixed
? `position: fixed; top: 0; left: 0; right: 0; z-index: ${zIndex};`
: '',
});
},
onBack() {
wx.navigateBack({ delta: 1 });
},
},
});
-18
View File
@@ -1,18 +0,0 @@
<view class="nav-spacer" style="height: {{_spacerHeight}}; {{_navStyle}}">
<view class="nav-wrap" style="background-color: {{bgColor}};">
<view style="height: {{statusBarHeight}}px;"></view>
<view class="nav-content" style="height: {{navBarHeight}}px; padding-right: {{navPaddingRight}}px;">
<view class="nav-left">
<block wx:if="{{_showBack}}">
<view class="back-btn" bind:tap="onBack">
<view class="back-arrow" style="border-left-color: {{arrowColor}}; border-bottom-color: {{arrowColor}};"></view>
</view>
</block>
<slot name="left" />
</view>
<view class="nav-center">
<text class="nav-title" style="color: {{color}};">{{title}}</text>
</view>
</view>
</view>
</view>
@@ -1,4 +0,0 @@
{
"component": true,
"usingComponents": {}
}
@@ -1,189 +0,0 @@
/* 遮罩层 */
.drawer-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(37, 37, 53, 0.6);
z-index: 100;
opacity: 0;
transition: opacity 0.3s ease;
&--visible {
opacity: 1;
}
}
/* 抽屉面板 */
.drawer-panel {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 85vh;
background-color: #FFFFFF;
border-radius: 24rpx 24rpx 0 0;
z-index: 101;
display: flex;
flex-direction: column;
transform: translateY(100%);
transition: transform 0.3s ease;
&--visible {
transform: translateY(0);
}
}
/* 拖拽把手 */
.drawer-handle {
width: 72rpx;
height: 6rpx;
background-color: #77849E;
border-radius: 3rpx;
margin: 32rpx auto 0;
}
/* 标题栏 */
.drawer-header {
width: 100%;
height: 100rpx;
padding: 30rpx;
box-sizing: border-box;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
border-bottom: 2rpx solid #EAEDF1;
.drawer-icon {
width: 40rpx;
height: 40rpx;
}
.drawer-title {
color: #252535;
height: 40rpx;
font-size: 32rpx;
font-weight: bolder;
line-height: 40rpx;
}
/* 关闭按钮 */
.drawer-close {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
.drawer-close-icon {
width: 28rpx;
height: 28rpx;
position: relative;
&::before,
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 3rpx;
background-color: #252535;
border-radius: 2rpx;
}
&::before {
transform: translate(-50%, -50%) rotate(45deg);
}
&::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
}
}
}
/* 用户滚动列表 */
.drawer-user-list {
flex: 1;
overflow: hidden;
}
.scrollViewContent {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
/* 用户行 */
.member-item {
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
padding: 24rpx 0;
border-bottom: 2rpx solid #EAEDF1;
/* 纯色占位头像 */
.member-avatar-placeholder {
width: 90rpx;
height: 90rpx;
border-radius: 24rpx;
}
/* 姓名 + 副标题 */
.member-info {
flex: 1;
height: 78rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 23rpx;
.member-name {
color: #333333;
height: 32rpx;
font-size: 32rpx;
font-weight: 500;
line-height: 32rpx;
white-space: nowrap;
}
.member-sub {
color: #77849E;
height: 34rpx;
font-size: 26rpx;
line-height: 34rpx;
white-space: nowrap;
}
}
.member-type {
height: 40rpx;
flex-shrink: 0;
.member-type-tag {
height: 40rpx;
padding: 0 14rpx;
font-size: 22rpx;
line-height: 40rpx;
border-radius: 6rpx;
}
.member-type-tag--self {
color: #1385FA;
background-color: rgba(19, 133, 250, 0.12);
}
.member-type-tag--employee {
color: #10B981;
background-color: rgba(16, 185, 129, 0.12);
}
.member-type-tag--family {
color: #F59E0B;
background-color: rgba(245, 158, 11, 0.12);
}
}
}
}
@@ -1,189 +0,0 @@
import { get } from '../../utils/request/index'
import { leFuService } from '../../lefu/index'
import { calcAge } from '../../utils/idCard/index'
/** GET /weighingScale/v5/select/addMembers/user 返回的单条结构 */
interface AddMemberApiItem {
id: string
realname: string
sex_dictText: '男' | '女'
birthday: string
height: number
weight: number
idCard: string | null
avatar: string | null
dataType?: number
relationType?: number | string | null
}
/** GET /weighingScale/v3/select/history/user 返回的单条结构 */
interface HistoryApiItem {
id: string
userId: string
realname: string
sex: number
height: number
birthday: string
avatar: string | null
relationType: number | string | null
dataType?: number
}
/** 抽屉内部用户项(含回填所需全量字段) */
interface ExistingMember {
id: string
name: string
gender: '男' | '女'
age: number
height: number
weight: number
idCard: string
avatar?: string
selected?: boolean
/** history 模式额外携带,供页面构建 userInfo */
userId?: string
sex?: number
birthday?: string
relationType?: number | string | null
/** 0=员工 1=家庭成员 */
dataType?: number
}
/**
* 选择已有用户抽屉组件
* Properties: show(控制显示)、source(数据来源:addMember/history)、excludeUserId(排除用户)
* Events: close(关闭), select(选中用户,携带 ExistingMember)
*/
Component({
properties: {
/** 是否显示抽屉 */
show: {
type: Boolean,
value: false
},
/** 数据来源模式:addMember=新增用户选择 / history=历史数据切换用户 */
source: {
type: String,
value: 'addMember'
},
/** 需要排除的用户 ID(history 模式下排除当前查看的用户) */
excludeUserId: {
type: String,
value: ''
}
},
data: {
/** 控制 wx:ifDOM 是否存在 */
innerShow: false,
/** 控制 --visible 类,触发 CSS transition */
animVisible: false,
/** 用户列表(组件内部拉取) */
members: [] as ExistingMember[]
},
observers: {
/**
* 监听外部 show 变化:
* 打开时先拉数据再展示抽屉;关闭时移除动画类后移除 DOM
*/
show(val: boolean) {
if (val) {
this._fetchMembers()
this.setData({ innerShow: true })
setTimeout(() => {
this.setData({ animVisible: true })
}, 20)
} else {
this.setData({ animVisible: false })
setTimeout(() => {
this.setData({ innerShow: false })
}, 300)
}
}
},
methods: {
/** 调接口获取可选用户列表,根据 source 调不同接口 */
_fetchMembers() {
const userInfo = wx.getStorageSync('userInfo') as { userId?: string } | null
const userId = userInfo?.userId ?? ''
wx.showLoading({ title: '加载中...', mask: true })
if (this.properties.source === 'history') {
const params: Record<string, string> = { userId }
if (this.properties.excludeUserId) {
params.userIdExclude = this.properties.excludeUserId
}
get<HistoryApiItem[]>('weighingScale/v3/select/history/user', params, { loading: false })
.then((res: any) => {
const members: ExistingMember[] = (res.result ?? []).map((item: HistoryApiItem) => ({
id: item.id,
name: item.realname,
gender: item.sex === 1 ? '男' : '女',
age: calcAge(item.birthday),
height: item.height,
weight: 0,
idCard: '',
avatar: item.avatar ?? '',
userId: item.userId,
sex: item.sex,
birthday: item.birthday,
relationType: item.relationType,
dataType: item.dataType,
}))
this.setData({ members })
})
.catch((err: any) => {
console.error('[selectMemberDrawer] 加载成员失败:', err)
wx.showToast({ title: err?.msg || err?.message || '加载失败', icon: 'none' })
})
.finally(() => {
wx.hideLoading()
})
} else {
const sn = leFuService.deviceInfo?.serialNumber ?? ''
get<AddMemberApiItem[]>('weighingScale/v5/select/addMembers/user', { userId, sn }, { loading: false })
.then((res: any) => {
const members: ExistingMember[] = (res.result ?? []).map((item: AddMemberApiItem) => ({
id: item.id,
name: item.realname,
gender: item.sex_dictText,
age: calcAge(item.birthday),
height: item.height,
weight: item.weight,
idCard: item.idCard ?? '',
avatar: item.avatar ?? '',
relationType: item.relationType,
dataType: item.dataType,
}))
this.setData({ members })
})
.catch((err: any) => {
console.error('[selectMemberDrawer] 加载成员失败:', err)
wx.showToast({ title: err?.msg || err?.message || '加载失败', icon: 'none' })
})
.finally(() => {
wx.hideLoading()
})
}
},
/** 点击遮罩关闭 */
onTapMask() {
this.triggerEvent('close')
},
/** 点击关闭按钮 */
onTapClose() {
this.triggerEvent('close')
},
/** 点击用户行,触发 select 事件 */
onTapMember(e: WechatMiniprogram.TouchEvent) {
const member = e.currentTarget.dataset.member as ExistingMember
this.triggerEvent('select', member)
}
}
})
@@ -1,61 +0,0 @@
<!-- 选择已有用户抽屉 -->
<block wx:if="{{ innerShow }}">
<!-- 遮罩 -->
<view class="drawer-mask {{ animVisible ? 'drawer-mask--visible' : '' }}" bind:tap="onTapMask"></view>
<!-- 抽屉面板 -->
<view class="drawer-panel {{ animVisible ? 'drawer-panel--visible' : '' }}">
<!-- 顶部拖拽把手 -->
<view class="drawer-handle"></view>
<!-- 标题栏 -->
<view class="drawer-header">
<view class="drawer-icon"></view>
<view class="drawer-title">选择本人添加的用户</view>
<view class="drawer-close" bind:tap="onTapClose">
<view class="drawer-close-icon"></view>
</view>
</view>
<!-- 用户列表 -->
<view class="drawer-user-list">
<block wx:if="{{ members.length }}">
<scroll-view class="~scrollView" scroll-y>
<view class="scrollViewContent">
<block wx:for="{{ members }}" wx:key="id">
<view class="member-item" bind:tap="onTapMember" data-member="{{ item }}">
<!-- 头像 -->
<view class="member-avatar-placeholder">
<image src="{{ item.gender === '女' ? '/images/woman.png' : '/images/man.png' }}" mode="aspectFit" />
</view>
<!-- 姓名 + 性别·年龄 -->
<view class="member-info">
<view class="member-name">{{ item.name }}</view>
<view class="member-sub">{{ item.gender }}·{{ item.age }}岁 丨 {{ item.height }}cm</view>
</view>
<view class="member-type">
<block wx:if="{{ item.relationType == 1 }}">
<view class="member-type-tag member-type-tag--self">本人</view>
</block>
<block wx:elif="{{ item.dataType === 0 }}">
<view class="member-type-tag member-type-tag--employee">员工</view>
</block>
<block wx:elif="{{ item.dataType === 1 }}">
<view class="member-type-tag member-type-tag--family">家庭用户</view>
</block>
</view>
</view>
</block>
</view>
</scroll-view>
</block>
<!-- 无用户:占位 -->
<block wx:else>
<empty-data text="暂无用户" />
</block>
</view>
</view>
</block>
@@ -1,139 +0,0 @@
.confirm-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.modal-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
opacity: 0;
transition: opacity 0.3s ease;
&.anim-visible {
opacity: 1;
}
}
.modal-content {
position: relative;
width: 660rpx;
background-color: #ffffff;
border-radius: 24rpx;
overflow: hidden;
transform: scale(0.9);
opacity: 0;
transition: all 0.3s ease;
&.anim-visible {
transform: scale(1);
opacity: 1;
}
}
.modal-header {
padding-top: 50rpx;
width: 100%;
margin-bottom: 30rpx;
.modal-title {
width: 100%;
height: 36rpx;
font-weight: bolder;
font-size: 36rpx;
color: #252535;
line-height: 36rpx;
text-align: center;
margin-bottom: 24rpx;
}
.modal-sub-title {
width: 100%;
height: 32rpx;
font-weight: 400;
font-size: 32rpx;
color: #1385FA;
line-height: 32rpx;
text-align: center;
}
}
.modal-body {
width: 100%;
box-sizing: border-box;
padding: 0 30rpx;
margin-bottom: 30rpx;
.modal-body-box {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
border-radius: 16rpx;
background-color: #F6F6F6;
.info-row {
width: 100%;
height: 80rpx;
display: flex;
padding: 10rpx 0;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
border-bottom: 1px solid #EAECF1;
.info-label {
color: #77849E;
height: 80rpx;
font-size: 28rpx;
line-height: 80rpx;
}
.info-value {
color: #252535;
height: 80rpx;
font-weight: 500;
font-size: 28rpx;
line-height: 80rpx;
}
&:last-of-type {
border-bottom: none;
}
}
}
}
.modal-footer {
width: 100%;
height: 110rpx;
display: flex;
border-top: 1rpx solid #EAECF1;
.modal-btn {
flex: 1;
height: 110rpx;
line-height: 110rpx;
font-size: 36rpx;
text-align: center;
}
.modal-btn-cancel {
color: #77849E;
border-right: 1rpx solid #EAECF1;
}
.modal-btn-confirm {
color: #1385FA;
font-weight: 500;
}
}
@@ -1,63 +0,0 @@
/**
* 用户信息确认弹框组件
* Properties: show(控制显示), userInfo(用户信息)
* Events: confirm(确认), cancel(取消)
*/
Component({
properties: {
/** 是否显示弹框 */
show: {
type: Boolean,
value: false
},
/** 用户信息数据 */
userInfo: {
type: Object,
value: {}
}
},
data: {
/** 控制 wx:ifDOM 是否存在 */
innerShow: false,
/** 控制 --visible 类,触发 CSS transition */
animVisible: false
},
observers: {
/**
* 监听外部 show 变化:
* 打开时先展示弹框再执行动画;关闭时移除动画类后移除 DOM
*/
show(val: boolean) {
if (val) {
this.setData({ innerShow: true })
setTimeout(() => {
this.setData({ animVisible: true })
}, 20)
} else {
this.setData({ animVisible: false })
setTimeout(() => {
this.setData({ innerShow: false })
}, 300)
}
}
},
methods: {
/** 点击遮罩关闭 */
onTapMask() {
this.triggerEvent('cancel')
},
/** 点击取消按钮 */
onTapCancel() {
this.triggerEvent('cancel')
},
/** 点击确认按钮 */
onTapConfirm() {
this.triggerEvent('confirm')
}
}
})
@@ -1,42 +0,0 @@
<view class="confirm-modal" wx:if="{{ innerShow }}">
<view class="modal-mask {{ animVisible ? 'anim-visible' : '' }}" bind:tap="onTapMask"></view>
<view class="modal-content {{ animVisible ? 'anim-visible' : '' }}">
<view class="modal-header">
<view class="modal-title">当前身份证号已存在</view>
<view class="modal-sub-title">是否直接复用信息?</view>
</view>
<block wx:if="{{ userInfo }}">
<view class="modal-body">
<view class="modal-body-box">
<view class="info-row">
<view class="info-label">姓名:</view>
<view class="info-value">{{ userInfo.realname }}</view>
</view>
<view class="info-row">
<view class="info-label">身份证号:</view>
<view class="info-value">{{ userInfo.idCard }}</view>
</view>
<view class="info-row">
<view class="info-label">性别:</view>
<view class="info-value">{{ userInfo.sex_dictText }}</view>
</view>
<view class="info-row">
<view class="info-label">身高:</view>
<view class="info-value">{{ userInfo.height }}cm</view>
</view>
<view class="info-row">
<view class="info-label">体重:</view>
<view class="info-value">{{ userInfo.weight }}kg</view>
</view>
</view>
</view>
</block>
<view class="modal-footer">
<view class="modal-btn modal-btn-cancel" bind:tap="onTapCancel">取消</view>
<view class="modal-btn modal-btn-confirm" bind:tap="onTapConfirm">确认</view>
</view>
</view>
</view>
@@ -1,58 +0,0 @@
.userManagementAddUser-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(37, 37, 53, 0.5);
z-index: 100;
}
.userManagementAddUser-panel {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 660rpx;
box-sizing: border-box;
padding: 48rpx 40rpx 56rpx;
background-color: #FFFFFF;
border-radius: 24rpx;
z-index: 101;
display: flex;
flex-direction: column;
align-items: center;
.userManagementAddUser-title {
color: #252535;
height: 36rpx;
font-size: 36rpx;
font-weight: bolder;
line-height: 36rpx;
margin-bottom: 48rpx;
}
.userManagementAddUser-btn {
width: 100%;
height: 96rpx;
font-size: 36rpx;
font-weight: bold;
text-align: center;
border-radius: 48rpx;
box-sizing: border-box;
&--primary {
color: #FFFFFF;
line-height: 96rpx;
background-color: #1385FA;
margin-bottom: 40rpx;
}
&--outline {
color: #1385FA;
line-height: 92rpx;
border: 2rpx solid #1385FA;
background-color: #FFFFFF;
}
}
}
@@ -1,26 +0,0 @@
Component({
properties: {
/** 是否显示弹框 */
show: {
type: Boolean,
value: false
}
},
methods: {
/** 点击遮罩关闭 */
onClose() {
this.triggerEvent('close')
},
/** 一键添加本人 */
onAddSelf() {
this.triggerEvent('addself')
},
/** 添加其他用户 */
onAddOther() {
this.triggerEvent('addother')
}
}
})
@@ -1,8 +0,0 @@
<block wx:if="{{ show }}">
<view class="userManagementAddUser-mask" bind:tap="onClose"></view>
<view class="userManagementAddUser-panel">
<view class="userManagementAddUser-title">添加用户</view>
<view class="userManagementAddUser-btn userManagementAddUser-btn--primary" bind:tap="onAddSelf">一键添加本人</view>
<view class="userManagementAddUser-btn userManagementAddUser-btn--outline" bind:tap="onAddOther">添加其他用户</view>
</view>
</block>

Some files were not shown because too many files have changed in this diff Show More