新增设备C06/C09PRO

This commit is contained in:
qcl_123 2026-02-10 11:20:25 +08:00
parent 8cc0df43ad
commit 66b2cdf8f2
58 changed files with 364 additions and 214 deletions

View File

@ -5,13 +5,16 @@
<image src="/static/zhong.png"></image> <image src="/static/zhong.png"></image>
<text @click="openBluetoothAdapter">{{bleTipsText}}</text> <text @click="openBluetoothAdapter">{{bleTipsText}}</text>
</view> </view>
<view class="duan" @click="handleBack" v-if="isShow&&isConnection == 2">
断开连接
</view>
</view> </view>
<view class="name">{{name}}</view> <view class="name">{{name}}</view>
<!-- 蓝牙称重 --> <!-- 蓝牙称重 -->
<view class="weight-wrap"> <view class="weight-wrap">
<view class="weight" @click="inputDialogToggle"> <view class="weight" @click="inputDialogToggle">
<text class="val">{{weight == '' ? '0.0':weight}}</text> <text class="val">{{weight == '' ? '0.0':weight}}</text>
<text class="unit">{{unit}}</text> <text class="unit">{{unitConversion(unit)}}</text>
</view> </view>
<view class="weight"> <view class="weight">
<text class="val">{{kcal?kcal:0}}</text> <text class="val">{{kcal?kcal:0}}</text>
@ -22,7 +25,7 @@
<view class="btn danwei"> <view class="btn danwei">
<view class="lan border-bottom"> <view class="lan border-bottom">
<view class="right"> <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"> :value="unitListIndex">
<view class="uni-input"> <view class="uni-input">
单位 单位
@ -52,26 +55,12 @@
data() { data() {
return { return {
kcal: "", kcal: "",
// weight: "",
weightALL: "", weightALL: "",
bleTipsText: "", bleTipsText: "",
unit: 'g', unit: 'g',
weight0: 0, unitA: [],
stopblue: false, stopblue: false,
devicesList: [],
unitList: [{
name: "克",
id: '00',
unit: "g"
}, {
name: "盎司",
id: "08",
unit: "oz"
}],
unitListIndex: 0, unitListIndex: 0,
units: ['kg', '斤', 'st:lb', 'lb', 'g', 'ml', 'Waterml',
'milkml', 'oz', 'floz', 'lboz'
]
} }
}, },
props: { props: {
@ -91,15 +80,18 @@
computed: { computed: {
...mapState(["user", "isBluetoothTyle", "bleValue"]), ...mapState(["user", "isBluetoothTyle", "bleValue"]),
weight() { weight() {
let kcal = (Number(this.weightKcal) * this.bleValue.countWeight).toFixed(2) let weightNew = this.convertToGrams(this.bleValue.countWeight, this.bleValue.unit)
this.unit = this.unitConversion(this.bleValue.unit) this.kcal = (Number(this.weightKcal) * weightNew).toFixed(1)
this.kcal = this.convertToGrams(kcal, this.bleValue.unit).toFixed(2) this.unit = this.bleValue.unit
return this.bleValue.countWeight return this.bleValue.countWeight
}, },
isConnection() { isConnection() {
this.bleTipsText = this.bleValue.bleTipsText this.bleTipsText = this.bleValue.bleTipsText
return this.bleValue.isConnectStatus return this.bleValue.isConnectStatus
}, },
isShow() {
return this.bleValue.serviceId != '' ? true : false
},
}, },
mounted() { mounted() {
let that = this let that = this
@ -114,10 +106,22 @@
that.handleBack() that.handleBack()
} }
}, },
isLast: function() { isLast: {
let that = this handler(newVal, oldVal) {
that.stopblue = that.isLast 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: { methods: {
// //
@ -131,6 +135,8 @@
notify: '', notify: '',
write: '', write: '',
unit: "g", unit: "g",
type: 1,
unitList: that.$json.unitMinus,
countWeight: "", countWeight: "",
bleTipsText: "蓝牙搜索中", bleTipsText: "蓝牙搜索中",
isConnectStatus: 0, isConnectStatus: 0,
@ -139,17 +145,63 @@
}, },
changleUnits(e) { changleUnits(e) {
let that = this let that = this
let name = that.unitList[e.detail.value].name let name = that.unitA[e.detail.value].name
console.log("单位切换", name, that.unit) let val = that.unitA[e.detail.value].unit
if (that.unit != name) { if (that.isShow && that.unit != name) {
that.handletoggleUnit(name == '盎司' ? 0x08 : 0x04) 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) { handletoggleUnit(unit) {
let that = this let that = this
let checksum = 0; let checksum = 0;
@ -184,30 +236,43 @@
}, },
}) })
}, },
// handleBack() {
handlesub() {
let that = this let that = this
console.log("测量保存", that.weight, that.unit, that.kcal) that.$store.commit("changeBluetoothValue", {
if (Number(that.weight) > 0) { bleTipsText: "连接失败,点击重新连接",
that.$emit("handleBle", that.weight, that.unit, that.kcal) unitList: that.$json.unitMinus,
} else { isConnectStatus: 1,
that.$tools.msg("数据异常,请清零后重新测量!") })
} 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)) { unitConversion(unit) {
return '' 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 unit
return value * conversionFactors[fromUnit];
}, },
// //
handleDetailSub() { handleDetailSub() {
@ -215,7 +280,7 @@
if (Number(that.weight) > 0) { if (Number(that.weight) > 0) {
that.$emit("handleDetailSub", that.weight, that.unit, that.kcal) that.$emit("handleDetailSub", that.weight, that.unit, that.kcal)
} else { } else {
that.$tools.msg("数据异常,请重新测量!") that.$tools.msg("数据异常,请清零后重新测量!")
} }
}, },
// //
@ -227,33 +292,12 @@
that.$tools.msg("数据异常,请清零后重新测量!") 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) { confirm(value) {
console.log("手动输入", value) console.log(value)
let that = this
this.$store.commit("changeBluetoothValue", { this.$store.commit("changeBluetoothValue", {
countWeight: value, countWeight: value,
unit: this.unitList[this.unitListIndex].unit unit: this.unitA[this.unitListIndex].unit
}) })
this.$refs.popup.close() 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 { .name {
width: 100%; width: 100%;
text-align: center; text-align: center;

View File

@ -110,7 +110,6 @@
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.unitA = newVal.unitList this.unitA = newVal.unitList
this.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.unit) this.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.unit)
console.log("2222222222", newVal.unit)
}, },
deep: true, deep: true,
immediate: true immediate: true

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="content"> <view class="content" >
<view class="content_box"> <view class="content_box">
<view class="box"> <view class="box">
<!-- 类型 --> <!-- 类型 -->
@ -465,4 +465,9 @@
font-weight: bold; font-weight: bold;
margin: 30rpx 0; margin: 30rpx 0;
} }
.no-scroll {
height: 80vh !important;
overflow: hidden !important;
}
</style> </style>

