对接c07/c10
This commit is contained in:
parent
66b2cdf8f2
commit
984f3e66a0
6
App.vue
6
App.vue
|
|
@ -3,10 +3,6 @@
|
||||||
mapState
|
mapState
|
||||||
} from "vuex";
|
} from "vuex";
|
||||||
export default {
|
export default {
|
||||||
onTabItemClick(itemPath) {
|
|
||||||
// 例如,你可以在这里添加一个确认对话框
|
|
||||||
console.log("itemPath", itemPath)
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["bleValue"]),
|
...mapState(["bleValue"]),
|
||||||
},
|
},
|
||||||
|
|
@ -17,6 +13,8 @@
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
|
// this.$ble.closeBLEConnection(this.bleValue.deviceId)
|
||||||
|
// this.$ble.closeBluetoothAdapter()
|
||||||
console.log('App Hide')
|
console.log('App Hide')
|
||||||
},
|
},
|
||||||
methods: {}
|
methods: {}
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,8 @@
|
||||||
unit: "g",
|
unit: "g",
|
||||||
type: 1,
|
type: 1,
|
||||||
unitList: that.$json.unitMinus,
|
unitList: that.$json.unitMinus,
|
||||||
countWeight: "",
|
countWeight: 0,
|
||||||
|
oldCountWeight: 0,
|
||||||
bleTipsText: "蓝牙搜索中",
|
bleTipsText: "蓝牙搜索中",
|
||||||
isConnectStatus: 0,
|
isConnectStatus: 0,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="kcal" v-else>
|
<view class="kcal" v-else>
|
||||||
<view class="num" v-if="ite.newweight">
|
<view class="num" v-if="ite.newweight">
|
||||||
{{ite.newweight}}{{ite.newunit=="oz"?'盎司':'克'}}
|
{{ite.newweight}}{{ite.newunit}}
|
||||||
</view>
|
</view>
|
||||||
<view class="num" v-if="ite.newkcal">
|
<view class="num" v-if="ite.newkcal">
|
||||||
{{ite.newkcal}}
|
{{ite.newkcal}}
|
||||||
|
|
@ -292,7 +292,7 @@
|
||||||
meals_type: that.foodItem[that.selectSaveType].name,
|
meals_type: that.foodItem[that.selectSaveType].name,
|
||||||
id: that.info.tags[0].list[i].id,
|
id: that.info.tags[0].list[i].id,
|
||||||
weight: that.info.tags[0].list[i].newweight,
|
weight: that.info.tags[0].list[i].newweight,
|
||||||
unit: that.info.tags[0].list[i].newunit == '克' ? '克' : '盎司'
|
unit: that.info.tags[0].list[i].newunit
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,12 @@
|
||||||
that.token = uni.getStorageSync('token')
|
that.token = uni.getStorageSync('token')
|
||||||
that.$store.dispatch("getHomeConfig")
|
that.$store.dispatch("getHomeConfig")
|
||||||
if (that.token) {
|
if (that.token) {
|
||||||
that.$ble.openBluetoothAdapter()
|
console.log("首页搜索蓝牙",that.bleValue)
|
||||||
|
that.$ble.closeBLEConnection(that.bleValue.deviceId)
|
||||||
|
that.$ble.closeBluetoothAdapter()
|
||||||
|
setTimeout(function() {
|
||||||
|
that.$ble.openBluetoothAdapter()
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
that.$ble.onBLEConnectionStateChange()
|
that.$ble.onBLEConnectionStateChange()
|
||||||
uni.onBluetoothAdapterStateChange(function(res) {
|
uni.onBluetoothAdapterStateChange(function(res) {
|
||||||
|
|
@ -220,6 +225,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
startWatching() {
|
startWatching() {
|
||||||
|
console.log("99999999",this.bleValue)
|
||||||
this.unwatch = this.$watch('bleValue', (newVal, oldVal) => {
|
this.unwatch = this.$watch('bleValue', (newVal, oldVal) => {
|
||||||
// 这里可以执行你的业务逻辑
|
// 这里可以执行你的业务逻辑
|
||||||
if (newVal.serviceId != '' && newVal.oldCountWeight != newVal.countWeight) {
|
if (newVal.serviceId != '' && newVal.oldCountWeight != newVal.countWeight) {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,14 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
cookbook_label: [],
|
cookbook_label: [],
|
||||||
activity_level: [],
|
activity_level: [],
|
||||||
default_count_foot: {},
|
default_count_foot: {
|
||||||
|
date: "",
|
||||||
|
list: [],
|
||||||
|
details: {},
|
||||||
|
nutrients_four: [],
|
||||||
|
remaining_kcal: "",
|
||||||
|
trace_elements_all_day: []
|
||||||
|
},
|
||||||
business_cooperation: {}
|
business_cooperation: {}
|
||||||
},
|
},
|
||||||
// 计食器
|
// 计食器
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,10 @@ function onBluetoothDeviceFound() {
|
||||||
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 ||
|
||||||
|
device.name.toLowerCase().indexOf('pc-c10pro') != -1 ||
|
||||||
|
device.name.toLowerCase().indexOf('pc-c07pro') != -1 ||
|
||||||
|
(device.localName && device.localName.toLowerCase().indexOf('pc-c07pro') != -1) ||
|
||||||
|
(device.localName && device.localName.toLowerCase().indexOf('pc-c10pro') != -1) ||
|
||||||
(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)) {
|
||||||
|
|
@ -209,7 +213,8 @@ function getBLECharacteristicValueChange(deviceId, serviceId, notify, write) {
|
||||||
write: write,
|
write: write,
|
||||||
unit: "g",
|
unit: "g",
|
||||||
type: 1,
|
type: 1,
|
||||||
countWeight: "",
|
countWeight: 0,
|
||||||
|
oldCountWeight: 0,
|
||||||
bleTipsText: "测量中,请将食物放到秤上",
|
bleTipsText: "测量中,请将食物放到秤上",
|
||||||
isConnectStatus: 2
|
isConnectStatus: 2
|
||||||
})
|
})
|
||||||
|
|
@ -324,7 +329,8 @@ function closeBluetoothAdapter() {
|
||||||
notify: "",
|
notify: "",
|
||||||
write: "",
|
write: "",
|
||||||
unit: "g",
|
unit: "g",
|
||||||
countWeight: '',
|
countWeight: 0,
|
||||||
|
oldCountWeight: 0,
|
||||||
type: 1,
|
type: 1,
|
||||||
unitList: $data.unitMinus,
|
unitList: $data.unitMinus,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
|
|
|
||||||
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
|
|
@ -125,10 +125,6 @@ var _vuex = __webpack_require__(/*! vuex */ 30);
|
||||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
||||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
||||||
var _default = {
|
var _default = {
|
||||||
onTabItemClick: function onTabItemClick(itemPath) {
|
|
||||||
// 例如,你可以在这里添加一个确认对话框
|
|
||||||
console.log("itemPath", itemPath);
|
|
||||||
},
|
|
||||||
computed: _objectSpread({}, (0, _vuex.mapState)(["bleValue"])),
|
computed: _objectSpread({}, (0, _vuex.mapState)(["bleValue"])),
|
||||||
onLaunch: function onLaunch() {
|
onLaunch: function onLaunch() {
|
||||||
console.log('App Launch');
|
console.log('App Launch');
|
||||||
|
|
@ -137,6 +133,8 @@ var _default = {
|
||||||
console.log('App Show');
|
console.log('App Show');
|
||||||
},
|
},
|
||||||
onHide: function onHide() {
|
onHide: function onHide() {
|
||||||
|
// this.$ble.closeBLEConnection(this.bleValue.deviceId)
|
||||||
|
// this.$ble.closeBluetoothAdapter()
|
||||||
console.log('App Hide');
|
console.log('App Hide');
|
||||||
},
|
},
|
||||||
methods: {}
|
methods: {}
|
||||||
|
|
|
||||||
|
|
@ -28073,7 +28073,14 @@ var _default = new _vuex.default.Store({
|
||||||
},
|
},
|
||||||
cookbook_label: [],
|
cookbook_label: [],
|
||||||
activity_level: [],
|
activity_level: [],
|
||||||
default_count_foot: {},
|
default_count_foot: {
|
||||||
|
date: "",
|
||||||
|
list: [],
|
||||||
|
details: {},
|
||||||
|
nutrients_four: [],
|
||||||
|
remaining_kcal: "",
|
||||||
|
trace_elements_all_day: []
|
||||||
|
},
|
||||||
business_cooperation: {}
|
business_cooperation: {}
|
||||||
},
|
},
|
||||||
// 计食器
|
// 计食器
|
||||||
|
|
@ -29195,7 +29202,7 @@ function onBluetoothDeviceFound() {
|
||||||
if (!device.name && !device.localName) {
|
if (!device.name && !device.localName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (device.name.toLowerCase().indexOf('pc-c06pro') != -1 || device.name.toLowerCase().indexOf('pc-c02pro') != -1 || device.name.toLowerCase().indexOf('pc-c09pro') != -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-c09pro') != -1) {
|
if (device.name.toLowerCase().indexOf('pc-c06pro') != -1 || device.name.toLowerCase().indexOf('pc-c02pro') != -1 || device.name.toLowerCase().indexOf('pc-c09pro') != -1 || device.name.toLowerCase().indexOf('pc-c10pro') != -1 || device.name.toLowerCase().indexOf('pc-c07pro') != -1 || device.localName && device.localName.toLowerCase().indexOf('pc-c07pro') != -1 || device.localName && device.localName.toLowerCase().indexOf('pc-c10pro') != -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-c09pro') != -1) {
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
var bytes = new Uint8Array(device.advertisData);
|
var bytes = new Uint8Array(device.advertisData);
|
||||||
var macBytes = bytes.slice(6, 12);
|
var macBytes = bytes.slice(6, 12);
|
||||||
|
|
@ -29330,7 +29337,8 @@ function getBLECharacteristicValueChange(deviceId, serviceId, notify, write) {
|
||||||
write: write,
|
write: write,
|
||||||
unit: "g",
|
unit: "g",
|
||||||
type: 1,
|
type: 1,
|
||||||
countWeight: "",
|
countWeight: 0,
|
||||||
|
oldCountWeight: 0,
|
||||||
bleTipsText: "测量中,请将食物放到秤上",
|
bleTipsText: "测量中,请将食物放到秤上",
|
||||||
isConnectStatus: 2
|
isConnectStatus: 2
|
||||||
});
|
});
|
||||||
|
|
@ -29430,7 +29438,8 @@ function closeBluetoothAdapter() {
|
||||||
notify: "",
|
notify: "",
|
||||||
write: "",
|
write: "",
|
||||||
unit: "g",
|
unit: "g",
|
||||||
countWeight: '',
|
countWeight: 0,
|
||||||
|
oldCountWeight: 0,
|
||||||
type: 1,
|
type: 1,
|
||||||
unitList: _content.default.unitMinus,
|
unitList: _content.default.unitMinus,
|
||||||
isConnectStatus: 1,
|
isConnectStatus: 1,
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,8 @@ var _default = {
|
||||||
unit: "g",
|
unit: "g",
|
||||||
type: 1,
|
type: 1,
|
||||||
unitList: that.$json.unitMinus,
|
unitList: that.$json.unitMinus,
|
||||||
countWeight: "",
|
countWeight: 0,
|
||||||
|
oldCountWeight: 0,
|
||||||
bleTipsText: "蓝牙搜索中",
|
bleTipsText: "蓝牙搜索中",
|
||||||
isConnectStatus: 0
|
isConnectStatus: 0
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ var _default = {
|
||||||
meals_type: that.foodItem[that.selectSaveType].name,
|
meals_type: that.foodItem[that.selectSaveType].name,
|
||||||
id: that.info.tags[0].list[i].id,
|
id: that.info.tags[0].list[i].id,
|
||||||
weight: that.info.tags[0].list[i].newweight,
|
weight: that.info.tags[0].list[i].newweight,
|
||||||
unit: that.info.tags[0].list[i].newunit == '克' ? '克' : '盎司'
|
unit: that.info.tags[0].list[i].newunit
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -222,7 +222,12 @@ var _default = {
|
||||||
that.token = uni.getStorageSync('token');
|
that.token = uni.getStorageSync('token');
|
||||||
that.$store.dispatch("getHomeConfig");
|
that.$store.dispatch("getHomeConfig");
|
||||||
if (that.token) {
|
if (that.token) {
|
||||||
that.$ble.openBluetoothAdapter();
|
console.log("首页搜索蓝牙", that.bleValue);
|
||||||
|
that.$ble.closeBLEConnection(that.bleValue.deviceId);
|
||||||
|
that.$ble.closeBluetoothAdapter();
|
||||||
|
setTimeout(function () {
|
||||||
|
that.$ble.openBluetoothAdapter();
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
that.$ble.onBLEConnectionStateChange();
|
that.$ble.onBLEConnectionStateChange();
|
||||||
uni.onBluetoothAdapterStateChange(function (res) {
|
uni.onBluetoothAdapterStateChange(function (res) {
|
||||||
|
|
@ -259,6 +264,7 @@ var _default = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
startWatching: function startWatching() {
|
startWatching: function startWatching() {
|
||||||
|
console.log("99999999", this.bleValue);
|
||||||
this.unwatch = this.$watch('bleValue', function (newVal, oldVal) {
|
this.unwatch = this.$watch('bleValue', function (newVal, oldVal) {
|
||||||
// 这里可以执行你的业务逻辑
|
// 这里可以执行你的业务逻辑
|
||||||
if (newVal.serviceId != '' && newVal.oldCountWeight != newVal.countWeight) {
|
if (newVal.serviceId != '' && newVal.oldCountWeight != newVal.countWeight) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue