feat: update input event handling in PopupInput and adjust feeding plan calculations
This commit is contained in:
1 parent
9a4a230cc2
commit
53cf9d12ea
4 files changed
+12
-6
No files matched your search
@@ -14,7 +14,7 @@ defineEmits<{
|
||||
|
||||
<template>
|
||||
<view class="w-full flex items-center gap-2">
|
||||
<input class="text-right" :value="modelValue" :placeholder="placeholder" @input="$emit('update:modelValue', modelValue)">
|
||||
<input class="text-right" :value="modelValue" :placeholder="placeholder" @input="$emit('update:modelValue', $event.detail.value)">
|
||||
<text v-if="suffix">
|
||||
{{ suffix }}
|
||||
</text>
|
||||
|
||||
@@ -5,7 +5,8 @@ export interface Product extends BaseModel {
|
||||
category: ProductCategory
|
||||
photo: string
|
||||
tags: string[]
|
||||
totalCalories: number
|
||||
meValue: number | null // ME值(kcal/g),直接配置的代谢能
|
||||
totalCalories: number // 产品总能量(kcal)
|
||||
totalWeight: number
|
||||
}
|
||||
export enum ProductCategory {
|
||||
|
||||
@@ -128,8 +128,9 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
|
||||
return 1.2
|
||||
}
|
||||
|
||||
// 未绝育成年猫/活跃:系数1.4(根据新规则从1.6调整为1.4)
|
||||
if (pet.value.isActive && !pet.value.isSterilization && ageInMonths > 12) {
|
||||
return 1.6
|
||||
return 1.4
|
||||
}
|
||||
|
||||
if (feedingPlan.value.targetWeight < pet.value.weight) {
|
||||
@@ -145,9 +146,12 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
|
||||
|
||||
const rer = ref(0)
|
||||
|
||||
watch(() => pet.value.weight, () => {
|
||||
feedingPlan.value.targetWeight = calculateIdealWeight()
|
||||
rer.value = calculateRER(pet.value.weight)
|
||||
// 监听体重和体型变化,重新计算理想体重和RER
|
||||
// RER应该使用理想体重而不是当前体重
|
||||
watch([() => pet.value.weight, () => pet.value.bodyType], () => {
|
||||
const idealWeight = calculateIdealWeight()
|
||||
feedingPlan.value.targetWeight = idealWeight
|
||||
rer.value = calculateRER(idealWeight)
|
||||
})
|
||||
|
||||
const feedingGoalOptions = [
|
||||
|
||||
@@ -32,6 +32,7 @@ export default async ({ command, mode }) => {
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 5175,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: env.VITE_PROXY_ENDPOINT,
|
||||
|
||||
Reference in new issue
Block a user