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