新增设备C06/C09PRO
This commit is contained in:
parent
8cc0df43ad
commit
66b2cdf8f2
|
|
@ -5,13 +5,16 @@
|
|||
<image src="/static/zhong.png"></image>
|
||||
<text @click="openBluetoothAdapter">{{bleTipsText}}</text>
|
||||
</view>
|
||||
<view class="duan" @click="handleBack" v-if="isShow&&isConnection == 2">
|
||||
断开连接
|
||||
</view>
|
||||
</view>
|
||||
<view class="name">{{name}}</view>
|
||||
<!-- 蓝牙称重 -->
|
||||
<view class="weight-wrap">
|
||||
<view class="weight" @click="inputDialogToggle">
|
||||
<text class="val">{{weight == '' ? '0.0':weight}}</text>
|
||||
<text class="unit">{{unit}}</text>
|
||||
<text class="unit">{{unitConversion(unit)}}</text>
|
||||
</view>
|
||||
<view class="weight">
|
||||
<text class="val">{{kcal?kcal:0}}</text>
|
||||
|
|
@ -22,7 +25,7 @@
|
|||
<view class="btn danwei">
|
||||
<view class="lan border-bottom">
|
||||
<view class="right">
|
||||
<picker mode="selector" :range="unitList" range-key="name" @change="changleUnits"
|
||||
<picker mode="selector" :range="unitA" range-key="name" @change="changleUnits"
|
||||
:value="unitListIndex">
|
||||
<view class="uni-input">
|
||||
单位
|
||||
|
|
@ -52,26 +55,12 @@
|
|||
data() {
|
||||
return {
|
||||
kcal: "",
|
||||
// weight: "",
|
||||
weightALL: "",
|
||||
bleTipsText: "",
|
||||
unit: 'g',
|
||||
weight0: 0,
|
||||
unitA: [],
|
||||
stopblue: false,
|
||||
devicesList: [],
|
||||
unitList: [{
|
||||
name: "克",
|
||||
id: '00',
|
||||
unit: "g"
|
||||
}, {
|
||||
name: "盎司",
|
||||
id: "08",
|
||||
unit: "oz"
|
||||
}],
|
||||
unitListIndex: 0,
|
||||
units: ['kg', '斤', 'st:lb', 'lb', 'g', 'ml', 'Waterml',
|
||||
'milkml', 'oz', 'floz', 'lboz'
|
||||
]
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
|
@ -91,15 +80,18 @@
|
|||
computed: {
|
||||
...mapState(["user", "isBluetoothTyle", "bleValue"]),
|
||||
weight() {
|
||||
let kcal = (Number(this.weightKcal) * this.bleValue.countWeight).toFixed(2)
|
||||
this.unit = this.unitConversion(this.bleValue.unit)
|
||||
this.kcal = this.convertToGrams(kcal, this.bleValue.unit).toFixed(2)
|
||||
let weightNew = this.convertToGrams(this.bleValue.countWeight, this.bleValue.unit)
|
||||
this.kcal = (Number(this.weightKcal) * weightNew).toFixed(1)
|
||||
this.unit = this.bleValue.unit
|
||||
return this.bleValue.countWeight
|
||||
},
|
||||
isConnection() {
|
||||
this.bleTipsText = this.bleValue.bleTipsText
|
||||
return this.bleValue.isConnectStatus
|
||||
},
|
||||
isShow() {
|
||||
return this.bleValue.serviceId != '' ? true : false
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
let that = this
|
||||
|
|
@ -114,10 +106,22 @@
|
|||
that.handleBack()
|
||||
}
|
||||
},
|
||||
isLast: function() {
|
||||
let that = this
|
||||
that.stopblue = that.isLast
|
||||
}
|
||||
isLast: {
|
||||
handler(newVal, oldVal) {
|
||||
this.stopblue = newVal
|
||||
},
|
||||
// deep: true,
|
||||
immediate: true
|
||||
|
||||
},
|
||||
bleValue: {
|
||||
handler(newVal, oldVal) {
|
||||
this.unitA = newVal.unitList
|
||||
this.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.unit)
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 初始化蓝牙
|
||||
|
|
@ -131,6 +135,8 @@
|
|||
notify: '',
|
||||
write: '',
|
||||
unit: "g",
|
||||
type: 1,
|
||||
unitList: that.$json.unitMinus,
|
||||
countWeight: "",
|
||||
bleTipsText: "蓝牙搜索中",
|
||||
isConnectStatus: 0,
|
||||
|
|
@ -139,17 +145,63 @@
|
|||
},
|
||||
changleUnits(e) {
|
||||
let that = this
|
||||
let name = that.unitList[e.detail.value].name
|
||||
console.log("单位切换", name, that.unit)
|
||||
if (that.unit != name) {
|
||||
that.handletoggleUnit(name == '盎司' ? 0x08 : 0x04)
|
||||
let name = that.unitA[e.detail.value].name
|
||||
let val = that.unitA[e.detail.value].unit
|
||||
if (that.isShow && that.unit != name) {
|
||||
that.handletoggleUnit(that.unitConversion2(val))
|
||||
}
|
||||
if (that.bleValue.serviceId == '') {
|
||||
that.unitListIndex = [e.detail.value]
|
||||
that.$store.commit('changeBluetoothValue', {
|
||||
unit: that.unitA[e.detail.value].unit,
|
||||
})
|
||||
}
|
||||
that.unitListIndex = [e.detail.value]
|
||||
that.$store.commit('changeBluetoothValue', {
|
||||
unit: that.unitList[e.detail.value].unit
|
||||
})
|
||||
|
||||
},
|
||||
convertToGrams(value, fromUnit) {
|
||||
const conversionFactors = {
|
||||
'lb': 453.59237, // 1磅 = 453.59237克
|
||||
'oz': 28.349523125, // 1盎司 = 28.349523125克
|
||||
'kg': 1000, // 1公斤 = 1000克
|
||||
'g': 1,
|
||||
'ml': 1,
|
||||
'斤': 500,
|
||||
'Waterml': 1,
|
||||
'milkml': 1.03
|
||||
};
|
||||
|
||||
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return value * conversionFactors[fromUnit];
|
||||
},
|
||||
unitConversion2(unit) {
|
||||
if (unit == 'kg') {
|
||||
return 0x00
|
||||
} else if (unit == '斤') {
|
||||
return 0x01
|
||||
} else if (unit == 'st:lb') {
|
||||
return 0x02
|
||||
} else if (unit == 'lb') {
|
||||
return 0x03
|
||||
} else if (unit == 'g') {
|
||||
return 0x04
|
||||
} else if (unit == 'ml') {
|
||||
return 0x05
|
||||
} else if (unit == 'Waterml') {
|
||||
return 0x06
|
||||
} else if (unit == 'milkml') {
|
||||
return 0x07
|
||||
} else if (unit == 'oz') {
|
||||
return 0x08
|
||||
} else if (unit == 'floz') {
|
||||
return 0x09
|
||||
} else if (unit == 'lboz') {
|
||||
return 0x0A
|
||||
}
|
||||
return unit
|
||||
},
|
||||
// 下发单位
|
||||
handletoggleUnit(unit) {
|
||||
let that = this
|
||||
let checksum = 0;
|
||||
|
|
@ -184,30 +236,43 @@
|
|||
},
|
||||
})
|
||||
},
|
||||
// 保存测量结果
|
||||
handlesub() {
|
||||
handleBack() {
|
||||
let that = this
|
||||
console.log("测量保存", that.weight, that.unit, that.kcal)
|
||||
if (Number(that.weight) > 0) {
|
||||
that.$emit("handleBle", that.weight, that.unit, that.kcal)
|
||||
} else {
|
||||
that.$tools.msg("数据异常,请清零后重新测量!")
|
||||
}
|
||||
|
||||
that.$store.commit("changeBluetoothValue", {
|
||||
bleTipsText: "连接失败,点击重新连接",
|
||||
unitList: that.$json.unitMinus,
|
||||
isConnectStatus: 1,
|
||||
})
|
||||
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||
that.$ble.closeBLEConnection(that.bleValue.deviceId)
|
||||
that.$ble.closeBluetoothAdapter()
|
||||
},
|
||||
convertToGrams(value, fromUnit) {
|
||||
const conversionFactors = {
|
||||
'lb': 453.59, // 1磅 = 453.59237克
|
||||
'oz': 28.35, // 1盎司 = 28.349523125克
|
||||
'kg': 1000, // 1公斤 = 1000克
|
||||
'g': 1
|
||||
};
|
||||
|
||||
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
||||
return ''
|
||||
unitConversion(unit) {
|
||||
if (unit == 'kg') {
|
||||
return '千克'
|
||||
} else if (unit == '斤') {
|
||||
return '斤'
|
||||
} else if (unit == 'stlb') {
|
||||
return 'stlb'
|
||||
} else if (unit == 'lb') {
|
||||
return '磅'
|
||||
} else if (unit == 'g') {
|
||||
return '克'
|
||||
} else if (unit == 'ml') {
|
||||
return '毫升'
|
||||
} else if (unit == 'Waterml') {
|
||||
return 'Waterml'
|
||||
} else if (unit == 'milkml') {
|
||||
return 'milkml'
|
||||
} else if (unit == 'oz') {
|
||||
return '盎司'
|
||||
} else if (unit == 'floz') {
|
||||
return 'floz'
|
||||
} else if (unit == 'lboz') {
|
||||
return 'lboz'
|
||||
}
|
||||
|
||||
return value * conversionFactors[fromUnit];
|
||||
return unit
|
||||
},
|
||||
// 备料完成
|
||||
handleDetailSub() {
|
||||
|
|
@ -215,7 +280,7 @@
|
|||
if (Number(that.weight) > 0) {
|
||||
that.$emit("handleDetailSub", that.weight, that.unit, that.kcal)
|
||||
} else {
|
||||
that.$tools.msg("数据异常,请重新测量!")
|
||||
that.$tools.msg("数据异常,请清零后重新测量!")
|
||||
}
|
||||
},
|
||||
//备料下一个
|
||||
|
|
@ -227,33 +292,12 @@
|
|||
that.$tools.msg("数据异常,请清零后重新测量!")
|
||||
}
|
||||
},
|
||||
unitConversion(unit) {
|
||||
if (unit == 'kcal') {
|
||||
return '千卡'
|
||||
} else if (unit == 'g') {
|
||||
return '克'
|
||||
} else if (unit == 'lb') {
|
||||
return '磅'
|
||||
} else if (unit == 'oz') {
|
||||
return '盎司'
|
||||
}
|
||||
return unit
|
||||
},
|
||||
handleBack() {
|
||||
let that = this
|
||||
that.$store.commit("changeBluetoothValue", {
|
||||
bleTipsText: "连接失败,点击重新连接",
|
||||
isConnectStatus: 1
|
||||
})
|
||||
that.$ble.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||
that.$ble.closeBLEConnection(that.bleValue.deviceId)
|
||||
that.$ble.closeBluetoothAdapter()
|
||||
},
|
||||
confirm(value) {
|
||||
console.log("手动输入", value)
|
||||
console.log(value)
|
||||
let that = this
|
||||
this.$store.commit("changeBluetoothValue", {
|
||||
countWeight: value,
|
||||
unit: this.unitList[this.unitListIndex].unit
|
||||
unit: this.unitA[this.unitListIndex].unit
|
||||
})
|
||||
this.$refs.popup.close()
|
||||
},
|
||||
|
|
@ -395,6 +439,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
.duan {
|
||||
width: fit-content;
|
||||
background: linear-gradient(-90deg, #d4f5c4, #a7d5e4 80%, );
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
padding: 3px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.name {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@
|
|||
handler(newVal, oldVal) {
|
||||
this.unitA = newVal.unitList
|
||||
this.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.unit)
|
||||
console.log("2222222222", newVal.unit)
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="content" >
|
||||
<view class="content_box">
|
||||
<view class="box">
|
||||
<!-- 类型 -->
|
||||
|
|
@ -465,4 +465,9 @@
|
|||
font-weight: bold;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
|
||||
.no-scroll {
|
||||
height: 80vh !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
list.forEach(ite => {
|
||||
ite.weight = null
|
||||
})
|
||||
console.log("222222222",that.info.tags[0].list,list)
|
||||
console.log("222222222", that.info.tags[0].list, list)
|
||||
that.info.tags[0].list = that.$tools.mergeAndDeduplicate(that.info.tags[0].list, list, 'name')
|
||||
},
|
||||
// 清空食材
|
||||
|
|
@ -335,6 +335,10 @@
|
|||
that.info.token = uni.getStorageSync('token')
|
||||
console.log("修改", that.info)
|
||||
that.$model.getEditCookbook(that.info).then(res2 => {
|
||||
if (res2.code != 0) {
|
||||
that.$tools.msg(res.msg)
|
||||
return
|
||||
}
|
||||
if (res2.code == 0) {
|
||||
that.$tools.msg("修改成功")
|
||||
setTimeout(function() {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
</view>
|
||||
<view class="h4">
|
||||
<view class="tags">
|
||||
<view class="tags-item" v-for="(item,ind) in info.tags[0]"
|
||||
<view class="tags-item" :class="[index ==ind?'active':'']" v-for="(item,ind) in info.tags"
|
||||
:key="ind" @click="handleToggle(ind)">{{item.title}}</view>
|
||||
</view>
|
||||
<view class="close" @click="handleWeight">
|
||||
|
|
@ -39,8 +39,9 @@
|
|||
连接测量
|
||||
</view>
|
||||
</view>
|
||||
<view class="foodlist" v-if="info.tags.length&&info.tags[0].list.length">
|
||||
<view class="item" v-for="(ite,ind) in info.tags[0].list" :key="ind">
|
||||
<view class="foodlist">
|
||||
<view class="item" v-for="(ite,ind) in info.tags[index].list" :key="ind"
|
||||
v-if="info.tags&&info.tags[index].list.length">
|
||||
<view class="name" style="flex: 1;">{{ite.name}}</view>
|
||||
<view class="weight">
|
||||
{{ite.weight}}{{ite.unit}}
|
||||
|
|
@ -164,6 +165,12 @@
|
|||
listInd: 0,
|
||||
cookIndex: null,
|
||||
showSaveFood: false,
|
||||
saveFoodTypes: [
|
||||
'早餐',
|
||||
'午餐',
|
||||
'晚餐',
|
||||
'加餐',
|
||||
],
|
||||
selectSaveType: 0
|
||||
}
|
||||
},
|
||||
|
|
@ -172,12 +179,12 @@
|
|||
menu() {
|
||||
return this.configInfo.cookbook_label
|
||||
},
|
||||
endDate() {
|
||||
return this.$tools.getDate("start")
|
||||
},
|
||||
foodItem() {
|
||||
return this.configInfo.meal_list
|
||||
},
|
||||
endDate() {
|
||||
return this.$tools.getDate("start")
|
||||
},
|
||||
},
|
||||
components: {
|
||||
blueTooth
|
||||
|
|
@ -225,6 +232,7 @@
|
|||
that.isWeightType = false
|
||||
that.activeType = that.info.tags[0].list[0]
|
||||
that.weightKcal = Number(Number(that.activeType.kcal) / 100).toFixed(2)
|
||||
console.log("222222222",that.info.tags[0].list)
|
||||
if (that.info.tags[0].list.length == 1) {
|
||||
that.isLast = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<text class="overflow">{{it.create_user_nickname}}</text>
|
||||
</view>
|
||||
<view class="zan" @click="handleZan(it)">
|
||||
<icon class="t-icon" :class="[it.is_me_like_it=='yes'?'t-icon-icon3':'t-icon-icon_collect']">
|
||||
<icon class="t-icon mr-5" :class="[it.is_me_like_it=='yes'?'t-icon-icon3':'t-icon-icon_collect']">
|
||||
</icon>
|
||||
<text>{{it.likes_num}}</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -338,8 +338,8 @@
|
|||
that.FMimg = ""
|
||||
that.cookIndex = null
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url: "/pages/menu/menu"
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/me/mymenu?pageName=我的菜谱"
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="content" >
|
||||
<view v-if="!token" class="list2" @click="handleLogin()">
|
||||
<view class="nolist">
|
||||
<icon class="iconfont icon-zanwushuju"></icon>
|
||||
|
|
@ -618,5 +618,10 @@
|
|||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.no-scroll {
|
||||
height: 80vh !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
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
|
|
@ -107,6 +107,15 @@ var render = function () {
|
|||
var _vm = this
|
||||
var _h = _vm.$createElement
|
||||
var _c = _vm._self._c || _h
|
||||
var m0 = _vm.unitConversion(_vm.unit)
|
||||
_vm.$mp.data = Object.assign(
|
||||
{},
|
||||
{
|
||||
$root: {
|
||||
m0: m0,
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
var recyclableRender = false
|
||||
var staticRenderFns = []
|
||||
|
|
@ -155,24 +164,12 @@ var _default = {
|
|||
data: function data() {
|
||||
return {
|
||||
kcal: "",
|
||||
// weight: "",
|
||||
weightALL: "",
|
||||
bleTipsText: "",
|
||||
unit: 'g',
|
||||
weight0: 0,
|
||||
unitA: [],
|
||||
stopblue: false,
|
||||
devicesList: [],
|
||||
unitList: [{
|
||||
name: "克",
|
||||
id: '00',
|
||||
unit: "g"
|
||||
}, {
|
||||
name: "盎司",
|
||||
id: "08",
|
||||
unit: "oz"
|
||||
}],
|
||||
unitListIndex: 0,
|
||||
units: ['kg', '斤', 'st:lb', 'lb', 'g', 'ml', 'Waterml', 'milkml', 'oz', 'floz', 'lboz']
|
||||
unitListIndex: 0
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
|
@ -192,14 +189,17 @@ var _default = {
|
|||
},
|
||||
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["user", "isBluetoothTyle", "bleValue"])), {}, {
|
||||
weight: function weight() {
|
||||
var kcal = (Number(this.weightKcal) * this.bleValue.countWeight).toFixed(2);
|
||||
this.unit = this.unitConversion(this.bleValue.unit);
|
||||
this.kcal = this.convertToGrams(kcal, this.bleValue.unit).toFixed(2);
|
||||
var weightNew = this.convertToGrams(this.bleValue.countWeight, this.bleValue.unit);
|
||||
this.kcal = (Number(this.weightKcal) * weightNew).toFixed(1);
|
||||
this.unit = this.bleValue.unit;
|
||||
return this.bleValue.countWeight;
|
||||
},
|
||||
isConnection: function isConnection() {
|
||||
this.bleTipsText = this.bleValue.bleTipsText;
|
||||
return this.bleValue.isConnectStatus;
|
||||
},
|
||||
isShow: function isShow() {
|
||||
return this.bleValue.serviceId != '' ? true : false;
|
||||
}
|
||||
}),
|
||||
mounted: function mounted() {
|
||||
|
|
@ -215,9 +215,22 @@ var _default = {
|
|||
that.handleBack();
|
||||
}
|
||||
},
|
||||
isLast: function isLast() {
|
||||
var that = this;
|
||||
that.stopblue = that.isLast;
|
||||
isLast: {
|
||||
handler: function handler(newVal, oldVal) {
|
||||
this.stopblue = newVal;
|
||||
},
|
||||
// deep: true,
|
||||
immediate: true
|
||||
},
|
||||
bleValue: {
|
||||
handler: function handler(newVal, oldVal) {
|
||||
this.unitA = newVal.unitList;
|
||||
this.unitListIndex = newVal.unitList.findIndex(function (ite) {
|
||||
return ite.unit == newVal.unit;
|
||||
});
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -232,6 +245,8 @@ var _default = {
|
|||
notify: '',
|
||||
write: '',
|
||||
unit: "g",
|
||||
type: 1,
|
||||
unitList: that.$json.unitMinus,
|
||||
countWeight: "",
|
||||
bleTipsText: "蓝牙搜索中",
|
||||
isConnectStatus: 0
|
||||
|
|
@ -240,16 +255,64 @@ var _default = {
|
|||
},
|
||||
changleUnits: function changleUnits(e) {
|
||||
var that = this;
|
||||
var name = that.unitList[e.detail.value].name;
|
||||
console.log("单位切换", name, that.unit);
|
||||
if (that.unit != name) {
|
||||
that.handletoggleUnit(name == '盎司' ? 0x08 : 0x04);
|
||||
var name = that.unitA[e.detail.value].name;
|
||||
var val = that.unitA[e.detail.value].unit;
|
||||
if (that.isShow && that.unit != name) {
|
||||
that.handletoggleUnit(that.unitConversion2(val));
|
||||
}
|
||||
if (that.bleValue.serviceId == '') {
|
||||
that.unitListIndex = [e.detail.value];
|
||||
that.$store.commit('changeBluetoothValue', {
|
||||
unit: that.unitA[e.detail.value].unit
|
||||
});
|
||||
}
|
||||
that.unitListIndex = [e.detail.value];
|
||||
that.$store.commit('changeBluetoothValue', {
|
||||
unit: that.unitList[e.detail.value].unit
|
||||
});
|
||||
},
|
||||
convertToGrams: function convertToGrams(value, fromUnit) {
|
||||
var conversionFactors = {
|
||||
'lb': 453.59237,
|
||||
// 1磅 = 453.59237克
|
||||
'oz': 28.349523125,
|
||||
// 1盎司 = 28.349523125克
|
||||
'kg': 1000,
|
||||
// 1公斤 = 1000克
|
||||
'g': 1,
|
||||
'ml': 1,
|
||||
'斤': 500,
|
||||
'Waterml': 1,
|
||||
'milkml': 1.03
|
||||
};
|
||||
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
||||
return '';
|
||||
}
|
||||
return value * conversionFactors[fromUnit];
|
||||
},
|
||||
unitConversion2: function unitConversion2(unit) {
|
||||
if (unit == 'kg') {
|
||||
return 0x00;
|
||||
} else if (unit == '斤') {
|
||||
return 0x01;
|
||||
} else if (unit == 'st:lb') {
|
||||
return 0x02;
|
||||
} else if (unit == 'lb') {
|
||||
return 0x03;
|
||||
} else if (unit == 'g') {
|
||||
return 0x04;
|
||||
} else if (unit == 'ml') {
|
||||
return 0x05;
|
||||
} else if (unit == 'Waterml') {
|
||||
return 0x06;
|
||||
} else if (unit == 'milkml') {
|
||||
return 0x07;
|
||||
} else if (unit == 'oz') {
|
||||
return 0x08;
|
||||
} else if (unit == 'floz') {
|
||||
return 0x09;
|
||||
} else if (unit == 'lboz') {
|
||||
return 0x0A;
|
||||
}
|
||||
return unit;
|
||||
},
|
||||
// 下发单位
|
||||
handletoggleUnit: function handletoggleUnit(unit) {
|
||||
var that = this;
|
||||
var checksum = 0;
|
||||
|
|
@ -284,30 +347,42 @@ var _default = {
|
|||
}
|
||||
});
|
||||
},
|
||||
// 保存测量结果
|
||||
handlesub: function handlesub() {
|
||||
handleBack: function handleBack() {
|
||||
var that = this;
|
||||
console.log("测量保存", that.weight, that.unit, that.kcal);
|
||||
if (Number(that.weight) > 0) {
|
||||
that.$emit("handleBle", that.weight, that.unit, that.kcal);
|
||||
} else {
|
||||
that.$tools.msg("数据异常,请清零后重新测量!");
|
||||
}
|
||||
that.$store.commit("changeBluetoothValue", {
|
||||
bleTipsText: "连接失败,点击重新连接",
|
||||
unitList: that.$json.unitMinus,
|
||||
isConnectStatus: 1
|
||||
});
|
||||
that.$ble.stopBluetoothDevicesDiscovery(); //取消蓝牙搜索
|
||||
that.$ble.closeBLEConnection(that.bleValue.deviceId);
|
||||
that.$ble.closeBluetoothAdapter();
|
||||
},
|
||||
convertToGrams: function convertToGrams(value, fromUnit) {
|
||||
var conversionFactors = {
|
||||
'lb': 453.59,
|
||||
// 1磅 = 453.59237克
|
||||
'oz': 28.35,
|
||||
// 1盎司 = 28.349523125克
|
||||
'kg': 1000,
|
||||
// 1公斤 = 1000克
|
||||
'g': 1
|
||||
};
|
||||
if (!conversionFactors.hasOwnProperty(fromUnit)) {
|
||||
return '';
|
||||
unitConversion: function unitConversion(unit) {
|
||||
if (unit == 'kg') {
|
||||
return '千克';
|
||||
} else if (unit == '斤') {
|
||||
return '斤';
|
||||
} else if (unit == 'stlb') {
|
||||
return 'stlb';
|
||||
} else if (unit == 'lb') {
|
||||
return '磅';
|
||||
} else if (unit == 'g') {
|
||||
return '克';
|
||||
} else if (unit == 'ml') {
|
||||
return '毫升';
|
||||
} else if (unit == 'Waterml') {
|
||||
return 'Waterml';
|
||||
} else if (unit == 'milkml') {
|
||||
return 'milkml';
|
||||
} else if (unit == 'oz') {
|
||||
return '盎司';
|
||||
} else if (unit == 'floz') {
|
||||
return 'floz';
|
||||
} else if (unit == 'lboz') {
|
||||
return 'lboz';
|
||||
}
|
||||
return value * conversionFactors[fromUnit];
|
||||
return unit;
|
||||
},
|
||||
// 备料完成
|
||||
handleDetailSub: function handleDetailSub() {
|
||||
|
|
@ -315,7 +390,7 @@ var _default = {
|
|||
if (Number(that.weight) > 0) {
|
||||
that.$emit("handleDetailSub", that.weight, that.unit, that.kcal);
|
||||
} else {
|
||||
that.$tools.msg("数据异常,请重新测量!");
|
||||
that.$tools.msg("数据异常,请清零后重新测量!");
|
||||
}
|
||||
},
|
||||
//备料下一个
|
||||
|
|
@ -327,33 +402,12 @@ var _default = {
|
|||
that.$tools.msg("数据异常,请清零后重新测量!");
|
||||
}
|
||||
},
|
||||
unitConversion: function unitConversion(unit) {
|
||||
if (unit == 'kcal') {
|
||||
return '千卡';
|
||||
} else if (unit == 'g') {
|
||||
return '克';
|
||||
} else if (unit == 'lb') {
|
||||
return '磅';
|
||||
} else if (unit == 'oz') {
|
||||
return '盎司';
|
||||
}
|
||||
return unit;
|
||||
},
|
||||
handleBack: function handleBack() {
|
||||
var that = this;
|
||||
that.$store.commit("changeBluetoothValue", {
|
||||
bleTipsText: "连接失败,点击重新连接",
|
||||
isConnectStatus: 1
|
||||
});
|
||||
that.$ble.stopBluetoothDevicesDiscovery(); //取消蓝牙搜索
|
||||
that.$ble.closeBLEConnection(that.bleValue.deviceId);
|
||||
that.$ble.closeBluetoothAdapter();
|
||||
},
|
||||
confirm: function confirm(value) {
|
||||
console.log("手动输入", value);
|
||||
console.log(value);
|
||||
var that = this;
|
||||
this.$store.commit("changeBluetoothValue", {
|
||||
countWeight: value,
|
||||
unit: this.unitList[this.unitListIndex].unit
|
||||
unit: this.unitA[this.unitListIndex].unit
|
||||
});
|
||||
this.$refs.popup.close();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<view class="weightPages data-v-53fa6103"><view class="table data-v-53fa6103"><view class="text data-v-53fa6103"><image src="/static/zhong.png" class="data-v-53fa6103"></image><text data-event-opts="{{[['tap',[['openBluetoothAdapter',['$event']]]]]}}" bindtap="__e" class="data-v-53fa6103">{{bleTipsText}}</text></view></view><view class="name data-v-53fa6103">{{name}}</view><view class="weight-wrap data-v-53fa6103"><view data-event-opts="{{[['tap',[['inputDialogToggle',['$event']]]]]}}" class="weight data-v-53fa6103" bindtap="__e"><text class="val data-v-53fa6103">{{weight==''?'0.0':weight}}</text><text class="unit data-v-53fa6103">{{unit}}</text></view><view class="weight data-v-53fa6103"><text class="val data-v-53fa6103">{{kcal?kcal:0}}</text><text class="unit data-v-53fa6103">kcal</text></view></view><view class="groupbtn data-v-53fa6103"><view class="btn danwei data-v-53fa6103"><view class="lan border-bottom data-v-53fa6103"><view class="right data-v-53fa6103"><picker mode="selector" range="{{unitList}}" range-key="name" value="{{unitListIndex}}" data-event-opts="{{[['change',[['changleUnits',['$event']]]]]}}" bindchange="__e" class="data-v-53fa6103"><view class="uni-input data-v-53fa6103">单位</view></picker></view></view></view><view data-event-opts="{{[['tap',[['handleDetailSub',['$event']]]]]}}" class="btn data-v-53fa6103" style="{{'width:'+(!stopblue?'20%':'45%')+';'}}" bindtap="__e">保存</view><block wx:if="{{!stopblue}}"><view data-event-opts="{{[['tap',[['handleDetailNext',['$event']]]]]}}" class="btn data-v-53fa6103" bindtap="__e">下一味</view></block><view data-event-opts="{{[['tap',[['handleqingling',['$event']]]]]}}" class="btn qingling data-v-53fa6103" bindtap="__e">清零</view></view><view class="data-v-53fa6103"><uni-popup vue-id="2b524063-1" type="dialog" data-ref="popup" class="data-v-53fa6103 vue-ref" bind:__l="__l" vue-slots="{{['default']}}"><uni-popup-dialog vue-id="{{('2b524063-2')+','+('2b524063-1')}}" mode="input" title="重量" placeholder="请输入食物重量" data-event-opts="{{[['^close',[['close']]],['^confirm',[['confirm']]]]}}" bind:close="__e" bind:confirm="__e" class="data-v-53fa6103" bind:__l="__l"></uni-popup-dialog></uni-popup></view></view>
|
||||
<view class="weightPages data-v-53fa6103"><view class="table data-v-53fa6103"><view class="text data-v-53fa6103"><image src="/static/zhong.png" class="data-v-53fa6103"></image><text data-event-opts="{{[['tap',[['openBluetoothAdapter',['$event']]]]]}}" bindtap="__e" class="data-v-53fa6103">{{bleTipsText}}</text></view><block wx:if="{{isShow&&isConnection==2}}"><view data-event-opts="{{[['tap',[['handleBack',['$event']]]]]}}" class="duan data-v-53fa6103" bindtap="__e">断开连接</view></block></view><view class="name data-v-53fa6103">{{name}}</view><view class="weight-wrap data-v-53fa6103"><view data-event-opts="{{[['tap',[['inputDialogToggle',['$event']]]]]}}" class="weight data-v-53fa6103" bindtap="__e"><text class="val data-v-53fa6103">{{weight==''?'0.0':weight}}</text><text class="unit data-v-53fa6103">{{$root.m0}}</text></view><view class="weight data-v-53fa6103"><text class="val data-v-53fa6103">{{kcal?kcal:0}}</text><text class="unit data-v-53fa6103">kcal</text></view></view><view class="groupbtn data-v-53fa6103"><view class="btn danwei data-v-53fa6103"><view class="lan border-bottom data-v-53fa6103"><view class="right data-v-53fa6103"><picker mode="selector" range="{{unitA}}" range-key="name" value="{{unitListIndex}}" data-event-opts="{{[['change',[['changleUnits',['$event']]]]]}}" bindchange="__e" class="data-v-53fa6103"><view class="uni-input data-v-53fa6103">单位</view></picker></view></view></view><view data-event-opts="{{[['tap',[['handleDetailSub',['$event']]]]]}}" class="btn data-v-53fa6103" style="{{'width:'+(!stopblue?'20%':'45%')+';'}}" bindtap="__e">保存</view><block wx:if="{{!stopblue}}"><view data-event-opts="{{[['tap',[['handleDetailNext',['$event']]]]]}}" class="btn data-v-53fa6103" bindtap="__e">下一味</view></block><view data-event-opts="{{[['tap',[['handleqingling',['$event']]]]]}}" class="btn qingling data-v-53fa6103" bindtap="__e">清零</view></view><view class="data-v-53fa6103"><uni-popup vue-id="2b524063-1" type="dialog" data-ref="popup" class="data-v-53fa6103 vue-ref" bind:__l="__l" vue-slots="{{['default']}}"><uni-popup-dialog vue-id="{{('2b524063-2')+','+('2b524063-1')}}" mode="input" title="重量" placeholder="请输入食物重量" data-event-opts="{{[['^close',[['close']]],['^confirm',[['confirm']]]]}}" bind:close="__e" bind:confirm="__e" class="data-v-53fa6103" bind:__l="__l"></uni-popup-dialog></uni-popup></view></view>
|
||||
|
|
@ -135,6 +135,15 @@
|
|||
border-radius: 8rpx;
|
||||
background-color: #F0AE43;
|
||||
}
|
||||
.weightPages .duan.data-v-53fa6103 {
|
||||
width: -webkit-fit-content;
|
||||
width: fit-content;
|
||||
background: linear-gradient(-90deg, #d4f5c4, #a7d5e4 80%);
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
padding: 3px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.weightPages .name.data-v-53fa6103 {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -224,7 +224,6 @@ var _default = {
|
|||
this.unitListIndex = newVal.unitList.findIndex(function (ite) {
|
||||
return ite.unit == newVal.unit;
|
||||
});
|
||||
console.log("2222222222", newVal.unit);
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
|
|
|
|||
|
|
@ -184,4 +184,8 @@
|
|||
font-weight: bold;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
.no-scroll.data-v-1c5f368e {
|
||||
height: 80vh !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -456,6 +456,10 @@ var _default = {
|
|||
that.info.token = uni.getStorageSync('token');
|
||||
console.log("修改", that.info);
|
||||
that.$model.getEditCookbook(that.info).then(function (res2) {
|
||||
if (res2.code != 0) {
|
||||
that.$tools.msg(res.msg);
|
||||
return;
|
||||
}
|
||||
if (res2.code == 0) {
|
||||
that.$tools.msg("修改成功");
|
||||
setTimeout(function () {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ var render = function () {
|
|||
var _vm = this
|
||||
var _h = _vm.$createElement
|
||||
var _c = _vm._self._c || _h
|
||||
var g0 = _vm.info.tags.length && _vm.info.tags[0].list.length
|
||||
var g0 = _vm.info.tags && _vm.info.tags[_vm.index].list.length
|
||||
var g1 = _vm.info.step_list && _vm.info.step_list.length
|
||||
var l0 = _vm.isBle
|
||||
? _vm.__map(_vm.info.tags[0].list, function (ite, ind) {
|
||||
|
|
@ -208,6 +208,7 @@ var _default = {
|
|||
listInd: 0,
|
||||
cookIndex: null,
|
||||
showSaveFood: false,
|
||||
saveFoodTypes: ['早餐', '午餐', '晚餐', '加餐'],
|
||||
selectSaveType: 0
|
||||
};
|
||||
},
|
||||
|
|
@ -215,11 +216,11 @@ var _default = {
|
|||
menu: function menu() {
|
||||
return this.configInfo.cookbook_label;
|
||||
},
|
||||
endDate: function endDate() {
|
||||
return this.$tools.getDate("start");
|
||||
},
|
||||
foodItem: function foodItem() {
|
||||
return this.configInfo.meal_list;
|
||||
},
|
||||
endDate: function endDate() {
|
||||
return this.$tools.getDate("start");
|
||||
}
|
||||
}),
|
||||
components: {
|
||||
|
|
@ -270,6 +271,7 @@ var _default = {
|
|||
that.isWeightType = false;
|
||||
that.activeType = that.info.tags[0].list[0];
|
||||
that.weightKcal = Number(Number(that.activeType.kcal) / 100).toFixed(2);
|
||||
console.log("222222222", that.info.tags[0].list);
|
||||
if (that.info.tags[0].list.length == 1) {
|
||||
that.isLast = true;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
<view class="content data-v-3e1b5f72"><search bind:handleSearch="__e" vue-id="f55de058-1" data-event-opts="{{[['^handleSearch',[['handleSearch']]]]}}" class="data-v-3e1b5f72" bind:__l="__l"></search><block wx:if="{{$root.g0}}"><view class="footlist footbox data-v-3e1b5f72"><block wx:for="{{menuList}}" wx:for-item="it" wx:for-index="id" wx:key="*this"><view data-event-opts="{{[['tap',[['handleDetail',['$0'],[[['menuList','',id,'id']]]]]]]}}" class="list data-v-3e1b5f72" bindtap="__e"><view class="topimg data-v-3e1b5f72"><image class="img data-v-3e1b5f72" src="{{it.cover_url}}" mode="aspectFill"></image></view><view class="item data-v-3e1b5f72"><view class="title data-v-3e1b5f72">{{it.title}}</view><view class="name data-v-3e1b5f72"><image src="{{it.create_user_head_pic}}" class="data-v-3e1b5f72"></image><text class="overflow data-v-3e1b5f72">{{it.create_user_nickname}}</text></view><view data-event-opts="{{[['tap',[['handleZan',['$0'],[[['menuList','',id]]]]]]]}}" class="zan data-v-3e1b5f72" bindtap="__e"><icon class="{{['t-icon','data-v-3e1b5f72',it.is_me_like_it=='yes'?'t-icon-icon3':'t-icon-icon_collect']}}"></icon><text class="data-v-3e1b5f72">{{it.likes_num}}</text></view></view></view></block></view></block><block wx:if="{{$root.g1}}"><view class="endtext data-v-3e1b5f72">—— 到底了,看看别的吧 ——</view></block><block wx:if="{{!$root.g2}}"><view class="nolist data-v-3e1b5f72"><icon class="iconfont icon-wancan data-v-3e1b5f72"></icon><text class="data-v-3e1b5f72">还没有记录哦</text></view></block></view>
|
||||
<view class="content data-v-3e1b5f72"><search bind:handleSearch="__e" vue-id="f55de058-1" data-event-opts="{{[['^handleSearch',[['handleSearch']]]]}}" class="data-v-3e1b5f72" bind:__l="__l"></search><block wx:if="{{$root.g0}}"><view class="footlist footbox data-v-3e1b5f72"><block wx:for="{{menuList}}" wx:for-item="it" wx:for-index="id" wx:key="*this"><view data-event-opts="{{[['tap',[['handleDetail',['$0'],[[['menuList','',id,'id']]]]]]]}}" class="list data-v-3e1b5f72" bindtap="__e"><view class="topimg data-v-3e1b5f72"><image class="img data-v-3e1b5f72" src="{{it.cover_url}}" mode="aspectFill"></image></view><view class="item data-v-3e1b5f72"><view class="title data-v-3e1b5f72">{{it.title}}</view><view class="name data-v-3e1b5f72"><image src="{{it.create_user_head_pic}}" class="data-v-3e1b5f72"></image><text class="overflow data-v-3e1b5f72">{{it.create_user_nickname}}</text></view><view data-event-opts="{{[['tap',[['handleZan',['$0'],[[['menuList','',id]]]]]]]}}" class="zan data-v-3e1b5f72" bindtap="__e"><icon class="{{['t-icon','mr-5','data-v-3e1b5f72',it.is_me_like_it=='yes'?'t-icon-icon3':'t-icon-icon_collect']}}"></icon><text class="data-v-3e1b5f72">{{it.likes_num}}</text></view></view></view></block></view></block><block wx:if="{{$root.g1}}"><view class="endtext data-v-3e1b5f72">—— 到底了,看看别的吧 ——</view></block><block wx:if="{{!$root.g2}}"><view class="nolist data-v-3e1b5f72"><icon class="iconfont icon-wancan data-v-3e1b5f72"></icon><text class="data-v-3e1b5f72">还没有记录哦</text></view></block></view>
|
||||
|
|
@ -469,8 +469,8 @@ var _default = {
|
|||
that.FMimg = "";
|
||||
that.cookIndex = null;
|
||||
setTimeout(function () {
|
||||
uni.switchTab({
|
||||
url: "/pages/menu/menu"
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/me/mymenu?pageName=我的菜谱"
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,4 +256,8 @@
|
|||
height: 44rpx;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.no-scroll.data-v-378efeb4 {
|
||||
height: 80vh !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"projectname": "kitchendDevice",
|
||||
"setting": {
|
||||
"compileHotReLoad": false
|
||||
"compileHotReLoad": true
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue