feat: update input event handling in PopupInput and adjust feeding plan calculations

This commit is contained in:
ilhamtahir committed 2026-02-02 00:28:34 +08:00
1 parent 9a4a230cc2
commit 53cf9d12ea
4 files changed
+12 -6

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ defineEmits<{
<template> <template>
<view class="w-full flex items-center gap-2"> <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"> <text v-if="suffix">
{{ suffix }} {{ suffix }}
</text> </text>
+2 -1
View File
@@ -5,7 +5,8 @@ export interface Product extends BaseModel {
category: ProductCategory category: ProductCategory
photo: string photo: string
tags: string[] tags: string[]
totalCalories: number meValue: number | null // ME值(kcal/g),直接配置的代谢能
totalCalories: number // 产品总能量(kcal)
totalWeight: number totalWeight: number
} }
export enum ProductCategory { export enum ProductCategory {
+8 -4
View File
@@ -128,8 +128,9 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
return 1.2 return 1.2
} }
// 未绝育成年猫/活跃:系数1.4(根据新规则从1.6调整为1.4)
if (pet.value.isActive && !pet.value.isSterilization && ageInMonths > 12) { if (pet.value.isActive && !pet.value.isSterilization && ageInMonths > 12) {
return 1.6 return 1.4
} }
if (feedingPlan.value.targetWeight < pet.value.weight) { if (feedingPlan.value.targetWeight < pet.value.weight) {
@@ -145,9 +146,12 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
const rer = ref(0) const rer = ref(0)
watch(() => pet.value.weight, () => { // 监听体重和体型变化,重新计算理想体重和RER
feedingPlan.value.targetWeight = calculateIdealWeight() // RER应该使用理想体重而不是当前体重
rer.value = calculateRER(pet.value.weight) watch([() => pet.value.weight, () => pet.value.bodyType], () => {
const idealWeight = calculateIdealWeight()
feedingPlan.value.targetWeight = idealWeight
rer.value = calculateRER(idealWeight)
}) })
const feedingGoalOptions = [ const feedingGoalOptions = [
+1
View File
@@ -32,6 +32,7 @@ export default async ({ command, mode }) => {
}, },
}, },
server: { server: {
port: 5175,
proxy: { proxy: {
'/api': { '/api': {
target: env.VITE_PROXY_ENDPOINT, target: env.VITE_PROXY_ENDPOINT,