View File

@ -131,7 +131,7 @@
list.forEach(ite => { list.forEach(ite => {
ite.weight = null 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') 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') that.info.token = uni.getStorageSync('token')
console.log("修改", that.info) console.log("修改", that.info)
that.$model.getEditCookbook(that.info).then(res2 => { that.$model.getEditCookbook(that.info).then(res2 => {
if (res2.code != 0) {
that.$tools.msg(res.msg)
return
}
if (res2.code == 0) { if (res2.code == 0) {
that.$tools.msg("修改成功") that.$tools.msg("修改成功")
setTimeout(function() { setTimeout(function() {

View File

@ -31,7 +31,7 @@
</view> </view>
<view class="h4"> <view class="h4">
<view class="tags"> <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> :key="ind" @click="handleToggle(ind)">{{item.title}}</view>
</view> </view>
<view class="close" @click="handleWeight"> <view class="close" @click="handleWeight">
@ -39,8 +39,9 @@
连接测量 连接测量
</view> </view>
</view> </view>
<view class="foodlist" v-if="info.tags.length&&info.tags[0].list.length"> <view class="foodlist">
<view class="item" v-for="(ite,ind) in info.tags[0].list" :key="ind"> <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="name" style="flex: 1;">{{ite.name}}</view>
<view class="weight"> <view class="weight">
{{ite.weight}}{{ite.unit}} {{ite.weight}}{{ite.unit}}
@ -164,6 +165,12 @@
listInd: 0, listInd: 0,
cookIndex: null, cookIndex: null,
showSaveFood: false, showSaveFood: false,
saveFoodTypes: [
'早餐',
'午餐',
'晚餐',
'加餐',
],
selectSaveType: 0 selectSaveType: 0
} }
}, },
@ -172,12 +179,12 @@
menu() { menu() {
return this.configInfo.cookbook_label return this.configInfo.cookbook_label
}, },
endDate() {
return this.$tools.getDate("start")
},
foodItem() { foodItem() {
return this.configInfo.meal_list return this.configInfo.meal_list
}, },
endDate() {
return this.$tools.getDate("start")
},
}, },
components: { components: {
blueTooth blueTooth
@ -225,6 +232,7 @@
that.isWeightType = false that.isWeightType = false
that.activeType = that.info.tags[0].list[0] that.activeType = that.info.tags[0].list[0]
that.weightKcal = Number(Number(that.activeType.kcal) / 100).toFixed(2) 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) { if (that.info.tags[0].list.length == 1) {
that.isLast = true that.isLast = true
} }

View File

@ -15,7 +15,7 @@
<text class="overflow">{{it.create_user_nickname}}</text> <text class="overflow">{{it.create_user_nickname}}</text>
</view> </view>
<view class="zan" @click="handleZan(it)"> <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> </icon>
<text>{{it.likes_num}}</text> <text>{{it.likes_num}}</text>
</view> </view>

View File

@ -338,8 +338,8 @@
that.FMimg = "" that.FMimg = ""
that.cookIndex = null that.cookIndex = null
setTimeout(function() { setTimeout(function() {
uni.switchTab({ uni.navigateTo({
url: "/pages/menu/menu" url: "/pageTwo/me/mymenu?pageName=我的菜谱"
}) })
}, 1000) }, 1000)
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="content"> <view class="content" >
<view v-if="!token" class="list2" @click="handleLogin()"> <view v-if="!token" class="list2" @click="handleLogin()">
<view class="nolist"> <view class="nolist">
<icon class="iconfont icon-zanwushuju"></icon> <icon class="iconfont icon-zanwushuju"></icon>
@ -619,4 +619,9 @@
} }
} }
.no-scroll {
height: 80vh !important;
overflow: hidden !important;
}
</style> </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

View File

@ -107,6 +107,15 @@ var render = function () {
var _vm = this var _vm = this
var _h = _vm.$createElement var _h = _vm.$createElement
var _c = _vm._self._c || _h var _c = _vm._self._c || _h
var m0 = _vm.unitConversion(_vm.unit)
_vm.$mp.data = Object.assign(
{},
{
$root: {
m0: m0,
},
}
)
} }
var recyclableRender = false var recyclableRender = false
var staticRenderFns = [] var staticRenderFns = []
@ -155,24 +164,12 @@ var _default = {
data: function data() { data: function data() {
return { return {
kcal: "", kcal: "",
// weight: "",
weightALL: "", weightALL: "",
bleTipsText: "", bleTipsText: "",
unit: 'g', unit: 'g',
weight0: 0, unitA: [],
stopblue: false, stopblue: false,
devicesList: [], unitListIndex: 0
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: { props: {
@ -192,14 +189,17 @@ var _default = {
}, },
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["user", "isBluetoothTyle", "bleValue"])), {}, { computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(["user", "isBluetoothTyle", "bleValue"])), {}, {
weight: function weight() { weight: function weight() {
var kcal = (Number(this.weightKcal) * this.bleValue.countWeight).toFixed(2); var weightNew = this.convertToGrams(this.bleValue.countWeight, this.bleValue.unit);
this.unit = this.unitConversion(this.bleValue.unit); this.kcal = (Number(this.weightKcal) * weightNew).toFixed(1);
this.kcal = this.convertToGrams(kcal, this.bleValue.unit).toFixed(2); this.unit = this.bleValue.unit;
return this.bleValue.countWeight; return this.bleValue.countWeight;
}, },
isConnection: function isConnection() { isConnection: function isConnection() {
this.bleTipsText = this.bleValue.bleTipsText; this.bleTipsText = this.bleValue.bleTipsText;
return this.bleValue.isConnectStatus; return this.bleValue.isConnectStatus;
},
isShow: function isShow() {
return this.bleValue.serviceId != '' ? true : false;
} }
}), }),
mounted: function mounted() { mounted: function mounted() {
@ -215,9 +215,22 @@ var _default = {
that.handleBack(); that.handleBack();
} }
}, },
isLast: function isLast() { isLast: {
var that = this; handler: function handler(newVal, oldVal) {
that.stopblue = that.isLast; 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: { methods: {
@ -232,6 +245,8 @@ var _default = {
notify: '', notify: '',
write: '', write: '',
unit: "g", unit: "g",
type: 1,
unitList: that.$json.unitMinus,
countWeight: "", countWeight: "",
bleTipsText: "蓝牙搜索中", bleTipsText: "蓝牙搜索中",
isConnectStatus: 0 isConnectStatus: 0
@ -240,16 +255,64 @@ var _default = {
}, },
changleUnits: function changleUnits(e) { changleUnits: function changleUnits(e) {
var that = this; var that = this;
var name = that.unitList[e.detail.value].name; var name = that.unitA[e.detail.value].name;
console.log("单位切换", name, that.unit); var val = that.unitA[e.detail.value].unit;
if (that.unit != name) { if (that.isShow && that.unit != name) {
that.handletoggleUnit(name == '盎司' ? 0x08 : 0x04); 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) { handletoggleUnit: function handletoggleUnit(unit) {
var that = this; var that = this;
var checksum = 0; var checksum = 0;
@ -284,30 +347,42 @@ var _default = {
} }
}); });
}, },
// 保存测量结果 handleBack: function handleBack() {
handlesub: function handlesub() {
var that = this; var that = this;
console.log("测量保存", that.weight, that.unit, that.kcal); that.$store.commit("changeBluetoothValue", {
if (Number(that.weight) > 0) { bleTipsText: "连接失败,点击重新连接",
that.$emit("handleBle", that.weight, that.unit, that.kcal); unitList: that.$json.unitMinus,
} else { isConnectStatus: 1
that.$tools.msg("数据异常,请清零后重新测量!"); });
} that.$ble.stopBluetoothDevicesDiscovery(); //取消蓝牙搜索
that.$ble.closeBLEConnection(that.bleValue.deviceId);
that.$ble.closeBluetoothAdapter();
}, },
convertToGrams: function convertToGrams(value, fromUnit) { unitConversion: function unitConversion(unit) {
var conversionFactors = { if (unit == 'kg') {
'lb': 453.59, return '千克';
// 1磅 = 453.59237克 } else if (unit == '斤') {
'oz': 28.35, return '斤';
// 1盎司 = 28.349523125克 } else if (unit == 'stlb') {
'kg': 1000, return 'stlb';
// 1公斤 = 1000克 } else if (unit == 'lb') {
'g': 1 return '磅';
}; } else if (unit == 'g') {
if (!conversionFactors.hasOwnProperty(fromUnit)) { return '克';
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() { handleDetailSub: function handleDetailSub() {
@ -315,7 +390,7 @@ var _default = {
if (Number(that.weight) > 0) { if (Number(that.weight) > 0) {
that.$emit("handleDetailSub", that.weight, that.unit, that.kcal); that.$emit("handleDetailSub", that.weight, that.unit, that.kcal);
} else { } else {
that.$tools.msg("数据异常,请重新测量!"); that.$tools.msg("数据异常,请清零后重新测量!");
} }
}, },
//备料下一个 //备料下一个
@ -327,33 +402,12 @@ var _default = {
that.$tools.msg("数据异常,请清零后重新测量!"); 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) { confirm: function confirm(value) {
console.log("手动输入", value); console.log(value);
var that = this;
this.$store.commit("changeBluetoothValue", { this.$store.commit("changeBluetoothValue", {
countWeight: value, countWeight: value,
unit: this.unitList[this.unitListIndex].unit unit: this.unitA[this.unitListIndex].unit
}); });
this.$refs.popup.close(); this.$refs.popup.close();
}, },

View File

@ -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>

View File

@ -135,6 +135,15 @@
border-radius: 8rpx; border-radius: 8rpx;
background-color: #F0AE43; 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 { .weightPages .name.data-v-53fa6103 {
width: 100%; width: 100%;
text-align: center; text-align: center;

View File

@ -224,7 +224,6 @@ var _default = {
this.unitListIndex = newVal.unitList.findIndex(function (ite) { this.unitListIndex = newVal.unitList.findIndex(function (ite) {
return ite.unit == newVal.unit; return ite.unit == newVal.unit;
}); });
console.log("2222222222", newVal.unit);
}, },
deep: true, deep: true,
immediate: true immediate: true

View File

@ -184,4 +184,8 @@
font-weight: bold; font-weight: bold;
margin: 30rpx 0; margin: 30rpx 0;
} }
.no-scroll.data-v-1c5f368e {
height: 80vh !important;
overflow: hidden !important;
}

View File

@ -456,6 +456,10 @@ var _default = {
that.info.token = uni.getStorageSync('token'); that.info.token = uni.getStorageSync('token');
console.log("修改", that.info); console.log("修改", that.info);
that.$model.getEditCookbook(that.info).then(function (res2) { that.$model.getEditCookbook(that.info).then(function (res2) {
if (res2.code != 0) {
that.$tools.msg(res.msg);
return;
}
if (res2.code == 0) { if (res2.code == 0) {
that.$tools.msg("修改成功"); that.$tools.msg("修改成功");
setTimeout(function () { setTimeout(function () {

View File

@ -102,7 +102,7 @@ var render = function () {
var _vm = this var _vm = this
var _h = _vm.$createElement var _h = _vm.$createElement
var _c = _vm._self._c || _h 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 g1 = _vm.info.step_list && _vm.info.step_list.length
var l0 = _vm.isBle var l0 = _vm.isBle
? _vm.__map(_vm.info.tags[0].list, function (ite, ind) { ? _vm.__map(_vm.info.tags[0].list, function (ite, ind) {
@ -208,6 +208,7 @@ var _default = {
listInd: 0, listInd: 0,
cookIndex: null, cookIndex: null,
showSaveFood: false, showSaveFood: false,
saveFoodTypes: ['早餐', '午餐', '晚餐', '加餐'],
selectSaveType: 0 selectSaveType: 0
}; };
}, },
@ -215,11 +216,11 @@ var _default = {
menu: function menu() { menu: function menu() {
return this.configInfo.cookbook_label; return this.configInfo.cookbook_label;
}, },
endDate: function endDate() {
return this.$tools.getDate("start");
},
foodItem: function foodItem() { foodItem: function foodItem() {
return this.configInfo.meal_list; return this.configInfo.meal_list;
},
endDate: function endDate() {
return this.$tools.getDate("start");
} }
}), }),
components: { components: {
@ -270,6 +271,7 @@ var _default = {
that.isWeightType = false; that.isWeightType = false;
that.activeType = that.info.tags[0].list[0]; that.activeType = that.info.tags[0].list[0];
that.weightKcal = Number(Number(that.activeType.kcal) / 100).toFixed(2); 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) { if (that.info.tags[0].list.length == 1) {
that.isLast = true; that.isLast = true;
} }

File diff suppressed because one or more lines are too long

View File

@ -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>

View File

@ -469,8 +469,8 @@ var _default = {
that.FMimg = ""; that.FMimg = "";
that.cookIndex = null; that.cookIndex = null;
setTimeout(function () { setTimeout(function () {
uni.switchTab({ uni.navigateTo({
url: "/pages/menu/menu" url: "/pageTwo/me/mymenu?pageName=我的菜谱"
}); });
}, 1000); }, 1000);
} }

View File

@ -256,4 +256,8 @@
height: 44rpx; height: 44rpx;
margin-right: 5px; margin-right: 5px;
} }
.no-scroll.data-v-378efeb4 {
height: 80vh !important;
overflow: hidden !important;
}

View File

@ -2,6 +2,6 @@
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "kitchendDevice", "projectname": "kitchendDevice",
"setting": { "setting": {
"compileHotReLoad": false "compileHotReLoad": true
} }
} }