G02/B20单位切换问题

This commit is contained in:
qiaocl 2025-02-18 15:52:22 +08:00
parent 94b5e68143
commit c0da635e70
78 changed files with 3413 additions and 3236 deletions

View File

@ -112,10 +112,15 @@
}, },
isFinished: function() { isFinished: function() {
let that = this let that = this
console.log("是否开启弹框", that.weight, that.isFinished, that.typeInfo)
if (!that.isFinished) {
that.isHeight = false
return
}
if (that.isFinished && that.typeInfo == 2) { if (that.isFinished && that.typeInfo == 2) {
setTimeout(function() { setTimeout(function() {
that.isHeight = true that.isHeight = true
}, 500) }, 1500)
} }
} }
}, },
@ -199,7 +204,7 @@
that.isFinished = false that.isFinished = false
setTimeout(function() { setTimeout(function() {
that.notifyBLECharacteristicValue() that.notifyBLECharacteristicValue()
}, 600) }, 800)
}, },
fail: res => { fail: res => {
console.log('获取特征值失败:', JSON.stringify(res)) console.log('获取特征值失败:', JSON.stringify(res))
@ -226,20 +231,9 @@
let weight = parseInt(value.substring(8, 14), 16) // let weight = parseInt(value.substring(8, 14), 16) //
let digit = value.substring(18, 19) // let digit = value.substring(18, 19) //
let unit = value.substring(19, 20) // let unit = value.substring(19, 20) //
let weight1 = ""
let weight2 = ""
//
if (unit == "0") {
that.unit = "kg"
}
if (unit == "1") {
that.unit = "斤"
}
if (unit == "2") {
that.unit = "st:lb"
}
if (unit == "3") {
that.unit = "lb"
}
// //
if (digit == "0") { if (digit == "0") {
weight = weight weight = weight
@ -253,18 +247,43 @@
if (digit == "3") { if (digit == "3") {
weight = weight / 1000 weight = weight / 1000
} }
//
//
if (unit == "0") {
that.unit = "kg"
}
if (unit == "1") {
that.unit = "斤"
}
if (unit == "2") {
console.log("st:lb", weight)
weight1 = Math.floor(weight / 14)
weight2 = weight - weight1 * 14
weight = weight1 + ":" + weight2.toFixed(2)
that.unit = "st:lb"
}
if (unit == "3") {
that.unit = "lb"
}
if (unit == "4") {
that.unit = "g"
}
//
if (typeInfo == "01") { if (typeInfo == "01") {
that.typeInfo = 1 that.typeInfo = 1
that.weight = weight that.weight = weight
that.IsLing = false that.IsLing = false
that.isHeight = false
that.isFinished = false that.isFinished = false
} }
if (typeInfo == "02") { //
if (typeInfo == "02" && !that.isFinished) {
that.typeInfo = 2 that.typeInfo = 2
that.weight = weight that.weight = weight
if (weight > 0 || toString(weight) != '0:0.00') {
that.isFinished = true that.isFinished = true
} }
}
console.log("状态:", value, type, typeInfo, weight, that.unit, that.isFinished) console.log("状态:", value, type, typeInfo, weight, that.unit, that.isFinished)
}); });
}, },
@ -345,13 +364,32 @@
// //
handleBack() { handleBack() {
let that = this let that = this
that.typeInfo = 0 let str = "A6020500076A"
that.writeBLECharacteristicValue("A6020500076A") // let buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function(h) {
setTimeout(function() { return parseInt(h, 16)
that.isFinished = false }))
that.isHeight = false uni.writeBLECharacteristicValue({
}, 200) deviceId: that.deviceId,
serviceId: that.serviceId,
characteristicId: that.write,
value: buf.buffer,
success: res => {
console.log('下发指令成功', res.errMsg)
uni.showToast({
title: '数据重置中',
icon: "none"
})
console.log("重置", that.typeInfo, that.weight)
// setTimeout(function() {
// that.isHeight = false
// that.isFinished = false
// uni.hideLoading()
// }, 1200)
},
fail: res => {
console.log("下发指令失败", res);
},
})
}, },
/** /**
* 停止搜索蓝牙设备 * 停止搜索蓝牙设备

View File

@ -41,6 +41,7 @@
text: "", text: "",
weight: "", weight: "",
height: "", height: "",
height2: "",
deviceId: "", deviceId: "",
macAddr: "", macAddr: "",
unit: "cm", unit: "cm",
@ -189,26 +190,37 @@
let data = parseInt(value.substring(7, 10), 16) let data = parseInt(value.substring(7, 10), 16)
let unit = parseInt(value.substring(10, 12)) let unit = parseInt(value.substring(10, 12))
let digit = parseInt(value.substring(12, 14)) let digit = parseInt(value.substring(12, 14))
if (unit == "1") {
that.unit = "inch"
}
if (unit == "2") {
that.unit = "ftin"
}
if (digit == "1") { if (digit == "1") {
data = data / 10 data = data / 10
} }
if (digit == "2") { if (digit == "2") {
data = data / 100 data = data / 100
} }
if (unit == "0") {
that.unit = "cm"
}
if (unit == "1") {
that.unit = "inch"
}
if (unit == "2") {
that.unit = "ft"
}
if (Number(data) < 20) { if (Number(data) < 20) {
that.text = "操作错误,请重新测量" that.text = "操作错误,请重新测量"
} else { } else {
if (unit == "2") {
let data1 = data / 12
let data2 = Number(data1 - Math.floor(data1)) * 12
that.height2 = data
that.height = Math.floor(data1) + "'" + data2.toFixed(1)
} else {
that.height2 = data
that.height = data that.height = data
that.text = "您的身高是:" + data + that.unit }
that.text = "您的身高是:" + that.height + that.unit
that.isHeight = true that.isHeight = true
} }
console.log("G02", value, data) console.log("G02", value, unit, data, that.height, that.height2)
}) })
}, },
fail(res) { fail(res) {
@ -219,14 +231,21 @@
// //
handleGetMeasure() { handleGetMeasure() {
let that = this let that = this
let height = 0
if (!that.weight) { if (!that.weight) {
this.$tools.msg("请输入体重") that.$tools.msg("请输入体重")
return return
} }
if (that.unit == 'ft') {
height =Number(that.height2 * 2.54).toFixed(2)
} else {
height = that.height2
}
console.log("提交身高", height)
that.$model.getmeasurefunit({ that.$model.getmeasurefunit({
adc: 0, adc: 0,
weight: that.weight, weight: that.weight,
height: that.height, height: height,
aud_id: that.userInfo.id aud_id: that.userInfo.id
}).then(res => { }).then(res => {
that.isHeight = false that.isHeight = false

View File

@ -14,8 +14,8 @@
let that = this let that = this
let token = uni.getStorageSync('token') let token = uni.getStorageSync('token')
let url = options.url + '?token=' + token + '&id=' + options.id let url = options.url + '?token=' + token + '&id=' + options.id
this.webviewUrl = decodeURIComponent(url); that.webviewUrl = decodeURIComponent(url);
console.log("11111", url, this.webviewUrl) console.log("11111", options, url, this.webviewUrl)
} }
} }
</script> </script>

View File

@ -256,6 +256,9 @@
let myTime; let myTime;
import headerIndex from "@/element/headerIndex.vue" import headerIndex from "@/element/headerIndex.vue"
import record from '@/element/manuallyAdd/record.vue'; import record from '@/element/manuallyAdd/record.vue';
import {
I18nT
} from "vue-i18n";
export default { export default {
data() { data() {
return { return {
@ -328,6 +331,7 @@
}, },
], ],
unit: ""
} }
}, },
components: { components: {
@ -388,7 +392,7 @@
isBluetoothTyle: function() { isBluetoothTyle: function() {
let that = this let that = this
if (!that.isBluetoothTyle) { if (!that.isBluetoothTyle) {
that.textLink = "请打开手机蓝牙后,开始测量" that.textLink = "开始连接"
that.islink = -1 that.islink = -1
} }
}, },
@ -571,7 +575,9 @@
let that = this let that = this
uni.startBluetoothDevicesDiscovery({ uni.startBluetoothDevicesDiscovery({
allowDuplicatesKey: true, // allowDuplicatesKey: true, //
interval: 200,
success: res => { success: res => {
console.log("搜索设备")
that.onBluetoothDeviceFound(); that.onBluetoothDeviceFound();
}, },
fail: res => {} fail: res => {}
@ -627,6 +633,7 @@
let that = this let that = this
const foundDevices = that.devicesList const foundDevices = that.devicesList
const idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId) const idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId)
console.log("1111111", device.name)
if (idx === -1) { if (idx === -1) {
// //
if (device.name.indexOf("PCL") != -1) { if (device.name.indexOf("PCL") != -1) {

View File

@ -21,14 +21,34 @@ export default {
} }
function NewsPtype(con) { function NewsPtype(con) {
// 1=外链,2=内链,3-内容 if (con.type == "wechat") { //跳小程序
if (con.type == "wechat") { // #ifdef APP-PLUS || APP
// #ifdef APP-PLUS
uni.navigateTo({ uni.navigateTo({
url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url
}) })
// plus.share.getServices( //app跳小程序
// (data) => {
// let sweixin = null
// data.forEach(item => {
// if (item.id === "weixin") {
// sweixin = item
// }
// })
// if (sweixin) {
// // 跳转微信小程序
// sweixin.launchMiniProgram({
// id: con.gh_id, //微信小程序原始id
// path: con.path
// })
// } else {
// uni.showToast({
// title: "请安装微信",
// icon: none
// })
// }
// })
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN //小程序跳小程序
uni.navigateToMiniProgram({ uni.navigateToMiniProgram({
appId: con.appid, appId: con.appid,
path: con.path, path: con.path,
@ -36,7 +56,7 @@ function NewsPtype(con) {
}) })
// #endif // #endif
} else if (con.type != 'wechat') { } else if (con.type != 'wechat') { //跳h5或文本
uni.navigateTo({ uni.navigateTo({
url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url
}) })

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__20604F1","name":"Reedaw","version":{"name":"1.2.9","code":129},"description":"面向儿童青少年的健康体质测量APP","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"Bluetooth":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"light","background":"#37cc92"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"template":"index.html","compattible":{"ignoreVersion":true},"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"splashscreen":{"androidStyle":"common","android":{"hdpi":"static/logo.png","xhdpi":"static/logo.png","xxhdpi":"static/logo.png"},"useOriginalMsgbox":true},"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"],"abiFilters":["arm64-v8a","x86"]},"apple":{"dSYMs":false,"idfa":false,"privacyDescription":{"NSBluetoothAlwaysUsageDescription":"需要蓝牙权限来连接设备","NSBluetoothPeripheralUsageDescription":"使用蓝牙与外设通信"}},"plugins":{"share":{},"ad":{},"geolocation":{"system":{"__platform__":["ios"]}},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false,"version":"2"},"allowsInlineMediaPlayback":true,"safearea":{"background":"#fff","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"4.24","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","fontSize":"14px","selectedColor":"#37cc92","backgroundColor":"#fff","list":[{"pagePath":"pages/home/home","iconPath":"static/shou.png","selectedIconPath":"static/shou2.png","text":"记录"},{"pagePath":"pages/zixun/list","iconPath":"static/ping.png","selectedIconPath":"static/ping2.png","text":"资讯"},{"pagePath":"pages/my/me","iconPath":"static/wo.png","selectedIconPath":"static/wo2.png","text":"我的"}],"borderStyle":"rgba(0,0,0,0.4)","height":"50px","child":["lauchwebview"],"selected":0},"launch_path":"__uniappview.html"},"locale":"zh-Hans"} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__20604F1","name":"Reedaw","version":{"name":"1.3.0","code":130},"description":"面向儿童青少年的健康体质测量APP","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"Bluetooth":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"light","background":"#37cc92"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"template":"index.html","compattible":{"ignoreVersion":true},"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"splashscreen":{"androidStyle":"common","android":{"hdpi":"static/logo.png","xhdpi":"static/logo.png","xxhdpi":"static/logo.png"},"useOriginalMsgbox":true},"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"],"abiFilters":["arm64-v8a","x86"]},"apple":{"dSYMs":false,"idfa":false,"privacyDescription":{"NSBluetoothAlwaysUsageDescription":"需要蓝牙权限来连接设备","NSBluetoothPeripheralUsageDescription":"使用蓝牙与外设通信"}},"plugins":{"share":{},"ad":{},"geolocation":{"system":{"__platform__":["ios"]}},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false,"version":"2"},"allowsInlineMediaPlayback":true,"safearea":{"background":"#fff","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"4.24","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","fontSize":"14px","selectedColor":"#37cc92","backgroundColor":"#fff","list":[{"pagePath":"pages/home/home","iconPath":"static/shou.png","selectedIconPath":"static/shou2.png","text":"记录"},{"pagePath":"pages/zixun/list","iconPath":"static/ping.png","selectedIconPath":"static/ping2.png","text":"资讯"},{"pagePath":"pages/my/me","iconPath":"static/wo.png","selectedIconPath":"static/wo2.png","text":"我的"}],"borderStyle":"rgba(0,0,0,0.4)","height":"50px","child":["lauchwebview"],"selected":0},"launch_path":"__uniappview.html"},"locale":"zh-Hans"}

View File

@ -11743,14 +11743,43 @@ var _default = {
}; };
exports.default = _default; exports.default = _default;
function NewsPtype(con) { function NewsPtype(con) {
// 1=外链,2=内链,3-内容
if (con.type == "wechat") { if (con.type == "wechat") {
//跳小程序
// #ifdef APP-PLUS || APP
uni.navigateTo({
url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url
});
// plus.share.getServices( //app跳小程序
// (data) => {
// let sweixin = null
// data.forEach(item => {
// if (item.id === "weixin") {
// sweixin = item
// }
// })
// if (sweixin) {
// // 跳转微信小程序
// sweixin.launchMiniProgram({
// id: con.gh_id, //微信小程序原始id
// path: con.path
// })
// } else {
// uni.showToast({
// title: "请安装微信",
// icon: none
// })
// }
// })
// #endif
// #ifdef MP-WEIXIN //小程序跳小程序
uni.navigateToMiniProgram({ uni.navigateToMiniProgram({
appId: con.appid, appId: con.appid,
path: con.path, path: con.path,
extraData: {} extraData: {}
}); });
// #endif
} else if (con.type != 'wechat') { } else if (con.type != 'wechat') {
//跳h5或文本
uni.navigateTo({ uni.navigateTo({
url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url
}); });

View File

@ -219,10 +219,15 @@ var _default = {
}, },
isFinished: function isFinished() { isFinished: function isFinished() {
var that = this; var that = this;
console.log("是否开启弹框", that.weight, that.isFinished, that.typeInfo);
if (!that.isFinished) {
that.isHeight = false;
return;
}
if (that.isFinished && that.typeInfo == 2) { if (that.isFinished && that.typeInfo == 2) {
setTimeout(function () { setTimeout(function () {
that.isHeight = true; that.isHeight = true;
}, 500); }, 1500);
} }
} }
}, },
@ -307,7 +312,7 @@ var _default = {
that.isFinished = false; that.isFinished = false;
setTimeout(function () { setTimeout(function () {
that.notifyBLECharacteristicValue(); that.notifyBLECharacteristicValue();
}, 600); }, 800);
}, },
fail: function fail(res) { fail: function fail(res) {
console.log('获取特征值失败:', JSON.stringify(res)); console.log('获取特征值失败:', JSON.stringify(res));
@ -335,20 +340,9 @@ var _default = {
var weight = parseInt(value.substring(8, 14), 16); //体重 var weight = parseInt(value.substring(8, 14), 16); //体重
var digit = value.substring(18, 19); // 小数 var digit = value.substring(18, 19); // 小数
var unit = value.substring(19, 20); //单位 var unit = value.substring(19, 20); //单位
var weight1 = "";
var weight2 = "";
// 单位
if (unit == "0") {
that.unit = "kg";
}
if (unit == "1") {
that.unit = "斤";
}
if (unit == "2") {
that.unit = "st:lb";
}
if (unit == "3") {
that.unit = "lb";
}
// 小数 // 小数
if (digit == "0") { if (digit == "0") {
weight = weight; weight = weight;
@ -362,18 +356,43 @@ var _default = {
if (digit == "3") { if (digit == "3") {
weight = weight / 1000; weight = weight / 1000;
} }
// 状态
// 单位
if (unit == "0") {
that.unit = "kg";
}
if (unit == "1") {
that.unit = "斤";
}
if (unit == "2") {
console.log("st:lb", weight);
weight1 = Math.floor(weight / 14);
weight2 = weight - weight1 * 14;
weight = weight1 + ":" + weight2.toFixed(2);
that.unit = "st:lb";
}
if (unit == "3") {
that.unit = "lb";
}
if (unit == "4") {
that.unit = "g";
}
// 实时体重
if (typeInfo == "01") { if (typeInfo == "01") {
that.typeInfo = 1; that.typeInfo = 1;
that.weight = weight; that.weight = weight;
that.IsLing = false; that.IsLing = false;
that.isHeight = false;
that.isFinished = false; that.isFinished = false;
} }
if (typeInfo == "02") { // 稳定体重
if (typeInfo == "02" && !that.isFinished) {
that.typeInfo = 2; that.typeInfo = 2;
that.weight = weight; that.weight = weight;
if (weight > 0 || toString(weight) != '0:0.00') {
that.isFinished = true; that.isFinished = true;
} }
}
console.log("状态:", value, type, typeInfo, weight, that.unit, that.isFinished); console.log("状态:", value, type, typeInfo, weight, that.unit, that.isFinished);
}); });
}, },
@ -454,12 +473,33 @@ var _default = {
//重新测量 //重新测量
handleBack: function handleBack() { handleBack: function handleBack() {
var that = this; var that = this;
that.typeInfo = 0; var str = "A6020500076A";
that.writeBLECharacteristicValue("A6020500076A"); // 清零 var buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function (h) {
setTimeout(function () { return parseInt(h, 16);
that.isFinished = false; }));
that.isHeight = false; uni.writeBLECharacteristicValue({
}, 200); deviceId: that.deviceId,
serviceId: that.serviceId,
characteristicId: that.write,
value: buf.buffer,
success: function success(res) {
console.log('下发指令成功', res.errMsg);
uni.showToast({
title: '数据重置中',
icon: "none"
});
console.log("重置", that.typeInfo, that.weight);
// setTimeout(function() {
// that.isHeight = false
// that.isFinished = false
// uni.hideLoading()
// }, 1200)
},
fail: function fail(res) {
console.log("下发指令失败", res);
}
});
}, },
/** /**
* 停止搜索蓝牙设备 * 停止搜索蓝牙设备

View File

@ -153,6 +153,7 @@ var _default = {
text: "", text: "",
weight: "", weight: "",
height: "", height: "",
height2: "",
deviceId: "", deviceId: "",
macAddr: "", macAddr: "",
unit: "cm", unit: "cm",
@ -301,26 +302,37 @@ var _default = {
var data = parseInt(value.substring(7, 10), 16); var data = parseInt(value.substring(7, 10), 16);
var unit = parseInt(value.substring(10, 12)); var unit = parseInt(value.substring(10, 12));
var digit = parseInt(value.substring(12, 14)); var digit = parseInt(value.substring(12, 14));
if (unit == "1") {
that.unit = "inch";
}
if (unit == "2") {
that.unit = "ftin";
}
if (digit == "1") { if (digit == "1") {
data = data / 10; data = data / 10;
} }
if (digit == "2") { if (digit == "2") {
data = data / 100; data = data / 100;
} }
if (unit == "0") {
that.unit = "cm";
}
if (unit == "1") {
that.unit = "inch";
}
if (unit == "2") {
that.unit = "ft";
}
if (Number(data) < 20) { if (Number(data) < 20) {
that.text = "操作错误,请重新测量"; that.text = "操作错误,请重新测量";
} else { } else {
if (unit == "2") {
var data1 = data / 12;
var data2 = Number(data1 - Math.floor(data1)) * 12;
that.height2 = data;
that.height = Math.floor(data1) + "'" + data2.toFixed(1);
} else {
that.height2 = data;
that.height = data; that.height = data;
that.text = "您的身高是:" + data + that.unit; }
that.text = "您的身高是:" + that.height + that.unit;
that.isHeight = true; that.isHeight = true;
} }
console.log("G02", value, data); console.log("G02", value, unit, data, that.height, that.height2);
}); });
}, },
fail: function fail(res) { fail: function fail(res) {
@ -331,14 +343,21 @@ var _default = {
// 保存测量结果 // 保存测量结果
handleGetMeasure: function handleGetMeasure() { handleGetMeasure: function handleGetMeasure() {
var that = this; var that = this;
var height = 0;
if (!that.weight) { if (!that.weight) {
this.$tools.msg("请输入体重"); that.$tools.msg("请输入体重");
return; return;
} }
if (that.unit == 'ft') {
height = Number(that.height2 * 2.54).toFixed(2);
} else {
height = that.height2;
}
console.log("提交身高", height);
that.$model.getmeasurefunit({ that.$model.getmeasurefunit({
adc: 0, adc: 0,
weight: that.weight, weight: that.weight,
height: that.height, height: height,
aud_id: that.userInfo.id aud_id: that.userInfo.id
}).then(function (res) { }).then(function (res) {
that.isHeight = false; that.isHeight = false;

View File

@ -154,8 +154,8 @@ var _default = {
var that = this; var that = this;
var token = uni.getStorageSync('token'); var token = uni.getStorageSync('token');
var url = options.url + '?token=' + token + '&id=' + options.id; var url = options.url + '?token=' + token + '&id=' + options.id;
this.webviewUrl = decodeURIComponent(url); that.webviewUrl = decodeURIComponent(url);
console.log("11111", url, this.webviewUrl); console.log("11111", options, url, this.webviewUrl);
} }
}; };
exports.default = _default; exports.default = _default;

View File

@ -316,6 +316,7 @@ Object.defineProperty(exports, "__esModule", {
exports.default = void 0; exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11)); var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _vuex = __webpack_require__(/*! vuex */ 34); var _vuex = __webpack_require__(/*! vuex */ 34);
var _vueI18n = __webpack_require__(/*! vue-i18n */ 46);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var myTime; var myTime;
@ -391,7 +392,8 @@ var _default = {
icon: '/static/q9.png', icon: '/static/q9.png',
title: '成员管理', title: '成员管理',
path: "/pageTwo/my/manage" path: "/pageTwo/my/manage"
}] }],
unit: ""
}; };
}, },
components: { components: {
@ -442,7 +444,7 @@ var _default = {
isBluetoothTyle: function isBluetoothTyle() { isBluetoothTyle: function isBluetoothTyle() {
var that = this; var that = this;
if (!that.isBluetoothTyle) { if (!that.isBluetoothTyle) {
that.textLink = "请打开手机蓝牙后,开始测量"; that.textLink = "开始连接";
that.islink = -1; that.islink = -1;
} }
} }
@ -627,7 +629,9 @@ var _default = {
uni.startBluetoothDevicesDiscovery({ uni.startBluetoothDevicesDiscovery({
allowDuplicatesKey: true, allowDuplicatesKey: true,
//是否允许重复上报同一设备 //是否允许重复上报同一设备
interval: 200,
success: function success(res) { success: function success(res) {
console.log("搜索设备");
that.onBluetoothDeviceFound(); that.onBluetoothDeviceFound();
}, },
fail: function fail(res) {} fail: function fail(res) {}
@ -682,6 +686,7 @@ var _default = {
var that = this; var that = this;
var foundDevices = that.devicesList; var foundDevices = that.devicesList;
var idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId); var idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId);
console.log("1111111", device.name);
if (idx === -1) { if (idx === -1) {
// 体脂秤 // 体脂秤
if (device.name.indexOf("PCL") != -1) { if (device.name.indexOf("PCL") != -1) {