目标卡路里及时更新

This commit is contained in:
qcl_123 2026-03-30 15:02:56 +08:00
parent 22debbb070
commit 7c9036dff6
21 changed files with 418 additions and 315 deletions

View File

@ -88,7 +88,8 @@
that.$nextTick(() => { that.$nextTick(() => {
that.isShow = true that.isShow = true
that.rangeValue[0] = Number(that.nutrition.list[0].proportion) that.rangeValue[0] = Number(that.nutrition.list[0].proportion)
that.rangeValue[1] = Number(that.nutrition.list[0].proportion) + Number(that.nutrition.list[1].proportion) that.rangeValue[1] = Number(that.nutrition.list[0].proportion) + Number(that
.nutrition.list[1].proportion)
that.handleProportion() that.handleProportion()
}) })
} }
@ -150,6 +151,10 @@
that.$store.dispatch('getUserInfo', { that.$store.dispatch('getUserInfo', {
aud_id: that.user.aud_id aud_id: that.user.aud_id
}) })
that.$store.dispatch("getCountFoodInfo", {
aud_id: that.user.aud_id,
time: that.$tools.getDate("start")
})
setTimeout(function() { setTimeout(function() {
uni.navigateBack() uni.navigateBack()
}, 1000) }, 1000)

View File

@ -24,8 +24,8 @@
</view> </view>
<view class="jishiqi"> <view class="jishiqi">
<view class="left"> <view class="left">
<view class="chart-wrap" v-if="handTrue"> <view class="chart-wrap">
<view class="charts-box"> <view class="charts-box" v-if="handTrue">
<qiun-data-charts type="arcbar" :chartData="chartData" :canvas2d="true" <qiun-data-charts type="arcbar" :chartData="chartData" :canvas2d="true"
canvasId="foodCharts01" /> canvasId="foodCharts01" />
</view> </view>
@ -218,11 +218,10 @@
}, },
foodInfo() { foodInfo() {
let that = this let that = this
this.handTrue = false that.handTrue = false
that.$nextTick(() => { that.$nextTick(() => {
that.handTrue = true that.handTrue = true
that.chartData.series[0].data = that.user.aud_id ? Number(that.countFoodInfo.nutrients_four[0] that.chartData.series[0].data = that.user.aud_id ? Number(that.countFoodInfo.nutrients_four[0].proportion) / 100 : 0
.proportion) / 100 : 0
}) })
that.data = that.user.aud_id ? that.countFoodInfo.date : that.$tools.getDate("start") that.data = that.user.aud_id ? that.countFoodInfo.date : that.$tools.getDate("start")
return that.user.aud_id ? that.countFoodInfo : that.configInfo.default_count_foot return that.user.aud_id ? that.countFoodInfo : that.configInfo.default_count_foot

View File

@ -69,6 +69,7 @@
}, },
onUnload: function() { onUnload: function() {
let that = this let that = this
that.$ble.stopBluetoothDevicesDiscovery();
that.$ble.closeBLEConnection() that.$ble.closeBLEConnection()
that.$ble.closeBluetoothAdapter() that.$ble.closeBluetoothAdapter()
console.log("页面返回onUnload") console.log("页面返回onUnload")

View File

@ -77,7 +77,8 @@
drawer, drawer,
}, },
computed: { computed: {
...mapState(["user", "familayList", 'isBluetoothTyle', "configInfo", "bleValue", "homeCardIndex"]), ...mapState(["user", "familayList", 'isBluetoothTyle', "isConnected", "configInfo", "bleValue",
"homeCardIndex"]),
info() { info() {
return this.user return this.user
}, },
@ -117,6 +118,13 @@
that.$ble.onBLEConnectionStateChange() that.$ble.onBLEConnectionStateChange()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
onShow() {
let that = this
that.token = uni.getStorageSync('token')
uni.onBluetoothAdapterStateChange(function(res) {
that.$store.commit("changeBluetooth", res.available);
})
},
watch: { watch: {
isBluetoothTyle() { isBluetoothTyle() {
let that = this let that = this
@ -125,7 +133,15 @@
bleTipsText: "重新连接", bleTipsText: "重新连接",
isConnectStatus: 1, isConnectStatus: 1,
}) })
that.$ble.stopBluetoothDevicesDiscovery() // }
},
isConnected: function() {
let that = this
if (!that.isConnected) {
that.$store.commit("changeBluetoothValue", {
bleTipsText: "重新连接",
isConnectStatus: 1,
})
} }
}, },
'bleValue.isFood'() { 'bleValue.isFood'() {
@ -134,20 +150,13 @@
that.$store.commit("changehomeCard", 1); that.$store.commit("changehomeCard", 1);
} }
}, },
// homeCardIndex: {
// handler(newVal, oldVal) {
// this.toolsIndex = newVal
// },
// deep: true,
// immediate: true
// }
}, },
methods: { methods: {
// //
openBluetoothAdapter() { openBluetoothAdapter() {
let that = this let that = this
if (that.isConnection != 1) return if (that.isConnection == 2) return
that.$store.commit('changeBluetoothValue', { that.$store.commit('changeBluetoothValue', {
deviceId: "", deviceId: "",
serviceId: "", serviceId: "",

View File

@ -54,7 +54,7 @@ export default new Vuex.Store({
foodWrite: "", foodWrite: "",
foodunitList: json.unitArray, foodunitList: json.unitArray,
foodType: 1, //食物称 1实时2锁定 状态类型 foodType: 1, //食物称 1实时2锁定 状态类型
bleTipsText: "", //蓝牙提示语 bleTipsText: "搜索中", //蓝牙提示语
isConnectStatus: 0, //蓝牙连接状态 0搜索中1失败2成功 isConnectStatus: 0, //蓝牙连接状态 0搜索中1失败2成功
}, },
// 计食器 // 计食器
@ -121,6 +121,7 @@ export default new Vuex.Store({
isRecord: false, //手动记录 isRecord: false, //手动记录
isPublicRecord: false, //公共手动记录弹框 isPublicRecord: false, //公共手动记录弹框
isBluetoothTyle: false, isBluetoothTyle: false,
isConnected: false,
trendInfo: { trendInfo: {
weightList: [], weightList: [],
target_weight: "", target_weight: "",
@ -242,6 +243,10 @@ export default new Vuex.Store({
changeBluetooth(state, newData) { changeBluetooth(state, newData) {
state.isBluetoothTyle = newData state.isBluetoothTyle = newData
}, },
//
changeConnected(state, newData) {
state.isConnected = newData
},
}, },
// 模块化vuex // 模块化vuex
modules: {}, modules: {},

View File

@ -57,7 +57,6 @@ 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(() => {
@ -316,6 +315,18 @@ function closeBluetoothAdapter() {
uni.closeBluetoothAdapter({ uni.closeBluetoothAdapter({
success: res => { success: res => {
clearTimeout(searchTimer); clearTimeout(searchTimer);
$store.commit("changeBluetoothValue", {
deviceId: "",
serviceId: "",
foodUnit: "g",
foodNotify: "",
foodWrite: "",
foodType: 1,
foodWeight: 100,
unitList: $data.unitMinus,
isConnectStatus: 1,
bleTipsText: "点击重新连接",
})
console.log('蓝牙模块关闭成功'); console.log('蓝牙模块关闭成功');
} }
}) })
@ -334,24 +345,7 @@ function closeBLEConnection() {
// 监听蓝牙连接状态 // 监听蓝牙连接状态
function onBLEConnectionStateChange() { function onBLEConnectionStateChange() {
uni.onBLEConnectionStateChange(function(res) { uni.onBLEConnectionStateChange(function(res) {
console.log("监听蓝牙连接状态", res.connected) $store.commit("changeConnected", res.connected);
if (!res.connected) {
clearTimeout(searchTimer);
$store.commit("changeBluetoothValue", {
deviceId: "",
serviceId: "",
foodUnit: "g",
foodNotify: "",
foodWrite: "",
foodType: 1,
foodWeight: 100,
unitList: $data.unitMinus,
isConnectStatus: 1,
bleTipsText: "点击重新连接",
})
$store.commit("changeBluetooth", false);
closeBLEConnection()
}
}) })
} }
/** /**

View File

@ -409,7 +409,7 @@ const cfu = {
"padding": [15, 15, 0, 15], "padding": [15, 15, 0, 15],
"xAxis": { "xAxis": {
"disableGrid": true, "disableGrid": true,
"axisLine": false, // "axisLine": false,
}, },
"yAxis": { "yAxis": {
"gridType": "dash", "gridType": "dash",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -280,6 +280,10 @@ var _default = {
that.$store.dispatch('getUserInfo', { that.$store.dispatch('getUserInfo', {
aud_id: that.user.aud_id aud_id: that.user.aud_id
}); });
that.$store.dispatch("getCountFoodInfo", {
aud_id: that.user.aud_id,
time: that.$tools.getDate("start")
});
setTimeout(function () { setTimeout(function () {
uni.navigateBack(); uni.navigateBack();
}, 1000); }, 1000);

View File

@ -9671,7 +9671,7 @@ var _default = new _vuex.default.Store({
foodunitList: _content.default.unitArray, foodunitList: _content.default.unitArray,
foodType: 1, foodType: 1,
//食物称 1实时2锁定 状态类型 //食物称 1实时2锁定 状态类型
bleTipsText: "", bleTipsText: "搜索中",
//蓝牙提示语 //蓝牙提示语
isConnectStatus: 0 //蓝牙连接状态 0搜索中1失败2成功 isConnectStatus: 0 //蓝牙连接状态 0搜索中1失败2成功
}, },
@ -9746,6 +9746,7 @@ var _default = new _vuex.default.Store({
isPublicRecord: false, isPublicRecord: false,
//公共手动记录弹框 //公共手动记录弹框
isBluetoothTyle: false, isBluetoothTyle: false,
isConnected: false,
trendInfo: { trendInfo: {
weightList: [], weightList: [],
target_weight: "", target_weight: "",
@ -9862,6 +9863,10 @@ var _default = new _vuex.default.Store({
//蓝牙状态 //蓝牙状态
changeBluetooth: function changeBluetooth(state, newData) { changeBluetooth: function changeBluetooth(state, newData) {
state.isBluetoothTyle = newData; state.isBluetoothTyle = newData;
},
//
changeConnected: function changeConnected(state, newData) {
state.isConnected = newData;
} }
}, },
// 模块化vuex // 模块化vuex
@ -12344,7 +12349,6 @@ function startBluetoothDeviceDiscovery() {
allowDuplicatesKey: true, allowDuplicatesKey: true,
interval: 200, interval: 200,
//上报设备的间隔 //上报设备的间隔
services: [],
success: function success(res) { success: function success(res) {
onBluetoothDeviceFound(); onBluetoothDeviceFound();
searchTimer = setTimeout(function () { searchTimer = setTimeout(function () {
@ -12580,6 +12584,18 @@ function closeBluetoothAdapter() {
uni.closeBluetoothAdapter({ uni.closeBluetoothAdapter({
success: function success(res) { success: function success(res) {
clearTimeout(searchTimer); clearTimeout(searchTimer);
_store.default.commit("changeBluetoothValue", {
deviceId: "",
serviceId: "",
foodUnit: "g",
foodNotify: "",
foodWrite: "",
foodType: 1,
foodWeight: 100,
unitList: _content.default.unitMinus,
isConnectStatus: 1,
bleTipsText: "点击重新连接"
});
console.log('蓝牙模块关闭成功'); console.log('蓝牙模块关闭成功');
} }
}); });
@ -12598,24 +12614,7 @@ function closeBLEConnection() {
// 监听蓝牙连接状态 // 监听蓝牙连接状态
function onBLEConnectionStateChange() { function onBLEConnectionStateChange() {
uni.onBLEConnectionStateChange(function (res) { uni.onBLEConnectionStateChange(function (res) {
console.log("监听蓝牙连接状态", res.connected); _store.default.commit("changeConnected", res.connected);
if (!res.connected) {
clearTimeout(searchTimer);
_store.default.commit("changeBluetoothValue", {
deviceId: "",
serviceId: "",
foodUnit: "g",
foodNotify: "",
foodWrite: "",
foodType: 1,
foodWeight: 100,
unitList: _content.default.unitMinus,
isConnectStatus: 1,
bleTipsText: "点击重新连接"
});
_store.default.commit("changeBluetooth", false);
closeBLEConnection();
}
}); });
} }
/** /**
@ -31238,9 +31237,10 @@ var cfu = {
"color": color, "color": color,
"padding": [15, 15, 0, 15], "padding": [15, 15, 0, 15],
"xAxis": { "xAxis": {
"disableGrid": true, "disableGrid": true
"axisLine": false // "axisLine": false,
}, },
"yAxis": { "yAxis": {
"gridType": "dash", "gridType": "dash",
"disableGrid": true, "disableGrid": true,

View File

@ -233,7 +233,7 @@ var _default = {
}, },
foodInfo: function foodInfo() { foodInfo: function foodInfo() {
var that = this; var that = this;
this.handTrue = false; that.handTrue = false;
that.$nextTick(function () { that.$nextTick(function () {
that.handTrue = true; that.handTrue = true;
that.chartData.series[0].data = that.user.aud_id ? Number(that.countFoodInfo.nutrients_four[0].proportion) / 100 : 0; that.chartData.series[0].data = that.user.aud_id ? Number(that.countFoodInfo.nutrients_four[0].proportion) / 100 : 0;

File diff suppressed because one or more lines are too long

View File

@ -180,6 +180,7 @@ var _default = {
}, },
onUnload: function onUnload() { onUnload: function onUnload() {
var that = this; var that = this;
that.$ble.stopBluetoothDevicesDiscovery();
that.$ble.closeBLEConnection(); that.$ble.closeBLEConnection();
that.$ble.closeBluetoothAdapter(); that.$ble.closeBluetoothAdapter();
console.log("页面返回onUnload"); console.log("页面返回onUnload");

View File

@ -196,7 +196,7 @@ var _default = {
card: card, card: card,
drawer: drawer drawer: drawer
}, },
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["user", "familayList", 'isBluetoothTyle', "configInfo", "bleValue", "homeCardIndex"])), {}, { computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["user", "familayList", 'isBluetoothTyle', "isConnected", "configInfo", "bleValue", "homeCardIndex"])), {}, {
info: function info() { info: function info() {
return this.user; return this.user;
}, },
@ -236,6 +236,13 @@ var _default = {
that.$ble.onBLEConnectionStateChange(); that.$ble.onBLEConnectionStateChange();
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, },
onShow: function onShow() {
var that = this;
that.token = uni.getStorageSync('token');
uni.onBluetoothAdapterStateChange(function (res) {
that.$store.commit("changeBluetooth", res.available);
});
},
watch: { watch: {
isBluetoothTyle: function isBluetoothTyle() { isBluetoothTyle: function isBluetoothTyle() {
var that = this; var that = this;
@ -244,7 +251,15 @@ var _default = {
bleTipsText: "重新连接", bleTipsText: "重新连接",
isConnectStatus: 1 isConnectStatus: 1
}); });
that.$ble.stopBluetoothDevicesDiscovery(); //取消蓝牙搜索 }
},
isConnected: function isConnected() {
var that = this;
if (!that.isConnected) {
that.$store.commit("changeBluetoothValue", {
bleTipsText: "重新连接",
isConnectStatus: 1
});
} }
}, },
'bleValue.isFood': function bleValueIsFood() { 'bleValue.isFood': function bleValueIsFood() {
@ -252,19 +267,13 @@ var _default = {
if (that.bleValue.isFood) { if (that.bleValue.isFood) {
that.$store.commit("changehomeCard", 1); that.$store.commit("changehomeCard", 1);
} }
} // homeCardIndex: { }
// handler(newVal, oldVal) {
// this.toolsIndex = newVal
// },
// deep: true,
// immediate: true
// }
}, },
methods: { methods: {
// 初始化蓝牙 // 初始化蓝牙
openBluetoothAdapter: function openBluetoothAdapter() { openBluetoothAdapter: function openBluetoothAdapter() {
var that = this; var that = this;
if (that.isConnection != 1) return; if (that.isConnection == 2) return;
that.$store.commit('changeBluetoothValue', { that.$store.commit('changeBluetoothValue', {
deviceId: "", deviceId: "",
serviceId: "", serviceId: "",