蓝牙设备对接
This commit is contained in:
parent
3400c47db8
commit
8f2e28012e
|
|
@ -302,9 +302,9 @@
|
||||||
watch: {
|
watch: {
|
||||||
bleValue: {
|
bleValue: {
|
||||||
handler(newVal, oldVal) {
|
handler(newVal, oldVal) {
|
||||||
this.realTimeWeight(newVal.countWeight, newVal.unit)
|
this.realTimeWeight(newVal.foodWeight, newVal.foodUnit)
|
||||||
if (newVal.type == 2 && Number(newVal.countWeight) > 0) {
|
if (newVal.foodType == 2 && Number(newVal.foodWeight) > 0) {
|
||||||
this.handletoggleUnit(newVal.countWeight, newVal.unit, this.activeType.nutrients_four)
|
this.handletoggleUnit(newVal.foodWeight, newVal.foodUnit, this.activeType.nutrients_four)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
|
@ -384,7 +384,7 @@
|
||||||
//实时重量
|
//实时重量
|
||||||
realTimeWeight(weight, unit) {
|
realTimeWeight(weight, unit) {
|
||||||
this.activeType = Object.assign({}, this.activeType, {
|
this.activeType = Object.assign({}, this.activeType, {
|
||||||
weight: this.convertToGrams(weight, unit)
|
weight: this.$ble.convertToGrams(weight, unit)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 食物选择
|
// 食物选择
|
||||||
|
|
@ -398,17 +398,17 @@
|
||||||
that.activeType = ite
|
that.activeType = ite
|
||||||
that.weightKcal = ite.kcal
|
that.weightKcal = ite.kcal
|
||||||
if (that.bleValue.serviceId != "") {
|
if (that.bleValue.serviceId != "") {
|
||||||
that.realTimeWeight(that.bleValue.countWeight, that.bleValue.unit)
|
that.realTimeWeight(that.bleValue.foodWeight, that.bleValue.foodUnit)
|
||||||
if (that.bleValue.type == 2 && Number(that.bleValue.countWeight) > 0) {
|
if (that.bleValue.foodType == 2 && Number(that.bleValue.foodWeight) > 0) {
|
||||||
that.handletoggleUnit(that.bleValue.countWeight, that.bleValue.unit, ite.nutrients_four)
|
that.handletoggleUnit(that.bleValue.foodWeight, that.bleValue.foodUnit, ite.nutrients_four)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let weight = Number(that.bleValue.countWeight) > 0 ? Number(that.bleValue.countWeight) : 100
|
let weight = Number(that.bleValue.foodWeight) > 0 ? Number(that.bleValue.foodWeight) : 100
|
||||||
that.$store.commit("changeBluetoothValue", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
countWeight: weight,
|
foodWeight: weight,
|
||||||
unit: that.bleValue.unit
|
foodUnit: that.bleValue.foodUnit
|
||||||
})
|
})
|
||||||
that.realTimeWeight(weight, that.bleValue.unit)
|
that.realTimeWeight(weight, that.bleValue.foodUnit)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -523,14 +523,10 @@
|
||||||
eat_log_id: ite.food_id
|
eat_log_id: ite.food_id
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.ActiveList.splice(that.ActiveList.indexOf(ite), 1);
|
that.ActiveList.splice(that.ActiveList.indexOf(ite), 1);
|
||||||
if (that.time == that.countFoodInfo.date) {
|
|
||||||
that.$store.dispatch("getUserInfoFood")
|
|
||||||
} else {
|
|
||||||
that.$store.dispatch("getCountFoodInfo", {
|
that.$store.dispatch("getCountFoodInfo", {
|
||||||
aud_id: that.user.aud_id,
|
aud_id: that.user.aud_id,
|
||||||
time: that.time
|
time: that.time
|
||||||
})
|
})
|
||||||
}
|
|
||||||
that.handleAddEveryMealFood()
|
that.handleAddEveryMealFood()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -570,30 +566,10 @@
|
||||||
}
|
}
|
||||||
return unit
|
return unit
|
||||||
},
|
},
|
||||||
convertToGrams(value, fromUnit) {
|
|
||||||
const conversionFactors = {
|
|
||||||
'lb': 453.59237, // 1磅 = 453.59237克
|
|
||||||
'oz': 28.349523125, // 1盎司 = 28.349523125克
|
|
||||||
'kg': 1000, // 1公斤 = 1000克
|
|
||||||
'g': 1,
|
|
||||||
'ml': 1,
|
|
||||||
'斤': 500,
|
|
||||||
'Waterml': 1,
|
|
||||||
'milkml': 1.03
|
|
||||||
// "stlb": "floz": "lboz":
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
return value * conversionFactors[fromUnit];
|
|
||||||
},
|
|
||||||
|
|
||||||
// 下发营养含量
|
// 下发营养含量
|
||||||
handletoggleUnit(val, unit, ite) {
|
handletoggleUnit(val, unit, ite) {
|
||||||
let that = this
|
let that = this
|
||||||
let weight = Number(that.convertToGrams(val, unit)) / 100
|
let weight = Number(that.$ble.convertToGrams(val, unit)) / 100
|
||||||
const dataArray = that.buildNutritionData({
|
const dataArray = that.buildNutritionData({
|
||||||
fat: weight * ite[2].value,
|
fat: weight * ite[2].value,
|
||||||
calorie: weight * ite[0].value,
|
calorie: weight * ite[0].value,
|
||||||
|
|
@ -676,7 +652,7 @@
|
||||||
uni.writeBLECharacteristicValue({
|
uni.writeBLECharacteristicValue({
|
||||||
deviceId: that.bleValue.deviceId,
|
deviceId: that.bleValue.deviceId,
|
||||||
serviceId: that.bleValue.serviceId,
|
serviceId: that.bleValue.serviceId,
|
||||||
characteristicId: that.bleValue.write,
|
characteristicId: that.bleValue.foodWrite,
|
||||||
value: buffer,
|
value: buffer,
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log('下发指令成功', res.errMsg)
|
console.log('下发指令成功', res.errMsg)
|
||||||
|
|
@ -1246,7 +1222,6 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
border-bottom: 1px solid #f1f1f1;
|
border-bottom: 1px solid #f1f1f1;
|
||||||
padding: 16rpx 0;
|
padding: 16rpx 0;
|
||||||
font-size: 24rpx;
|
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -298,14 +298,18 @@
|
||||||
time: that.$tools.getDate("start")
|
time: that.$tools.getDate("start")
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code != 0) return
|
if (res.code != 0) return
|
||||||
that.$store.dispatch("getUserInfoFood")
|
that.$store.dispatch("getCountFoodInfo", {
|
||||||
|
aud_id: that.user.aud_id,
|
||||||
|
time: that.$tools.getDate("start")
|
||||||
|
})
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '保存成功',
|
title: '保存成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
// uni.switchTab({
|
that.$store.commit("changehomeCard", 1);
|
||||||
// url: "/pages/count/count"
|
uni.switchTab({
|
||||||
// })
|
url: "/pages/index/index"
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
that.showSaveFood = false
|
that.showSaveFood = false
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@
|
||||||
})
|
})
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: "/pages/home/home"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}).catch(err => {})
|
}).catch(err => {})
|
||||||
|
|
@ -285,7 +285,6 @@
|
||||||
|
|
||||||
button {
|
button {
|
||||||
line-height: initial;
|
line-height: initial;
|
||||||
background: #fff;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@
|
||||||
that.$store.dispatch("getResult", {
|
that.$store.dispatch("getResult", {
|
||||||
aud_id: val.id
|
aud_id: val.id
|
||||||
})
|
})
|
||||||
|
that.$store.commit("changehomeCard", 0);
|
||||||
that.$store.commit("changeDrawe", false);
|
that.$store.commit("changeDrawe", false);
|
||||||
// that.handlePublicRecord(val.id)
|
// that.handlePublicRecord(val.id)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
<input type="digit" v-model="weight" placeholder="请输入体重">kg
|
<input type="digit" v-model="weight" placeholder="请输入体重">kg
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="editem" v-if="userInfo.stage=='婴儿'">
|
<view class="editem" v-if="userInfo.stage==3">
|
||||||
<view class="left">头围</view>
|
<view class="left">头围</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<input v-model="head" type="digit" placeholder="请输入" />cm
|
<input v-model="head" type="digit" placeholder="请输入" />cm
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="weightPages">
|
<view class="weightPages">
|
||||||
<view class="table">
|
<view class="table">
|
||||||
<view class="text">
|
<view class="texttip">
|
||||||
<image src="/static/zhong.png"></image>
|
<image src="/static/zhong.png"></image>
|
||||||
<text @click="openBluetoothAdapter">{{bleTipsText}}</text>
|
<text @click="openBluetoothAdapter">{{bleTipsText}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<view class="weight-wrap">
|
<view class="weight-wrap">
|
||||||
<view class="weight" @click="inputDialogToggle">
|
<view class="weight" @click="inputDialogToggle">
|
||||||
<text class="val">{{weight == '' ? '0.0':weight}}</text>
|
<text class="val">{{weight == '' ? '0.0':weight}}</text>
|
||||||
<text class="unit">{{unitConversion(unit)}}</text>
|
<text class="unit">{{unit}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="weight">
|
<view class="weight">
|
||||||
<text class="val">{{kcal?kcal:0}}</text>
|
<text class="val">{{kcal?kcal:0}}</text>
|
||||||
|
|
@ -25,8 +25,7 @@
|
||||||
<view class="btn danwei">
|
<view class="btn danwei">
|
||||||
<view class="lan border-bottom">
|
<view class="lan border-bottom">
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<picker mode="selector" :range="unitA" range-key="name" @change="changleUnits"
|
<picker mode="selector" :range="unitA" @change="changleUnits" :value="unitListIndex">
|
||||||
:value="unitListIndex">
|
|
||||||
<view class="uni-input">
|
<view class="uni-input">
|
||||||
单位
|
单位
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -55,9 +54,11 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
kcal: "",
|
kcal: "",
|
||||||
weightALL: "",
|
|
||||||
bleTipsText: "",
|
|
||||||
unit: 'g',
|
unit: 'g',
|
||||||
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
|
notify: "",
|
||||||
|
write: "",
|
||||||
unitA: [],
|
unitA: [],
|
||||||
stopblue: false,
|
stopblue: false,
|
||||||
unitListIndex: 0,
|
unitListIndex: 0,
|
||||||
|
|
@ -78,48 +79,50 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "isBluetoothTyle", "bleValue"]),
|
...mapState(["user", "bleValue", "countFoodInfo"]),
|
||||||
weight() {
|
weight() {
|
||||||
let weightNew = this.convertToGrams(this.bleValue.countWeight, this.bleValue.unit)
|
let weightNew = this.$ble.convertToGrams(this.bleValue.foodWeight, this.bleValue.foodUnit)
|
||||||
this.kcal = (Number(this.weightKcal) * weightNew).toFixed(1)
|
this.kcal = (Number(this.weightKcal) * weightNew).toFixed(1)
|
||||||
this.unit = this.bleValue.unit
|
this.unit = this.bleValue.foodUnit
|
||||||
return this.bleValue.countWeight
|
return this.bleValue.foodWeight
|
||||||
},
|
},
|
||||||
isConnection() {
|
isConnection() {
|
||||||
this.bleTipsText = this.bleValue.bleTipsText
|
|
||||||
return this.bleValue.isConnectStatus
|
return this.bleValue.isConnectStatus
|
||||||
},
|
},
|
||||||
isShow() {
|
isShow() {
|
||||||
return this.bleValue.serviceId != '' ? true : false
|
return this.bleValue.serviceId != '' ? true : false
|
||||||
},
|
},
|
||||||
|
bleTipsText() {
|
||||||
|
return this.bleValue.bleTipsText
|
||||||
},
|
},
|
||||||
mounted() {
|
// unitA() {
|
||||||
let that = this
|
// let that = this
|
||||||
uni.onBluetoothAdapterStateChange(function(res) {
|
// that.unitListIndex = that.bleValue.unitList.findIndex(ite => ite.unit == that.bleValue.foodUnit)
|
||||||
// that.$store.commit("changeBluetooth", res.available);
|
// return that.bleValue.unitList
|
||||||
})
|
// }
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isBluetoothTyle: function() {
|
bleValue: {
|
||||||
|
handler(newVal, oldVal) {
|
||||||
let that = this
|
let that = this
|
||||||
if (!that.isBluetoothTyle) {
|
if (!newVal.isBluetoothTyle) {
|
||||||
that.handleBack()
|
that.handleBack()
|
||||||
}
|
}
|
||||||
|
if (newVal.serviceId) {
|
||||||
|
that.deviceId = newVal.deviceId
|
||||||
|
that.serviceId = newVal.serviceId
|
||||||
|
that.getBLEDeviceCharacteristics()
|
||||||
|
}
|
||||||
|
that.unitA = newVal.unitList
|
||||||
|
that.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.foodUnit)
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
},
|
},
|
||||||
isLast: {
|
isLast: {
|
||||||
handler(newVal, oldVal) {
|
handler(newVal, oldVal) {
|
||||||
this.stopblue = newVal
|
this.stopblue = newVal
|
||||||
},
|
},
|
||||||
// deep: true,
|
|
||||||
immediate: true
|
|
||||||
|
|
||||||
},
|
|
||||||
bleValue: {
|
|
||||||
handler(newVal, oldVal) {
|
|
||||||
this.unitA = newVal.unitList
|
|
||||||
this.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.unit)
|
|
||||||
},
|
|
||||||
deep: true,
|
|
||||||
immediate: true
|
immediate: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -127,80 +130,173 @@
|
||||||
// 初始化蓝牙
|
// 初始化蓝牙
|
||||||
openBluetoothAdapter() {
|
openBluetoothAdapter() {
|
||||||
let that = this
|
let that = this
|
||||||
if (that.isConnection == 0) return
|
if (that.isConnection != 1) return
|
||||||
that.kcal = ""
|
that.kcal = ""
|
||||||
that.$store.commit('changeBluetoothValue', {
|
that.$store.commit('changeBluetoothValue', {
|
||||||
deviceId: "",
|
|
||||||
serviceId: "",
|
|
||||||
notify: '',
|
|
||||||
write: '',
|
|
||||||
unit: "g",
|
|
||||||
type: 1,
|
|
||||||
unitList: that.$json.unitMinus,
|
|
||||||
countWeight: "",
|
|
||||||
bleTipsText: "蓝牙搜索中",
|
bleTipsText: "蓝牙搜索中",
|
||||||
isConnectStatus: 0,
|
isConnectStatus: 0,
|
||||||
|
isBleLink: false,
|
||||||
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
|
foodNotify: "",
|
||||||
|
foodType: 1,
|
||||||
|
foodWrite: "",
|
||||||
|
foodWeight: 0,
|
||||||
})
|
})
|
||||||
that.$ble.openBluetoothAdapter()
|
that.$ble.openBluetoothAdapter()
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 获取指定服务的特征值
|
||||||
|
*/
|
||||||
|
getBLEDeviceCharacteristics() {
|
||||||
|
let that = this
|
||||||
|
uni.getBLEDeviceCharacteristics({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
success: res => {
|
||||||
|
for (let i = 0; i < res.characteristics.length; i++) {
|
||||||
|
let item = res.characteristics[i];
|
||||||
|
if (item.uuid.indexOf('0000FFF2') != -1) {
|
||||||
|
that.write = item.uuid
|
||||||
|
} else if (item.uuid.indexOf('0000FFF1') != -1) {
|
||||||
|
that.notify = item.uuid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.getBLECharacteristicValueChange()
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
foodType: 1,
|
||||||
|
isConnectStatus: 1,
|
||||||
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
|
})
|
||||||
|
console.log('获取特征值失败:', JSON.stringify(res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getBLECharacteristicValueChange() {
|
||||||
|
let that = this
|
||||||
|
uni.notifyBLECharacteristicValueChange({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
characteristicId: that.notify,
|
||||||
|
state: true,
|
||||||
|
success: () => {
|
||||||
|
that.$store.commit('changeBluetoothValue', {
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
foodNotify: that.notify,
|
||||||
|
foodWrite: that.write,
|
||||||
|
bleTipsText: "测量中,请将食物放到秤上",
|
||||||
|
isConnectStatus: 2
|
||||||
|
})
|
||||||
|
uni.onBLECharacteristicValueChange(function(res) {
|
||||||
|
const value = res.value
|
||||||
|
const dataView = new DataView(value)
|
||||||
|
const header = dataView.getUint8(0)
|
||||||
|
// MCU主动上报数据
|
||||||
|
if (header === 0xC7) {
|
||||||
|
const cmd = dataView.getUint8(2)
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
case 0x02:
|
||||||
|
const statusByte = dataView.getUint8(4)
|
||||||
|
const isNegative = !!(statusByte & 0x80) // 最高位表示正负
|
||||||
|
const statusType = statusByte & 0x0F // 状态类型
|
||||||
|
|
||||||
|
// 组合24位重量值 (大端序)
|
||||||
|
const weightValue =
|
||||||
|
(dataView.getUint8(5) << 16) |
|
||||||
|
(dataView.getUint8(6) << 8) |
|
||||||
|
dataView.getUint8(7)
|
||||||
|
|
||||||
|
// 精度和单位
|
||||||
|
const unitByte = dataView.getUint8(8)
|
||||||
|
const precision = (unitByte & 0xF0) >> 4 // 高4位精度
|
||||||
|
const unitIndex = unitByte & 0x0F // 低4位单位
|
||||||
|
|
||||||
|
// 计算实际重量
|
||||||
|
let finalWeight = weightValue / Math.pow(10, precision)
|
||||||
|
|
||||||
|
if (isNegative) finalWeight = -finalWeight
|
||||||
|
|
||||||
|
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
foodWeight: finalWeight,
|
||||||
|
foodUnit: that.$json.units[unitIndex],
|
||||||
|
foodType: statusType
|
||||||
|
})
|
||||||
|
console.log('重量:' + finalWeight, "状态:" + statusType)
|
||||||
|
console.log('单位:' + that.$json.units[unitIndex])
|
||||||
|
break
|
||||||
|
case 0x03:
|
||||||
|
break
|
||||||
|
case 0x08:
|
||||||
|
const start0 = []
|
||||||
|
const value2 = that.$tools.ab2hex(value, "");
|
||||||
|
const start = that.$tools.parseUnitMask(value2.substring(8,
|
||||||
|
10), that.$json.units.slice(0, 7))
|
||||||
|
const start1 = that.$tools.parseUnitMask(value2.substring(10,
|
||||||
|
12), that.$json.units.slice(8, 10))
|
||||||
|
start.push.apply(start, start1)
|
||||||
|
if (start.length) {
|
||||||
|
that.$json.unitMinus.forEach(item => {
|
||||||
|
start.forEach(item2 => {
|
||||||
|
if (item == item2) {
|
||||||
|
start0.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
unitList: start0.length ? start0 : that.$json
|
||||||
|
.unitMinus
|
||||||
|
})
|
||||||
|
console.log("22222222222222", start, start0)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log('获取特征值失败:', JSON.stringify(res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 备料完成
|
||||||
|
handleDetailSub() {
|
||||||
|
let that = this
|
||||||
|
if (Number(that.weight) > 0) {
|
||||||
|
that.$emit("handleDetailSub", that.weight, that.unit, that.kcal)
|
||||||
|
} else {
|
||||||
|
that.$tools.msg("数据异常,请清零后重新测量!")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//备料下一个
|
||||||
|
handleDetailNext() {
|
||||||
|
let that = this
|
||||||
|
if (Number(that.weight) > 0) {
|
||||||
|
that.$emit("handleDetailNext", that.weight, that.unit, that.kcal)
|
||||||
|
} else {
|
||||||
|
that.$tools.msg("数据异常,请清零后重新测量!")
|
||||||
|
}
|
||||||
|
},
|
||||||
changleUnits(e) {
|
changleUnits(e) {
|
||||||
let that = this
|
let that = this
|
||||||
let name = that.unitA[e.detail.value].name
|
let unit = that.unitA[e.detail.value]
|
||||||
let val = that.unitA[e.detail.value].unit
|
console.log("danwei", that.unit, unit)
|
||||||
if (that.isShow && that.unit != name) {
|
if (that.isShow && that.unit != unit) {
|
||||||
that.handletoggleUnit(that.unitConversion2(val))
|
that.handletoggleUnit(that.$ble.unitInstruction(unit))
|
||||||
}
|
}
|
||||||
if (that.bleValue.serviceId == '') {
|
if (that.bleValue.serviceId == '') {
|
||||||
that.unitListIndex = [e.detail.value]
|
that.unitListIndex = [e.detail.value]
|
||||||
that.$store.commit('changeBluetoothValue', {
|
that.$store.commit('changeBluetoothValue', {
|
||||||
unit: that.unitA[e.detail.value].unit,
|
foodUnit: that.unitA[e.detail.value],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
convertToGrams(value, fromUnit) {
|
|
||||||
const conversionFactors = {
|
|
||||||
'lb': 453.59237, // 1磅 = 453.59237克
|
|
||||||
'oz': 28.349523125, // 1盎司 = 28.349523125克
|
|
||||||
'kg': 1000, // 1公斤 = 1000克
|
|
||||||
'g': 1,
|
|
||||||
'ml': 1,
|
|
||||||
'斤': 500,
|
|
||||||
'Waterml': 1,
|
|
||||||
'milkml': 1.03
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
return value * conversionFactors[fromUnit];
|
|
||||||
},
|
|
||||||
unitConversion2(unit) {
|
|
||||||
if (unit == 'kg') {
|
|
||||||
return 0x00
|
|
||||||
} else if (unit == '斤') {
|
|
||||||
return 0x01
|
|
||||||
} else if (unit == 'st:lb') {
|
|
||||||
return 0x02
|
|
||||||
} else if (unit == 'lb') {
|
|
||||||
return 0x03
|
|
||||||
} else if (unit == 'g') {
|
|
||||||
return 0x04
|
|
||||||
} else if (unit == 'ml') {
|
|
||||||
return 0x05
|
|
||||||
} else if (unit == 'Waterml') {
|
|
||||||
return 0x06
|
|
||||||
} else if (unit == 'milkml') {
|
|
||||||
return 0x07
|
|
||||||
} else if (unit == 'oz') {
|
|
||||||
return 0x08
|
|
||||||
} else if (unit == 'floz') {
|
|
||||||
return 0x09
|
|
||||||
} else if (unit == 'lboz') {
|
|
||||||
return 0x0A
|
|
||||||
}
|
|
||||||
return unit
|
|
||||||
},
|
|
||||||
// 下发单位
|
// 下发单位
|
||||||
handletoggleUnit(unit) {
|
handletoggleUnit(unit) {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -226,7 +322,7 @@
|
||||||
uni.writeBLECharacteristicValue({
|
uni.writeBLECharacteristicValue({
|
||||||
deviceId: that.bleValue.deviceId,
|
deviceId: that.bleValue.deviceId,
|
||||||
serviceId: that.bleValue.serviceId,
|
serviceId: that.bleValue.serviceId,
|
||||||
characteristicId: that.bleValue.write,
|
characteristicId: that.bleValue.foodWrite,
|
||||||
value: buffer,
|
value: buffer,
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log('下发指令成功', res.errMsg)
|
console.log('下发指令成功', res.errMsg)
|
||||||
|
|
@ -238,68 +334,26 @@
|
||||||
},
|
},
|
||||||
handleBack() {
|
handleBack() {
|
||||||
let that = this
|
let that = this
|
||||||
|
that.unitA = that.$json.unitMinus
|
||||||
that.$store.commit("changeBluetoothValue", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
bleTipsText: "连接失败,点击重新连接",
|
bleTipsText: "连接失败,点击重新连接",
|
||||||
unitList: that.$json.unitMinus,
|
unitList: that.$json.unitMinus,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
|
foodType: 1
|
||||||
})
|
})
|
||||||
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
that.$ble.closeBLEConnection(that.bleValue.deviceId)
|
that.$ble.closeBLEConnection(that.deviceId)
|
||||||
that.$ble.closeBluetoothAdapter()
|
that.$ble.closeBluetoothAdapter()
|
||||||
},
|
},
|
||||||
|
|
||||||
unitConversion(unit) {
|
|
||||||
if (unit == 'kg') {
|
|
||||||
return '千克'
|
|
||||||
} else if (unit == '斤') {
|
|
||||||
return '斤'
|
|
||||||
} else if (unit == 'stlb') {
|
|
||||||
return 'stlb'
|
|
||||||
} else if (unit == 'lb') {
|
|
||||||
return '磅'
|
|
||||||
} else if (unit == 'g') {
|
|
||||||
return '克'
|
|
||||||
} else if (unit == 'ml') {
|
|
||||||
return '毫升'
|
|
||||||
} else if (unit == 'Waterml') {
|
|
||||||
return 'Waterml'
|
|
||||||
} else if (unit == 'milkml') {
|
|
||||||
return 'milkml'
|
|
||||||
} else if (unit == 'oz') {
|
|
||||||
return '盎司'
|
|
||||||
} else if (unit == 'floz') {
|
|
||||||
return 'floz'
|
|
||||||
} else if (unit == 'lboz') {
|
|
||||||
return 'lboz'
|
|
||||||
}
|
|
||||||
return unit
|
|
||||||
},
|
|
||||||
// 备料完成
|
|
||||||
handleDetailSub() {
|
|
||||||
let that = this
|
|
||||||
if (Number(that.weight) > 0) {
|
|
||||||
that.$emit("handleDetailSub", that.weight, that.unit, that.kcal)
|
|
||||||
} else {
|
|
||||||
that.$tools.msg("数据异常,请清零后重新测量!")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//备料下一个
|
|
||||||
handleDetailNext() {
|
|
||||||
let that = this
|
|
||||||
if (Number(that.weight) > 0) {
|
|
||||||
that.$emit("handleDetailNext", that.weight, that.unit, that.kcal)
|
|
||||||
} else {
|
|
||||||
that.$tools.msg("数据异常,请清零后重新测量!")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
confirm(value) {
|
confirm(value) {
|
||||||
console.log(value)
|
console.log(value)
|
||||||
let that = this
|
let that = this
|
||||||
this.$store.commit("changeBluetoothValue", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
countWeight: value,
|
foodWeight: value,
|
||||||
unit: this.unitA[this.unitListIndex].unit
|
foodUnit: that.$json.unitMinus[that.unitListIndex]
|
||||||
})
|
})
|
||||||
this.$refs.popup.close()
|
that.$refs.popup.close()
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.$refs.popup.close()
|
this.$refs.popup.close()
|
||||||
|
|
@ -321,7 +375,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.text {
|
.texttip {
|
||||||
color: #8284f0;
|
color: #8284f0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="weightPages">
|
<view class="weightPages">
|
||||||
<view class="table">
|
<view class="table">
|
||||||
<view class="text">
|
<view class="textTipe">
|
||||||
<image src="/static/zhong.png"></image>
|
<image src="/static/zhong.png"></image>
|
||||||
<text @click="openBluetoothAdapter">{{bleTipsText}}</text>
|
<text @click="openBluetoothAdapter">{{bleTipsText}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<!-- 蓝牙称重 -->
|
<!-- 蓝牙称重 -->
|
||||||
<view class="weight" @click="inputDialogToggle">
|
<view class="weight" @click="inputDialogToggle">
|
||||||
<text class="val">{{weight == '' ? '0.0':weight}}</text>
|
<text class="val">{{weight == '' ? '0.0':weight}}</text>
|
||||||
<text class="unit">{{unitConversion(unit)}}</text>
|
<text class="unit">{{unit}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
@ -22,8 +22,7 @@
|
||||||
<view class="btn danwei">
|
<view class="btn danwei">
|
||||||
<view class="lan border-bottom">
|
<view class="lan border-bottom">
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<picker mode="selector" :range="unitA" range-key="name" @change="changleUnits"
|
<picker mode="selector" :range="unitA" @change="changleUnits" :value="unitListIndex">
|
||||||
:value="unitListIndex">
|
|
||||||
<view class="uni-input">
|
<view class="uni-input">
|
||||||
单位
|
单位
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -55,9 +54,13 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
kcal: 0,
|
kcal: 0,
|
||||||
unit: '',
|
unit: 'g',
|
||||||
inputDialog: false,
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
|
notify: "",
|
||||||
|
write: "",
|
||||||
unitA: [],
|
unitA: [],
|
||||||
|
inputDialog: false,
|
||||||
unitListIndex: 0,
|
unitListIndex: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -72,12 +75,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["bleValue", "isBluetoothTyle", "countFoodInfo"]),
|
...mapState(["bleValue", "countFoodInfo", "user"]),
|
||||||
weight() {
|
weight() {
|
||||||
let weightNew = this.convertToGrams(this.bleValue.countWeight, this.bleValue.unit)
|
let weightNew = this.$ble.convertToGrams(this.bleValue.foodWeight, this.bleValue.foodUnit)
|
||||||
this.kcal = (Number(this.weightKcal) / 100 * weightNew).toFixed(1)
|
this.kcal = (Number(this.weightKcal) / 100 * weightNew).toFixed(1)
|
||||||
this.unit = this.bleValue.unit
|
this.unit = this.bleValue.foodUnit
|
||||||
return this.bleValue.countWeight
|
return this.bleValue.foodWeight
|
||||||
},
|
},
|
||||||
isConnection() {
|
isConnection() {
|
||||||
return this.bleValue.isConnectStatus
|
return this.bleValue.isConnectStatus
|
||||||
|
|
@ -87,30 +90,22 @@
|
||||||
},
|
},
|
||||||
bleTipsText() {
|
bleTipsText() {
|
||||||
return this.bleValue.bleTipsText
|
return this.bleValue.bleTipsText
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
let that = this
|
|
||||||
uni.onBluetoothAdapterStateChange(function(res) {
|
|
||||||
// that.$store.commit("changeBluetooth", res.available);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
destroyed() {
|
|
||||||
// this.isConnection = 1
|
|
||||||
// this.closeBLEConnection()
|
|
||||||
// this.closeBluetoothAdapter()
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isBluetoothTyle: function() {
|
|
||||||
let that = this
|
|
||||||
if (!that.isBluetoothTyle) {
|
|
||||||
that.handleBack()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bleValue: {
|
bleValue: {
|
||||||
handler(newVal, oldVal) {
|
handler(newVal, oldVal) {
|
||||||
this.unitA = newVal.unitList
|
let that = this
|
||||||
this.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.unit)
|
if (!newVal.isBluetoothTyle) {
|
||||||
|
that.handleBack()
|
||||||
|
}
|
||||||
|
if (newVal.serviceId) {
|
||||||
|
that.deviceId = newVal.deviceId
|
||||||
|
that.serviceId = newVal.serviceId
|
||||||
|
that.getBLEDeviceCharacteristics()
|
||||||
|
}
|
||||||
|
that.unitA = newVal.unitList
|
||||||
|
that.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.foodUnit)
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true
|
immediate: true
|
||||||
|
|
@ -120,80 +115,157 @@
|
||||||
// 初始化蓝牙
|
// 初始化蓝牙
|
||||||
openBluetoothAdapter() {
|
openBluetoothAdapter() {
|
||||||
let that = this
|
let that = this
|
||||||
if (that.isConnection == 2) return
|
if (that.isConnection != 1) return
|
||||||
that.kcal = ""
|
that.kcal = ""
|
||||||
that.$store.commit('changeBluetoothValue', {
|
that.$store.commit('changeBluetoothValue', {
|
||||||
deviceId: "",
|
|
||||||
serviceId: "",
|
|
||||||
notify: '',
|
|
||||||
write: '',
|
|
||||||
unit: "g",
|
|
||||||
type: 1,
|
|
||||||
unitList: that.$json.unitMinus,
|
|
||||||
countWeight: "",
|
|
||||||
bleTipsText: "蓝牙搜索中",
|
bleTipsText: "蓝牙搜索中",
|
||||||
isConnectStatus: 0,
|
isConnectStatus: 0,
|
||||||
|
isBleLink: false,
|
||||||
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
|
foodNotify: "",
|
||||||
|
foodType: 1,
|
||||||
|
foodWrite: "",
|
||||||
|
foodWeight: 0
|
||||||
})
|
})
|
||||||
that.$ble.openBluetoothAdapter()
|
that.$ble.openBluetoothAdapter()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定服务的特征值
|
||||||
|
*/
|
||||||
|
getBLEDeviceCharacteristics() {
|
||||||
|
let that = this
|
||||||
|
uni.getBLEDeviceCharacteristics({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
success: res => {
|
||||||
|
for (let i = 0; i < res.characteristics.length; i++) {
|
||||||
|
let item = res.characteristics[i];
|
||||||
|
if (item.uuid.indexOf('0000FFF2') != -1) {
|
||||||
|
that.write = item.uuid
|
||||||
|
} else if (item.uuid.indexOf('0000FFF1') != -1) {
|
||||||
|
that.notify = item.uuid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.getBLECharacteristicValueChange()
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
foodType: 1,
|
||||||
|
isConnectStatus: 1,
|
||||||
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
|
})
|
||||||
|
console.log('获取特征值失败:', JSON.stringify(res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getBLECharacteristicValueChange() {
|
||||||
|
let that = this
|
||||||
|
uni.notifyBLECharacteristicValueChange({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
characteristicId: that.notify,
|
||||||
|
state: true,
|
||||||
|
success: () => {
|
||||||
|
that.$store.commit('changeBluetoothValue', {
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
foodNotify: that.notify,
|
||||||
|
foodWrite: that.write,
|
||||||
|
bleTipsText: "测量中,请将食物放到秤上",
|
||||||
|
isConnectStatus: 2
|
||||||
|
})
|
||||||
|
uni.onBLECharacteristicValueChange(function(res) {
|
||||||
|
const value = res.value
|
||||||
|
const dataView = new DataView(value)
|
||||||
|
const header = dataView.getUint8(0)
|
||||||
|
// MCU主动上报数据
|
||||||
|
if (header === 0xC7) {
|
||||||
|
const cmd = dataView.getUint8(2)
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
case 0x02:
|
||||||
|
const statusByte = dataView.getUint8(4)
|
||||||
|
const isNegative = !!(statusByte & 0x80) // 最高位表示正负
|
||||||
|
const statusType = statusByte & 0x0F // 状态类型
|
||||||
|
|
||||||
|
// 组合24位重量值 (大端序)
|
||||||
|
const weightValue =
|
||||||
|
(dataView.getUint8(5) << 16) |
|
||||||
|
(dataView.getUint8(6) << 8) |
|
||||||
|
dataView.getUint8(7)
|
||||||
|
|
||||||
|
// 精度和单位
|
||||||
|
const unitByte = dataView.getUint8(8)
|
||||||
|
const precision = (unitByte & 0xF0) >> 4 // 高4位精度
|
||||||
|
const unitIndex = unitByte & 0x0F // 低4位单位
|
||||||
|
|
||||||
|
// 计算实际重量
|
||||||
|
let finalWeight = weightValue / Math.pow(10, precision)
|
||||||
|
|
||||||
|
if (isNegative) finalWeight = -finalWeight
|
||||||
|
|
||||||
|
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
foodWeight: finalWeight,
|
||||||
|
foodUnit: that.$json.units[unitIndex],
|
||||||
|
foodType: statusType
|
||||||
|
})
|
||||||
|
console.log('重量:' + finalWeight, "状态:" + statusType)
|
||||||
|
console.log('单位:' + that.$json.units[unitIndex])
|
||||||
|
break
|
||||||
|
case 0x03:
|
||||||
|
break
|
||||||
|
case 0x08:
|
||||||
|
const start0 = []
|
||||||
|
const value2 = that.$tools.ab2hex(value, "");
|
||||||
|
const start = that.$tools.parseUnitMask(value2.substring(8,
|
||||||
|
10), that.$json.units.slice(0, 7))
|
||||||
|
const start1 = that.$tools.parseUnitMask(value2.substring(10,
|
||||||
|
12), that.$json.units.slice(8, 10))
|
||||||
|
start.push.apply(start, start1)
|
||||||
|
if (start.length) {
|
||||||
|
that.$json.unitMinus.forEach(item => {
|
||||||
|
start.forEach(item2 => {
|
||||||
|
if (item == item2) {
|
||||||
|
start0.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
unitList: start0.length ? start0 : that.$json
|
||||||
|
.unitMinus
|
||||||
|
})
|
||||||
|
console.log("22222222222222", start, start0)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log('获取特征值失败:', JSON.stringify(res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
changleUnits(e) {
|
changleUnits(e) {
|
||||||
let that = this
|
let that = this
|
||||||
let name = that.unitA[e.detail.value].name
|
let unit = that.unitA[e.detail.value]
|
||||||
let val = that.unitA[e.detail.value].unit
|
console.log("danwei", that.unit, unit)
|
||||||
if (that.isShow && that.unit != name) {
|
if (that.isShow && that.unit != unit) {
|
||||||
that.handletoggleUnit(that.unitConversion2(val))
|
that.handletoggleUnit(that.$ble.unitInstruction(unit))
|
||||||
}
|
}
|
||||||
if (that.bleValue.serviceId == '') {
|
if (that.bleValue.serviceId == '') {
|
||||||
that.unitListIndex = [e.detail.value]
|
that.unitListIndex = [e.detail.value]
|
||||||
that.$store.commit('changeBluetoothValue', {
|
that.$store.commit('changeBluetoothValue', {
|
||||||
unit: that.unitA[e.detail.value].unit,
|
foodUnit: that.unitA[e.detail.value],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
convertToGrams(value, fromUnit) {
|
|
||||||
const conversionFactors = {
|
|
||||||
'lb': 453.59237, // 1磅 = 453.59237克
|
|
||||||
'oz': 28.349523125, // 1盎司 = 28.349523125克
|
|
||||||
'kg': 1000, // 1公斤 = 1000克
|
|
||||||
'g': 1,
|
|
||||||
'ml': 1,
|
|
||||||
'斤': 500,
|
|
||||||
'Waterml': 1,
|
|
||||||
'milkml': 1.03
|
|
||||||
// "stlb": "floz": "lboz":
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
return value * conversionFactors[fromUnit];
|
|
||||||
},
|
|
||||||
unitConversion2(unit) {
|
|
||||||
if (unit == 'kg') {
|
|
||||||
return 0x00
|
|
||||||
} else if (unit == '斤') {
|
|
||||||
return 0x01
|
|
||||||
} else if (unit == 'st:lb') {
|
|
||||||
return 0x02
|
|
||||||
} else if (unit == 'lb') {
|
|
||||||
return 0x03
|
|
||||||
} else if (unit == 'g') {
|
|
||||||
return 0x04
|
|
||||||
} else if (unit == 'ml') {
|
|
||||||
return 0x05
|
|
||||||
} else if (unit == 'Waterml') {
|
|
||||||
return 0x06
|
|
||||||
} else if (unit == 'milkml') {
|
|
||||||
return 0x07
|
|
||||||
} else if (unit == 'oz') {
|
|
||||||
return 0x08
|
|
||||||
} else if (unit == 'floz') {
|
|
||||||
return 0x09
|
|
||||||
} else if (unit == 'lboz') {
|
|
||||||
return 0x0A
|
|
||||||
}
|
|
||||||
return unit
|
|
||||||
},
|
|
||||||
// 下发单位
|
// 下发单位
|
||||||
handletoggleUnit(unit) {
|
handletoggleUnit(unit) {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -218,9 +290,9 @@
|
||||||
sendData(buffer) {
|
sendData(buffer) {
|
||||||
let that = this
|
let that = this
|
||||||
uni.writeBLECharacteristicValue({
|
uni.writeBLECharacteristicValue({
|
||||||
deviceId: that.bleValue.deviceId,
|
deviceId: that.deviceId,
|
||||||
serviceId: that.bleValue.serviceId,
|
serviceId: that.serviceId,
|
||||||
characteristicId: that.bleValue.write,
|
characteristicId: that.write,
|
||||||
value: buffer,
|
value: buffer,
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log('下发指令成功', res.errMsg)
|
console.log('下发指令成功', res.errMsg)
|
||||||
|
|
@ -246,38 +318,14 @@
|
||||||
bleTipsText: "连接失败,点击重新连接",
|
bleTipsText: "连接失败,点击重新连接",
|
||||||
unitList: that.$json.unitMinus,
|
unitList: that.$json.unitMinus,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
|
foodType: 1
|
||||||
})
|
})
|
||||||
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
that.$ble.closeBLEConnection(that.bleValue.deviceId)
|
that.$ble.closeBLEConnection(that.deviceId)
|
||||||
that.$ble.closeBluetoothAdapter()
|
that.$ble.closeBluetoothAdapter()
|
||||||
},
|
},
|
||||||
|
|
||||||
unitConversion(unit) {
|
|
||||||
if (unit == 'kg') {
|
|
||||||
return '千克'
|
|
||||||
} else if (unit == '斤') {
|
|
||||||
return '斤'
|
|
||||||
} else if (unit == 'stlb') {
|
|
||||||
return 'stlb'
|
|
||||||
} else if (unit == 'lb') {
|
|
||||||
return '磅'
|
|
||||||
} else if (unit == 'g') {
|
|
||||||
return '克'
|
|
||||||
} else if (unit == 'ml') {
|
|
||||||
return '毫升'
|
|
||||||
} else if (unit == 'Waterml') {
|
|
||||||
return 'Waterml'
|
|
||||||
} else if (unit == 'milkml') {
|
|
||||||
return 'milkml'
|
|
||||||
} else if (unit == 'oz') {
|
|
||||||
return '盎司'
|
|
||||||
} else if (unit == 'floz') {
|
|
||||||
return 'floz'
|
|
||||||
} else if (unit == 'lboz') {
|
|
||||||
return 'lboz'
|
|
||||||
}
|
|
||||||
return unit
|
|
||||||
},
|
|
||||||
// 添加食物
|
// 添加食物
|
||||||
handleAddFood() {
|
handleAddFood() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
@ -289,13 +337,12 @@
|
||||||
},
|
},
|
||||||
// 手动输入
|
// 手动输入
|
||||||
confirm(value) {
|
confirm(value) {
|
||||||
console.log(value)
|
|
||||||
let that = this
|
let that = this
|
||||||
this.$store.commit("changeBluetoothValue", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
countWeight: value,
|
foodWeight: value,
|
||||||
unit: this.unitA[this.unitListIndex].unit
|
foodUnit: that.$json.unitMinus[that.unitListIndex]
|
||||||
})
|
})
|
||||||
this.$refs.popup.close()
|
that.$refs.popup.close()
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.$refs.popup.close()
|
this.$refs.popup.close()
|
||||||
|
|
@ -324,7 +371,6 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
margin: 10px;
|
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|
||||||
.weight-wrap {
|
.weight-wrap {
|
||||||
|
|
@ -409,7 +455,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.text {
|
.textTipe {
|
||||||
color: #8284f0;
|
color: #8284f0;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
21
content.json
21
content.json
|
|
@ -55,26 +55,7 @@
|
||||||
"unit": "lboz"
|
"unit": "lboz"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"unitMinus": [{
|
"unitMinus": ["g", "kg", "lb", "ml", "oz"],
|
||||||
"name": "千克",
|
|
||||||
"unit": "kg"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "磅",
|
|
||||||
"unit": "lb"
|
|
||||||
}, {
|
|
||||||
"name": "克",
|
|
||||||
"unit": "g"
|
|
||||||
}, {
|
|
||||||
"name": "毫升",
|
|
||||||
"unit": "ml"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "盎司",
|
|
||||||
"unit": "oz"
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
"units": ["kg", "斤", "stlb", "lb", "g", "ml", "Waterml", "milkml", "oz", "floz", "lboz"]
|
"units": ["kg", "斤", "stlb", "lb", "g", "ml", "Waterml", "milkml", "oz", "floz", "lboz"]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="weightPages">
|
<view class="weightPages">
|
||||||
<view class="content ">
|
<view class="content ">
|
||||||
<view class="status">{{UseBlueConfig.BleConnectMsg}}</view>
|
<view class="status">{{bleTipsText}}</view>
|
||||||
<view class="quan">
|
<view class="quan2">
|
||||||
<view>
|
<view>
|
||||||
<text class="weight">{{weight?weight:'0.00'}}</text>{{unit}}
|
<text class="weight">{{weight?weight:'0.00'}}</text>{{unit}}
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<view class="Blue-box">
|
<view class="Blue-box">
|
||||||
上次测量身高是:<input v-model="height" type="digit" placeholder="请输入身高" />cm
|
上次测量身高是:<input v-model="height" type="digit" placeholder="请输入身高" />cm
|
||||||
</view>
|
</view>
|
||||||
<view class="Blue-box" v-if="userInfo.stage=='婴儿'">
|
<view class="Blue-box" v-if="userInfo.stage==3">
|
||||||
上次测量头围是:<input v-model="head" type="digit" placeholder="请输入头围" />cm
|
上次测量头围是:<input v-model="head" type="digit" placeholder="请输入头围" />cm
|
||||||
</view>
|
</view>
|
||||||
<view class="Blue-btn Blue-close" @click="handleBack">重新测量</view>
|
<view class="Blue-btn Blue-close" @click="handleBack">重新测量</view>
|
||||||
|
|
@ -59,20 +59,18 @@
|
||||||
write: "",
|
write: "",
|
||||||
notify: "",
|
notify: "",
|
||||||
isFinished: false, //是否锁定数据
|
isFinished: false, //是否锁定数据
|
||||||
devicesList: [],
|
|
||||||
IsLing: false, //是否点击清零按钮
|
IsLing: false, //是否点击清零按钮
|
||||||
IsNum: false, //是否点击锁定按钮
|
IsNum: false, //是否点击锁定按钮
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "UseBlueConfig"]),
|
...mapState(["user", "bleValue"]),
|
||||||
userInfo() {
|
userInfo() {
|
||||||
return this.user
|
return this.user
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
bleTipsText() {
|
||||||
let that = this
|
return this.bleValue.bleTipsText
|
||||||
that.useBluetooth.clearBluetoothStatus()
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -80,22 +78,35 @@
|
||||||
that.height = that.userInfo.height
|
that.height = that.userInfo.height
|
||||||
that.head = that.userInfo.head_data
|
that.head = that.userInfo.head_data
|
||||||
that.deviceId = options.deviceId
|
that.deviceId = options.deviceId
|
||||||
that.useBluetooth.createBLEConnection("FFF0")
|
that.$ble.createBLEConnection("FFF0")
|
||||||
that.useBluetooth.onBLEConnectionStateChange()
|
that.$ble.onBLEConnectionStateChange()
|
||||||
that.useBluetooth.onBluetoothAdapterStateChange()
|
},
|
||||||
|
onUnload: function() {
|
||||||
|
let that = this
|
||||||
|
that.$ble.closeBLEConnection()
|
||||||
|
that.$ble.closeBluetoothAdapter()
|
||||||
|
console.log("返回首页onUnload")
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'UseBlueConfig.isUseConnect'() {
|
bleValue: {
|
||||||
|
handler(newVal, oldVal) {
|
||||||
let that = this
|
let that = this
|
||||||
if (!that.UseBlueConfig.isUseConnect) {
|
if (!newVal.isBluetoothTyle) {
|
||||||
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
|
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
|
||||||
|
setTimeout(function() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: "/pages/index/index"
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
if (newVal.serviceId) {
|
||||||
|
that.deviceId = newVal.deviceId
|
||||||
|
that.serviceId = newVal.serviceId
|
||||||
|
that.getBLEDeviceCharacteristics()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'UseBlueConfig.serviceId'() {
|
deep: true,
|
||||||
let that = this
|
immediate: true
|
||||||
if (that.UseBlueConfig.serviceId) {
|
|
||||||
that.getBLEDeviceCharacteristics(that.UseBlueConfig.serviceId)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
isFinished: function() {
|
isFinished: function() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -131,9 +142,11 @@
|
||||||
that.writeBLECharacteristicValue("A6020500076A") // 清零
|
that.writeBLECharacteristicValue("A6020500076A") // 清零
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
that.$store.commit("getIsUseBluetooth", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
BleConnectMsg: "蓝牙连接成功,请开始测量",
|
type: 1,
|
||||||
});
|
isConnectStatus: 2,
|
||||||
|
bleTipsText: "蓝牙连接成功,请上秤测量",
|
||||||
|
})
|
||||||
uni.notifyBLECharacteristicValueChange({
|
uni.notifyBLECharacteristicValueChange({
|
||||||
deviceId: that.deviceId,
|
deviceId: that.deviceId,
|
||||||
serviceId: that.serviceId,
|
serviceId: that.serviceId,
|
||||||
|
|
@ -277,32 +290,29 @@
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
that.$model.getmeasurefunit({
|
that.$model.getmeasurefunit({
|
||||||
adc: 0,
|
|
||||||
weight: that.weight + that.unit,
|
weight: that.weight + that.unit,
|
||||||
height: that.height,
|
height: that.height,
|
||||||
aud_id: that.userInfo.id,
|
aud_id: that.userInfo.aud_id,
|
||||||
head_data: that.head ? that.head : 0
|
head_data: that.head ? that.head : 0,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.isHeight = false
|
that.isHeight = false
|
||||||
that.isSave = false
|
that.isSave = false
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
that.$store.dispatch("getResult", {
|
|
||||||
aud_id: uni.getStorageSync('userid')
|
|
||||||
})
|
|
||||||
that.$store.dispatch('getUserInfo', {
|
that.$store.dispatch('getUserInfo', {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
|
})
|
||||||
|
that.$store.dispatch("getResult", {
|
||||||
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.$tools.msg("测量成功")
|
that.$tools.msg("测量成功")
|
||||||
} else {
|
} else {
|
||||||
that.$tools.msg("测量失败")
|
that.$tools.msg("测量失败")
|
||||||
}
|
}
|
||||||
|
setTimeout(function(){
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/body/body"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
// setTimeout(function() {
|
},500)
|
||||||
// that.closeBLEConnection()
|
|
||||||
// that.closeBluetoothAdapter()
|
|
||||||
// }, 200)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//重新测量
|
//重新测量
|
||||||
|
|
@ -354,9 +364,9 @@
|
||||||
background: linear-gradient(-90deg, #feaa50, #e96b13 80%) !important;
|
background: linear-gradient(-90deg, #feaa50, #e96b13 80%) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quan {
|
.quan2 {
|
||||||
width: 400rpx;
|
width: 460rpx;
|
||||||
height: 400rpx;
|
height: 460rpx;
|
||||||
border: 8px solid #feaa50;
|
border: 8px solid #feaa50;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin: 15px auto;
|
margin: 15px auto;
|
||||||
|
|
|
||||||
|
|
@ -68,12 +68,18 @@
|
||||||
that.deviceId = options.deviceId
|
that.deviceId = options.deviceId
|
||||||
that.$ble.createBLEConnection("FFF0")
|
that.$ble.createBLEConnection("FFF0")
|
||||||
that.$ble.onBLEConnectionStateChange()
|
that.$ble.onBLEConnectionStateChange()
|
||||||
that.$ble.onBluetoothAdapterStateChange()
|
},
|
||||||
|
onUnload: function() {
|
||||||
|
let that = this
|
||||||
|
that.$ble.closeBLEConnection()
|
||||||
|
that.$ble.closeBluetoothAdapter()
|
||||||
|
console.log("返回首页onUnload")
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'bleValue.isBluetoothTyle'() {
|
bleValue: {
|
||||||
|
handler(newVal, oldVal) {
|
||||||
let that = this
|
let that = this
|
||||||
if (!that.bleValue.isBluetoothTyle) {
|
if (!newVal.isBluetoothTyle) {
|
||||||
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
|
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
|
|
@ -81,14 +87,15 @@
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
},
|
if (newVal.serviceId) {
|
||||||
'bleValue.serviceId'() {
|
that.deviceId = newVal.deviceId
|
||||||
let that = this
|
that.serviceId = newVal.serviceId
|
||||||
if (that.bleValue.serviceId) {
|
that.getBLEDeviceCharacteristics(newVal.serviceId)
|
||||||
console.log("serviceId", that.bleValue.serviceId)
|
|
||||||
that.getBLEDeviceCharacteristics(that.bleValue.serviceId)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
|
|
@ -112,7 +119,7 @@
|
||||||
that.$store.commit("changeBluetoothValue", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
type: 1,
|
type: 1,
|
||||||
isConnectStatus: 2,
|
isConnectStatus: 2,
|
||||||
bleTipsText: "蓝牙连接成功,请上秤测量",
|
bleTipsText: "蓝牙连接成功,请开始测量",
|
||||||
})
|
})
|
||||||
uni.notifyBLECharacteristicValueChange({
|
uni.notifyBLECharacteristicValueChange({
|
||||||
deviceId: that.deviceId,
|
deviceId: that.deviceId,
|
||||||
|
|
@ -200,14 +207,9 @@
|
||||||
}
|
}
|
||||||
that.$model.getmeasurefunit({
|
that.$model.getmeasurefunit({
|
||||||
adc: 0,
|
adc: 0,
|
||||||
weight: that.weight,
|
weight: that.weight + 'kg',
|
||||||
height: height,
|
height: height,
|
||||||
aud_id: that.user.aud_id,
|
aud_id: that.user.aud_id,
|
||||||
lefthand: 0,
|
|
||||||
righthand: 0,
|
|
||||||
leftfoot: 0,
|
|
||||||
rightfoot: 0,
|
|
||||||
heart_rate: 0,
|
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.isHeight = false
|
that.isHeight = false
|
||||||
console.log("报告", res)
|
console.log("报告", res)
|
||||||
|
|
@ -215,13 +217,18 @@
|
||||||
that.$store.dispatch('getUserInfo', {
|
that.$store.dispatch('getUserInfo', {
|
||||||
aud_id: that.user.aud_id
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
|
that.$store.dispatch("getResult", {
|
||||||
|
aud_id: that.user.aud_id
|
||||||
|
})
|
||||||
that.$tools.msg("测量成功")
|
that.$tools.msg("测量成功")
|
||||||
} else {
|
} else {
|
||||||
that.$tools.msg("测量失败")
|
that.$tools.msg("测量失败")
|
||||||
}
|
}
|
||||||
|
setTimeout(function(){
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/index/index"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
|
},500)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleHeight() {
|
handleHeight() {
|
||||||
|
|
|
||||||
|
|
@ -49,22 +49,18 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user"]),
|
...mapState(["user", "bleValue"]),
|
||||||
info() {
|
info() {
|
||||||
return this.user
|
return this.user
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
|
||||||
let that = this
|
|
||||||
that.useBluetooth.clearBluetoothStatus()
|
|
||||||
},
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
that.text = ""
|
that.text = ""
|
||||||
that.stopblue = true
|
that.stopblue = true
|
||||||
that.deviceId = options.deviceId
|
that.deviceId = options.deviceId
|
||||||
that.height = that.user.height
|
that.height = that.user.height
|
||||||
uni.onBluetoothDeviceFound(handleDeviceFound)
|
that.onBluetoothDeviceFound()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
stopblue: function() {
|
stopblue: function() {
|
||||||
|
|
@ -79,8 +75,9 @@
|
||||||
/**
|
/**
|
||||||
* 发现外围设备
|
* 发现外围设备
|
||||||
*/
|
*/
|
||||||
onBluetoothDeviceFound(res) {
|
onBluetoothDeviceFound() {
|
||||||
var that = this;
|
var that = this
|
||||||
|
uni.onBluetoothDeviceFound(res => {
|
||||||
res.devices.forEach(device => {
|
res.devices.forEach(device => {
|
||||||
device.advertisData = device.advertisData ? device.advertisData : ''
|
device.advertisData = device.advertisData ? device.advertisData : ''
|
||||||
if (device.name.toLowerCase().indexOf("pcl") !== -1 && device.deviceId.indexOf(that
|
if (device.name.toLowerCase().indexOf("pcl") !== -1 && device.deviceId.indexOf(that
|
||||||
|
|
@ -115,12 +112,13 @@
|
||||||
that.deviceId = device.deviceId
|
that.deviceId = device.deviceId
|
||||||
that.weight = data
|
that.weight = data
|
||||||
that.stopblue = false
|
that.stopblue = false
|
||||||
that.useBluetooth.stopSearchBluetooth() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 保存测量结果
|
// 保存测量结果
|
||||||
handleGetMeasure() {
|
handleGetMeasure() {
|
||||||
|
|
@ -133,16 +131,16 @@
|
||||||
adc: that.imp,
|
adc: that.imp,
|
||||||
weight: that.weight + that.unit,
|
weight: that.weight + that.unit,
|
||||||
height: that.height,
|
height: that.height,
|
||||||
aud_id: that.info.id
|
aud_id: that.user.aud_id,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.isHeight = false
|
that.isHeight = false
|
||||||
console.log("res", res, that.imp)
|
console.log("res", res, that.imp)
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
that.$store.dispatch('getUserInfo', {
|
that.$store.dispatch('getUserInfo', {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.$store.dispatch("getResult", {
|
that.$store.dispatch("getResult", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.$tools.msg("测量成功")
|
that.$tools.msg("测量成功")
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -150,7 +148,7 @@
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/body/body"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
}, 200)
|
}, 200)
|
||||||
})
|
})
|
||||||
|
|
@ -159,14 +157,16 @@
|
||||||
handleBack() {
|
handleBack() {
|
||||||
let that = this
|
let that = this
|
||||||
that.text = ""
|
that.text = ""
|
||||||
that.$store.commit("getIsUseBluetooth", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
isBleLink: true,
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
BleBodyMsg: "开始测量",
|
isConnectStatus: 1,
|
||||||
isUseConnect: false,
|
isBleLink: false,
|
||||||
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
});
|
});
|
||||||
that.useBluetooth.stopSearchBluetooth() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/body/body"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -50,22 +50,18 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user"]),
|
...mapState(["user", "bleValue"]),
|
||||||
info() {
|
info() {
|
||||||
return this.user
|
return this.user
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
|
||||||
let that = this
|
|
||||||
that.useBluetooth.clearBluetoothStatus()
|
|
||||||
},
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
that.text = ""
|
that.text = ""
|
||||||
that.typeInfo = -1
|
that.typeInfo = -1
|
||||||
that.deviceId = options.deviceId
|
that.deviceId = options.deviceId
|
||||||
that.height = that.user.height
|
that.height = that.user.height
|
||||||
uni.onBluetoothDeviceFound(handleDeviceFound)
|
that.onBluetoothDeviceFound()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
stopblue: function() {
|
stopblue: function() {
|
||||||
|
|
@ -83,8 +79,9 @@
|
||||||
/**
|
/**
|
||||||
* 发现外围设备
|
* 发现外围设备
|
||||||
*/
|
*/
|
||||||
onBluetoothDeviceFound(res) {
|
onBluetoothDeviceFound() {
|
||||||
var that = this;
|
var that = this
|
||||||
|
uni.onBluetoothDeviceFound(res => {
|
||||||
res.devices.forEach(device => {
|
res.devices.forEach(device => {
|
||||||
device.advertisData = device.advertisData ? device.advertisData : ''
|
device.advertisData = device.advertisData ? device.advertisData : ''
|
||||||
let value = that.$tools.ab2hex(device.advertisData, "")
|
let value = that.$tools.ab2hex(device.advertisData, "")
|
||||||
|
|
@ -125,12 +122,13 @@
|
||||||
that.text = "您的稳定体重是:" + weight + that.unit
|
that.text = "您的稳定体重是:" + weight + that.unit
|
||||||
that.weight = weight
|
that.weight = weight
|
||||||
that.stopblue = true
|
that.stopblue = true
|
||||||
that.useBluetooth.stopSearchBluetooth() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
console.log("测量完成", that.weight)
|
console.log("测量完成", that.weight, that.imp)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 保存测量结果
|
// 保存测量结果
|
||||||
handleGetMeasure() {
|
handleGetMeasure() {
|
||||||
|
|
@ -143,16 +141,15 @@
|
||||||
adc: that.imp,
|
adc: that.imp,
|
||||||
weight: that.weight + that.unit,
|
weight: that.weight + that.unit,
|
||||||
height: that.height,
|
height: that.height,
|
||||||
aud_id: that.info.id
|
aud_id: that.user.aud_id,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.isHeight = false
|
that.isHeight = false
|
||||||
console.log("res", res, that.imp)
|
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
that.$store.dispatch('getUserInfo', {
|
that.$store.dispatch('getUserInfo', {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.$store.dispatch("getResult", {
|
that.$store.dispatch("getResult", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.$tools.msg("测量成功")
|
that.$tools.msg("测量成功")
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -160,7 +157,7 @@
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/body/body"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
}, 200)
|
}, 200)
|
||||||
})
|
})
|
||||||
|
|
@ -169,14 +166,16 @@
|
||||||
handleBack() {
|
handleBack() {
|
||||||
let that = this
|
let that = this
|
||||||
that.text = ""
|
that.text = ""
|
||||||
that.$store.commit("getIsUseBluetooth", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
isBleLink: true,
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
BleBodyMsg: "开始测量",
|
isConnectStatus: 1,
|
||||||
isUseConnect: false,
|
isBleLink: false,
|
||||||
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
});
|
});
|
||||||
that.useBluetooth.stopSearchBluetooth() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/body/body"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user"]),
|
...mapState(["user", "bleValue"]),
|
||||||
info() {
|
info() {
|
||||||
return this.user
|
return this.user
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
|
||||||
let that = this
|
|
||||||
that.useBluetooth.clearBluetoothStatus()
|
|
||||||
},
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
that.text = ""
|
that.text = ""
|
||||||
|
|
@ -66,7 +62,7 @@
|
||||||
that.stopblue = false
|
that.stopblue = false
|
||||||
that.deviceId = options.deviceId
|
that.deviceId = options.deviceId
|
||||||
that.height = that.user.height
|
that.height = that.user.height
|
||||||
uni.onBluetoothDeviceFound(handleDeviceFound)
|
that.onBluetoothDeviceFound()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
stopblue: function() {
|
stopblue: function() {
|
||||||
|
|
@ -84,8 +80,9 @@
|
||||||
/**
|
/**
|
||||||
* 发现外围设备
|
* 发现外围设备
|
||||||
*/
|
*/
|
||||||
onBluetoothDeviceFound(res) {
|
onBluetoothDeviceFound() {
|
||||||
var that = this;
|
var that = this
|
||||||
|
uni.onBluetoothDeviceFound(res => {
|
||||||
res.devices.forEach(device => {
|
res.devices.forEach(device => {
|
||||||
device.advertisData = device.advertisData ? device.advertisData : ''
|
device.advertisData = device.advertisData ? device.advertisData : ''
|
||||||
if (device.name.toLowerCase().indexOf("da") !== -1) {
|
if (device.name.toLowerCase().indexOf("da") !== -1) {
|
||||||
|
|
@ -106,12 +103,13 @@
|
||||||
that.imp = !isNaN(type2) ? parseInt(value.substring(6, 10), 16) : ''
|
that.imp = !isNaN(type2) ? parseInt(value.substring(6, 10), 16) : ''
|
||||||
that.weight = weight
|
that.weight = weight
|
||||||
that.stopblue = true
|
that.stopblue = true
|
||||||
that.useBluetooth.stopSearchBluetooth() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 保存测量结果
|
// 保存测量结果
|
||||||
handleGetMeasure() {
|
handleGetMeasure() {
|
||||||
|
|
@ -124,16 +122,16 @@
|
||||||
adc: that.imp,
|
adc: that.imp,
|
||||||
weight: that.weight + that.unit,
|
weight: that.weight + that.unit,
|
||||||
height: that.height,
|
height: that.height,
|
||||||
aud_id: that.info.id
|
aud_id: that.user.aud_id,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.isHeight = false
|
that.isHeight = false
|
||||||
console.log("res", res, that.imp)
|
console.log("res", res, that.imp)
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
that.$store.dispatch('getUserInfo', {
|
that.$store.dispatch('getUserInfo', {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.$store.dispatch("getResult", {
|
that.$store.dispatch("getResult", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.$tools.msg("测量成功")
|
that.$tools.msg("测量成功")
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -141,7 +139,7 @@
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/body/body"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
}, 200)
|
}, 200)
|
||||||
})
|
})
|
||||||
|
|
@ -150,14 +148,16 @@
|
||||||
handleBack() {
|
handleBack() {
|
||||||
let that = this
|
let that = this
|
||||||
that.text = ""
|
that.text = ""
|
||||||
that.$store.commit("getIsUseBluetooth", {
|
that.$store.commit("changeBluetoothValue", {
|
||||||
isBleLink: true,
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
BleBodyMsg: "开始测量",
|
isConnectStatus: 1,
|
||||||
isUseConnect: false,
|
isBleLink: false,
|
||||||
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
});
|
});
|
||||||
that.useBluetooth.stopSearchBluetooth() //取消蓝牙搜索
|
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/body/body"
|
url: "/pages/index/index"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["isConnected", "isBluetoothTyle"]),
|
...mapState(["bleValue","user"]),
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -104,10 +104,7 @@
|
||||||
}, 1200)
|
}, 1200)
|
||||||
}
|
}
|
||||||
that.handleAudioStart()
|
that.handleAudioStart()
|
||||||
that.$Bluetooth.onBLEConnectionStateChange()
|
that.$ble.onBLEConnectionStateChange()
|
||||||
uni.onBluetoothAdapterStateChange(function(res) {
|
|
||||||
// that.$store.commit("changeBluetooth", res.available);
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -118,9 +115,9 @@
|
||||||
console.log("PCT01返回onUnload")
|
console.log("PCT01返回onUnload")
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isConnected: function() {
|
"bleValue.isBluetoothTyle": function() {
|
||||||
let that = this
|
let that = this
|
||||||
if (!that.isConnected) {
|
if (!bleValue.isBluetoothTyle) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '连接已断开',
|
title: '连接已断开',
|
||||||
content: '训练过程中已与设备连接中断,请重新连接设备再开始训练',
|
content: '训练过程中已与设备连接中断,请重新连接设备再开始训练',
|
||||||
|
|
@ -134,12 +131,7 @@
|
||||||
console.log("蓝牙是否连接", that.isConnected)
|
console.log("蓝牙是否连接", that.isConnected)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isBluetoothTyle: function() {
|
|
||||||
let that = this
|
|
||||||
if (!that.isBluetoothTyle) {
|
|
||||||
console.log("蓝牙是否打开", that.isBluetoothTyle)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 开始跳绳
|
// 开始跳绳
|
||||||
isStart: function() {
|
isStart: function() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -399,8 +391,8 @@
|
||||||
that.time_s = that.time % 60
|
that.time_s = that.time % 60
|
||||||
}
|
}
|
||||||
console.log("111111保存", that.weight, that.Ycount, that.time_m, that.time_s)
|
console.log("111111保存", that.weight, that.Ycount, that.time_m, that.time_s)
|
||||||
that.$model.getskipResult({
|
that.$model.getSkipResult({
|
||||||
aud_id: uni.getStorageSync('userid'),
|
aud_id: that.user.aud_id,
|
||||||
kcal: Math.floor(that.kcal),
|
kcal: Math.floor(that.kcal),
|
||||||
num: that.weight,
|
num: that.weight,
|
||||||
time_m: Number(that.time_m),
|
time_m: Number(that.time_m),
|
||||||
|
|
@ -414,8 +406,8 @@
|
||||||
that.bpm = that.weight / (that.time / 60)
|
that.bpm = that.weight / (that.time / 60)
|
||||||
that.iswrapper = true
|
that.iswrapper = true
|
||||||
that.info.isSuccessful = true
|
that.info.isSuccessful = true
|
||||||
that.$store.dispatch('getUserInfo', {
|
that.$store.dispatch("getSkipResult", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
that.$tools.msg(res.msg)
|
that.$tools.msg(res.msg)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,423 @@
|
||||||
|
<template>
|
||||||
|
<view class="weightPages">
|
||||||
|
<view class="content ">
|
||||||
|
<view class="status">{{bleTipsText}}</view>
|
||||||
|
<view class="quan">
|
||||||
|
<view>
|
||||||
|
<text class="weight">{{weight?weight:'0.00'}}</text>{{unit}}
|
||||||
|
</view>
|
||||||
|
<view class="typeInfo" v-if="typeInfo!=0">{{typeInfo==2?'稳定重量':'实时重量'}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="tips">
|
||||||
|
<text>提示:</text>
|
||||||
|
<text>1.请确定设备是开机状态</text>
|
||||||
|
<text>2.请确定手机蓝牙、位置信息已打开</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 手动记录 -->
|
||||||
|
<view class="wrapper" v-if="isHeight">
|
||||||
|
<view class="bg"></view>
|
||||||
|
<view class="Blue">
|
||||||
|
<view class="h4">测量结果提示</view>
|
||||||
|
<view class="Blue-box">
|
||||||
|
本次测量身高为:<text>{{height}}{{unit}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="Blue-box">
|
||||||
|
上次测量体重为:<input v-model="weight" type="digit" placeholder="请输入体重" />kg
|
||||||
|
</view>
|
||||||
|
<view class="Blue-btn Blue-close" @click="handleHeight">重新测量</view>
|
||||||
|
<view class="Blue-btn" @click="handleGetMeasure">保存测量结果</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState
|
||||||
|
} from "vuex";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
text: "",
|
||||||
|
typeInfo: 0,
|
||||||
|
head: "",
|
||||||
|
weight: "",
|
||||||
|
height: "",
|
||||||
|
unit: "kg",
|
||||||
|
isHeight: false,
|
||||||
|
isSave: true, //保存按钮是否显示
|
||||||
|
deviceId: "",
|
||||||
|
serviceId: "",
|
||||||
|
write: "",
|
||||||
|
notify: "",
|
||||||
|
isFinished: false, //是否锁定数据
|
||||||
|
devicesList: [],
|
||||||
|
IsLing: false, //是否点击清零按钮
|
||||||
|
IsNum: false, //是否点击锁定按钮
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["user", "bleValue"]),
|
||||||
|
userInfo() {
|
||||||
|
return this.user
|
||||||
|
},
|
||||||
|
bleTipsText() {
|
||||||
|
return this.bleValue.bleTipsText
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
let that = this
|
||||||
|
that.typeInfo = 0
|
||||||
|
that.height = that.userInfo.height
|
||||||
|
that.head = that.userInfo.head_data
|
||||||
|
that.deviceId = options.deviceId
|
||||||
|
that.$ble.createBLEConnection("FFF0")
|
||||||
|
that.$ble.onBLEConnectionStateChange()
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'bleValue.isBluetoothTyle'() {
|
||||||
|
let that = this
|
||||||
|
if (!that.bleValue.isBluetoothTyle) {
|
||||||
|
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
|
||||||
|
setTimeout(function() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: "/pages/index/index"
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'bleValue.serviceId'() {
|
||||||
|
let that = this
|
||||||
|
if (that.bleValue.serviceId) {
|
||||||
|
that.serviceId = that.bleValue.serviceId
|
||||||
|
that.getBLEDeviceCharacteristics(that.bleValue.serviceId)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isFinished: function() {
|
||||||
|
let that = this
|
||||||
|
console.log("是否开启弹框", that.weight, that.isFinished, that.typeInfo)
|
||||||
|
if (!that.isFinished) {
|
||||||
|
that.isHeight = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (that.isFinished && that.typeInfo == 2) {
|
||||||
|
setTimeout(function() {
|
||||||
|
that.isHeight = true
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 获取指定服务的特征值
|
||||||
|
*/
|
||||||
|
getBLEDeviceCharacteristics(serviceId) {
|
||||||
|
let that = this;
|
||||||
|
uni.getBLEDeviceCharacteristics({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: serviceId,
|
||||||
|
success: res => {
|
||||||
|
// * 读read: true, //,写write: true, //,通知notify: true
|
||||||
|
for (let i = 0; i < res.characteristics.length; i++) {
|
||||||
|
let item = res.characteristics[i];
|
||||||
|
if (item.uuid.indexOf('0000FFF1') != -1) {
|
||||||
|
that.notify = item.uuid
|
||||||
|
} else if (item.uuid.indexOf('0000FFF2') != -1) {
|
||||||
|
that.write = item.uuid
|
||||||
|
that.writeBLECharacteristicValue("A6020500076A") // 清零
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
type: 1,
|
||||||
|
isConnectStatus: 2,
|
||||||
|
bleTipsText: "蓝牙连接成功,请上秤测量",
|
||||||
|
})
|
||||||
|
uni.notifyBLECharacteristicValueChange({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: serviceId,
|
||||||
|
characteristicId: that.notify,
|
||||||
|
state: true,
|
||||||
|
})
|
||||||
|
uni.notifyBLECharacteristicValueChange({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: serviceId,
|
||||||
|
characteristicId: that.write,
|
||||||
|
state: true,
|
||||||
|
})
|
||||||
|
that.isFinished = false
|
||||||
|
setTimeout(function() {
|
||||||
|
that.notifyBLECharacteristicValue(serviceId)
|
||||||
|
}, 800)
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log('获取特征值失败:', JSON.stringify(res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 开启订阅特征值
|
||||||
|
* read: true, //读,write: true, //写,notify: true, //广播
|
||||||
|
*/
|
||||||
|
notifyBLECharacteristicValue(serviceId) {
|
||||||
|
let that = this;
|
||||||
|
uni.notifyBLECharacteristicValueChange({
|
||||||
|
state: true, // 启用 notify 功能
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: serviceId,
|
||||||
|
characteristicId: that.notify,
|
||||||
|
success(res) {
|
||||||
|
that.isSave = true
|
||||||
|
uni.onBLECharacteristicValueChange(function(res) {
|
||||||
|
let value = that.$tools.ab2hex(res.value, "");
|
||||||
|
let type = value.substring(4, 6) // 状态
|
||||||
|
let typeInfo = value.substring(6, 8) //实时、稳定
|
||||||
|
let weight = parseInt(value.substring(8, 14), 16) //体重
|
||||||
|
let digit = value.substring(18, 19) // 小数
|
||||||
|
let unit = value.substring(19, 20) //单位
|
||||||
|
let weight1 = ""
|
||||||
|
let weight2 = ""
|
||||||
|
|
||||||
|
// 小数
|
||||||
|
if (digit == "0") {
|
||||||
|
weight = weight
|
||||||
|
}
|
||||||
|
if (digit == "1") {
|
||||||
|
weight = weight / 10
|
||||||
|
}
|
||||||
|
if (digit == '2') {
|
||||||
|
weight = weight / 100
|
||||||
|
}
|
||||||
|
if (digit == "3") {
|
||||||
|
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") {
|
||||||
|
that.typeInfo = 1
|
||||||
|
that.weight = weight
|
||||||
|
that.IsLing = false
|
||||||
|
that.isHeight = false
|
||||||
|
that.isFinished = false
|
||||||
|
}
|
||||||
|
// 稳定体重
|
||||||
|
if (typeInfo == "02" && !that.isFinished) {
|
||||||
|
that.typeInfo = 2
|
||||||
|
that.weight = weight
|
||||||
|
if (weight > 0 || toString(weight) != '0:0.00') {
|
||||||
|
that.isFinished = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("状态:", value, type, typeInfo, weight, that.unit, that.isFinished)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
console.log("测量失败", res.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 清零
|
||||||
|
handleIsLing() {
|
||||||
|
let that = this
|
||||||
|
if (!that.IsLing) {
|
||||||
|
that.writeBLECharacteristicValue("A6020500076A")
|
||||||
|
that.IsLing = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//锁定
|
||||||
|
handleIsNum() {
|
||||||
|
let that = this
|
||||||
|
that.writeBLECharacteristicValue("A6020400066A")
|
||||||
|
},
|
||||||
|
writeBLECharacteristicValue(str) {
|
||||||
|
var that = this;
|
||||||
|
let buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function(h) {
|
||||||
|
return parseInt(h, 16)
|
||||||
|
}))
|
||||||
|
console.log("buffer", str, buf)
|
||||||
|
uni.writeBLECharacteristicValue({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
characteristicId: that.write,
|
||||||
|
value: buf.buffer,
|
||||||
|
success: res => {
|
||||||
|
console.log('下发指令成功', res.errMsg)
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log("下发指令失败", res);
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 保存测量结果
|
||||||
|
handleGetMeasure() {
|
||||||
|
let that = this
|
||||||
|
if (!that.height) {
|
||||||
|
this.$tools.msg("请输入身高")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
that.$model.getmeasurefunit({
|
||||||
|
weight: that.weight + that.unit,
|
||||||
|
height: that.height,
|
||||||
|
aud_id: that.userInfo.aud_id,
|
||||||
|
head_data: that.head ? that.head : 0,
|
||||||
|
lefthand: 0,
|
||||||
|
righthand: 0,
|
||||||
|
leftfoot: 0,
|
||||||
|
rightfoot: 0,
|
||||||
|
heart_rate: 0,
|
||||||
|
}).then(res => {
|
||||||
|
that.isHeight = false
|
||||||
|
that.isSave = false
|
||||||
|
if (res.code == 0) {
|
||||||
|
that.$store.dispatch('getUserInfo', {
|
||||||
|
aud_id: that.user.aud_id
|
||||||
|
})
|
||||||
|
that.$store.dispatch("getResult", {
|
||||||
|
aud_id: that.user.aud_id
|
||||||
|
})
|
||||||
|
that.$tools.msg("测量成功")
|
||||||
|
} else {
|
||||||
|
that.$tools.msg("测量失败")
|
||||||
|
}
|
||||||
|
uni.switchTab({
|
||||||
|
url: "/pages/index/index"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//重新测量
|
||||||
|
handleBack() {
|
||||||
|
let that = this
|
||||||
|
let str = "A6020500076A"
|
||||||
|
let buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function(h) {
|
||||||
|
return parseInt(h, 16)
|
||||||
|
}))
|
||||||
|
uni.writeBLECharacteristicValue({
|
||||||
|
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)
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log("下发指令失败", res);
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.content {
|
||||||
|
background: #fff;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnClose {
|
||||||
|
color: #fff;
|
||||||
|
background: linear-gradient(-90deg, #fccf4f, #fba418 80%) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.baocun {
|
||||||
|
color: #fff;
|
||||||
|
background: linear-gradient(-90deg, #feaa50, #e96b13 80%) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quan {
|
||||||
|
width: 460rpx;
|
||||||
|
height: 460rpx;
|
||||||
|
border: 8px solid #feaa50;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 15px auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0px 0px 25px 10px #e96b13;
|
||||||
|
animation: pulse 1s infinite;
|
||||||
|
|
||||||
|
.weight {
|
||||||
|
font-size: 50px;
|
||||||
|
color: #000;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.typeInfo {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #f0ae43;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0px 0px 25px 10px #e96b13;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
box-shadow: 0px 0px 25px 10px #fba418;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
box-shadow: 0px 0px 25px 10px #e96b13;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
width: 70%;
|
||||||
|
font-size: 16px;
|
||||||
|
height: 35px;
|
||||||
|
line-height: 35px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 15px;
|
||||||
|
margin: 15px auto;
|
||||||
|
background-color: #ffdda6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
width: 150px;
|
||||||
|
background-color: #DFDFDF;
|
||||||
|
border: 1px solid #f7f7f7;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
padding: 7px;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin: 15px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
font-size: 14px !important;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -36,7 +36,6 @@
|
||||||
height: 70px;
|
height: 70px;
|
||||||
line-height: 70px;
|
line-height: 70px;
|
||||||
background: $btncolor;
|
background: $btncolor;
|
||||||
margin-left: calc(50% - 35px);
|
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<view class="skiptop">
|
<view class="skiptop">
|
||||||
<view class="status" @click="handleisSdevice()">
|
<view class="status" @click="handleisSdevice()">
|
||||||
<text>{{textLink}}</text>
|
<text>{{bleTipsText}}</text>
|
||||||
<image v-if="islink!=1" :class="[islink==-1?'':'icon_link']" src="../../static/zhuan.png"></image>
|
<image v-if="islink!=2" :class="[islink==1?'':'icon_link']" src="../../static/zhuan.png"></image>
|
||||||
<image v-if="islink==1" src="../../static/dui.png"></image>
|
<image v-if="islink==2" src="../../static/dui.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="item-ite">今日个数<text>{{info?info.today_jump_num:'--'}}</text></view>
|
<view class="item-ite">今日个数<text>{{info?info.today_jump_num:'--'}}</text></view>
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<text class="item-set item-set0">自由</text>
|
<text class="item-set item-set0">自由</text>
|
||||||
<text class="tips">无限制</text>
|
<text class="tips">无限制</text>
|
||||||
</view>
|
</view>
|
||||||
<view :class="[islink==1?'start':'start Nstart']" @click="handleStart(1)">开始</view>
|
<view :class="[islink==2?'start':'start Nstart']" @click="handleStart(1)">开始</view>
|
||||||
</view>
|
</view>
|
||||||
<!--定时训练 -->
|
<!--定时训练 -->
|
||||||
<view class="box1 box" v-if="active==2">
|
<view class="box1 box" v-if="active==2">
|
||||||
|
|
@ -69,29 +69,33 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
active: 1,
|
active: 1,
|
||||||
acd_id: 6,
|
|
||||||
weight: 50,
|
weight: 50,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
isDevice: 0,
|
isDevice: 0,
|
||||||
isConnection: false,
|
|
||||||
time_m: "",
|
time_m: "",
|
||||||
time_s: "",
|
time_s: "",
|
||||||
timeList: [],
|
timeList: [],
|
||||||
devicesList: [],
|
|
||||||
timesTndex: [1, 0],
|
timesTndex: [1, 0],
|
||||||
deviceId: "",
|
deviceId: "",
|
||||||
serviceId: "",
|
serviceId: "",
|
||||||
write: "",
|
write: "",
|
||||||
notify: "",
|
notify: "",
|
||||||
islink: 0, //0连接中,1成功,-1失败
|
|
||||||
textLink: ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', "MeasureSkip", "isConnected", "isBluetoothTyle"]),
|
...mapState(['user', "MeasureSkip", "bleValue"]),
|
||||||
info() {
|
info() {
|
||||||
return this.MeasureSkip
|
return this.MeasureSkip
|
||||||
},
|
},
|
||||||
|
bleTipsText() {
|
||||||
|
return this.bleValue.bleTipsText
|
||||||
|
},
|
||||||
|
isConnection() {
|
||||||
|
return this.bleValue.isBluetoothTyle
|
||||||
|
},
|
||||||
|
islink() {
|
||||||
|
return this.bleValue.isConnectStatus
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -101,27 +105,11 @@
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
// 首页进入
|
|
||||||
if (options && options.deviceId) {
|
|
||||||
that.deviceId = options.deviceId
|
that.deviceId = options.deviceId
|
||||||
setTimeout(function() {
|
|
||||||
that.createBLEConnection()
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
if (options && options.acd_id) {
|
|
||||||
that.$Bluetooth.stopBluetoothDevicesDiscovery()
|
|
||||||
setTimeout(function() {
|
|
||||||
that.handleisSdevice()
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
that.$store.dispatch("getSkipResult", {
|
that.$store.dispatch("getSkipResult", {
|
||||||
aud_id: that.user.aud_id
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
that.isConnection = that.isConnected
|
that.$ble.onBLEConnectionStateChange()
|
||||||
that.onBLEConnectionStateChange()
|
|
||||||
uni.onBluetoothAdapterStateChange(function(res) {
|
|
||||||
that.$store.commit("changeBluetooth", res.available);
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -133,180 +121,66 @@
|
||||||
// 跳绳页返回
|
// 跳绳页返回
|
||||||
uni.$on('updateData', function(info) {
|
uni.$on('updateData', function(info) {
|
||||||
let data = JSON.parse(info)
|
let data = JSON.parse(info)
|
||||||
that.acd_id = data.acd_id
|
|
||||||
that.isDevice = data.device
|
that.isDevice = data.device
|
||||||
that.active = data.active
|
that.active = data.active
|
||||||
that.deviceId = data.deviceId
|
that.deviceId = data.deviceId
|
||||||
that.serviceId = data.serviceId
|
that.serviceId = data.serviceId
|
||||||
that.write = data.write
|
that.write = data.write
|
||||||
that.notify = data.notify
|
that.notify = data.notify
|
||||||
that.islink = !that.isConnected ? -1 : 1
|
|
||||||
that.isConnection = that.isConnected
|
|
||||||
that.notifyBLECharacteristicValue()
|
that.notifyBLECharacteristicValue()
|
||||||
if (data.isSuccessful) {
|
if (data.isSuccessful) {
|
||||||
that.$store.dispatch("getSkipResult", {
|
that.$store.dispatch("getSkipResult", {
|
||||||
aud_id: that.user.aud_id
|
aud_id: that.user.aud_id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
that.onBLEConnectionStateChange()
|
that.$ble.onBLEConnectionStateChange()
|
||||||
uni.onBluetoothAdapterStateChange(function(res) {
|
|
||||||
that.$store.commit("changeBluetooth", res.available);
|
|
||||||
})
|
|
||||||
console.log('监听到事件来自 updateData', data);
|
console.log('监听到事件来自 updateData', data);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
let that = this
|
let that = this
|
||||||
clearTimeout(myTime);
|
clearTimeout(myTime);
|
||||||
that.islink = -1
|
that.$ble.closeBLEConnection()
|
||||||
that.isConnection = false
|
that.$ble.closeBluetoothAdapter()
|
||||||
that.closeBLEConnection()
|
|
||||||
that.closeBluetoothAdapter()
|
|
||||||
uni.$off("updateData")
|
uni.$off("updateData")
|
||||||
setTimeout(() => {
|
|
||||||
uni.switchTab({
|
|
||||||
url: '/pages/home/home'
|
|
||||||
})
|
|
||||||
}, 300)
|
|
||||||
console.log("返回首页onUnload")
|
console.log("返回首页onUnload")
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isConnected() {
|
bleValue: {
|
||||||
|
handler(newVal, oldVal) {
|
||||||
let that = this
|
let that = this
|
||||||
if (!that.isConnected) {
|
if (newVal.serviceId) {
|
||||||
that.islink = -1
|
that.deviceId = newVal.deviceId
|
||||||
that.textLink = "重新连接"
|
that.serviceId = newVal.serviceId
|
||||||
|
that.getBLEDeviceCharacteristics()
|
||||||
|
}
|
||||||
|
if (!newVal.isBluetoothTyle) {
|
||||||
|
that.$store.commit("changeBluetoothValue", {
|
||||||
|
bleTipsText: "连接失败,点击重新连接",
|
||||||
|
isConnectStatus: 1,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
that.isConnection = that.isConnected
|
|
||||||
console.log("蓝牙是否连接", that.isConnected)
|
|
||||||
},
|
},
|
||||||
isBluetoothTyle() {
|
deep: true,
|
||||||
let that = this
|
immediate: true
|
||||||
if (!that.isBluetoothTyle) {
|
},
|
||||||
that.isConnection = false
|
|
||||||
that.textLink = "请打开手机蓝牙"
|
|
||||||
that.islink = -1
|
|
||||||
}
|
|
||||||
console.log("蓝牙是否打开", that.isBluetoothTyle)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 初始化蓝牙
|
// 初始化蓝牙
|
||||||
handleisSdevice() {
|
handleisSdevice() {
|
||||||
let that = this
|
let that = this
|
||||||
if (that.isConnected) return
|
if (that.islink == 2) return
|
||||||
that.devicesList = []
|
that.$store.commit('changeBluetoothValue', {
|
||||||
that.$Bluetooth.stopBluetoothDevicesDiscovery()
|
bleTipsText: "蓝牙搜索中",
|
||||||
uni.openBluetoothAdapter({
|
isConnectStatus: 0,
|
||||||
success: e => {
|
isBleLink: false,
|
||||||
that.islink = 0
|
deviceId: "",
|
||||||
that.handleMyTime()
|
serviceId: "",
|
||||||
that.textLink = "蓝牙搜索中"
|
|
||||||
that.startBluetoothDeviceDiscovery()
|
|
||||||
that.$store.commit("changeBluetooth", true)
|
|
||||||
console.log('初始化蓝牙成功:' + e.errMsg);
|
|
||||||
},
|
|
||||||
fail: e => {
|
|
||||||
that.islink = -1
|
|
||||||
that.textLink = that.$tools.getBluetoothAdapter(e)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 开始搜寻附近的蓝牙外围设备
|
|
||||||
startBluetoothDeviceDiscovery() {
|
|
||||||
let that = this
|
|
||||||
uni.startBluetoothDevicesDiscovery({
|
|
||||||
allowDuplicatesKey: true,
|
|
||||||
interval: 200, //上报设备的间隔
|
|
||||||
services: [],
|
|
||||||
success: res => {
|
|
||||||
that.onBluetoothDeviceFound();
|
|
||||||
},
|
|
||||||
fail: res => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 发现外围设备
|
|
||||||
*/
|
|
||||||
onBluetoothDeviceFound() {
|
|
||||||
var that = this;
|
|
||||||
uni.onBluetoothDeviceFound(res => {
|
|
||||||
res.devices.forEach(device => {
|
|
||||||
if (!device.name && !device.localName) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (device.name.indexOf('YPC') != -1) {
|
|
||||||
device.deviceId = device.deviceId
|
|
||||||
that.deviceId = device.deviceId
|
|
||||||
that.$Bluetooth.stopBluetoothDevicesDiscovery()
|
|
||||||
that.handleDevice(device)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
that.$ble.openBluetoothAdapter()
|
||||||
that.handleMyTime()
|
|
||||||
},
|
|
||||||
handleDevice(device) {
|
|
||||||
let that = this
|
|
||||||
const foundDevices = that.devicesList
|
|
||||||
const idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId)
|
|
||||||
if (idx === -1) {
|
|
||||||
that.devicesList.push(device);
|
|
||||||
that.createBLEConnection()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 连接蓝牙
|
|
||||||
createBLEConnection() {
|
|
||||||
let that = this;
|
|
||||||
uni.createBLEConnection({
|
|
||||||
deviceId: that.deviceId,
|
|
||||||
success: res => {
|
|
||||||
that.textLink = "蓝牙连接中"
|
|
||||||
setTimeout(function() {
|
|
||||||
that.islink = 1
|
|
||||||
that.getBLEDeviceServices()
|
|
||||||
}, 1000)
|
|
||||||
},
|
|
||||||
fail: res => {
|
|
||||||
that.textLink = "重新连接"
|
|
||||||
console.log("设备连接失败,请重新连接", res, that.deviceId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 获取设备的UUID
|
|
||||||
*/
|
|
||||||
getBLEDeviceServices() {
|
|
||||||
let serviceList = [];
|
|
||||||
let that = this;
|
|
||||||
uni.getBLEDeviceServices({
|
|
||||||
deviceId: that.deviceId,
|
|
||||||
success: res => {
|
|
||||||
console.log("获取设备的UUID成功", res)
|
|
||||||
serviceList = res.services;
|
|
||||||
for (let i = 0; i < serviceList.length; i++) {
|
|
||||||
let service = serviceList[i];
|
|
||||||
if (service.uuid.indexOf("FFE0") != -1) {
|
|
||||||
that.serviceId = service.uuid;
|
|
||||||
that.isConnection = true
|
|
||||||
that.textLink = "连接成功"
|
|
||||||
that.getBLEDeviceCharacteristics();
|
|
||||||
console.log("设备的FFE0的serviceId: " + that.serviceId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: res => {
|
|
||||||
console.log('获取设备的UUID失败:', res)
|
|
||||||
that.islink = -1
|
|
||||||
that.textLink = "重新连接"
|
|
||||||
clearTimeout(myTime);
|
|
||||||
that.isConnection = false
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定服务的特征值
|
* 获取指定服务的特征值
|
||||||
*/
|
*/
|
||||||
|
|
@ -364,6 +238,14 @@
|
||||||
serviceId: that.serviceId,
|
serviceId: that.serviceId,
|
||||||
characteristicId: that.notify,
|
characteristicId: that.notify,
|
||||||
success(res) {
|
success(res) {
|
||||||
|
that.$store.commit('changeBluetoothValue', {
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
foodNotify: that.notify,
|
||||||
|
foodWrite: that.write,
|
||||||
|
bleTipsText: "连接成功",
|
||||||
|
isConnectStatus: 2
|
||||||
|
})
|
||||||
uni.onBLECharacteristicValueChange(function(res) {
|
uni.onBLECharacteristicValueChange(function(res) {
|
||||||
let value = that.$tools.ab2hex(res.value, "");
|
let value = that.$tools.ab2hex(res.value, "");
|
||||||
if (value == '5a05090169') { //模式设置成功
|
if (value == '5a05090169') { //模式设置成功
|
||||||
|
|
@ -373,15 +255,13 @@
|
||||||
serviceId: that.serviceId,
|
serviceId: that.serviceId,
|
||||||
notify: that.notify,
|
notify: that.notify,
|
||||||
write: that.write,
|
write: that.write,
|
||||||
acd_id: that.acd_id,
|
|
||||||
isDevice: that.isDevice,
|
isDevice: that.isDevice,
|
||||||
isSuccessful: false
|
isSuccessful: false
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.$off("updateData")
|
uni.$off("updateData")
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pageTwo/devices/PCT01?info=" + JSON
|
url: "/pageTwo/devices/PCT01?info=" + JSON.stringify(info)
|
||||||
.stringify(info)
|
|
||||||
})
|
})
|
||||||
}, 200)
|
}, 200)
|
||||||
}
|
}
|
||||||
|
|
@ -415,7 +295,7 @@
|
||||||
let that = this
|
let that = this
|
||||||
let m = null
|
let m = null
|
||||||
let send = null
|
let send = null
|
||||||
if (!that.isConnected) {
|
if (!that.bleValue.isBluetoothTyle) {
|
||||||
that.$tools.msg("请先连接设备!")
|
that.$tools.msg("请先连接设备!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -441,16 +321,7 @@
|
||||||
send = "A50508" + Number(num).toString(16) + m.substr(m.length - 2, 2)
|
send = "A50508" + Number(num).toString(16) + m.substr(m.length - 2, 2)
|
||||||
}
|
}
|
||||||
that.SendData(send)
|
that.SendData(send)
|
||||||
that.$Bluetooth.stopBluetoothDevicesDiscovery()
|
that.$ble.stopBluetoothDevicesDiscovery()
|
||||||
},
|
|
||||||
// 历史数据删除时重新加载接口
|
|
||||||
reload() {
|
|
||||||
let that = this
|
|
||||||
this.$nextTick(() => {
|
|
||||||
that.$store.dispatch("getSkipResult", {
|
|
||||||
aud_id: that.user.aud_id
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 定时训练
|
// 定时训练
|
||||||
//
|
//
|
||||||
|
|
@ -507,51 +378,6 @@
|
||||||
that.weight = Number(that.weight) + 50
|
that.weight = Number(that.weight) + 50
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 蓝牙搜索记时
|
|
||||||
handleMyTime() {
|
|
||||||
let that = this
|
|
||||||
myTime = setTimeout(function() {
|
|
||||||
if (!that.devicesList.length) {
|
|
||||||
that.islink = -1
|
|
||||||
that.textLink = "重新搜索"
|
|
||||||
that.$tools.showModal("没有查找到设备")
|
|
||||||
}
|
|
||||||
clearTimeout(myTime)
|
|
||||||
that.$Bluetooth.stopBluetoothDevicesDiscovery()
|
|
||||||
}, 20000);
|
|
||||||
},
|
|
||||||
// 监听蓝牙连接状态
|
|
||||||
onBLEConnectionStateChange() {
|
|
||||||
let that = this
|
|
||||||
uni.onBLEConnectionStateChange(function(res) {
|
|
||||||
console.log("监听蓝牙连接状态", res.connected)
|
|
||||||
that.$store.commit("changeConnected", res.connected);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 断开蓝牙模块
|
|
||||||
*/
|
|
||||||
closeBluetoothAdapter() {
|
|
||||||
let that = this;
|
|
||||||
uni.closeBluetoothAdapter({
|
|
||||||
success: res => {
|
|
||||||
console.log('蓝牙模块关闭成功');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 断开蓝牙连接
|
|
||||||
*/
|
|
||||||
closeBLEConnection() {
|
|
||||||
var that = this;
|
|
||||||
uni.closeBLEConnection({
|
|
||||||
deviceId: that.deviceId,
|
|
||||||
success: res => {
|
|
||||||
console.log('断开蓝牙连接成功');
|
|
||||||
that.$store.commit("changeConnected", false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,12 @@
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "devices/pcL06",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 蓝牙 -->
|
<!-- 蓝牙 -->
|
||||||
<view class="bluetooth" v-if="userList.length">
|
<view class="bluetooth" v-if="userList.length" :class="[bleValue.isConnectStatus==1?'activs':'']">
|
||||||
<view class="bleTips" @click="openBluetoothAdapter">
|
<view class="bleTips" @click="openBluetoothAdapter">
|
||||||
{{bleTipsText}}
|
{{bleTipsText}}
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -37,9 +37,9 @@
|
||||||
|
|
||||||
<!-- 数据 -->
|
<!-- 数据 -->
|
||||||
<view class="toggle">
|
<view class="toggle">
|
||||||
<view :class="{'active':toolsIndex==0}" class="toolsItem" @click="toolsIndex=0">身体数据</view>
|
<view :class="{'active':toolsIndex==0}" class="toolsItem" @click="handleToolsIndex(0)">身体数据</view>
|
||||||
<view :class="{'active':toolsIndex==1}" class="toolsItem" @click="toolsIndex=1">饮食数据</view>
|
<view :class="{'active':toolsIndex==1}" class="toolsItem" @click="handleToolsIndex(1)">饮食数据</view>
|
||||||
<view :class="{'active':toolsIndex==2}" class="toolsItem" @click="toolsIndex=2">健康工具</view>
|
<view :class="{'active':toolsIndex==2}" class="toolsItem" @click="handleToolsIndex(2)">健康工具</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="token">
|
<view v-if="token">
|
||||||
<body v-if="toolsIndex==0"></body>
|
<body v-if="toolsIndex==0"></body>
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
<text>暂无数据</text>
|
<text>暂无数据</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<drawer></drawer>
|
<drawer @handleToolsIndex="handleToolsIndex(0)"></drawer>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
token: "",
|
token: "",
|
||||||
toolsIndex: 0
|
// toolsIndex: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
drawer,
|
drawer,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user", "familayList", 'MeasureResult', "configInfo", "bleValue"]),
|
...mapState(["user", "familayList", 'MeasureResult', "configInfo", "bleValue", "homeCardIndex"]),
|
||||||
info() {
|
info() {
|
||||||
return this.user
|
return this.user
|
||||||
},
|
},
|
||||||
|
|
@ -92,6 +92,9 @@
|
||||||
},
|
},
|
||||||
bleTipsText() {
|
bleTipsText() {
|
||||||
return this.bleValue.bleTipsText
|
return this.bleValue.bleTipsText
|
||||||
|
},
|
||||||
|
toolsIndex(){
|
||||||
|
return this.homeCardIndex
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
@ -113,12 +116,25 @@
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isBluetoothTyle: function() {
|
'bleValue.isBluetoothTyle'() {
|
||||||
let that = this
|
let that = this
|
||||||
if (!that.isBluetoothTyle) {
|
if (!that.bleValue.isBluetoothTyle) {
|
||||||
that.handleBack()
|
that.handleBack()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'bleValue.isFood'() {
|
||||||
|
let that = this
|
||||||
|
if (that.bleValue.isFood) {
|
||||||
|
that.$store.commit("changehomeCard", 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// homeCardIndex: {
|
||||||
|
// handler(newVal, oldVal) {
|
||||||
|
// this.toolsIndex = newVal
|
||||||
|
// },
|
||||||
|
// deep: true,
|
||||||
|
// immediate: true
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 成员列表
|
// 成员列表
|
||||||
|
|
@ -165,8 +181,10 @@
|
||||||
aud_id: userid
|
aud_id: userid
|
||||||
})
|
})
|
||||||
that.handlePublicRecord(userid)
|
that.handlePublicRecord(userid)
|
||||||
|
if (that.bleValue.isConnectStatus != 2) {
|
||||||
that.$ble.openBluetoothAdapter()
|
that.$ble.openBluetoothAdapter()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).catch(err => {})
|
}).catch(err => {})
|
||||||
},
|
},
|
||||||
// 公共手动记录内容
|
// 公共手动记录内容
|
||||||
|
|
@ -184,17 +202,17 @@
|
||||||
// 初始化蓝牙
|
// 初始化蓝牙
|
||||||
openBluetoothAdapter() {
|
openBluetoothAdapter() {
|
||||||
let that = this
|
let that = this
|
||||||
if (that.isConnection == 2) return
|
if (that.isConnection != 1) return
|
||||||
that.$store.commit('changeBluetoothValue', {
|
that.$store.commit('changeBluetoothValue', {
|
||||||
deviceId: "",
|
deviceId: "",
|
||||||
serviceId: "",
|
serviceId: "",
|
||||||
// notify: '',
|
isFood: false,
|
||||||
// write: '',
|
foodWeight: 100,
|
||||||
// unit: "g",
|
foodUnit: "g",
|
||||||
// type: 1,
|
foodNotify: "",
|
||||||
// unitList: that.$json.unitMinus,
|
foodWrite: "",
|
||||||
// countWeight: "",
|
unitList: that.$json.unitMinus,
|
||||||
isBleLink: false, //是否可以点击
|
foodType: 1,
|
||||||
bleTipsText: "蓝牙搜索中",
|
bleTipsText: "蓝牙搜索中",
|
||||||
isConnectStatus: 0,
|
isConnectStatus: 0,
|
||||||
})
|
})
|
||||||
|
|
@ -222,9 +240,12 @@
|
||||||
that.$tools("登录后查看更多")
|
that.$tools("登录后查看更多")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleToolsIndex(ind) {
|
||||||
|
this.$store.commit("changehomeCard", ind);
|
||||||
|
},
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pageTwo/login/login"
|
url: "/body/login/login"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -232,6 +253,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.activs {
|
||||||
|
background: #ffc800 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 240rpx;
|
height: 240rpx;
|
||||||
|
|
|
||||||
|
|
@ -668,6 +668,7 @@
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
padding: 20px 10px 5px;
|
padding: 20px 10px 5px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
width: calc(100% - 50px);
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
width: 250rpx;
|
width: 250rpx;
|
||||||
height: 250rpx;
|
height: 250rpx;
|
||||||
margin-top: -30rpx;
|
margin-top: -30rpx;
|
||||||
margin-left: -5px;
|
margin-left: 5px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
|
|
@ -47,19 +47,16 @@ export default new Vuex.Store({
|
||||||
bleValue: {
|
bleValue: {
|
||||||
deviceId: "",
|
deviceId: "",
|
||||||
serviceId: "",
|
serviceId: "",
|
||||||
isBleLink: false,
|
isFood: false,
|
||||||
|
foodWeight: 100,
|
||||||
|
foodUnit: "g",
|
||||||
|
foodNotify: "",
|
||||||
|
foodWrite: "",
|
||||||
|
foodunitList: json.unitArray,
|
||||||
|
foodType: 1, //食物称 1实时,2锁定 状态类型
|
||||||
bleTipsText: "", //蓝牙提示语
|
bleTipsText: "", //蓝牙提示语
|
||||||
isConnectStatus: 0, //蓝牙连接状态 0搜索中,1失败,2成功
|
isConnectStatus: 0, //蓝牙连接状态 0搜索中,1失败,2成功
|
||||||
isBluetoothTyle: false, //蓝牙状态
|
isBluetoothTyle: false, //蓝牙状态
|
||||||
// notify: "",
|
|
||||||
// write: "",
|
|
||||||
// unit: "g",
|
|
||||||
// type: 1,
|
|
||||||
// unitList: json.unitArray,
|
|
||||||
// isSendVal: false,
|
|
||||||
// oldCountWeight: 0,
|
|
||||||
// countWeight: 100,
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// 计食器
|
// 计食器
|
||||||
countFoodInfo: {
|
countFoodInfo: {
|
||||||
|
|
@ -113,6 +110,7 @@ export default new Vuex.Store({
|
||||||
chosen_yes: [],
|
chosen_yes: [],
|
||||||
chosen_no: []
|
chosen_no: []
|
||||||
},
|
},
|
||||||
|
homeCardIndex: 0,
|
||||||
isDrawe: false, //左侧弹框
|
isDrawe: false, //左侧弹框
|
||||||
isTarget: false, //目标体重
|
isTarget: false, //目标体重
|
||||||
isFirst: false, //初始体重
|
isFirst: false, //初始体重
|
||||||
|
|
@ -128,6 +126,10 @@ export default new Vuex.Store({
|
||||||
changeUser(state, newData) {
|
changeUser(state, newData) {
|
||||||
Object.assign(state.user, newData)
|
Object.assign(state.user, newData)
|
||||||
},
|
},
|
||||||
|
// 首页卡片当前项
|
||||||
|
changehomeCard(state, newData) {
|
||||||
|
state.homeCardIndex = newData
|
||||||
|
},
|
||||||
//获取家庭成员
|
//获取家庭成员
|
||||||
changeFamilay(state, newData) {
|
changeFamilay(state, newData) {
|
||||||
if (newData.length == 0) {
|
if (newData.length == 0) {
|
||||||
|
|
|
||||||
|
|
@ -2,32 +2,38 @@ import $store from '@/store'
|
||||||
import useBluetooth from '@/toolJs/Bluetooth.js'
|
import useBluetooth from '@/toolJs/Bluetooth.js'
|
||||||
import $tools from '@/toolJs/tools.js'
|
import $tools from '@/toolJs/tools.js'
|
||||||
import $data from '@/content.json'
|
import $data from '@/content.json'
|
||||||
|
import $model from '@/toolJs/model.js'
|
||||||
// // 蓝牙连接
|
// // 蓝牙连接
|
||||||
let deviceId = ""
|
let deviceId = ""
|
||||||
|
let deviceName = ""
|
||||||
let devicesList = []
|
let devicesList = []
|
||||||
let searchTimer = null
|
let searchTimer = null
|
||||||
export default {
|
export default {
|
||||||
|
unitInstruction,
|
||||||
|
convertToGrams,
|
||||||
|
unitConversion,
|
||||||
openBluetoothAdapter,
|
openBluetoothAdapter,
|
||||||
startBluetoothDeviceDiscovery,
|
startBluetoothDeviceDiscovery,
|
||||||
onBluetoothDeviceFound,
|
onBluetoothDeviceFound,
|
||||||
Bluetoothfilter,
|
Bluetoothfilter,
|
||||||
createBLEConnection,
|
createBLEConnection,
|
||||||
getBLEDeviceServices,
|
getBLEDeviceServices,
|
||||||
getBLEDeviceCharacteristics,
|
|
||||||
closeBluetoothAdapter,
|
closeBluetoothAdapter,
|
||||||
closeBLEConnection,
|
closeBLEConnection,
|
||||||
getBLECharacteristicValueChange,
|
|
||||||
onBLEConnectionStateChange,
|
onBLEConnectionStateChange,
|
||||||
stopBluetoothDevicesDiscovery
|
stopBluetoothDevicesDiscovery
|
||||||
}
|
}
|
||||||
// // 初始化蓝牙
|
// // 初始化蓝牙
|
||||||
function openBluetoothAdapter() {
|
function openBluetoothAdapter() {
|
||||||
devicesList = []
|
devicesList = []
|
||||||
|
deviceId = ""
|
||||||
|
deviceName = ""
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
uni.openBluetoothAdapter({
|
uni.openBluetoothAdapter({
|
||||||
success: e => {
|
success: e => {
|
||||||
$store.commit("changeBluetoothValue", {
|
$store.commit("changeBluetoothValue", {
|
||||||
bleTipsText: "蓝牙搜索中",
|
bleTipsText: "蓝牙搜索中",
|
||||||
|
unitList: $data.unitMinus,
|
||||||
isConnectStatus: 0,
|
isConnectStatus: 0,
|
||||||
isBleLink: false,
|
isBleLink: false,
|
||||||
deviceId: "",
|
deviceId: "",
|
||||||
|
|
@ -38,6 +44,7 @@ function openBluetoothAdapter() {
|
||||||
fail: err => {
|
fail: err => {
|
||||||
$store.commit("changeBluetoothValue", {
|
$store.commit("changeBluetoothValue", {
|
||||||
bleTipsText: "连接超时,点击重新连接",
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
|
unitList: $data.unitMinus,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
isBleLink: false,
|
isBleLink: false,
|
||||||
deviceId: "",
|
deviceId: "",
|
||||||
|
|
@ -52,6 +59,7 @@ function startBluetoothDeviceDiscovery() {
|
||||||
uni.startBluetoothDevicesDiscovery({
|
uni.startBluetoothDevicesDiscovery({
|
||||||
allowDuplicatesKey: true,
|
allowDuplicatesKey: true,
|
||||||
interval: 200, //上报设备的间隔
|
interval: 200, //上报设备的间隔
|
||||||
|
services: [],
|
||||||
success: res => {
|
success: res => {
|
||||||
onBluetoothDeviceFound();
|
onBluetoothDeviceFound();
|
||||||
searchTimer = setTimeout(() => {
|
searchTimer = setTimeout(() => {
|
||||||
|
|
@ -87,11 +95,12 @@ function onBluetoothDeviceFound() {
|
||||||
let id = value.substring(12, 16)
|
let id = value.substring(12, 16)
|
||||||
if (type.toLowerCase() == 'c0') {
|
if (type.toLowerCase() == 'c0') {
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
device.deviceName = "c00002"
|
device.name = "c00002"
|
||||||
Bluetoothfilter(device)
|
Bluetoothfilter(device)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
console.log("device.name", device.name)
|
||||||
if (device.name.toLowerCase().indexOf('pc-c06pro') != -1 ||
|
if (device.name.toLowerCase().indexOf('pc-c06pro') != -1 ||
|
||||||
device.name.toLowerCase().indexOf('pc-c02pro') != -1 ||
|
device.name.toLowerCase().indexOf('pc-c02pro') != -1 ||
|
||||||
device.name.toLowerCase().indexOf('pc-c09pro') != -1 ||
|
device.name.toLowerCase().indexOf('pc-c09pro') != -1 ||
|
||||||
|
|
@ -103,16 +112,20 @@ function onBluetoothDeviceFound() {
|
||||||
(device.localName && device.localName.toLowerCase().indexOf('pc-c02pro') != -1) ||
|
(device.localName && device.localName.toLowerCase().indexOf('pc-c02pro') != -1) ||
|
||||||
(device.localName && device.localName.toLowerCase().indexOf('pc-c09pro') != -1)) {
|
(device.localName && device.localName.toLowerCase().indexOf('pc-c09pro') != -1)) {
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
|
const bytes = new Uint8Array(device.advertisData);
|
||||||
|
const macBytes = bytes.slice(6, 12);
|
||||||
|
device.macAddr = $tools.ab2hex(macBytes, ':').toUpperCase()
|
||||||
stopBluetoothDevicesDiscovery()
|
stopBluetoothDevicesDiscovery()
|
||||||
Bluetoothfilter(device)
|
Bluetoothfilter(device)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (device.name.toLowerCase().indexOf("g02") != -1 ||
|
if (device.name.toLowerCase().indexOf("g02") != -1 ||
|
||||||
device.name.toLowerCase().indexOf('ypc') != -1 ||
|
device.name.toLowerCase().indexOf('ypc') != -1 ||
|
||||||
device.name.toLowerCase().indexOf('pc-x01') != -1 ||
|
|
||||||
device.name.toLowerCase().indexOf('da') != -1 ||
|
device.name.toLowerCase().indexOf('da') != -1 ||
|
||||||
device.name.toLowerCase().indexOf('pcl') != -1 ||
|
device.name.toLowerCase().indexOf('pcl') != -1 ||
|
||||||
|
device.name.toLowerCase().indexOf('aiLink_') != -1 ||
|
||||||
device.name.toLowerCase().indexOf('pcf01') != -1 ||
|
device.name.toLowerCase().indexOf('pcf01') != -1 ||
|
||||||
|
device.name.toLowerCase().indexOf('chipsea_ble') != -1 ||
|
||||||
device.name.toLowerCase().indexOf('Yihejia_Lung') != -1) {
|
device.name.toLowerCase().indexOf('Yihejia_Lung') != -1) {
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
stopBluetoothDevicesDiscovery()
|
stopBluetoothDevicesDiscovery()
|
||||||
|
|
@ -152,30 +165,27 @@ function Bluetoothfilter(device) {
|
||||||
}
|
}
|
||||||
// 身高仪
|
// 身高仪
|
||||||
if (device.name.indexOf("G02") != -1) {
|
if (device.name.indexOf("G02") != -1) {
|
||||||
uni.navigateTo({
|
deviceName = 'G02'
|
||||||
url: "/pageTwo/devices/G02?deviceId=" + device.deviceId
|
createBLEConnection("FFF0")
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 跳绳
|
// 跳绳
|
||||||
if (device.name.indexOf("YPC") != -1) {
|
if (device.name.indexOf("YPC") != -1) {
|
||||||
uni.navigateTo({
|
deviceName = 'YPC'
|
||||||
url: "/pages/skiping/skip?deviceId=" + device.deviceId
|
createBLEConnection("FFE0")
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 婴儿秤
|
// 婴儿秤
|
||||||
if (device.name.indexOf("Chipsea_BLE") != -1) {
|
if (device.name.indexOf("Chipsea_BLE") != -1) {
|
||||||
uni.navigateTo({
|
deviceName = 'Chipsea_BLE'
|
||||||
url: "/pageTwo/devices/B20?deviceId=" + device.deviceId
|
createBLEConnection("FFF0")
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 心率秤
|
// 八电极
|
||||||
if (device.name.toLowerCase().indexOf('pc-x01') != -1) {
|
if (device.name.toLowerCase().indexOf('aiLink_') != -1) {
|
||||||
uni.navigateTo({
|
deviceName = 'aiLink'
|
||||||
url: "/pageTwo/devices/PCX01?deviceId=" + device.deviceId
|
createBLEConnection("FFE0")
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//厨房秤
|
//厨房秤
|
||||||
|
|
@ -189,7 +199,8 @@ function Bluetoothfilter(device) {
|
||||||
(device.localName && device.localName.toLowerCase().indexOf('pc-c06pro') != -1) ||
|
(device.localName && device.localName.toLowerCase().indexOf('pc-c06pro') != -1) ||
|
||||||
(device.localName && device.localName.toLowerCase().indexOf('pc-c02pro') != -1) ||
|
(device.localName && device.localName.toLowerCase().indexOf('pc-c02pro') != -1) ||
|
||||||
(device.localName && device.localName.toLowerCase().indexOf('pc-c09pro') != -1)) {
|
(device.localName && device.localName.toLowerCase().indexOf('pc-c09pro') != -1)) {
|
||||||
handleDevType(device)
|
deviceName = 'CFC'
|
||||||
|
createBLEConnection("FFF0")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -201,12 +212,13 @@ function handleDevType(device) {
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log("排查设备:", device, res)
|
console.log("排查设备:", device, res)
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
createBLEConnection(device.deviceId)
|
createBLEConnection("FFF0")
|
||||||
} else {
|
} else {
|
||||||
devicesList = []
|
devicesList = []
|
||||||
$tools.msg('设备未登记,请联系出售方进行系统认证')
|
$tools.msg('设备未登记,请联系出售方进行系统认证')
|
||||||
$store.commit("changeBluetoothValue", {
|
$store.commit("changeBluetoothValue", {
|
||||||
type: 1,
|
foodType: 1,
|
||||||
|
isFood: false,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
bleTipsText: "连接超时,点击重新连接",
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
})
|
})
|
||||||
|
|
@ -224,7 +236,7 @@ function createBLEConnection(serviceId) {
|
||||||
},
|
},
|
||||||
fail: res => {
|
fail: res => {
|
||||||
$store.commit("changeBluetoothValue", {
|
$store.commit("changeBluetoothValue", {
|
||||||
type: 1,
|
foodType: 1,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
bleTipsText: "连接超时,点击重新连接",
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
})
|
})
|
||||||
|
|
@ -241,16 +253,39 @@ function getBLEDeviceServices(serviceId) {
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log("获取设备的UUID成功", res)
|
console.log("获取设备的UUID成功", res)
|
||||||
stopBluetoothDevicesDiscovery();
|
stopBluetoothDevicesDiscovery();
|
||||||
|
|
||||||
|
if (deviceName == 'CFC') { //厨房秤
|
||||||
|
$store.commit("changeBluetoothValue", {
|
||||||
|
isFood: true,
|
||||||
|
})
|
||||||
|
} else if (deviceName == 'YPC') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pageTwo/skiping/skip?deviceId=" + deviceId
|
||||||
|
})
|
||||||
|
} else if (deviceName == 'aiLink') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pageTwo/devices/pcL06?deviceId=" + deviceId
|
||||||
|
})
|
||||||
|
} else if (deviceName == 'Chipsea_BLE') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pageTwo/devices/B20?deviceId=" + deviceId
|
||||||
|
})
|
||||||
|
}else if (deviceName == 'G02') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pageTwo/devices/G02?deviceId=" + deviceId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
serviceList = res.services;
|
serviceList = res.services;
|
||||||
for (let i = 0; i < serviceList.length; i++) {
|
for (let i = 0; i < serviceList.length; i++) {
|
||||||
let service = serviceList[i];
|
let service = serviceList[i];
|
||||||
if (service.uuid.indexOf(serviceId) != -1) {
|
if (service.uuid.indexOf(serviceId) != -1) {
|
||||||
$store.commit("changeBluetoothValue", {
|
$store.commit("changeBluetoothValue", {
|
||||||
type: 1,
|
foodType: 1,
|
||||||
isConnectStatus: 0,
|
isConnectStatus: 0,
|
||||||
deviceId: deviceId,
|
deviceId: deviceId,
|
||||||
serviceId: service.uuid,
|
serviceId: service.uuid,
|
||||||
bleTipsText: "蓝牙链接中",
|
bleTipsText: "蓝牙连接中",
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -258,7 +293,7 @@ function getBLEDeviceServices(serviceId) {
|
||||||
},
|
},
|
||||||
fail: res => {
|
fail: res => {
|
||||||
$store.commit("changeBluetoothValue", {
|
$store.commit("changeBluetoothValue", {
|
||||||
type: 1,
|
foodType: 1,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
bleTipsText: "连接超时,点击重新连接",
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
})
|
})
|
||||||
|
|
@ -267,154 +302,6 @@ function getBLEDeviceServices(serviceId) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定服务的特征值
|
|
||||||
*/
|
|
||||||
function getBLEDeviceCharacteristics(deviceId, serviceId) {
|
|
||||||
let characteristicsList = [];
|
|
||||||
uni.getBLEDeviceCharacteristics({
|
|
||||||
deviceId: deviceId,
|
|
||||||
serviceId: serviceId,
|
|
||||||
success: res => {
|
|
||||||
let write, notify
|
|
||||||
for (let i = 0; i < res.characteristics.length; i++) {
|
|
||||||
let item = res.characteristics[i];
|
|
||||||
if (item.uuid.indexOf('0000FFF2') != -1) {
|
|
||||||
write = item.uuid
|
|
||||||
} else if (item.uuid.indexOf('0000FFF1') != -1) {
|
|
||||||
notify = item.uuid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getBLECharacteristicValueChange(deviceId, serviceId, notify, write)
|
|
||||||
},
|
|
||||||
fail: res => {
|
|
||||||
$store.commit("changeBluetoothValue", {
|
|
||||||
type: 1,
|
|
||||||
isConnectStatus: 1,
|
|
||||||
bleTipsText: "连接超时,点击重新连接",
|
|
||||||
})
|
|
||||||
console.log('获取特征值失败:', JSON.stringify(res))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBLECharacteristicValueChange(deviceId, serviceId, notify, write) {
|
|
||||||
let that = this
|
|
||||||
uni.notifyBLECharacteristicValueChange({
|
|
||||||
deviceId: deviceId,
|
|
||||||
serviceId: serviceId,
|
|
||||||
characteristicId: notify,
|
|
||||||
state: true,
|
|
||||||
success: () => {
|
|
||||||
$store.commit('changeBluetoothValue', {
|
|
||||||
deviceId: deviceId,
|
|
||||||
serviceId: serviceId,
|
|
||||||
notify: notify,
|
|
||||||
write: write,
|
|
||||||
unit: "g",
|
|
||||||
type: 1,
|
|
||||||
countWeight: "",
|
|
||||||
bleTipsText: "测量中,请将食物放到秤上",
|
|
||||||
isConnectStatus: 2
|
|
||||||
})
|
|
||||||
uni.onBLECharacteristicValueChange(function(res) {
|
|
||||||
const value = res.value
|
|
||||||
const dataView = new DataView(value)
|
|
||||||
const header = dataView.getUint8(0)
|
|
||||||
// MCU主动上报数据
|
|
||||||
if (header === 0xC7) {
|
|
||||||
const cmd = dataView.getUint8(2)
|
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
case 0x02:
|
|
||||||
const statusByte = dataView.getUint8(4)
|
|
||||||
const isNegative = !!(statusByte & 0x80) // 最高位表示正负
|
|
||||||
const statusType = statusByte & 0x0F // 状态类型
|
|
||||||
|
|
||||||
// 组合24位重量值 (大端序)
|
|
||||||
const weightValue =
|
|
||||||
(dataView.getUint8(5) << 16) |
|
|
||||||
(dataView.getUint8(6) << 8) |
|
|
||||||
dataView.getUint8(7)
|
|
||||||
|
|
||||||
// 精度和单位
|
|
||||||
const unitByte = dataView.getUint8(8)
|
|
||||||
const precision = (unitByte & 0xF0) >> 4 // 高4位精度
|
|
||||||
const unitIndex = unitByte & 0x0F // 低4位单位
|
|
||||||
|
|
||||||
// 计算实际重量
|
|
||||||
let finalWeight = weightValue / Math.pow(10, precision)
|
|
||||||
console.log("类型:", cmd, "重量",
|
|
||||||
finalWeight, "小数点", precision, "单位", UNIT_MAP[unitIndex])
|
|
||||||
|
|
||||||
if (isNegative) finalWeight = -finalWeight
|
|
||||||
$store.commit("changeBluetoothValue", {
|
|
||||||
countWeight: finalWeight,
|
|
||||||
unit: UNIT_MAP[unitIndex],
|
|
||||||
type: statusType
|
|
||||||
})
|
|
||||||
break
|
|
||||||
|
|
||||||
case 0x03:
|
|
||||||
break
|
|
||||||
case 0x08:
|
|
||||||
const start0 = []
|
|
||||||
const value2 = $tools.ab2hex(res.value, "");
|
|
||||||
const start = parseUnitMask(value2.substring(8, 10), UNIT_MAP.slice(0,
|
|
||||||
7))
|
|
||||||
const start1 = parseUnitMask(value2.substring(10, 12), UNIT_MAP.slice(8,
|
|
||||||
10))
|
|
||||||
start.push.apply(start, start1)
|
|
||||||
if (start.length) {
|
|
||||||
$data.unitMinus.forEach(item => {
|
|
||||||
start.forEach(item2 => {
|
|
||||||
if (item.unit == item2) {
|
|
||||||
start0.push(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
$store.commit("changeBluetoothValue", {
|
|
||||||
unitList: start0.length ? start0 : $data.unitMinus
|
|
||||||
})
|
|
||||||
console.log("2222222", start, start0)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail: res => {
|
|
||||||
console.log('获取特征值失败:', JSON.stringify(res))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 获取服务
|
|
||||||
// function getBLEDeviceServices(uuid) {
|
|
||||||
// let serviceList = [];
|
|
||||||
// let serviceId = ""
|
|
||||||
// uni.getBLEDeviceServices({
|
|
||||||
// deviceId: deviceId,
|
|
||||||
// success: res => {
|
|
||||||
// console.log("获取设备的UUID成功", res)
|
|
||||||
// serviceList = res.services;
|
|
||||||
// for (let i = 0; i < serviceList.length; i++) {
|
|
||||||
// let service = serviceList[i];
|
|
||||||
// if (service.uuid.indexOf(uuid) != -1) {
|
|
||||||
// serviceId = service.uuid
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// $store.commit("getIsUseBluetooth", {
|
|
||||||
// serviceId: serviceId
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// fail: res => {
|
|
||||||
// console.log('获取设备的UUID失败:', res)
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 断开蓝牙模块
|
* 断开蓝牙模块
|
||||||
*/
|
*/
|
||||||
|
|
@ -425,11 +312,11 @@ function closeBluetoothAdapter() {
|
||||||
$store.commit("changeBluetoothValue", {
|
$store.commit("changeBluetoothValue", {
|
||||||
deviceId: "",
|
deviceId: "",
|
||||||
serviceId: "",
|
serviceId: "",
|
||||||
notify: "",
|
foodUnit: "g",
|
||||||
write: "",
|
foodNotify: "",
|
||||||
unit: "g",
|
foodWrite: "",
|
||||||
countWeight: '',
|
foodType: 1,
|
||||||
type: 1,
|
foodWeight: 100,
|
||||||
unitList: $data.unitMinus,
|
unitList: $data.unitMinus,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
bleTipsText: "连接超时,点击重新连接",
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
|
|
@ -441,7 +328,7 @@ function closeBluetoothAdapter() {
|
||||||
/**
|
/**
|
||||||
* 断开蓝牙连接
|
* 断开蓝牙连接
|
||||||
*/
|
*/
|
||||||
function closeBLEConnection(deviceId) {
|
function closeBLEConnection() {
|
||||||
uni.closeBLEConnection({
|
uni.closeBLEConnection({
|
||||||
deviceId: deviceId,
|
deviceId: deviceId,
|
||||||
success: res => {
|
success: res => {
|
||||||
|
|
@ -458,7 +345,10 @@ function onBLEConnectionStateChange() {
|
||||||
bleTipsText: "连接超时,点击重新连接",
|
bleTipsText: "连接超时,点击重新连接",
|
||||||
unitList: $data.unitMinus,
|
unitList: $data.unitMinus,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
type: 1,
|
foodUnit: "g",
|
||||||
|
foodNotify: "",
|
||||||
|
foodWrite: "",
|
||||||
|
foodType: 1,
|
||||||
})
|
})
|
||||||
closeBLEConnection()
|
closeBLEConnection()
|
||||||
closeBluetoothAdapter()
|
closeBluetoothAdapter()
|
||||||
|
|
@ -479,6 +369,78 @@ function stopBluetoothDevicesDiscovery() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unitConversion(unit) {
|
||||||
|
if (unit == 'kg') {
|
||||||
|
return '千克'
|
||||||
|
} else if (unit == '斤') {
|
||||||
|
return '斤'
|
||||||
|
} else if (unit == 'stlb') {
|
||||||
|
return 'stlb'
|
||||||
|
} else if (unit == 'lb') {
|
||||||
|
return '磅'
|
||||||
|
} else if (unit == 'g') {
|
||||||
|
return '克'
|
||||||
|
} else if (unit == 'ml') {
|
||||||
|
return '毫升'
|
||||||
|
} else if (unit == 'Waterml') {
|
||||||
|
return 'Waterml'
|
||||||
|
} else if (unit == 'milkml') {
|
||||||
|
return 'milkml'
|
||||||
|
} else if (unit == 'oz') {
|
||||||
|
return '盎司'
|
||||||
|
} else if (unit == 'floz') {
|
||||||
|
return 'floz'
|
||||||
|
} else if (unit == 'lboz') {
|
||||||
|
return 'lboz'
|
||||||
|
}
|
||||||
|
return unit
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertToGrams(value, fromUnit) {
|
||||||
|
const conversionFactors = {
|
||||||
|
'lb': 453.59237, // 1磅 = 453.59237克
|
||||||
|
'oz': 28.349523125, // 1盎司 = 28.349523125克
|
||||||
|
'kg': 1000, // 1公斤 = 1000克
|
||||||
|
'g': 1,
|
||||||
|
'ml': 1,
|
||||||
|
'斤': 500,
|
||||||
|
'Waterml': 1,
|
||||||
|
'milkml': 1.03
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return value * conversionFactors[fromUnit];
|
||||||
|
}
|
||||||
|
|
||||||
|
function unitInstruction(unit) {
|
||||||
|
if (unit == 'kg') {
|
||||||
|
return 0x00
|
||||||
|
} else if (unit == '斤') {
|
||||||
|
return 0x01
|
||||||
|
} else if (unit == 'st:lb') {
|
||||||
|
return 0x02
|
||||||
|
} else if (unit == 'lb') {
|
||||||
|
return 0x03
|
||||||
|
} else if (unit == 'g') {
|
||||||
|
return 0x04
|
||||||
|
} else if (unit == 'ml') {
|
||||||
|
return 0x05
|
||||||
|
} else if (unit == 'Waterml') {
|
||||||
|
return 0x06
|
||||||
|
} else if (unit == 'milkml') {
|
||||||
|
return 0x07
|
||||||
|
} else if (unit == 'oz') {
|
||||||
|
return 0x08
|
||||||
|
} else if (unit == 'floz') {
|
||||||
|
return 0x09
|
||||||
|
} else if (unit == 'lboz') {
|
||||||
|
return 0x0A
|
||||||
|
}
|
||||||
|
return unit
|
||||||
|
}
|
||||||
|
|
||||||
function parseUnitMask(hexValue, UNIT_MAP) {
|
function parseUnitMask(hexValue, UNIT_MAP) {
|
||||||
// 转换为数字
|
// 转换为数字
|
||||||
const mask = typeof hexValue === 'string' ? parseInt(hexValue, 16) : hexValue;
|
const mask = typeof hexValue === 'string' ? parseInt(hexValue, 16) : hexValue;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ const httpRequest = (url, method = "get", data) => {
|
||||||
uni.request(httpDefaultOpts).then(
|
uni.request(httpDefaultOpts).then(
|
||||||
(res) => {
|
(res) => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
console.log("request", url, res,)
|
// console.log("request", url, res,)
|
||||||
if (res[1].data.code == 20001) {
|
if (res[1].data.code == 20001) {
|
||||||
uni.clearStorageSync()
|
uni.clearStorageSync()
|
||||||
uni.setStorageSync('token', null)
|
uni.setStorageSync('token', null)
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,31 @@ export default {
|
||||||
validatePhoneEmail,
|
validatePhoneEmail,
|
||||||
checkPrivacyAgreement,
|
checkPrivacyAgreement,
|
||||||
mergeAndDeduplicate,
|
mergeAndDeduplicate,
|
||||||
handleCancelUpdate
|
handleCancelUpdate,
|
||||||
|
parseUnitMask
|
||||||
|
}
|
||||||
|
function parseUnitMask(hexValue, UNIT_MAP) {
|
||||||
|
// 转换为数字
|
||||||
|
const mask = typeof hexValue === 'string' ? parseInt(hexValue, 16) : hexValue;
|
||||||
|
|
||||||
|
// 验证输入
|
||||||
|
if (isNaN(mask) || mask < 0 || mask > 0xFF) {
|
||||||
|
console.error('无效的位掩码值');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储结果
|
||||||
|
const usedUnits = [];
|
||||||
|
|
||||||
|
// 遍历每一位
|
||||||
|
for (let i = 0; i < 8; i++) {
|
||||||
|
// 使用位运算检查第 i 位是否为 1
|
||||||
|
if (mask & (1 << i)) {
|
||||||
|
usedUnits.push(UNIT_MAP[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return usedUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
function NewsPtype(con) {
|
function NewsPtype(con) {
|
||||||
|
|
|
||||||
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
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
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["uni-app:///main.js"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":";;;;;;;;;;;;;AAAA;AAGA;AACA;AAHA;AACAA,EAAE,CAACC,iCAAiC,GAAGC,mBAAmB;AAG1DC,UAAU,CAACC,YAAI,CAAC,C","file":"pageTwo/pcL06/pcL06.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pageTwo/pcL06/pcL06.vue'\ncreatePage(Page)"],"sourceRoot":""}
|
||||||
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
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue