对接EF06S
This commit is contained in:
parent
950d8f118c
commit
29c6a48868
|
|
@ -85,11 +85,13 @@
|
||||||
serviceId: "",
|
serviceId: "",
|
||||||
write: "",
|
write: "",
|
||||||
notify: "",
|
notify: "",
|
||||||
|
height: "",
|
||||||
// cur_sex: 1,
|
// cur_sex: 1,
|
||||||
// cur_age: 27,
|
// cur_age: 27,
|
||||||
// show_info: false,
|
// show_info: false,
|
||||||
// ageRange: [],
|
// ageRange: [],
|
||||||
// ageIndex: 30,
|
// ageIndex: 30,
|
||||||
|
unit: "kg",
|
||||||
textW: "",
|
textW: "",
|
||||||
textH: "",
|
textH: "",
|
||||||
send_err_count: 0,
|
send_err_count: 0,
|
||||||
|
|
@ -319,6 +321,8 @@
|
||||||
uni.onBLECharacteristicValueChange(function(res) {
|
uni.onBLECharacteristicValueChange(function(res) {
|
||||||
const raw = new Uint8Array(res.value);
|
const raw = new Uint8Array(res.value);
|
||||||
let value = that.$tools.ab2hex(res.value, "");
|
let value = that.$tools.ab2hex(res.value, "");
|
||||||
|
let height = value.substring(3, 4) + value.substring(
|
||||||
|
30, 32)
|
||||||
cnt++
|
cnt++
|
||||||
console.log("value", value, cnt)
|
console.log("value", value, cnt)
|
||||||
|
|
||||||
|
|
@ -343,6 +347,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raw[0] == 0x5A && cnt > 1) {
|
if (raw[0] == 0x5A && cnt > 1) {
|
||||||
|
// 单位
|
||||||
|
that.unit = value.substring(2, 3) == 0 ? "kg" :
|
||||||
|
"lb"
|
||||||
|
|
||||||
// 体重(高低位组合, 实际值的100倍)
|
// 体重(高低位组合, 实际值的100倍)
|
||||||
that.BLEResult.weight = ((raw[2] << 8) | raw[3]) /
|
that.BLEResult.weight = ((raw[2] << 8) | raw[3]) /
|
||||||
100.0
|
100.0
|
||||||
|
|
@ -374,16 +382,25 @@
|
||||||
10.0;
|
10.0;
|
||||||
|
|
||||||
// 身高(高低位组合, 厘米)
|
// 身高(高低位组合, 厘米)
|
||||||
that.BLEResult.height = raw[15]
|
that.textW = "您的体重是:" + that.BLEResult.weight + that.unit
|
||||||
that.textW = "您的体重是:" + that.BLEResult.weight +'kg'
|
console.log("体重", that.BLEResult.weight, that.unit)
|
||||||
that.textH = "您的身高是:" + raw[15] + "cm"
|
|
||||||
console.log("体重", that.BLEResult.weight)
|
|
||||||
console.log("身高", raw[15])
|
|
||||||
if (raw.length == 18 && raw[17] == 0xA5) {
|
if (raw.length == 18 && raw[17] == 0xA5) {
|
||||||
|
if (that.unit == 'kg') {
|
||||||
|
that.BLEResult.height = raw[15]
|
||||||
|
that.textH = "您的身高是:" + raw[15] + "cm"
|
||||||
|
} else {
|
||||||
|
let height0 = parseInt(height, 16) / 10
|
||||||
|
that.textH = "您的身高是:" + parseInt(height, 16) / 10 + "inch"
|
||||||
|
that.BLEResult.height = Math.round(height0 / 0.39)
|
||||||
|
}
|
||||||
that.BLEResult.ecode = that.macAddr
|
that.BLEResult.ecode = that.macAddr
|
||||||
that.BLEResult.familyid = that.info.familyid
|
that.BLEResult.familyid = that.info.familyid
|
||||||
that.BLEResult.weight = that.BLEResult.weight +'kg'
|
that.BLEResult.weight = that.BLEResult.weight +
|
||||||
that.handleGetMeasure()
|
that.unit
|
||||||
|
setTimeout(function() {
|
||||||
|
that.handleGetMeasure()
|
||||||
|
}, 200)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -461,7 +478,7 @@
|
||||||
that.$store.dispatch("getResult", {
|
that.$store.dispatch("getResult", {
|
||||||
birthday: that.info.birthday,
|
birthday: that.info.birthday,
|
||||||
familyid: that.info.familyid,
|
familyid: that.info.familyid,
|
||||||
height: that.height ? that.height : that.info.height,
|
height: that.BLEResult.height ? that.BLEResult.height : that.info.height,
|
||||||
sex: that.info.sex,
|
sex: that.info.sex,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
183
store/actions.js
183
store/actions.js
|
|
@ -3,96 +3,97 @@ import tools from '@/tools/tools.js'
|
||||||
import config from '@/config.js'
|
import config from '@/config.js'
|
||||||
// Action 包含异步操作(请求API方法)、回调函数提交mutaions更改state数据状态,使之可以异步
|
// Action 包含异步操作(请求API方法)、回调函数提交mutaions更改state数据状态,使之可以异步
|
||||||
export default {
|
export default {
|
||||||
// 用户信息
|
// 用户信息
|
||||||
getUserInfo({
|
getUserInfo({
|
||||||
commit
|
commit
|
||||||
},
|
},
|
||||||
account) {
|
account) {
|
||||||
return model.getUserInfo(account).then(res => {
|
return model.getUserInfo(account).then(res => {
|
||||||
commit('changeUser', res.data)
|
commit('changeUser', res.data)
|
||||||
if (!res.data.height || !res.data.mage || !res.data.birthday) {
|
if (!res.data.height || !res.data.mage || !res.data.birthday) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pageTwo/login/userinfo`
|
url: `/pageTwo/login/userinfo`
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 获取称重结果
|
// 获取称重结果
|
||||||
getResult({
|
getResult({
|
||||||
commit
|
commit
|
||||||
}, account) {
|
}, account) {
|
||||||
return model.getResult(account).then((res) => {
|
console.log("1111111", account)
|
||||||
console.log("报告", res)
|
return model.getResult(account).then((res) => {
|
||||||
if (res.code == 0) {
|
console.log("报告", res)
|
||||||
commit('changeMeasureResult', res.data)
|
if (res.code == 0) {
|
||||||
} else {
|
commit('changeMeasureResult', res.data)
|
||||||
commit('changeMeasureResult', null)
|
} else {
|
||||||
}
|
commit('changeMeasureResult', null)
|
||||||
return res.data
|
}
|
||||||
})
|
return res.data
|
||||||
},
|
})
|
||||||
// 获取历史记录
|
},
|
||||||
gethistoryList({
|
// 获取历史记录
|
||||||
commit
|
gethistoryList({
|
||||||
}, account) {
|
commit
|
||||||
return model.getHistoryList(account).then((res) => {
|
}, account) {
|
||||||
if (res.data && res.data.items) {
|
return model.getHistoryList(account).then((res) => {
|
||||||
commit('changehistoryList', res.data.items)
|
if (res.data && res.data.items) {
|
||||||
} else {
|
commit('changehistoryList', res.data.items)
|
||||||
commit('changehistoryList', null)
|
} else {
|
||||||
}
|
commit('changehistoryList', null)
|
||||||
return res
|
}
|
||||||
})
|
return res
|
||||||
},
|
})
|
||||||
//趋势
|
},
|
||||||
GetBodyTrendList({
|
//趋势
|
||||||
commit
|
GetBodyTrendList({
|
||||||
}, account) {
|
commit
|
||||||
return model.GetBodyTrendList(account).then((res) => {
|
}, account) {
|
||||||
if (res) {
|
return model.GetBodyTrendList(account).then((res) => {
|
||||||
commit('changeTrend', res.cidata)
|
if (res) {
|
||||||
}
|
commit('changeTrend', res.cidata)
|
||||||
return res
|
}
|
||||||
})
|
return res
|
||||||
},
|
})
|
||||||
// 更新家庭成员
|
},
|
||||||
getFamilyList({
|
// 更新家庭成员
|
||||||
commit
|
getFamilyList({
|
||||||
}) {
|
commit
|
||||||
return model.getFamilyList({
|
}) {
|
||||||
pagenum: 20,
|
return model.getFamilyList({
|
||||||
pagesize: 1
|
pagenum: 20,
|
||||||
}).then((res) => {
|
pagesize: 1
|
||||||
commit('changeFamilay', res)
|
}).then((res) => {
|
||||||
return res
|
commit('changeFamilay', res)
|
||||||
})
|
return res
|
||||||
},
|
})
|
||||||
// 获取历史记录
|
},
|
||||||
gethistoryList({
|
// 获取历史记录
|
||||||
commit
|
gethistoryList({
|
||||||
}, account) {
|
commit
|
||||||
return model.getHistoryList(account).then((res) => {
|
}, account) {
|
||||||
if (res.data && res.data.rows) {
|
return model.getHistoryList(account).then((res) => {
|
||||||
commit('changehistoryList', res.data.rows)
|
if (res.data && res.data.rows) {
|
||||||
} else {
|
commit('changehistoryList', res.data.rows)
|
||||||
commit('changehistoryList', null)
|
} else {
|
||||||
}
|
commit('changehistoryList', null)
|
||||||
return res
|
}
|
||||||
})
|
return res
|
||||||
},
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 配置详情
|
// 配置详情
|
||||||
getConfig({
|
getConfig({
|
||||||
commit
|
commit
|
||||||
}, account) {
|
}, account) {
|
||||||
account.appid = config.appid
|
account.appid = config.appid
|
||||||
return model.getConfig(account).then((res) => {
|
return model.getConfig(account).then((res) => {
|
||||||
console.log("配置详情", res)
|
console.log("配置详情", res)
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
commit("changeConfig", res.data)
|
commit("changeConfig", res.data)
|
||||||
commit("toggleColor", res.data.themecolor)
|
commit("toggleColor", res.data.themecolor)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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
|
|
@ -154,11 +154,13 @@ var _default = {
|
||||||
serviceId: "",
|
serviceId: "",
|
||||||
write: "",
|
write: "",
|
||||||
notify: "",
|
notify: "",
|
||||||
|
height: "",
|
||||||
// cur_sex: 1,
|
// cur_sex: 1,
|
||||||
// cur_age: 27,
|
// cur_age: 27,
|
||||||
// show_info: false,
|
// show_info: false,
|
||||||
// ageRange: [],
|
// ageRange: [],
|
||||||
// ageIndex: 30,
|
// ageIndex: 30,
|
||||||
|
unit: "kg",
|
||||||
textW: "",
|
textW: "",
|
||||||
textH: "",
|
textH: "",
|
||||||
send_err_count: 0,
|
send_err_count: 0,
|
||||||
|
|
@ -390,6 +392,7 @@ var _default = {
|
||||||
uni.onBLECharacteristicValueChange(function (res) {
|
uni.onBLECharacteristicValueChange(function (res) {
|
||||||
var raw = new Uint8Array(res.value);
|
var raw = new Uint8Array(res.value);
|
||||||
var value = that.$tools.ab2hex(res.value, "");
|
var value = that.$tools.ab2hex(res.value, "");
|
||||||
|
var height = value.substring(3, 4) + value.substring(30, 32);
|
||||||
cnt++;
|
cnt++;
|
||||||
console.log("value", value, cnt);
|
console.log("value", value, cnt);
|
||||||
if (raw[0] == 0x55 && raw[1] == 0xAA) {
|
if (raw[0] == 0x55 && raw[1] == 0xAA) {
|
||||||
|
|
@ -412,6 +415,9 @@ var _default = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (raw[0] == 0x5A && cnt > 1) {
|
if (raw[0] == 0x5A && cnt > 1) {
|
||||||
|
// 单位
|
||||||
|
that.unit = value.substring(2, 3) == 0 ? "kg" : "lb";
|
||||||
|
|
||||||
// 体重(高低位组合, 实际值的100倍)
|
// 体重(高低位组合, 实际值的100倍)
|
||||||
that.BLEResult.weight = (raw[2] << 8 | raw[3]) / 100.0;
|
that.BLEResult.weight = (raw[2] << 8 | raw[3]) / 100.0;
|
||||||
if (that.BLEResult.weight < 1) {
|
if (that.BLEResult.weight < 1) {
|
||||||
|
|
@ -436,16 +442,23 @@ var _default = {
|
||||||
that.BLEResult.bmi = (raw[14] << 8 | raw[16]) / 10.0;
|
that.BLEResult.bmi = (raw[14] << 8 | raw[16]) / 10.0;
|
||||||
|
|
||||||
// 身高(高低位组合, 厘米)
|
// 身高(高低位组合, 厘米)
|
||||||
that.BLEResult.height = raw[15];
|
that.textW = "您的体重是:" + that.BLEResult.weight + that.unit;
|
||||||
that.textW = "您的体重是:" + that.BLEResult.weight + 'kg';
|
console.log("体重", that.BLEResult.weight, that.unit);
|
||||||
that.textH = "您的身高是:" + raw[15] + "cm";
|
|
||||||
console.log("体重", that.BLEResult.weight);
|
|
||||||
console.log("身高", raw[15]);
|
|
||||||
if (raw.length == 18 && raw[17] == 0xA5) {
|
if (raw.length == 18 && raw[17] == 0xA5) {
|
||||||
|
if (that.unit == 'kg') {
|
||||||
|
that.BLEResult.height = raw[15];
|
||||||
|
that.textH = "您的身高是:" + raw[15] + "cm";
|
||||||
|
} else {
|
||||||
|
var height0 = parseInt(height, 16) / 10;
|
||||||
|
that.textH = "您的身高是:" + parseInt(height, 16) / 10 + "inch";
|
||||||
|
that.BLEResult.height = Math.round(height0 / 0.39);
|
||||||
|
}
|
||||||
that.BLEResult.ecode = that.macAddr;
|
that.BLEResult.ecode = that.macAddr;
|
||||||
that.BLEResult.familyid = that.info.familyid;
|
that.BLEResult.familyid = that.info.familyid;
|
||||||
that.BLEResult.weight = that.BLEResult.weight + 'kg';
|
that.BLEResult.weight = that.BLEResult.weight + that.unit;
|
||||||
that.handleGetMeasure();
|
setTimeout(function () {
|
||||||
|
that.handleGetMeasure();
|
||||||
|
}, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -523,7 +536,7 @@ var _default = {
|
||||||
that.$store.dispatch("getResult", {
|
that.$store.dispatch("getResult", {
|
||||||
birthday: that.info.birthday,
|
birthday: that.info.birthday,
|
||||||
familyid: that.info.familyid,
|
familyid: that.info.familyid,
|
||||||
height: that.height ? that.height : that.info.height,
|
height: that.BLEResult.height ? that.BLEResult.height : that.info.height,
|
||||||
sex: that.info.sex
|
sex: that.info.sex
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -11122,6 +11122,7 @@ var _default = (_getUserInfo$getResul = {
|
||||||
// 获取称重结果
|
// 获取称重结果
|
||||||
getResult: function getResult(_ref2, account) {
|
getResult: function getResult(_ref2, account) {
|
||||||
var commit = _ref2.commit;
|
var commit = _ref2.commit;
|
||||||
|
console.log("1111111", account);
|
||||||
return _model.default.getResult(account).then(function (res) {
|
return _model.default.getResult(account).then(function (res) {
|
||||||
console.log("报告", res);
|
console.log("报告", res);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue