目标卡路里及时更新
This commit is contained in:
parent
22debbb070
commit
7c9036dff6
|
|
@ -88,7 +88,8 @@
|
|||
that.$nextTick(() => {
|
||||
that.isShow = true
|
||||
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()
|
||||
})
|
||||
}
|
||||
|
|
@ -150,6 +151,10 @@
|
|||
that.$store.dispatch('getUserInfo', {
|
||||
aud_id: that.user.aud_id
|
||||
})
|
||||
that.$store.dispatch("getCountFoodInfo", {
|
||||
aud_id: that.user.aud_id,
|
||||
time: that.$tools.getDate("start")
|
||||
})
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
</view>
|
||||
<view class="jishiqi">
|
||||
<view class="left">
|
||||
<view class="chart-wrap" v-if="handTrue">
|
||||
<view class="charts-box">
|
||||
<view class="chart-wrap">
|
||||
<view class="charts-box" v-if="handTrue">
|
||||
<qiun-data-charts type="arcbar" :chartData="chartData" :canvas2d="true"
|
||||
canvasId="foodCharts01" />
|
||||
</view>
|
||||
|
|
@ -218,11 +218,10 @@
|
|||
},
|
||||
foodInfo() {
|
||||
let that = this
|
||||
this.handTrue = false
|
||||
that.handTrue = false
|
||||
that.$nextTick(() => {
|
||||
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
|
||||
})
|
||||
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
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@
|
|||
},
|
||||
onUnload: function() {
|
||||
let that = this
|
||||
that.$ble.stopBluetoothDevicesDiscovery();
|
||||
that.$ble.closeBLEConnection()
|
||||
that.$ble.closeBluetoothAdapter()
|
||||
console.log("页面返回onUnload")
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@
|
|||
drawer,
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user", "familayList", 'isBluetoothTyle', "configInfo", "bleValue", "homeCardIndex"]),
|
||||
...mapState(["user", "familayList", 'isBluetoothTyle', "isConnected", "configInfo", "bleValue",
|
||||
"homeCardIndex"]),
|
||||
info() {
|
||||
return this.user
|
||||
},
|
||||
|
|
@ -117,6 +118,13 @@
|
|||
that.$ble.onBLEConnectionStateChange()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onShow() {
|
||||
let that = this
|
||||
that.token = uni.getStorageSync('token')
|
||||
uni.onBluetoothAdapterStateChange(function(res) {
|
||||
that.$store.commit("changeBluetooth", res.available);
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
isBluetoothTyle() {
|
||||
let that = this
|
||||
|
|
@ -125,7 +133,15 @@
|
|||
bleTipsText: "重新连接",
|
||||
isConnectStatus: 1,
|
||||
})
|
||||
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||
}
|
||||
},
|
||||
isConnected: function() {
|
||||
let that = this
|
||||
if (!that.isConnected) {
|
||||
that.$store.commit("changeBluetoothValue", {
|
||||
bleTipsText: "重新连接",
|
||||
isConnectStatus: 1,
|
||||
})
|
||||
}
|
||||
},
|
||||
'bleValue.isFood'() {
|
||||
|
|
@ -134,20 +150,13 @@
|
|||
that.$store.commit("changehomeCard", 1);
|
||||
}
|
||||
},
|
||||
// homeCardIndex: {
|
||||
// handler(newVal, oldVal) {
|
||||
// this.toolsIndex = newVal
|
||||
// },
|
||||
// deep: true,
|
||||
// immediate: true
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 初始化蓝牙
|
||||
openBluetoothAdapter() {
|
||||
let that = this
|
||||
if (that.isConnection != 1) return
|
||||
if (that.isConnection == 2) return
|
||||
that.$store.commit('changeBluetoothValue', {
|
||||
deviceId: "",
|
||||
serviceId: "",
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default new Vuex.Store({
|
|||
foodWrite: "",
|
||||
foodunitList: json.unitArray,
|
||||
foodType: 1, //食物称 1实时,2锁定 状态类型
|
||||
bleTipsText: "", //蓝牙提示语
|
||||
bleTipsText: "搜索中", //蓝牙提示语
|
||||
isConnectStatus: 0, //蓝牙连接状态 0搜索中,1失败,2成功
|
||||
},
|
||||
// 计食器
|
||||
|
|
@ -121,6 +121,7 @@ export default new Vuex.Store({
|
|||
isRecord: false, //手动记录
|
||||
isPublicRecord: false, //公共手动记录弹框
|
||||
isBluetoothTyle: false,
|
||||
isConnected: false,
|
||||
trendInfo: {
|
||||
weightList: [],
|
||||
target_weight: "",
|
||||
|
|
@ -242,6 +243,10 @@ export default new Vuex.Store({
|
|||
changeBluetooth(state, newData) {
|
||||
state.isBluetoothTyle = newData
|
||||
},
|
||||
//
|
||||
changeConnected(state, newData) {
|
||||
state.isConnected = newData
|
||||
},
|
||||
},
|
||||
// 模块化vuex
|
||||
modules: {},
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ function startBluetoothDeviceDiscovery() {
|
|||
uni.startBluetoothDevicesDiscovery({
|
||||
allowDuplicatesKey: true,
|
||||
interval: 200, //上报设备的间隔
|
||||
services: [],
|
||||
success: res => {
|
||||
onBluetoothDeviceFound();
|
||||
searchTimer = setTimeout(() => {
|
||||
|
|
@ -316,6 +315,18 @@ function closeBluetoothAdapter() {
|
|||
uni.closeBluetoothAdapter({
|
||||
success: res => {
|
||||
clearTimeout(searchTimer);
|
||||
$store.commit("changeBluetoothValue", {
|
||||
deviceId: "",
|
||||
serviceId: "",
|
||||
foodUnit: "g",
|
||||
foodNotify: "",
|
||||
foodWrite: "",
|
||||
foodType: 1,
|
||||
foodWeight: 100,
|
||||
unitList: $data.unitMinus,
|
||||
isConnectStatus: 1,
|
||||
bleTipsText: "点击重新连接",
|
||||
})
|
||||
console.log('蓝牙模块关闭成功');
|
||||
}
|
||||
})
|
||||
|
|
@ -334,24 +345,7 @@ function closeBLEConnection() {
|
|||
// 监听蓝牙连接状态
|
||||
function onBLEConnectionStateChange() {
|
||||
uni.onBLEConnectionStateChange(function(res) {
|
||||
console.log("监听蓝牙连接状态", 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()
|
||||
}
|
||||
$store.commit("changeConnected", res.connected);
|
||||
})
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ const cfu = {
|
|||
"padding": [15, 15, 0, 15],
|
||||
"xAxis": {
|
||||
"disableGrid": true,
|
||||
"axisLine": false,
|
||||
// "axisLine": false,
|
||||
},
|
||||
"yAxis": {
|
||||
"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
|
|
@ -280,6 +280,10 @@ var _default = {
|
|||
that.$store.dispatch('getUserInfo', {
|
||||
aud_id: that.user.aud_id
|
||||
});
|
||||
that.$store.dispatch("getCountFoodInfo", {
|
||||
aud_id: that.user.aud_id,
|
||||
time: that.$tools.getDate("start")
|
||||
});
|
||||
setTimeout(function () {
|
||||
uni.navigateBack();
|
||||
}, 1000);
|
||||
|
|
|
|||
|
|
@ -9671,7 +9671,7 @@ var _default = new _vuex.default.Store({
|
|||
foodunitList: _content.default.unitArray,
|
||||
foodType: 1,
|
||||
//食物称 1实时,2锁定 状态类型
|
||||
bleTipsText: "",
|
||||
bleTipsText: "搜索中",
|
||||
//蓝牙提示语
|
||||
isConnectStatus: 0 //蓝牙连接状态 0搜索中,1失败,2成功
|
||||
},
|
||||
|
|
@ -9746,6 +9746,7 @@ var _default = new _vuex.default.Store({
|
|||
isPublicRecord: false,
|
||||
//公共手动记录弹框
|
||||
isBluetoothTyle: false,
|
||||
isConnected: false,
|
||||
trendInfo: {
|
||||
weightList: [],
|
||||
target_weight: "",
|
||||
|
|
@ -9862,6 +9863,10 @@ var _default = new _vuex.default.Store({
|
|||
//蓝牙状态
|
||||
changeBluetooth: function changeBluetooth(state, newData) {
|
||||
state.isBluetoothTyle = newData;
|
||||
},
|
||||
//
|
||||
changeConnected: function changeConnected(state, newData) {
|
||||
state.isConnected = newData;
|
||||
}
|
||||
},
|
||||
// 模块化vuex
|
||||
|
|
@ -12344,7 +12349,6 @@ function startBluetoothDeviceDiscovery() {
|
|||
allowDuplicatesKey: true,
|
||||
interval: 200,
|
||||
//上报设备的间隔
|
||||
services: [],
|
||||
success: function success(res) {
|
||||
onBluetoothDeviceFound();
|
||||
searchTimer = setTimeout(function () {
|
||||
|
|
@ -12580,6 +12584,18 @@ function closeBluetoothAdapter() {
|
|||
uni.closeBluetoothAdapter({
|
||||
success: function success(res) {
|
||||
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('蓝牙模块关闭成功');
|
||||
}
|
||||
});
|
||||
|
|
@ -12598,24 +12614,7 @@ function closeBLEConnection() {
|
|||
// 监听蓝牙连接状态
|
||||
function onBLEConnectionStateChange() {
|
||||
uni.onBLEConnectionStateChange(function (res) {
|
||||
console.log("监听蓝牙连接状态", 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();
|
||||
}
|
||||
_store.default.commit("changeConnected", res.connected);
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
@ -31238,9 +31237,10 @@ var cfu = {
|
|||
"color": color,
|
||||
"padding": [15, 15, 0, 15],
|
||||
"xAxis": {
|
||||
"disableGrid": true,
|
||||
"axisLine": false
|
||||
"disableGrid": true
|
||||
// "axisLine": false,
|
||||
},
|
||||
|
||||
"yAxis": {
|
||||
"gridType": "dash",
|
||||
"disableGrid": true,
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ var _default = {
|
|||
},
|
||||
foodInfo: function foodInfo() {
|
||||
var that = this;
|
||||
this.handTrue = false;
|
||||
that.handTrue = false;
|
||||
that.$nextTick(function () {
|
||||
that.handTrue = true;
|
||||
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
|
|
@ -180,6 +180,7 @@ var _default = {
|
|||
},
|
||||
onUnload: function onUnload() {
|
||||
var that = this;
|
||||
that.$ble.stopBluetoothDevicesDiscovery();
|
||||
that.$ble.closeBLEConnection();
|
||||
that.$ble.closeBluetoothAdapter();
|
||||
console.log("页面返回onUnload");
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ var _default = {
|
|||
card: card,
|
||||
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() {
|
||||
return this.user;
|
||||
},
|
||||
|
|
@ -236,6 +236,13 @@ var _default = {
|
|||
that.$ble.onBLEConnectionStateChange();
|
||||
uni.stopPullDownRefresh();
|
||||
},
|
||||
onShow: function onShow() {
|
||||
var that = this;
|
||||
that.token = uni.getStorageSync('token');
|
||||
uni.onBluetoothAdapterStateChange(function (res) {
|
||||
that.$store.commit("changeBluetooth", res.available);
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
isBluetoothTyle: function isBluetoothTyle() {
|
||||
var that = this;
|
||||
|
|
@ -244,7 +251,15 @@ var _default = {
|
|||
bleTipsText: "重新连接",
|
||||
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() {
|
||||
|
|
@ -252,19 +267,13 @@ var _default = {
|
|||
if (that.bleValue.isFood) {
|
||||
that.$store.commit("changehomeCard", 1);
|
||||
}
|
||||
} // homeCardIndex: {
|
||||
// handler(newVal, oldVal) {
|
||||
// this.toolsIndex = newVal
|
||||
// },
|
||||
// deep: true,
|
||||
// immediate: true
|
||||
// }
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 初始化蓝牙
|
||||
openBluetoothAdapter: function openBluetoothAdapter() {
|
||||
var that = this;
|
||||
if (that.isConnection != 1) return;
|
||||
if (that.isConnection == 2) return;
|
||||
that.$store.commit('changeBluetoothValue', {
|
||||
deviceId: "",
|
||||
serviceId: "",
|
||||
|
|
|
|||
Loading…
Reference in New Issue