| @@ -1,279 +0,0 @@ | |||
| # 品网蓝牙体脂秤小程序插件 | |||
| 版本:V1.0.0 | |||
| 更新日期:2019年12月7日 | |||
| 深圳品网科技有限公司版权所有 | |||
| 本小程序插件的说明书如有变更,恕不另行通知。 | |||
| 深圳品网科技有限公司保留在不另行通知的情况下,对其中所包含的说明书和材料进行更改的权利,同时由于信任所引用的材料所造成的损害(包括结果性损害), | |||
| 包括但不限于印刷上的错误和其他与此出版物相关的错误,品网科技将不承担责任。 | |||
| # 前言 | |||
| 本文档是品网蓝牙体脂秤小程序插件开发帮助指南,描述了蓝牙体脂秤小程序插件的基本概念、提供的服务以及可用的API | |||
| # 1.简介 | |||
| 品网蓝牙体脂秤小程序插件(简称:插件)是一款基于微信小程序原生语言开发,为使用品网蓝牙模块的客户,提供解析蓝牙广播数据功能的插件; | |||
| 插件详细信息: | |||
| | appid | wxf6042009c5b19c52 | | |||
| |--- | --- | | |||
| | 名称 | 蓝牙体脂秤sdk | | |||
| # 2.使用方式 | |||
| 1.开发者可在"小程序管理后台->设置->第三方服务->插件管理",提交插件的接入申请 | |||
| 2.引入插件代码包:开发者需要在app.json中申明需要使用的插件 | |||
| 3.js接口使用:使用插件的 js 接口时,可以使用 requirePlugin 方法。 | |||
| Ps:详细使用方式,参考微信小程序官方开发文档:[https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html) | |||
| # 3.功能简介 | |||
| 解析原始蓝牙数据,返回基础数据 | |||
| 通过品网算法,对基础数据进行计算,返回17项身体指标参考结果 | |||
| 通过品网算法,对身体指标进行计算,返回身体指标评级参考结果 | |||
| # 4.开放接口 | |||
| ## 4.1基础数据 | |||
| ### 4.1.1获取广播称广播基础数据 | |||
| 适用蓝牙芯片协议: | |||
| 请求方法名:getBbroadcastData | |||
| 请求参数: | |||
| | 参数 | 必选 | 类型 | 说明 | | |||
| | --- | --- | --- | --- | | |||
| | device.advertisData | 是 | ArrayBuffer | 微信蓝牙接口onBluetoothDeviceFound,获取到的设备蓝牙广播数据流 | | |||
| 请求示例: | |||
| wx.onBluetoothDeviceFound((res) => { | |||
| res.devices.forEach(device => { | |||
| var fatData= plugin.getBbroadcastData(device.advertisData); | |||
| } | |||
| } | |||
| 返回数据: | |||
| | 参数名 | 类型 | 说明 | | |||
| | --- | --- | --- | | |||
| | adc | int | 阻抗 | | |||
| | address | string | 蓝牙地址 | | |||
| | algorithmType | int | 算法类型 | | |||
| | bleType | string | 蓝牙型号 | | |||
| | bleVersion | int | 蓝牙版本 | | |||
| | cmdType | int | 蓝牙广播命令标识(1:不稳定数据;2:体重稳定,阻抗测量中;3:稳定数据 ) | | |||
| | did | int | 设备标识did | | |||
| | temp | float | 温度 | | |||
| | unitType | int | 单位类型 | | |||
| | weight | float | 重量 | | |||
| 返回示例: | |||
| { | |||
| "adc": 0, | |||
| "address": "B4:C1:3C:1D:00:0E", | |||
| "algorithmType": 1, | |||
| "bleType": "15", | |||
| "bleVersion": 1, | |||
| "cmdType": 3, | |||
| "did": 0, | |||
| "temp": 6553.5, | |||
| "unitType": 4, | |||
| "weight": 53.7 | |||
| } | |||
| ## 4.2计算数据 | |||
| ### 4.2.1获取10项身体指标数据 | |||
| 请求方法名:getBodyDataByInet | |||
| 请求参数(请按照顺序,依次传入参数): | |||
| | 参数序号 | 必选 | 参数类型 | 说明 | | |||
| | --- | --- | --- | --- | | |||
| | 1 | 是 | int | 年龄(取值范围:0< 年龄 <= 120) | | |||
| | 2 | 是 | float | 身高(单位:厘米)(取值范围:0< 身高 <= 270) | | |||
| | 3 | 是 | int | 性别(1:男;2:女) | | |||
| | 4 | 是 | float | 重量(单位:千克)(取值范围:0< 重量 <= 220) | | |||
| | 5 | 是 | int | 阻抗((取值范围:0< 阻抗 <= 1000)) | | |||
| 请求示例: | |||
| var newinet = plugin.getBodyDataByInet(24, 170, 1, 60, 500); | |||
| 返回数据: | |||
| | 字段名 | 类型 | 说明 | | |||
| | --- | --- | --- | | |||
| | bfr | String | 体脂率(单位:%) | | |||
| | bm | float | 骨重(单位:kg) | | |||
| | bmi | float | 身体质量指数 | | |||
| | bmr | int | 基础新陈代谢率(单位:Kcal) | | |||
| | moi | float | 水分(单位:%) | | |||
| | pAge | string | 身体年龄(单位:年) | | |||
| | pp | float | 蛋白率(单位:%) | | |||
| | rom | float | 肌肉率(单位:%) | | |||
| | sfr | float | 皮下脂肪率(单位:%) | | |||
| | uvi | float | 内脏脂肪指数 | | |||
| 返回示例: | |||
| { | |||
| "bfr": "12.7", | |||
| "bm": 2.6, | |||
| "bmi": 20.7, | |||
| "bmr": 1413, | |||
| "moi": 63.8, | |||
| "pAge": "26", | |||
| "pp": 18.7, | |||
| "rom": 47.8, | |||
| "sfr": 11.4, | |||
| "uvi": 6 | |||
| } | |||
| ### 4.2.2获取身体指标数量数据 | |||
| 请求方法名:getBodyScaleDataByInet | |||
| 请求参数(请按照顺序,依次传入参数): | |||
| | 参数序号 | 必选 | 参数类型 | 说明 | | |||
| | --- | --- | --- | --- | | |||
| | 1 | 是 | int | 身高(单位:厘米)(取值范围:0< 身高 <= 270) | | |||
| | 2 | 是 | float | 重量(单位:千克)(取值范围:0< 重量 <= 220) | | |||
| | 3 | 是 | int | 性别(1:男;2:女) | | |||
| | 4 | 是 | float | 体脂率(百分比)(取值范围:0< 体脂率 <= 100) | | |||
| | 5 | 是 | float | 肌肉率(百分比)(取值范围:0< 肌肉率 <= 100) | | |||
| | 6 | 是 | float | 蛋白率(百分比)(取值范围:0< 蛋白率 <= 100) | | |||
| 请求示例: | |||
| var scaleFatData = plugin.getBodyScaleDataByInet(170, 60, 1, 12.7, 47.8, 18.7); | |||
| 返回数据: | |||
| | 字段名 | 类型 | 说明 | | |||
| | --- | --- | --- | | |||
| | controlWeight | float | 体重控制量(单位:kg) | | |||
| | fat | float | 脂肪量(单位:kg) | | |||
| | muscleMass | float | 肌肉量(单位:kg) | | |||
| | protein | float | 蛋白量(单位:kg) | | |||
| | removeFatWeight | float | 去脂体重(单位:kg) | | |||
| | standardWeight | float | 标准体重(单位:kg) | | |||
| 返回示例: | |||
| { | |||
| "controlWeight": -3, | |||
| "fat": 7.6, | |||
| "muscleMass": 28.7, | |||
| "protein": 11.2, | |||
| "removeFatWeight": 52.4, | |||
| "standardWeight": 63 | |||
| } | |||
| # 版本历史 | |||
| | 版本号 | 更新时间 | 作者 | 更新信息 | | |||
| | --- | --- | --- | --- | | |||
| | v1.0.0 | 2019/12/17 | Yann | 初始版本 | | |||
| | v1.0.1 | 2020/04/20 | lkz | 增加对2位小数的连接秤的支持 | | |||
| # FAQ | |||
| + 1:支持哪些设备? | |||
| 答: 本协议只支持BM15广播秤。 | |||
| + 2:蓝牙协议支持哪些单位? | |||
| 答:单位最多只支持4种(kg,lb,st,斤),具体支持什么单位请参照秤的出厂设置。 | |||
| + 3:扫描不到蓝牙设备? | |||
| 答:A.拔掉电池重启秤 B.检查秤是否已被其他手机连接,要求其断开(秤未被连接时,秤盘上蓝牙图标会不断闪烁) | |||
| + 4:扫描不到蓝牙设备? | |||
| 答:A.拔掉电池重启秤 B.检查秤是否已被其他手机连接,要求其断开(秤未被连接时,秤盘上蓝牙图标会不断闪烁) | |||
| + 5:为什么只能测到体重,没有其他体脂数据? | |||
| 答:必须脱掉鞋和袜子,光脚站在体脂秤的电极片上,才能测出体脂数据。 | |||
| + 6:称量时秤总是显示Error,app显示阻抗测量失败,是什么原因? | |||
| 答:脱掉鞋和袜子,光脚站在体脂秤的电极片上测量,就不会再显示Error。 | |||
| + 7:怎么得到全部身体数据? | |||
| 答: 首先调用 getBbroadcastData 方法解析广播称返回的基础数据,可得到体重和阻抗adc等数据, | |||
| 然后调用 getBodyDataByInet 方法获取到10项身体指标数据, | |||
| 再调用 getBodyScaleDataByInet 方法即可获取到6项身体指标数量数据 | |||
| var networkData = plugin.getBbroadcastData(device.advertisData); | |||
| var fatData = plugin.getBodyDataByInet(age, height ,sex,networkData.weight,networkData.adc); | |||
| var scaleFatData = plugin.getBodyScaleDataByInet(height, networkData.weight, sex, fatData.bfr, fatData.rom, fatData.pp) | |||
| + 8: 是否有各项体脂数据的判定标准和文案呢? | |||
| 答:体脂判定标准各厂商标准都可能不一样,目前并没有行业公认的参考标准。如下是我司使用的标准,仅供参考: 《蓝牙体脂秤判定标准及小程序文案20200416》https://shimo.im/sheets/8dGqCgyhX9P6Xpcw/GX3qk/ | |||
| # 联系我们 | |||
| 深圳市易连物联网有限公司 | |||
| 电话:0755-81773367 | |||
| 官网:www.elinkthings.com | |||
| 邮箱:app@elinkthings.com | |||
| @@ -1,5 +0,0 @@ | |||
| //app.js | |||
| App({ | |||
| onLaunch: function () { | |||
| } | |||
| }) | |||
| @@ -1,13 +0,0 @@ | |||
| { | |||
| "pages": [ | |||
| "pages/index/index", | |||
| "pages/BluetoothLink/BluetoothLink" | |||
| ], | |||
| "plugins": { | |||
| "myPlugin": { | |||
| "version": "1.0.0", | |||
| "provider": "wxf6042009c5b19c52" | |||
| } | |||
| }, | |||
| "sitemapLocation": "sitemap.json" | |||
| } | |||
| @@ -1,10 +0,0 @@ | |||
| /**app.wxss**/ | |||
| .container { | |||
| height: 100%; | |||
| display: flex; | |||
| flex-direction: column; | |||
| align-items: center; | |||
| justify-content: space-between; | |||
| padding: 200rpx 0; | |||
| box-sizing: border-box; | |||
| } | |||
| @@ -1,360 +0,0 @@ | |||
| var plugin = requirePlugin("myPlugin") | |||
| //var plugin = require("../../plugins/index.js"); | |||
| const app = getApp(); | |||
| function inArray(arr, key, val) { | |||
| for (let i = 0; i < arr.length; i++) { | |||
| if (arr[i][key] === val) { | |||
| return i; | |||
| } | |||
| } | |||
| return -1; | |||
| } | |||
| Page({ | |||
| data: { | |||
| list: [], | |||
| devices: [], // | |||
| dev1: "已发现", | |||
| dev2: "台设备", | |||
| data: {}, | |||
| dainji: "绑定设备", | |||
| shebei: "", | |||
| headTip: '下拉刷新', | |||
| indx: "0", | |||
| // 显示隐藏 | |||
| showView: true, | |||
| deviceInfo: ({ | |||
| macAddress: "", | |||
| name: "", | |||
| advertisData: "", | |||
| }) | |||
| }, | |||
| onLoad: function() { | |||
| var that = this; | |||
| // that.setData({ | |||
| // list: [], | |||
| // devices: [], | |||
| // }); | |||
| // 获取设备列表 | |||
| // that.openBluetoothAdapter(); | |||
| // console.log("openBluetoothAdapter"); | |||
| }, | |||
| // 点击切换显示隐藏 | |||
| onShow: function() { | |||
| var that = this; | |||
| that.setData({ | |||
| list: [], | |||
| devices: [], | |||
| }); | |||
| // that.refreshInterface(); | |||
| that.openBluetoothAdapter(); | |||
| setTimeout(() => { | |||
| var deviceInfo = wx.getStorageSync('deviceInfo') | |||
| console.log(deviceInfo); | |||
| if (deviceInfo == "1" || deviceInfo == null) { | |||
| that.setData({ | |||
| dainji: "绑定设备", | |||
| }); | |||
| } else { | |||
| // if (deviceInfo.macAddress.length == 9) { | |||
| // that.setData({ | |||
| // dainji: "绑定设备", | |||
| // }); | |||
| // }else{ | |||
| // that.setData({ | |||
| // dainji: "绑定设备", | |||
| // dev1: "已发现:", | |||
| // dev2: "台设备,已连接", | |||
| // shebei:wx.getStorageSync('deviceInfo').macAddress | |||
| // }); | |||
| // } | |||
| } | |||
| }, 1000) | |||
| }, | |||
| onHide: function() { | |||
| var that = this; | |||
| that.stopBluetoothDevicesDiscovery(); | |||
| }, | |||
| onPullDownRefresh: function() { | |||
| console.log('下拉刷新') | |||
| var that = this; | |||
| that.setData({ | |||
| list: [], | |||
| devices: [], | |||
| }); | |||
| that.openBluetoothAdapter(); | |||
| wx.showNavigationBarLoading() //在标题栏中显示加载 | |||
| setTimeout(() => { | |||
| wx.hideNavigationBarLoading() //完成停止加载 | |||
| wx.stopPullDownRefresh() //停止下拉刷新 | |||
| }, 3000) | |||
| }, | |||
| // 官方广播称开始 | |||
| openBluetoothAdapter: function() { | |||
| wx.openBluetoothAdapter({ | |||
| success: (res) => { | |||
| console.log('openBluetoothAdapter success', res) | |||
| this.startBluetoothDevicesDiscovery() | |||
| this.setData({ // 我们不一样 | |||
| shebei: ",请稍后", | |||
| dev1: "已发现", | |||
| dev2: "台设备", | |||
| }) | |||
| }, | |||
| fail: (res) => { | |||
| if (res.errCode === 10001) { | |||
| wx.onBluetoothAdapterStateChange(function(res) { | |||
| console.log('onBluetoothAdapterStateChange', res) | |||
| if (res.available) { | |||
| this.startBluetoothDevicesDiscovery() | |||
| } | |||
| }) | |||
| } | |||
| this.setData({ // 我们不一样 | |||
| shebei: "请开启手机蓝牙", | |||
| dev1: "", | |||
| dev2: "", | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| getBluetoothAdapterState() { | |||
| wx.getBluetoothAdapterState({ | |||
| success: (res) => { | |||
| // console.log('getBluetoothAdapterState', res) | |||
| if (res.discovering) { | |||
| this.onBluetoothDeviceFound() | |||
| } else if (res.available) { | |||
| this.startBluetoothDevicesDiscovery() | |||
| } | |||
| } | |||
| }) | |||
| }, | |||
| startBluetoothDevicesDiscovery() { | |||
| wx.startBluetoothDevicesDiscovery({ | |||
| // services: [AICARE_SERVICE_UUID, aicare_service_uuid_android], | |||
| allowDuplicatesKey: true, | |||
| success: (res) => { | |||
| console.log('startBluetoothDevicesDiscovery success', res) | |||
| this.onBluetoothDeviceFound() | |||
| }, | |||
| }) | |||
| }, | |||
| onBluetoothDeviceFound() { | |||
| console.log("reresresresresress"); | |||
| wx.onBluetoothDeviceFound((res) => { | |||
| console.log(res); | |||
| res.devices.forEach(device => { | |||
| if (device.advertisServiceUUIDs == null || device.advertisServiceUUIDs.length == 0) { | |||
| var data15 = plugin.getBbroadcastData(device.advertisData); | |||
| if (data15 != null) { | |||
| console.log("广播秤"); | |||
| device.advertisData = data15.address; | |||
| device.name = "icomon15"; | |||
| const foundDevices = this.data.devices | |||
| const idx = inArray(foundDevices, 'deviceId', device.deviceId) | |||
| const data = {} | |||
| if (idx === -1) { | |||
| data[`devices[${foundDevices.length}]`] = device | |||
| } else { | |||
| data[`devices[${idx}]`] = device | |||
| } | |||
| console.log(device); | |||
| this.setData(data) | |||
| } | |||
| } else { | |||
| console.log("不是我们的秤"); | |||
| } | |||
| }) | |||
| }) | |||
| }, | |||
| stopBluetoothDevicesDiscovery() { | |||
| wx.stopBluetoothDevicesDiscovery( | |||
| console.log("蓝牙搜索已关闭") | |||
| ) | |||
| }, | |||
| closeBluetoothAdapter() { | |||
| wx.closeBluetoothAdapter() | |||
| console.log("蓝牙模块已关闭") | |||
| }, | |||
| //点击绑定设备处理 | |||
| bindViewTap: function(e) { | |||
| var that = this; | |||
| console.log('点击事件--绑定对应的秤'); | |||
| wx.closeBLEConnection({ | |||
| deviceId: wx.getStorageSync('deviceInfo').macAddress, | |||
| success(res) { | |||
| console.log(res) | |||
| } | |||
| }) | |||
| that.stopBluetoothDevicesDiscovery(); // 关闭蓝牙搜索 | |||
| console.log(e.currentTarget.dataset.title); | |||
| console.log(e.currentTarget.dataset.name); | |||
| console.log(e.currentTarget.dataset.macaddress); | |||
| if (e.currentTarget.dataset.name != "icomon15") { | |||
| console.log('点击连接--连接秤'); | |||
| wx.showLoading({ | |||
| title: '正在连接....', | |||
| }) | |||
| // 初适化蓝牙模块 | |||
| wx.openBluetoothAdapter({ | |||
| success: function(res) {}, | |||
| fail: function() { | |||
| wx.showToast({ | |||
| title: '启动蓝牙失败,请开启蓝牙', | |||
| icon: 'noine', | |||
| duration: 1500, | |||
| }) | |||
| } | |||
| }) | |||
| wx.createBLEConnection({ | |||
| deviceId: e.currentTarget.dataset.title, | |||
| success: function(res) { | |||
| console.log('连接成功'); | |||
| console.log(res); | |||
| wx.hideLoading() | |||
| wx.showToast({ | |||
| title: '绑定成功', | |||
| icon: 'success', | |||
| duration: 1000, | |||
| }) | |||
| that.setData({ // 我们不一样 | |||
| deviceInfo: ({ | |||
| macAddress: e.currentTarget.dataset.title, | |||
| name: e.currentTarget.dataset.name, | |||
| advertisData: e.currentTarget.dataset.advertisData, | |||
| macdidname: e.currentTarget.dataset.macdidname | |||
| }) | |||
| }) | |||
| wx.setStorageSync("deviceInfo", that.data.deviceInfo); | |||
| console.log("新绑定设备信息:") | |||
| console.log(wx.getStorageSync('deviceInfo')) | |||
| wx.switchTab({ | |||
| url: '../index/index' | |||
| }) | |||
| }, | |||
| fail: function(res) { | |||
| console.log('连接秤连接失败'); | |||
| console.log(res); | |||
| wx.hideLoading() | |||
| console.log(res); | |||
| wx.showToast({ | |||
| title: '连接失败,再试试', | |||
| icon: 'none', | |||
| duration: 2000, | |||
| }) | |||
| } | |||
| }) | |||
| } else { | |||
| // 广播秤BM15 连接 | |||
| // 初适化蓝牙模块 | |||
| wx.showLoading({ | |||
| title: '正在绑定广播....', | |||
| }) | |||
| wx.closeBluetoothAdapter({ | |||
| success: function(res) { | |||
| console.log(res) | |||
| wx.hideLoading() | |||
| wx.showToast({ | |||
| title: '广播秤绑定成功', | |||
| icon: 'success', | |||
| duration: 1000, | |||
| }) | |||
| that.setData({ // 我们不一样 | |||
| deviceInfo: ({ | |||
| macAddress: e.currentTarget.dataset.title, | |||
| name: e.currentTarget.dataset.name, | |||
| advertisData: e.currentTarget.dataset.advertisData, | |||
| macdidname: e.currentTarget.dataset.macdidname, | |||
| }) | |||
| }) | |||
| wx.setStorageSync("deviceInfo", that.data.deviceInfo); | |||
| wx.setStorageSync("devMacAddress", e.currentTarget.dataset.macaddress); | |||
| console.log("新绑定设备信息:" + e.currentTarget.dataset.macaddress); | |||
| // wx.switchTab({ | |||
| // url: '../index/index' | |||
| // }) | |||
| wx.navigateTo({ | |||
| url: '../index/index' | |||
| }) | |||
| } | |||
| }) | |||
| } | |||
| // 跳转回主界面 | |||
| // wx.switchTab({ | |||
| // url: '../measure/measure' | |||
| // }) | |||
| }, | |||
| }) | |||
| @@ -1,4 +0,0 @@ | |||
| { | |||
| "navigationBarTitleText": "搜索设备", | |||
| "enablePullDownRefresh": true | |||
| } | |||
| @@ -1,61 +0,0 @@ | |||
| <wxs module="utils"> | |||
| module.exports.max = function(n1, n2) { | |||
| return Math.max(n1, n2) | |||
| } | |||
| module.exports.len = function(arr) { | |||
| arr = arr || [] | |||
| return arr.length | |||
| } | |||
| </wxs> | |||
| <view class="topView"> | |||
| <view class="op-topView">{{headTip}}</view> | |||
| </view> | |||
| <view class="ming"> {{dev1}} {{devices.length}} {{dev2}} {{shebei}}</view> | |||
| <view wx:for="{{devices}}" wx:for-item="item" | |||
| data-title="{{item.deviceId}}" | |||
| data-name="{{item.name}}" | |||
| data-macaddress="{{item.advertisData}}" | |||
| data-advertisData="{{item.advertisServiceUUIDs}}" | |||
| wx:key="{{item.deviceId}}" bindtap="bindViewTap"> | |||
| <view class="cell-item"> | |||
| <view class="cell-head"> | |||
| <view >名称:{{item.name}}</view> | |||
| <view >信号强度::{{item.RSSI}}dBm ({{utils.max(0, item.RSSI + 100)}}%)</view> | |||
| <view class='cell-head-id'>地址:{{item.advertisData}}</view> | |||
| </view> | |||
| <view class="cell-click"> | |||
| <text>{{dainji}}</text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <!-- 没有找到设备 | |||
| <view class="hide{{showView?'show':''}}" bindtap="onChangeShowState"> | |||
| <image src='../Image/timg.jpg'></image> | |||
| </view> | |||
| <button bindtap="openBluetoothAdapter">开始扫描</button> | |||
| <button bindtap="stopBluetoothDevicesDiscovery">停止扫描</button> | |||
| <button bindtap="closeBluetoothAdapter">结束流程</button> | |||
| <view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view> | |||
| <scroll-view class="device_list" scroll-y scroll-with-animation> | |||
| <view wx:for="{{devices}}" wx:key="index" | |||
| data-device-id="{{item.deviceId}}" | |||
| data-name="{{item.name || item.localName}}" | |||
| bindtap="createBLEConnection" | |||
| class="device_item" | |||
| hover-class="device_item_hover"> | |||
| <view style="font-size: 16px; color: #333;">{{item.name}}</view> | |||
| <view style="font-size: 10px">信号强度: {{item.RSSI}}dBm ({{utils.max(0, item.RSSI + 100)}}%)</view> | |||
| <view style="font-size: 10px">UUID: {{item.deviceId}}</view> | |||
| <view style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view> | |||
| </view> | |||
| </scroll-view> | |||
| --> | |||
| @@ -1,122 +0,0 @@ | |||
| page { | |||
| background: #f4f4f4; | |||
| } | |||
| .topView { | |||
| width: 100%; | |||
| height: 20rpx; | |||
| font-size: 25rpx; | |||
| color: #898c92; | |||
| display: flex; | |||
| justify-content:center; | |||
| align-content: center; | |||
| } | |||
| .ming{ | |||
| width: 100%; | |||
| height: 100rpx; | |||
| font-size: 35rpx; | |||
| color: #9F832B; | |||
| line-height: 100rpx; | |||
| text-align: center; | |||
| } | |||
| .cell-item { | |||
| padding-top: 10px; | |||
| padding-bottom: 10px; | |||
| height: 120rpx; | |||
| width: 100%; | |||
| background-color: white; | |||
| display: flex; | |||
| flex-direction: row; | |||
| align-items: center; | |||
| justify-content: space-between; | |||
| border-bottom: 1px solid #b6b6b6; | |||
| } | |||
| .cell-head { | |||
| margin-left: 30rpx; | |||
| flex-direction: row-reverse; | |||
| } | |||
| .cell-head view{ | |||
| font-size: 25rpx; | |||
| color: #333; | |||
| } | |||
| .cell-head .cell-head-id{ | |||
| font-size: 30rpx; | |||
| color: #333; | |||
| } | |||
| .cell-click { | |||
| display: block; | |||
| width: 180rpx; | |||
| height:70rpx; | |||
| border: 3rpx #14abc0 solid; | |||
| line-height: 70rpx; | |||
| text-align: center; | |||
| margin-right: 30rpx; | |||
| font-size: 30rpx; | |||
| } | |||
| .cell-click:hover { | |||
| border: 3rpx gold solid; | |||
| } | |||
| .hide{ | |||
| display: none; | |||
| } | |||
| .show{ | |||
| display: block; | |||
| } | |||
| image{ | |||
| width: 100%; | |||
| display: block; | |||
| opacity: 0.2; | |||
| } | |||
| .devices_summary { | |||
| margin-top: 30px; | |||
| padding: 10px; | |||
| font-size: 16px; | |||
| } | |||
| .device_list { | |||
| height: 300px; | |||
| margin: 50px 5px; | |||
| margin-top: 0; | |||
| border: 1px solid #EEE; | |||
| border-radius: 5px; | |||
| width: auto; | |||
| } | |||
| .device_item { | |||
| border-bottom: 1px solid #EEE; | |||
| padding: 10px; | |||
| color: #666; | |||
| } | |||
| .device_item_hover { | |||
| background-color: rgba(0, 0, 0, .1); | |||
| } | |||
| .connected_info { | |||
| position: fixed; | |||
| bottom: 0; | |||
| width: 100%; | |||
| background-color: #F0F0F0; | |||
| padding: 10px; | |||
| padding-bottom: 20px; | |||
| margin-bottom: env(safe-area-inset-bottom); | |||
| font-size: 14px; | |||
| min-height: 100px; | |||
| box-shadow: 0px 0px 3px 0px; | |||
| } | |||
| .connected_info .operation { | |||
| position: absolute; | |||
| display: inline-block; | |||
| right: 30px; | |||
| } | |||
| @@ -1,512 +0,0 @@ | |||
| var app = getApp(); | |||
| var util = require('../../utils/util.js'); | |||
| var plugin = requirePlugin("myPlugin"); | |||
| //var plugin = require("../../plugins/index.js"); | |||
| var deviceInfo_address = "" | |||
| var deviceInfo = "" | |||
| Page({ | |||
| /** | |||
| * 页面的初始数据 | |||
| */ | |||
| data: { | |||
| userInfo: {}, | |||
| deviceID_wxml: '', | |||
| array: ['100', '101', '102', '103', '104', '105', '106', '107', '108', '109', | |||
| '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', | |||
| '120', '121', '122', '123', '124', '125', '126', '127', '128', '129', | |||
| '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', | |||
| '140', '141', '142', '143', '144', '145', '146', '147', '148', '149', | |||
| '150', '151', '152', '153', '154', '155', '156', '157', '158', '159', | |||
| '160', '161', '162', '163', '164', '165', '166', '167', '168', '169', | |||
| '170', '171', '172', '173', '174', '175', '176', '177', '178', '179', | |||
| '180', '181', '182', '183', '184', '185', '186', '187', '188', '189', | |||
| '190', '191', '192', '193', '194', '195', '196', '197', '198', '199', | |||
| '200', '201', '202', '203', '204', '205', '206', '207', '208', '209', | |||
| '210', '211', '212', '213', '214', '215', '216', '217', '218', '219'], | |||
| isUnitShow: false, | |||
| isSexShow: false, | |||
| sex: '男', | |||
| man_image: '../Image/radio.png', | |||
| women_image: '../Image/radio-1.png', | |||
| briday: '1990-05-10', | |||
| endTime: '2020-09-01', | |||
| height: '160', | |||
| index: 62, // 必须写下来用来指向身高数组的下指标 | |||
| unit: '%', | |||
| UD_unit:"kg", | |||
| kcal: "kcal", | |||
| kg_unit: '../Image/radio-1.png', | |||
| jin_unit: '../Image/radio.png', | |||
| edition: 'V1.0', | |||
| hasUserInfo: false, | |||
| wanShow: false, | |||
| linksToPrompt: "提示", | |||
| }, | |||
| bindViewTap: function () { | |||
| wx.openSetting({ | |||
| success: (res) => { | |||
| } | |||
| }) | |||
| }, | |||
| onShow: function () { | |||
| // 从存储中拿出连接的设备ID | |||
| var that = this; | |||
| var fatData = plugin.getBodyDataByInet(27, 170, 1, 60, 500);//年龄 身高 性别 重量 阻抗 | |||
| console.log("fatData" , fatData); | |||
| var scaleFatData = plugin.getBodyScaleDataByInet(170, 60, 1, fatData.bfr, fatData.rom, fatData.pp);//身高 体重 性别 体脂率 肌肉率 蛋白率 | |||
| console.log("scaleFatData", scaleFatData); | |||
| //console.log("height:", obtainHeight("170")); | |||
| //判断蓝牙是否开启 | |||
| that.longnv(); | |||
| deviceInfo = wx.getStorageSync('deviceInfo'); | |||
| deviceInfo_address = wx.getStorageSync('devMacAddress') | |||
| if (deviceInfo != undefined && deviceInfo != null && deviceInfo != "" && deviceInfo != "1") { | |||
| } else { | |||
| that.setData({ | |||
| linksToPrompt: '未绑定设备', | |||
| }); | |||
| } | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| var that = this | |||
| //判断蓝牙是否开启 | |||
| that.longnv(); | |||
| if (wx.getStorageSync('userInfo').avatarUrl == null || wx.getStorageSync('userInfo').nickName == null) { | |||
| that.setData({ | |||
| wanShow: !that.data.wanShow | |||
| }) | |||
| } else { | |||
| this.setData({ | |||
| userInfo: wx.getStorageSync('userInfo') | |||
| }) | |||
| } | |||
| // 拿到当前日期(如:2017-06-06) | |||
| var time2 = util.forNowTime(new Date()); | |||
| that.setData({ | |||
| endTime: time2, | |||
| }) | |||
| // 拿到生日 | |||
| wx.getStorage({ | |||
| key: 'UserBriday', | |||
| success: function (res) { | |||
| that.briday = res.data; | |||
| that.theSaveBriday(that.briday); | |||
| }, fail: function (res) { | |||
| wx.setStorageSync('UserBriday', "1990-05-10") | |||
| } | |||
| }) | |||
| // 拿到身高 | |||
| wx.getStorage({ | |||
| key: 'UserHight', | |||
| success: function (res) { | |||
| that.height = res.data; | |||
| that.theSaveHeight(that.height); | |||
| }, fail: function (res) { | |||
| wx.setStorageSync('UserHight', "160") | |||
| } | |||
| }) | |||
| // 拿到性别 | |||
| wx.getStorage({ | |||
| key: 'UserSex', | |||
| success: function (res) { | |||
| that.sex = res.data; | |||
| that.theSavedSex(that.sex); | |||
| }, | |||
| }) | |||
| // 拿到单位 | |||
| wx.getStorage({ | |||
| key: 'UserUnit', | |||
| success: function (res) { | |||
| that.unit = res.data; | |||
| that.theSavedUnit(that.unit); | |||
| }, | |||
| }) | |||
| }, | |||
| // 拿到生日--重新刷UI | |||
| theSaveBriday: function (bridayString) { | |||
| this.setData({ | |||
| briday: bridayString, | |||
| }); | |||
| }, | |||
| // 拿到身高--刷新UI | |||
| theSaveHeight: function (heightString) { | |||
| this.setData({ | |||
| index: heightString - 100, | |||
| }) | |||
| }, | |||
| // 拿到性别--重新刷UI | |||
| theSavedSex: function (sexString) { | |||
| if (sexString == "男") { | |||
| this.setData({ | |||
| sex: "男", | |||
| man_image: '../Image/radio-1.png', | |||
| women_image: '../Image/radio.png', | |||
| }) | |||
| } else { | |||
| this.setData({ | |||
| sex: "女", | |||
| women_image: '../Image/radio-1.png', | |||
| man_image: '../Image/radio.png', | |||
| }) | |||
| } | |||
| wx.setStorage({ | |||
| key: 'UserSex', | |||
| data: sexString, | |||
| }) | |||
| }, | |||
| ///////// ****** 调用点击方法 ******* //////////////// | |||
| //** 性别 **// | |||
| sexClick: function (res) { | |||
| this.setData({ | |||
| isSexShow: !this.data.isSexShow | |||
| }) | |||
| }, | |||
| manClick: function () { | |||
| this.setData({ | |||
| sex: '男', | |||
| man_image: '../Image/radio-1.png', | |||
| women_image: '../Image/radio.png', | |||
| }); | |||
| wx.setStorage({ | |||
| key: 'UserSex', | |||
| data: this.data.sex, | |||
| }) | |||
| }, | |||
| womanClick: function () { | |||
| this.setData({ | |||
| sex: '女', | |||
| women_image: '../Image/radio-1.png', | |||
| man_image: '../Image/radio.png', | |||
| }); | |||
| wx.setStorage({ | |||
| key: 'UserSex', | |||
| data: this.data.sex, | |||
| }) | |||
| }, | |||
| //** 生日 **// | |||
| bindDateChange: function (res) { | |||
| this.setData({ | |||
| briday: res.detail.value | |||
| }); | |||
| wx.setStorage({ | |||
| key: 'UserBriday', | |||
| data: this.data.briday, | |||
| }) | |||
| }, | |||
| //** 身高 **// | |||
| bindHightChange: function (res) { | |||
| var numberValue = parseInt(res.detail.value)+100; | |||
| this.setData({ | |||
| index: res.detail.value | |||
| }); | |||
| wx.setStorage({ | |||
| key: 'UserHight', | |||
| data: numberValue, | |||
| }) | |||
| }, | |||
| //** 解除绑定 **/ | |||
| dismissDevice: function (res) { | |||
| wx.navigateTo({ | |||
| url: '../BluetoothLink/BluetoothLink' | |||
| }) | |||
| }, | |||
| /** 搜索蓝牙设备 **/ | |||
| linkBleButton: function () { | |||
| wx.navigateTo({ | |||
| url: '../BluetoothLink/BluetoothLink' | |||
| }) | |||
| }, | |||
| /** 自动连接蓝牙设备 **/ | |||
| longnv: function () { | |||
| var that = this; | |||
| if (deviceInfo != null && deviceInfo != "1") { | |||
| if (wx.getStorageSync('deviceInfo').name == "icomon15") { | |||
| wx.openBluetoothAdapter({ | |||
| success: function (res) { | |||
| deviceInfo_address = wx.getStorageSync('devMacAddress') | |||
| that.setData({ | |||
| linksToPrompt: "已绑定广播称:" + wx.getStorageSync('devMacAddress')+",请上秤", | |||
| }); | |||
| // 保持监测 | |||
| // 蓝牙已开启 开始 | |||
| that.openBluetoothAdapter(); | |||
| }, fail: function (res) { | |||
| // console.log("开启模块失败!"); | |||
| that.setData({ | |||
| linksToPrompt: '请开启手机蓝牙', | |||
| }); | |||
| //重新搜索 | |||
| setTimeout(function () { | |||
| that.longnv(); | |||
| }, 2000) | |||
| }, | |||
| }) | |||
| } else { | |||
| // 已绑定连接秤 重新连接 | |||
| wx.showLoading({ | |||
| title: '重新连接中....', | |||
| icon: 'none', | |||
| duration: 2000, | |||
| }) | |||
| wx.openBluetoothAdapter({ | |||
| success: function (res) { | |||
| wx.createBLEConnection({ | |||
| deviceId: wx.getStorageSync('deviceInfo').macAddress, | |||
| success: function (res) { | |||
| console.log('连接成功'); | |||
| console.log(res); | |||
| wx.hideLoading() | |||
| deviceInfo_address = wx.getStorageSync('devMacAddress') | |||
| that.setData({ | |||
| linksToPrompt: '已连接' + wx.getStorageSync('devMacAddress') + ',请上秤', | |||
| }); | |||
| that.link_device(); | |||
| }, | |||
| fail: function (res) { | |||
| console.log('连接秤连接失败'); | |||
| console.log(res); | |||
| wx.hideLoading() | |||
| console.log(res); | |||
| wx.showToast({ | |||
| title: '自动连接失败,手动连接', | |||
| icon: 'none', | |||
| duration: 2000, | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| fail: function () { | |||
| wx.showToast({ | |||
| title: '请开启手机蓝牙', | |||
| icon: 'none', | |||
| duration: 2000, | |||
| }) | |||
| that.setData({ | |||
| linksToPrompt: '请开启手机蓝牙', | |||
| }); | |||
| } | |||
| }) | |||
| } | |||
| } else { | |||
| that.setData({ | |||
| linksToPrompt: '未绑定设备', | |||
| }); | |||
| } | |||
| }, | |||
| /** 监听蓝牙 广播开始 **/ | |||
| openBluetoothAdapter: function () { | |||
| var that = this; | |||
| wx.openBluetoothAdapter({ | |||
| success: (res) => { | |||
| console.log('openBluetoothAdapter success', res) | |||
| that.startBluetoothDevicesDiscovery() | |||
| }, | |||
| fail: (res) => { | |||
| if (res.errCode === 10001) { | |||
| wx.onBluetoothAdapterStateChange(function (res) { | |||
| // console.log('onBluetoothAdapterStateChange', res) | |||
| if (res.available) { | |||
| this.startBluetoothDevicesDiscovery() | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| }) | |||
| }, | |||
| /** 监听广播 **/ | |||
| startBluetoothDevicesDiscovery() { | |||
| wx.startBluetoothDevicesDiscovery({ | |||
| allowDuplicatesKey: true, | |||
| interval: 0, | |||
| success: (res) => { | |||
| console.log('startBluetoothDevicesDiscovery success', res) | |||
| this.onBluetoothDeviceFound() | |||
| }, | |||
| fail: (res) => { | |||
| console.log('开始搜索失败', res) | |||
| } | |||
| }) | |||
| }, | |||
| /** 接收广播数据,解析数据 **/ | |||
| onBluetoothDeviceFound() { | |||
| wx.onBluetoothDeviceFound((res) => { | |||
| res.devices.forEach(device => { | |||
| if (device.advertisServiceUUIDs == null || device.advertisServiceUUIDs.length == 0) { //判断是否为15设备 | |||
| if (deviceInfo != "1" && deviceInfo != null && deviceInfo.macAddress.length != 9) { //判断是否已经绑定设备 | |||
| var networkData = plugin.getBbroadcastData(device.advertisData);//获取广播称基础数据 | |||
| if (networkData != null && networkData.address == deviceInfo_address) {//判断基础数据是否为空,广播数据的mac地址是否等于绑定设备mac地址 | |||
| var sex = obtainSex(this.data.sex);//获取用户性别 | |||
| var age = obtainAge(this.data.briday);//获取用户年龄、 | |||
| var heigjtObt = obtainHeight(); | |||
| console.log("sex:" + sex + ";age:" + age + ";height:" + heigjtObt); | |||
| if (networkData.cmdType == 3) {//称重数据稳定,阻抗测量结束 | |||
| if (networkData.adc > 0) { //有阻抗时 | |||
| var fatData = plugin.getBodyDataByInet(age, heigjtObt ,sex,networkData.weight,networkData.adc);//年龄,身高,性别,重量,阻抗 | |||
| this.setData({ | |||
| weightsum: networkData.weight.toFixed(1), ///<重量 + | |||
| adc: networkData.adc, ///<阻抗 | |||
| BMI: fatData.bmi, ///<BMI | |||
| fatRate: fatData.bfr, ///<体脂率 | |||
| muscle: fatData.rom, ///<肌肉率 | |||
| moisture: fatData.moi, ///<水份 | |||
| boneMass: fatData.bm, ///<骨量 | |||
| BMR: fatData.bmr, ///<基础代谢率 | |||
| visceralFat: fatData.uvi, ///<内脏脂肪 | |||
| subcutaneousFat: fatData.sfr, ///<皮下脂肪 | |||
| proteinRate: fatData.pp, ///<蛋白率 | |||
| physicalAge: fatData.pAge, ///<生理年龄 | |||
| temp: networkData.temp, ////温度 | |||
| did: networkData.did, ////did | |||
| linksToPrompt: "测量完成", | |||
| unit: "%" | |||
| }); | |||
| var scaleFatData = plugin.getBodyScaleDataByInet(heigjtObt, networkData.weight, sex, fatData.bfr, fatData.rom, fatData.pp);//身高 体重 性别 体脂率 肌肉率 蛋白率 | |||
| this.setData({ | |||
| standardWeight: scaleFatData.standardWeight, //标准体重 | |||
| controlWeight: scaleFatData.controlWeight, //体重控制量 | |||
| fat: scaleFatData.fat, //脂肪量 | |||
| removeFatWeight: scaleFatData.removeFatWeight, //去脂肪体重 | |||
| muscleMass: scaleFatData.muscleMass, //肌肉量 | |||
| protein: scaleFatData.protein //蛋白量 | |||
| }); | |||
| } else {//无阻抗时 | |||
| this.restartData(); | |||
| this.setData({ | |||
| weightsum: networkData.weight.toFixed(1), ///<重量 | |||
| adc: networkData.adc, ///<阻抗 | |||
| temp: networkData.temp, ////温度 | |||
| did: networkData.did, ////did | |||
| linksToPrompt: "阻抗测量失败", | |||
| }) | |||
| } | |||
| } else if (networkData.cmdType == 1) {//称重数据未稳定时 | |||
| this.setData({ | |||
| weightsum: networkData.weight.toFixed(1), | |||
| linksToPrompt: "称量中...", | |||
| fatdata: "称量中" | |||
| }) | |||
| } else if (networkData.cmdType == 2) {//阻抗测量中 | |||
| this.restartData(); | |||
| this.setData({ | |||
| linksToPrompt: "数据分析中,请不要下秤...", | |||
| weightsum: networkData.weight, | |||
| adc: networkData.adc, ///<阻抗 | |||
| temp: networkData.temp, ////温度 | |||
| did: networkData.did, ////did | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }) | |||
| }) | |||
| }, | |||
| restartData(){//设置默认值 | |||
| if (this.data.BMI != null && this.data.BMI != ""){ | |||
| this.setData({ | |||
| BMI:"", ///<BMI | |||
| fatRate: "", ///<体脂率 | |||
| muscle: "", ///<肌肉率 | |||
| moisture: "", ///<水份 | |||
| boneMass: "", ///<骨量 | |||
| BMR: "", ///<基础代谢率 | |||
| visceralFat: "", ///<内脏脂肪 | |||
| subcutaneousFat: "", ///<皮下脂肪 | |||
| proteinRate: "", ///<蛋白率 | |||
| physicalAge: "", ///<生理年龄 | |||
| unit: "%", | |||
| standardWeight: "", //标准体重 | |||
| controlWeight: "", //体重控制量 | |||
| fat: "", //脂肪量 | |||
| removeFatWeight: "", //去脂肪体重 | |||
| muscleMass: "", //肌肉量 | |||
| protein: "" //蛋白量 | |||
| }); | |||
| } | |||
| } | |||
| }) | |||
| function obtainSex(sexTemp) { | |||
| if (sexTemp == "男") { | |||
| return 1; | |||
| } else { | |||
| return 2; | |||
| } | |||
| } | |||
| /// 获取年龄 | |||
| function obtainAge(bridayTemp) { | |||
| if (bridayTemp == "") { | |||
| bridayTemp = "1990-05-10"; | |||
| } | |||
| var date1 = new Date(bridayTemp) | |||
| var date2 = new Date() | |||
| var s1 = date1.getTime(), s2 = date2.getTime(); | |||
| var total = (s2 - s1) / 1000; | |||
| var day = parseInt(total / (24 * 60 * 60));//计算整数天数 | |||
| var age = parseInt(day / 365) + 1; | |||
| return age; | |||
| } | |||
| /// 获取身高 | |||
| function obtainHeight() { | |||
| var heightTemp = wx.getStorageSync('UserHight'); | |||
| if (heightTemp == null || heightTemp == "") { | |||
| heightTemp = 160; | |||
| }else{ | |||
| return heightTemp; | |||
| } | |||
| } | |||
| @@ -1,5 +0,0 @@ | |||
| { | |||
| "usingComponents": { | |||
| "list": "plugin://myPlugin/list" | |||
| } | |||
| } | |||
| @@ -1,172 +0,0 @@ | |||
| <view class="gray-content" bindtap="linkBleButton">{{linksToPrompt}}</view> | |||
| <view class="info-div"> | |||
| <view class="info-item" bindtap="sexClick"> | |||
| <text class="info-item-text-1">性别</text> | |||
| <view class="info-right-div"> | |||
| <text class="info-item-text-2" color="red" >{{sex}}</text> | |||
| <image src="../Image/ok.png" class="info-item-image"></image> | |||
| </view> | |||
| </view> | |||
| <picker mode="date" value="{{briday}}" start="1900-09-01" end="{{endTime}}" bindchange="bindDateChange"> | |||
| <view class="info-item"> | |||
| <text class="info-item-text-1">生日</text> | |||
| <view class="info-right-div"> | |||
| <text class="info-item-text-2">{{briday}}</text> | |||
| <image src="../Image/ok.png" class="info-item-image"></image> | |||
| </view> | |||
| </view> | |||
| </picker> | |||
| <picker bindchange="bindHightChange" value="{{index}}" range="{{array}}"> | |||
| <view class="info-item end-border"> | |||
| <text class="info-item-text-1">身高</text> | |||
| <view class="info-right-div"> | |||
| <text class="info-item-text-2">{{array[index]}}cm</text> | |||
| <image src="../Image/ok.png" class="info-item-image"></image> | |||
| </view> | |||
| </view> | |||
| </picker> | |||
| </view> | |||
| <view class="shape-cover" wx:if="{{isSexShow}}" bindtap="sexClick"> | |||
| <view class="sex-modal"> | |||
| <text class="modal-text-title">性别</text> | |||
| <view class="male-div" bindtap="manClick"> | |||
| <text class="modal-text">男</text> | |||
| <image src="{{man_image}}" class="radio-class"></image> | |||
| </view> | |||
| <view class="line"></view> | |||
| <view class="male-div" bindtap="womanClick"> | |||
| <text class="modal-text">女</text> | |||
| <image src="{{women_image}}" class="radio-class"></image> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <view class="table-content"> | |||
| <!-- 数据 --> | |||
| <view class="top-right-b-a" bindtap="onChangeShowState0"> | |||
| <view class="top-right-a-1"><image src="../Image/weight.png"></image>体重</view> | |||
| <view class="top-right-a-2">{{weightsum}}{{UD_unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a" bindtap="onChangeShowState0"> | |||
| <view class="top-right-a-1"><image src="../Image/weight.png"></image>阻抗</view> | |||
| <view class="top-right-a-2">{{adc}}</view> | |||
| </view> | |||
| <view class="top-right-b-a" bindtap="onChangeShowState0"> | |||
| <view class="top-right-a-1"><image src="../Image/weight.png"></image>温度</view> | |||
| <view class="top-right-a-2">{{temp}}</view> | |||
| </view> | |||
| <view class="top-right-b-a" bindtap="onChangeShowState0"> | |||
| <view class="top-right-a-1"><image src="../Image/weight.png"></image>DID</view> | |||
| <view class="top-right-a-2">{{did}}</view> | |||
| </view> | |||
| <view class="top-right-b-a" bindtap="onChangeShowState1"> | |||
| <view class="top-right-a-1"><image src="../Image/bmi.png"></image>BMI</view> | |||
| <view class="top-right-a-2">{{BMI}}</view> | |||
| </view> | |||
| <view class="top-right-b-a" bindtap="onChangeShowState2"> | |||
| <view class="top-right-a-1"><image src="../Image/bfr.png"></image>体脂率</view> | |||
| <view class="top-right-a-2">{{fatRate}} {{unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState7"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/muscle.png"></image>肌肉率</view> | |||
| <view class="top-right-a-2">{{muscle}} {{unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState10"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/moisture.png"></image>水份</view> | |||
| <view class="top-right-a-2">{{moisture}} {{unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState8"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/bone_mass.png"></image>骨量</view> | |||
| <view class="top-right-a-2">{{boneMass}} {{unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState4"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/bmr.png"></image>基础代谢率</view> | |||
| <view class="top-right-a-2">{{BMR}} {{kcal}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState6"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/visceral_fat.png"></image>内脏脂肪指数</view> | |||
| <view class="top-right-a-2">{{visceralFat}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState14"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/sub_fat.png"></image>皮下脂肪率</view> | |||
| <view class="top-right-a-2">{{subcutaneousFat}} {{unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState9"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/protein_rate.png"></image>蛋白率</view> | |||
| <view class="top-right-a-2">{{proteinRate}} {{unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState17"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/body_type.png"></image>身体年龄</view> | |||
| <view class="top-right-a-2">{{physicalAge}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState17"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/standard_weight.png"></image>标准体重</view> | |||
| <view class="top-right-a-2">{{standardWeight}}{{UD_unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState17"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/weight_ci.png"></image>体重控制量</view> | |||
| <view class="top-right-a-2">{{controlWeight}}{{UD_unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState17"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/fat_weight.png"></image>脂肪量</view> | |||
| <view class="top-right-a-2">{{fat}}{{UD_unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState17"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/out_fat_weight.png"></image>去脂体重</view> | |||
| <view class="top-right-a-2">{{removeFatWeight}}{{UD_unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState17"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/muscle_weight.png"></image>肌肉量</view> | |||
| <view class="top-right-a-2">{{muscleMass}}{{UD_unit}}</view> | |||
| </view> | |||
| <view class="top-right-b-a " bindtap="onChangeShowState17"> | |||
| <view class="top-right-a-1"> | |||
| <image src="../Image/pr_weight.png"></image>蛋白量</view> | |||
| <view class="top-right-a-2">{{protein}}{{UD_unit}}</view> | |||
| </view> | |||
| </view> | |||
| @@ -1,517 +0,0 @@ | |||
| page { | |||
| background-color: #f4f4f4; | |||
| } | |||
| .top-div { | |||
| width: 750rpx; | |||
| height: 278rpx; | |||
| background: #14abbf; | |||
| display: flex; | |||
| flex-direction: column; | |||
| align-items: center; | |||
| justify-content: center; | |||
| } | |||
| .top-div button{ | |||
| height: 80rpx; | |||
| line-height:80rpx | |||
| } | |||
| .avator-class { | |||
| height: 133rpx; | |||
| width: 133rpx; | |||
| border-radius: 50%; | |||
| } | |||
| .name-class { | |||
| color: white; | |||
| font-size: 30rpx; | |||
| margin-top: 25rpx; | |||
| } | |||
| .info-div { | |||
| width: 750rpx; | |||
| display: flex; | |||
| flex-direction: column; | |||
| background: white; | |||
| margin-top: 38rpx; | |||
| } | |||
| .info-item { | |||
| height: 86rpx; | |||
| margin-left: 30rpx; | |||
| margin-right: 0rpx; | |||
| display: flex; | |||
| flex-direction: row; | |||
| align-items: center; | |||
| justify-content: space-between; | |||
| border-bottom: 1px solid #e6e6e6; | |||
| } | |||
| .info-item2 { | |||
| height: 86rpx; | |||
| background: white; | |||
| padding-left: 30rpx; | |||
| margin-top: 30rpx; | |||
| display: flex; | |||
| flex-direction: row; | |||
| align-items: center; | |||
| justify-content: space-between; | |||
| border-bottom: 1px solid #e6e6e6; | |||
| } | |||
| .info-right-div { | |||
| margin-right: 30rpx; | |||
| } | |||
| .info-item-text-0 { | |||
| flex-direction:row-reverse; | |||
| } | |||
| .info-item-text-1 { | |||
| font-size: 30rpx; | |||
| color: black; | |||
| } | |||
| .info-item-text-1_1 { | |||
| margin-top: 5px; | |||
| font-size: 24rpx; | |||
| color: gray; | |||
| } | |||
| .info-item-text-2 { | |||
| font-size: 30rpx; | |||
| color: black; | |||
| } | |||
| .info-item-image { | |||
| width: 30rpx; | |||
| height: 25rpx; | |||
| margin-left: 20rpx; | |||
| } | |||
| .end-border { | |||
| border-bottom: 0; | |||
| } | |||
| .shape-cover { | |||
| position: fixed; | |||
| top: 0; | |||
| right: 0; | |||
| bottom: 0; | |||
| left: 0; | |||
| background-color: rgba(0, 0, 0, 0.5); | |||
| z-index: 999; | |||
| display: flex; | |||
| align-items: center; | |||
| justify-content: center; | |||
| } | |||
| .show-cover { | |||
| display: block; | |||
| } | |||
| .hide-cover { | |||
| display: none; | |||
| } | |||
| .sex-modal { | |||
| width: 623rpx; | |||
| height: 320rpx; | |||
| background: white; | |||
| border-radius: 4px; | |||
| display: flex; | |||
| flex-direction: column; | |||
| align-items: center; | |||
| } | |||
| .modal-text { | |||
| font-size: 37rpx; | |||
| color: black; | |||
| } | |||
| .radio-class { | |||
| width: 40rpx; | |||
| height: 40rpx; | |||
| } | |||
| .modal-text { | |||
| font-size: 35rpx; | |||
| color: black; | |||
| } | |||
| .modal-text-title { | |||
| font-size: 35rpx; | |||
| color: black; | |||
| margin-top: 50rpx; | |||
| } | |||
| .male-div { | |||
| width: 450rpx; | |||
| display: flex; | |||
| flex-direction: row; | |||
| justify-content: space-between; | |||
| align-items: center; | |||
| height: 100rpx; | |||
| margin-top: 20rpx; | |||
| } | |||
| .line{ | |||
| height: 1px; | |||
| width: 100%; | |||
| background: #e6e6e6; | |||
| } | |||
| .wan{ | |||
| width: 623rpx; | |||
| height: 320rpx; | |||
| border-radius: 30rpx; | |||
| background: white; | |||
| display: flex; | |||
| flex-direction: column; | |||
| align-items: center; | |||
| position: relative; | |||
| z-index: -3; | |||
| overflow: hidden; | |||
| } | |||
| .wan image{ | |||
| width: 623rpx; | |||
| height: 320rpx; | |||
| position: absolute; | |||
| top: 0; | |||
| left: 0; | |||
| z-index: -5; | |||
| } | |||
| .wan0{ | |||
| width: 500rpx; | |||
| height: 120rpx; | |||
| text-align: center; | |||
| line-height: 120rpx; | |||
| color: rgb(154, 198, 228); | |||
| font-size: 35rpx; | |||
| } | |||
| .wan1{ | |||
| width: 500rpx; | |||
| text-align: center; | |||
| color: rgb(180, 180, 180); | |||
| font-size: 28rpx; | |||
| } | |||
| .wan button{ | |||
| width: 100%; | |||
| height: 100rpx; | |||
| margin-top: 50rpx; | |||
| background: white; | |||
| text-align: center; | |||
| line-height: 100rpx; | |||
| font-size: 40rpx; | |||
| color:#2D9FFF; | |||
| border-top: 1rpx rgb(164, 206, 241) solid; | |||
| } | |||
| .wan button:hover{ | |||
| color:rgb(219, 167, 64); | |||
| } | |||
| .gray-content{ | |||
| width: 750rpx; | |||
| height: 70rpx; | |||
| background: #f4f4f4; | |||
| color: #666; | |||
| font-size: 27rpx; | |||
| line-height: 70rpx; | |||
| text-align: center; | |||
| } | |||
| /*身体指标数据*/ | |||
| page { | |||
| width: 100%; | |||
| height: auto; | |||
| background-attachment: fixed; | |||
| background-repeat: no-repeat; | |||
| background-size: cover; | |||
| background: #F4F4F4; | |||
| } | |||
| .c-content { | |||
| overflow-x: hidden; | |||
| width: 100%; | |||
| height: 400rpx; | |||
| background: linear-gradient(#2D9FFF, #2d9fff); | |||
| } | |||
| .c-3 { | |||
| width:300rpx; | |||
| height:300rpx; | |||
| border-radius: 50%; | |||
| /* border: 8rpx solid white; */ | |||
| display: flex; | |||
| flex-direction: column; | |||
| align-items: center; | |||
| justify-content: center; | |||
| margin: 0 auto; | |||
| position: relative; | |||
| z-index: 9; | |||
| } | |||
| .animationData { | |||
| width:300rpx; | |||
| height:300rpx; | |||
| border-radius: 50%; | |||
| display: block; | |||
| flex-direction: column; | |||
| align-items: center; | |||
| justify-content: center; | |||
| position: absolute; | |||
| top: 70rpx; | |||
| left: 225rpx; | |||
| z-index: 1; | |||
| } | |||
| .animationData image{ | |||
| width:300rpx; | |||
| height:300rpx; | |||
| } | |||
| .c-3-text-2 { | |||
| width: 50%; | |||
| height: 40rpx; | |||
| line-height: 30rpx; | |||
| text-align: center; | |||
| font-size: 32rpx; | |||
| color: white; | |||
| } | |||
| .c-3-1{ | |||
| width: 100%; | |||
| height: 100rpx; | |||
| text-align: center; | |||
| } | |||
| .c-3-1-text-1 { | |||
| font-size: 64rpx; | |||
| color: white; | |||
| } | |||
| .c-3-1-text-2 { | |||
| font-size: 40rpx; | |||
| color: white; | |||
| margin-left: 20rpx; | |||
| } | |||
| .scfxt{ | |||
| width: 60%; | |||
| height: 50rpx; | |||
| background: white; | |||
| border-radius: 30rpx; | |||
| text-align: center; | |||
| line-height: 50rpx; | |||
| color: #2D9FFF; | |||
| font-size: 25rpx; | |||
| display: block; | |||
| } | |||
| .timescore{ | |||
| margin-top: 10rpx; | |||
| font-size: 25rpx; | |||
| color: white; | |||
| text-align: center; | |||
| } | |||
| .table-content{ | |||
| width: 100%; | |||
| overflow-x: hidden; | |||
| background: white; | |||
| display: flex; | |||
| flex-direction: row; | |||
| flex-wrap: wrap; | |||
| margin:30rpx 0; | |||
| } | |||
| .top-right-b-a{ | |||
| width:100%; | |||
| height: auto; | |||
| flex-direction: column; | |||
| border-bottom:1px solid #e8e8e8; | |||
| border-right:1px solid #e8e8e8; | |||
| box-sizing:border-box; | |||
| } | |||
| .top-right-b-a image{ | |||
| width: 97%; | |||
| height: 200rpx; | |||
| } | |||
| .top-right-a-1 { | |||
| width: 40%; | |||
| height: 100rpx; | |||
| font-size: 30rpx; | |||
| line-height: 100rpx; | |||
| color: black; | |||
| float: left; | |||
| overflow: hidden; | |||
| } | |||
| .top-right-b-a .top-right-a-1 image{ | |||
| display: block; | |||
| width:60rpx; | |||
| height:60%; | |||
| float: left; | |||
| margin: 20rpx 10rpx 0 30rpx; | |||
| } | |||
| .top-right-a-2 { | |||
| width: 30%; | |||
| height: 100rpx; | |||
| font-size: 35rpx; | |||
| line-height: 100rpx; | |||
| text-align: center; | |||
| color: black; | |||
| float: left; | |||
| overflow: hidden; | |||
| } | |||
| .top-right-a-3 { | |||
| width: 20%; | |||
| height: 100rpx; | |||
| font-size: 30rpx; | |||
| line-height: 100rpx; | |||
| text-align: center; | |||
| color: #666; | |||
| float: left; | |||
| overflow: hidden; | |||
| } | |||
| .top-right-a-4{ | |||
| width: 10%; | |||
| height: 100rpx; | |||
| font-size: 20rpx; | |||
| line-height: 100rpx; | |||
| color: black; | |||
| float: right; | |||
| } | |||
| .hide{ | |||
| display: none; | |||
| } | |||
| /* 动态显示 */ | |||
| .con{ | |||
| display: block; | |||
| margin: 0 30rpx; | |||
| width: 92%; | |||
| padding: 0rpx 0 30rpx; | |||
| overflow: hidden; | |||
| } | |||
| .con1{ | |||
| width: 110%; | |||
| margin-left: 20rpx; | |||
| margin-bottom: 5rpx; | |||
| /* width: 80%; */ | |||
| } | |||
| .con1 view{ | |||
| display: block; | |||
| width:31.5%; | |||
| height: 25rpx; | |||
| line-height: 25rpx; | |||
| float: left; | |||
| font-size: 25rpx; | |||
| text-align: right; | |||
| } | |||
| .con2{ | |||
| overflow: hidden; | |||
| width: 133%; | |||
| /* width: 100%; */ | |||
| height: 20rpx; | |||
| } | |||
| .con2 view{ | |||
| width: 25%; | |||
| height: 10rpx; | |||
| float: left; | |||
| } | |||
| .con3{ | |||
| width: 133%; | |||
| overflow: hidden; | |||
| /* width: 100%; */ | |||
| } | |||
| .con3 view{ | |||
| width:25%; | |||
| float: left; | |||
| font-size: 25rpx; | |||
| text-align: center; | |||
| color: #666; | |||
| } | |||
| .con4{ | |||
| display: block; | |||
| margin-top: 6rpx; | |||
| font-size: 27rpx; | |||
| text-indent: 2em; | |||
| color: #666; | |||
| } | |||
| .devices_summary { | |||
| margin-top: 30rpx; | |||
| padding: 10rpx; | |||
| font-size: 40rpx; | |||
| } | |||
| /* 为你优选 */ | |||
| .optimize{ | |||
| padding: 0 30rpx 0; | |||
| overflow-x: hidden; | |||
| background: #2d9fff; | |||
| } | |||
| .optimize1{ | |||
| width: 100%; | |||
| font-size: 35rpx; | |||
| text-align: left; | |||
| color: white; | |||
| padding: 30rpx 20rpx; | |||
| } | |||
| .optimize1 view{ | |||
| display: block; | |||
| width: 20rpx; | |||
| height: 40rpx; | |||
| background: white; | |||
| float: left; | |||
| margin: 5rpx 20rpx 0 0; | |||
| } | |||
| .o21{ | |||
| width: 100%; | |||
| } | |||
| .mall-1{ | |||
| width: 99%; | |||
| height: 190rpx; | |||
| padding: 30rpx 0 0; | |||
| background: #2d9fff; | |||
| border-top: 1rpx white solid; | |||
| } | |||
| .o21-left{ | |||
| width: 25%; | |||
| height:160rpx; | |||
| float: left; | |||
| overflow: hidden; | |||
| } | |||
| .o21-left image{ | |||
| width: 100%; | |||
| height: 100%; | |||
| margin: 0 20rpx; | |||
| } | |||
| .o21-right{ | |||
| width: 73%; | |||
| height:160rpx; | |||
| float: right; | |||
| } | |||
| .o21-right view{ | |||
| margin: 0 5%; | |||
| font-size: 35rpx; | |||
| color: white; | |||
| overflow: hidden; | |||
| text-overflow:ellipsis; | |||
| white-space: nowrap; | |||
| } | |||
| .o21-right .n21-right-2{ | |||
| margin: 15rpx 5%; | |||
| font-size: 30rpx; | |||
| color: white; | |||
| } | |||
| @@ -1,15 +0,0 @@ | |||
| //logs.js | |||
| const util = require('../../utils/util.js') | |||
| Page({ | |||
| data: { | |||
| logs: [] | |||
| }, | |||
| onLoad: function () { | |||
| this.setData({ | |||
| logs: (wx.getStorageSync('logs') || []).map(log => { | |||
| return util.formatTime(new Date(log)) | |||
| }) | |||
| }) | |||
| } | |||
| }) | |||
| @@ -1,4 +0,0 @@ | |||
| { | |||
| "navigationBarTitleText": "查看启动日志", | |||
| "usingComponents": {} | |||
| } | |||
| @@ -1,6 +0,0 @@ | |||
| <!--logs.wxml--> | |||
| <view class="container log-list"> | |||
| <block wx:for="{{logs}}" wx:for-item="log"> | |||
| <text class="log-item">{{index + 1}}. {{log}}</text> | |||
| </block> | |||
| </view> | |||
| @@ -1,8 +0,0 @@ | |||
| .log-list { | |||
| display: flex; | |||
| flex-direction: column; | |||
| padding: 40rpx; | |||
| } | |||
| .log-item { | |||
| margin: 10rpx; | |||
| } | |||
| @@ -1,43 +0,0 @@ | |||
| { | |||
| "description": "项目配置文件", | |||
| "packOptions": { | |||
| "ignore": [] | |||
| }, | |||
| "setting": { | |||
| "urlCheck": true, | |||
| "es6": true, | |||
| "postcss": true, | |||
| "minified": true, | |||
| "newFeature": true, | |||
| "autoAudits": false, | |||
| "coverView": true | |||
| }, | |||
| "compileType": "miniprogram", | |||
| "libVersion": "2.9.4", | |||
| "appid": "wxf6042009c5b19c52", | |||
| "projectname": "bodyFatScale-plugin-demo", | |||
| "debugOptions": { | |||
| "hidedInDevtools": [] | |||
| }, | |||
| "isGameTourist": false, | |||
| "simulatorType": "wechat", | |||
| "simulatorPluginLibVersion": {}, | |||
| "condition": { | |||
| "search": { | |||
| "current": -1, | |||
| "list": [] | |||
| }, | |||
| "conversation": { | |||
| "current": -1, | |||
| "list": [] | |||
| }, | |||
| "game": { | |||
| "currentL": -1, | |||
| "list": [] | |||
| }, | |||
| "miniprogram": { | |||
| "current": -1, | |||
| "list": [] | |||
| } | |||
| } | |||
| } | |||
| @@ -1,7 +0,0 @@ | |||
| { | |||
| "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", | |||
| "rules": [{ | |||
| "action": "allow", | |||
| "page": "*" | |||
| }] | |||
| } | |||
| @@ -1,43 +0,0 @@ | |||
| /** | |||
| * banner数据 | |||
| */ | |||
| function getBannerData() { | |||
| } | |||
| function formatTime(date) { | |||
| var year = date.getFullYear() | |||
| var month = date.getMonth() + 1 | |||
| var day = date.getDate() | |||
| var hour = date.getHours() | |||
| var minute = date.getMinutes() | |||
| var second = date.getSeconds() | |||
| // return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') | |||
| return year + '/' + month + '/' + day + ' ' + hour + ':' + minute | |||
| } | |||
| function forNowTime(date) { | |||
| var year = date.getFullYear() | |||
| var month = date.getMonth() + 1 | |||
| var day = date.getDate() | |||
| return [year, month, day].map(formatNumber).join('-') | |||
| } | |||
| function formatNumber(n) { | |||
| n = n.toString() | |||
| return n[1] ? n : '0' + n | |||
| } | |||
| /* | |||
| * 对外暴露接口 必须与页面函数一一对应 | |||
| */ | |||
| module.exports = { | |||
| formatTime: formatTime, | |||
| getBannerData: getBannerData, | |||
| forNowTime: forNowTime, | |||
| } | |||