5 Commits
23 changed files with 298 additions and 75 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
VITE_ENABLE_MOCK=false VITE_ENABLE_MOCK=false
VITE_API_PREFIX=/api VITE_API_PREFIX=/api
VITE_PROXY_ENDPOINT=https://bright.yilibili.com/api VITE_PROXY_ENDPOINT=http://localhost:3000
+1 -1
View File
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import carousalApi from '@/api/carousal' import carousalApi from '@/api/carousal'
import CardList from '@/pages/pet-manual/components/CardList.vue' import CardList from '../src/components/CardList.vue'
// const searchValue = ref('') // const searchValue = ref('')
import bg from '@/static/image/feed-plan/bg.png' import bg from '@/static/image/feed-plan/bg.png'
import circle from '@/static/image/feed-plan/circle.png' import circle from '@/static/image/feed-plan/circle.png'
+6
View File
@@ -0,0 +1,6 @@
import type { Article } from '@/model/pet-manual'
import httpClient from '@/api/httpClient'
export async function getArticle(id: string) {
return httpClient.get<Article>(`/articles/${id}`)
}
+4
View File
@@ -8,3 +8,7 @@ export async function createFeedingPlan(createFeedingPlanRequest: CreateFeedingP
export async function getFeedingPlan(id: string) { export async function getFeedingPlan(id: string) {
return httpClient.get<FeedingPlan>(`/feeding-plans/${id}`) return httpClient.get<FeedingPlan>(`/feeding-plans/${id}`)
} }
export async function updateFeedingPlan(id: string, createFeedingPlanRequest: CreateFeedingPlanRequest) {
return httpClient.put<FeedingPlan>(`/feeding-plans/${id}`, createFeedingPlanRequest)
}
+5 -1
View File
@@ -1,4 +1,4 @@
import type { CreatePetRequest, Pet } from '@/model/pet' import type { CreatePetRequest, Pet, PetVariety } from '@/model/pet'
import httpClient from '@/api/httpClient' import httpClient from '@/api/httpClient'
export function createPet(createPetRequest: CreatePetRequest) { export function createPet(createPetRequest: CreatePetRequest) {
@@ -8,3 +8,7 @@ export function createPet(createPetRequest: CreatePetRequest) {
export function getOwnPets() { export function getOwnPets() {
return httpClient.get<Pet[]>('/pets/own') return httpClient.get<Pet[]>('/pets/own')
} }
export function petVarietiesList() {
return httpClient.get<PetVariety[]>('/pet-varieties/list')
}
+1
View File
@@ -10,6 +10,7 @@ declare module 'vue' {
AddFeedingPlan: typeof import('./components/AddFeedingPlan.vue')['default'] AddFeedingPlan: typeof import('./components/AddFeedingPlan.vue')['default']
BButton: typeof import('./components/BButton.vue')['default'] BButton: typeof import('./components/BButton.vue')['default']
BSlider: typeof import('./components/BSlider.vue')['default'] BSlider: typeof import('./components/BSlider.vue')['default']
CardList: typeof import('./components/CardList.vue')['default']
Cell: typeof import('./components/Cell.vue')['default'] Cell: typeof import('./components/Cell.vue')['default']
CellGroup: typeof import('./components/CellGroup.vue')['default'] CellGroup: typeof import('./components/CellGroup.vue')['default']
FeedForm: typeof import('./components/FeedForm.vue')['default'] FeedForm: typeof import('./components/FeedForm.vue')['default']
@@ -34,12 +34,19 @@ function handleLoadMore() {
} }
emit('loadMore') emit('loadMore')
} }
function goToArticle(id: string) {
uni.navigateTo({
url: `/pages/article/detail?id=${id}`,
})
}
</script> </script>
<template> <template>
<view class="flex flex-col gap-4 px-4"> <view class="flex flex-col gap-4 px-4">
<view <view
v-for="(item, index) in props.cardList" :key="index" class="bg-[white] rounded-md shadow-lg flex w-full h-[120px] overflow-hidden" v-for="(item, index) in props.cardList" :key="index" class="bg-[white] rounded-md shadow-lg flex w-full h-[120px] overflow-hidden"
@tap="() => goToArticle(item.id)"
> >
<image class="w-[120px] h-[120px] rounded-l-md shrink-0" :src="item?.imageUrl || titleBg" /> <image class="w-[120px] h-[120px] rounded-l-md shrink-0" :src="item?.imageUrl || titleBg" />
<view class="p-4 flex flex-col"> <view class="p-4 flex flex-col">
+4
View File
@@ -12,6 +12,10 @@ const emits = defineEmits<{
'update:modelValue': [string | number] 'update:modelValue': [string | number]
}>() }>()
if (props.options.length && !props.modelValue) {
emits('update:modelValue', props.options[0].value)
}
function bindPickerChange(e: { detail: { value: number | string } }) { function bindPickerChange(e: { detail: { value: number | string } }) {
const currentIndex = e.detail.value as number const currentIndex = e.detail.value as number
emits('update:modelValue', props.options[currentIndex].value) emits('update:modelValue', props.options[currentIndex].value)
+4 -36
View File
@@ -1,8 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { UniPopupDialogInstance } from '@uni-helper/uni-types' withDefaults(defineProps<{
import type { UniPopupInstance } from '@uni-helper/uni-ui-types'
const props = withDefaults(defineProps<{
modelValue: string | number modelValue: string | number
placeholder?: string placeholder?: string
suffix?: string suffix?: string
@@ -10,47 +7,18 @@ const props = withDefaults(defineProps<{
placeholder: '请输入内容', placeholder: '请输入内容',
}) })
const emits = defineEmits<{ defineEmits<{
'update:modelValue': [string | number] 'update:modelValue': [string | number]
}>() }>()
const uniPopupRef = ref<UniPopupInstance | null>(null)
const uniPopupDialogRef = ref<UniPopupDialogInstance | null>(null)
function dialogInputConfirm(value: any) {
if (value === '') {
uni.showToast({
title: props.placeholder,
icon: 'none',
})
return
}
emits('update:modelValue', value as (string | number))
if (uniPopupRef.value && uniPopupRef.value.close) {
uniPopupRef.value.close()
}
}
function handleClick() {
if (uniPopupRef.value && uniPopupRef.value.open) {
uniPopupRef.value.open()
}
}
</script> </script>
<template> <template>
<view class="w-full" @click="handleClick"> <view class="w-full flex items-center gap-2">
{{ 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>
</view> </view>
<uni-popup ref="uniPopupRef" type="dialog">
<uni-popup-dialog
ref="uniPopupDialogRef" mode="input" title="输入内容" :value="modelValue" :placeholder="placeholder"
@confirm="dialogInputConfirm"
/>
</uni-popup>
</template> </template>
<style scoped> <style scoped>
+2 -2
View File
@@ -15,13 +15,13 @@ function handleTap() {
<template> <template>
<view class="w-full relative rounded-3 overflow-hidden shadow-cell-group bg-[#fff]"> <view class="w-full relative rounded-3 overflow-hidden shadow-cell-group bg-[#fff]">
<view v-if="operationTitle" class="w-[111px] h-[44px] bg-[#1a1a1a] absolute right-0 top-0" @tap="handleTap"> <view v-if="operationTitle" class="w-[111px] h-[44px] bg-[#1a1a1a] absolute right-0 top-0">
<view class="text-[#999] text-xs absolute right-4 leading-[34px]"> <view class="text-[#999] text-xs absolute right-4 leading-[34px]">
{{ operationTitle }} {{ operationTitle }}
</view> </view>
</view> </view>
<image class="w-[343px] h-[179px] absolute right-0 top-0" src="@/static/image/shape-bg.png" /> <image class="w-[343px] h-[179px] absolute right-0 top-0" src="@/static/image/shape-bg.png" />
<view class="pl-4 relative flex gap-1 h-[44px] items-center text-xs"> <view class="pl-4 relative flex gap-1 h-[44px] items-center text-xs" @tap="handleTap">
<view>{{ title }}</view> <view>{{ title }}</view>
<view v-if="subtitle" class="text-[#D9D9D9]"> <view v-if="subtitle" class="text-[#D9D9D9]">
{{ subtitle }} {{ subtitle }}
+3 -4
View File
@@ -1,4 +1,4 @@
import type { Paging } from '@/model/base' import type { BaseModel, Paging } from '@/model/base'
import type { CreatePetRequest } from '@/model/pet' import type { CreatePetRequest } from '@/model/pet'
export interface CreateCarousalsRequest { export interface CreateCarousalsRequest {
@@ -20,14 +20,13 @@ export interface ArticleParams extends Paging {
categoryId: string categoryId: string
} }
export interface Article { export interface Article extends BaseModel {
id: string
content: string content: string
status: string status: string
title: string title: string
description: string description: string
updatedTime?: string
imageUrl?: string imageUrl?: string
category: Category
} }
export interface Recommends { export interface Recommends {
+6 -1
View File
@@ -14,6 +14,7 @@ export interface Pet extends TraceableModel {
type: PetType type: PetType
weight: number weight: number
feedingPlan: FeedingPlan feedingPlan: FeedingPlan
varietyName: string
} }
export interface CreatePetRequest extends Omit<Pet, keyof TraceableModel> { export interface CreatePetRequest extends Omit<Pet, keyof TraceableModel> {
@@ -64,5 +65,9 @@ export interface FeedingPlan extends BaseModel {
export interface CreateFeedingPlanRequest extends Omit<FeedingPlan, keyof BaseModel> { export interface CreateFeedingPlanRequest extends Omit<FeedingPlan, keyof BaseModel> {
petId: string petId: string
products: { id: string, dailyUsageWeight: number }[] products: { id: string, dailyUsageWeight: number, percentage: number }[]
}
export interface PetVariety extends BaseModel {
name: string
} }
+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 {
+5 -5
View File
@@ -7,6 +7,11 @@
}, },
"entryPagePath": "pages/home/index", "entryPagePath": "pages/home/index",
"pages": [ "pages": [
{
"path": "pages/article/detail",
"type": "page",
"style": {}
},
{ {
"path": "pages/feed-plan/index", "path": "pages/feed-plan/index",
"type": "page", "type": "page",
@@ -86,11 +91,6 @@
"path": "pages/userInfo/index", "path": "pages/userInfo/index",
"type": "page", "type": "page",
"style": {} "style": {}
},
{
"path": "pages/pet-manual/components/CardList",
"type": "page",
"style": {}
} }
], ],
"globalStyle": { "globalStyle": {
+46
View File
@@ -0,0 +1,46 @@
<script setup lang="ts">
import type { Article } from '@/model/pet-manual'
import { getArticle } from '@/api/article'
const article = ref<Article | null>()
const id = ref('')
onLoad((options) => {
id.value = options!.id as string
})
onMounted(() => {
fetchData()
})
async function fetchData() {
article.value = await getArticle(id.value)
await uni.setNavigationBarTitle({
title: article.value.category.name,
})
}
const fixedContent = computed(() => {
if (!article.value) {
return ''
}
return article.value.content.replace(/<img/g, '<img class="w-full"')
})
</script>
<template>
<view v-if="article" class="w-full h-screen p-4 bg-[#F5F6F7]">
<view class="mb-2 text-xl font-semibold">
{{ article.title }}
</view>
<view class="flex text-xs text-[#999] mb-6">
<view>{{ article.createdTime }}</view>
</view>
<rich-text :nodes="fixedContent" />
</view>
</template>
<style scoped>
</style>
+29 -4
View File
@@ -37,6 +37,31 @@ async function selectPet(index: number) {
currentIndex.value = index currentIndex.value = index
} }
const feedingPlanStore = useFeedingPlanStore()
async function handleAddFeedingPlan() {
feedingPlanStore.initPet(currentPet.value)
uni.navigateTo({
url: '/pages/feed-plan-calculator/index',
})
}
function handleAddPet() {
uni.navigateTo({
url: '/pages/start-filing/index',
})
}
async function handleEdit() {
if (!feedingPlan.value)
return
feedingPlanStore.initPet(currentPet.value)
feedingPlanStore.initFeedingPlan(feedingPlan.value)
uni.navigateTo({
url: '/pages/feed-plan-calculator/index',
})
}
onMounted(fetchPets) onMounted(fetchPets)
</script> </script>
@@ -54,9 +79,9 @@ onMounted(fetchPets)
{{ item.name }} {{ item.name }}
<view v-if="index === currentIndex" class="absolute w-[30%] h-[3px] bg-primary bottom-[-4px] rounded-full" /> <view v-if="index === currentIndex" class="absolute w-[30%] h-[3px] bg-primary bottom-[-4px] rounded-full" />
</view> </view>
<image src="@/static/icons/plus-circle.svg" class="w-[24px] h-[24px]" /> <image src="@/static/icons/plus-circle.svg" class="w-[24px] h-[24px]" @tap="handleAddPet" />
</template> </template>
<view v-else class="text-primary text-xl relative flex justify-center font-semibold"> <view v-else class="text-primary text-xl relative flex justify-center font-semibold" @tap="handleAddPet">
待添加 待添加
</view> </view>
</view> </view>
@@ -74,11 +99,11 @@ onMounted(fetchPets)
</view> </view>
<image class="w-[20px] h-[20px]" src="@/static/icons/edit.svg" /> <image class="w-[20px] h-[20px]" src="@/static/icons/edit.svg" />
</view> </view>
<SectionCard v-if="feedingPlan" title="喂养计划" subtitle="FEEDING PLAN" operation-title="编辑计划"> <SectionCard v-if="feedingPlan" title="喂养计划" subtitle="FEEDING PLAN" operation-title="编辑计划" :on-operation-click="handleEdit">
<ProductReadonlyItem v-for="item in feedingPlan.feedingPlanProducts" :key="item.product.id" :data="item" /> <ProductReadonlyItem v-for="item in feedingPlan.feedingPlanProducts" :key="item.product.id" :data="item" />
</SectionCard> </SectionCard>
<SectionCard v-else title="喂养计划" subtitle="FEEDING PLAN" operation-title="无计划"> <SectionCard v-else title="喂养计划" subtitle="FEEDING PLAN" operation-title="无计划">
<view class="w-full h-[120px] flex flex-col items-center justify-center gap-1.5"> <view class="w-full h-[120px] flex flex-col items-center justify-center gap-1.5" @tap="handleAddFeedingPlan">
<image src="@/static/icons/plus-circle-2.svg" class="w-[47px] h-[47px]" /> <image src="@/static/icons/plus-circle-2.svg" class="w-[47px] h-[47px]" />
<view class="text-xs text-disabled"> <view class="text-xs text-disabled">
添加您的喂养计划 添加您的喂养计划
-4
View File
@@ -58,11 +58,7 @@ function reset() {
function handleReady() { function handleReady() {
reset() reset()
titleName.value = '喂养问卷' titleName.value = '喂养问卷'
controlFormDisplay.value.display2 = true
setTimeout(() => {
reset()
controlFormDisplay.value.display3 = true controlFormDisplay.value.display3 = true
}, 2000)
} }
function handleBackFeedStart() { function handleBackFeedStart() {
reset() reset()
+1 -1
View File
@@ -2,7 +2,7 @@
import type { Paging } from '@/model/base' import type { Paging } from '@/model/base'
import type { Article, ArticleParams, Category, CreateCarousalsRequest, Recommends } from '@/model/pet-manual' import type { Article, ArticleParams, Category, CreateCarousalsRequest, Recommends } from '@/model/pet-manual'
import carousalApi from '@/api/carousal' import carousalApi from '@/api/carousal'
import CardList from '@/pages/pet-manual/components/CardList.vue' import CardList from '@/components/CardList.vue'
import circle from '@/static/image/feed-plan/circle.png' import circle from '@/static/image/feed-plan/circle.png'
import message from '@/static/image/feed-plan/message.png' import message from '@/static/image/feed-plan/message.png'
import ToolApi from '@/utils' import ToolApi from '@/utils'
+14 -5
View File
@@ -9,12 +9,18 @@ import ToolApi from '@/utils'
const safeHeight = ToolApi.getSafeHeight() const safeHeight = ToolApi.getSafeHeight()
const feedSloganBottom = ref<number>(13) const feedSloganBottom = ref<number>(13)
function handleNext() {
uni.navigateTo({ url: '/pages/feed-questionnaire/index' })
}
const feedingPlanStore = useFeedingPlanStore() const feedingPlanStore = useFeedingPlanStore()
function handleNext() {
if (!feedingPlanStore.pet.varietyName) {
uni.showToast({
title: '请选择品种',
icon: 'error',
})
return
}
uni.navigateTo({ url: '/pages/feed-questionnaire/index' })
}
const disabled = computed(() => { const disabled = computed(() => {
return feedingPlanStore.pet.type === PetType.DOG return feedingPlanStore.pet.type === PetType.DOG
}) })
@@ -35,9 +41,12 @@ const disabled = computed(() => {
</Cell> </Cell>
</CellGroup> </CellGroup>
<CellGroup class="w-full bg-[#fff] shadow-cell-group rounded-3 overflow-hidden"> <CellGroup class="w-full bg-[#fff] shadow-cell-group rounded-3 overflow-hidden">
<Cell title="品种" border> <Cell title="类别" border>
<PickerItem v-model="feedingPlanStore.pet.type" :options="feedingPlanStore.petTypeOptions" /> <PickerItem v-model="feedingPlanStore.pet.type" :options="feedingPlanStore.petTypeOptions" />
</Cell> </Cell>
<Cell title="品种" border>
<PickerItem v-model="feedingPlanStore.pet.varietyName" :options="feedingPlanStore.petVarietiesOptions" />
</Cell>
<Cell title="性别" border> <Cell title="性别" border>
<PickerItem v-model="feedingPlanStore.pet.gender" :options="feedingPlanStore.genderOptions" /> <PickerItem v-model="feedingPlanStore.pet.gender" :options="feedingPlanStore.genderOptions" />
</Cell> </Cell>
+80 -6
View File
@@ -1,11 +1,12 @@
import type { FeedingPlanProduct } from '@/model/feeding-plan' import type { FeedingPlanProduct } from '@/model/feeding-plan'
import type { Product } from '@/model/product' import type { Product } from '@/model/product'
import { createFeedingPlan } from '@/api/feeding-plan' import { createFeedingPlan, updateFeedingPlan } from '@/api/feeding-plan'
import { createPet } from '@/api/pet' import { createPet, petVarietiesList } from '@/api/pet'
import { import {
type CreateFeedingPlanRequest, type CreateFeedingPlanRequest,
type CreatePetRequest, type CreatePetRequest,
FeedingGoal, FeedingGoal,
type FeedingPlan,
Gender, Gender,
type Pet, type Pet,
PetBodyType, PetBodyType,
@@ -24,6 +25,23 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
{ value: Gender.FEMALE, label: '女孩' }, { value: Gender.FEMALE, label: '女孩' },
] ]
const petVarietiesOptions = ref<{
value: string
label: string
}[]>([])
const fetchPetVarieties = async () => {
const result = await petVarietiesList()
petVarietiesOptions.value = result.map((item) => {
return {
value: item.name,
label: item.name,
}
})
}
fetchPetVarieties()
const dailyCalories = ref(400) const dailyCalories = ref(400)
// @ts-expect-error @ts-ignore // @ts-expect-error @ts-ignore
const pet = ref <CreatePetRequest>({ const pet = ref <CreatePetRequest>({
@@ -38,6 +56,7 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
photo: '', photo: '',
type: PetType.CAT, type: PetType.CAT,
weight: 0, weight: 0,
varietyName: '',
}) })
const savedPet = ref<Pet | null>(null) const savedPet = ref<Pet | null>(null)
@@ -109,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) {
@@ -126,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 = [
@@ -220,6 +243,8 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
}) })
} }
const isEdit = ref(false)
/** /**
* 修改指定 productId 的 percentage * 修改指定 productId 的 percentage
* @param productId 产品的id * @param productId 产品的id
@@ -245,6 +270,7 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
arrangeDailyConsumeWeight() arrangeDailyConsumeWeight()
} }
} }
const savedFeedingPlan = ref<FeedingPlan | null>(null)
const confirm = async () => { const confirm = async () => {
if (savedPet.value === null) { if (savedPet.value === null) {
@@ -256,10 +282,55 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
return { return {
id: item.product.id, id: item.product.id,
dailyUsageWeight: item.dailyUsageWeight, dailyUsageWeight: item.dailyUsageWeight,
percentage: item.percentage,
} }
}) })
if ((isEdit.value && savedFeedingPlan.value)) {
await updateFeedingPlan(savedFeedingPlan.value.id, feedingPlan.value)
}
else {
await createFeedingPlan(feedingPlan.value) await createFeedingPlan(feedingPlan.value)
} }
}
const initPet = (payload: Pet) => {
// @ts-expect-error @ts-ignore
pet.value = {
birthday: payload.birthday,
bodyType: payload.bodyType,
gender: payload.gender,
isActive: payload.isActive,
isLactation: payload.isLactation,
isPregnant: payload.isPregnant,
isSterilization: payload.isSterilization,
name: payload.name,
photo: payload.photo,
type: payload.type,
weight: payload.weight,
}
savedPet.value = payload
feedingPlan.value.targetWeight = calculateIdealWeight()
rer.value = calculateRER(pet.value.weight)
}
const initFeedingPlan = (payload: FeedingPlan) => {
// @ts-expect-error @ts-ignore
feedingPlan.value = {
feedingGoal: payload.feedingGoal,
targetWeight: payload.targetWeight,
petId: savedPet.value?.id || '',
products: payload.feedingPlanProducts.map((item) => {
return {
id: item.product.id,
dailyUsageWeight: item.dailyUsageWeight,
}
}),
}
savedFeedingPlan.value = payload
selectedProducts.value = payload.feedingPlanProducts
dailyCalories.value = Math.floor(rer.value * derRate.value)
}
return { return {
pet, pet,
@@ -275,5 +346,8 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
changePercentage, changePercentage,
dailyCalories, dailyCalories,
confirm, confirm,
initPet,
initFeedingPlan,
petVarietiesOptions,
} }
}) })
+3 -3
View File
@@ -4,7 +4,8 @@
// Generated by vite-plugin-uni-pages // Generated by vite-plugin-uni-pages
interface NavigateToOptions { interface NavigateToOptions {
url: "/pages/feed-plan/index" | url: "/pages/article/detail" |
"/pages/feed-plan/index" |
"/pages/feed-plan-calculator/choose-product" | "/pages/feed-plan-calculator/choose-product" |
"/pages/feed-plan-calculator/confirm" | "/pages/feed-plan-calculator/confirm" |
"/pages/feed-plan-calculator/index" | "/pages/feed-plan-calculator/index" |
@@ -14,8 +15,7 @@ interface NavigateToOptions {
"/pages/pet-manual/index" | "/pages/pet-manual/index" |
"/pages/setting/index" | "/pages/setting/index" |
"/pages/start-filing/index" | "/pages/start-filing/index" |
"/pages/userInfo/index" | "/pages/userInfo/index";
"/pages/pet-manual/components/CardList";
} }
interface RedirectToOptions extends NavigateToOptions {} interface RedirectToOptions extends NavigateToOptions {}
+73
View File
@@ -0,0 +1,73 @@
3.产品产能计算(ME)
NEF:无氮浸出物(淀粉) GE(总能)DE(消化能)ME(代谢能)
NEF(%)=1-蛋白质含量*(1-水分含量)-脂肪含量*(1-水分含量)-粗纤维*(1-水分含量)-粗灰分*(1-水分含量)-水分含量
干物质%=1-水分含量%
蛋白质质量=蛋白质含量值*干物质含量值
脂肪质量=脂肪含量*干物质含量值
粗纤维质量=粗纤维含量值*干物质含量值
干物质中粗纤维含量占比=粗纤维质量/干物质占比*100
步骤一:GE(kcal)=5.7*蛋白质质量+9.4*脂肪质量+4.1*(NEF+粗纤维质量)
步骤二:能量消化率(%)=87.9-(0.88*干物质中粗纤维百分含量)
步骤三:DE(kcal)=GE*能量消化率的百分数/100
步骤四:ME(kcal)=DE-(0.77*蛋白质质量)
产品具体成分见“产品成分保证值”
举例某产品信息中:粗蛋白含量 40%,粗脂肪 19%,粗纤维2%,粗灰分 25%,水分6%
干物质%=1-6%=94%
NEF(%)=1-40%*(1-6%)-19%*(1-6%)-2%*(1-6%)-25%*(1-6%)-6%=13.16%
蛋白质质量=40%*94%=0.38
粗纤维质量=2%*94%=0.02
粗脂肪质量=19%*94%=0.18
干物质中粗纤维含量占比=0.02/94%*100=2.12765957
GE(kcal)=5.7*0.38+9.4*0.18+4.1*(0.02+13.16%)=4.43212 步骤一计算完成
能量消化率(%)=87.9-(0.88*干物质中粗纤维百分含量)
=87.9-(0.88*2.12)=86.03 步骤二计算完成
DE(kcal)=4.43212*86.03/100=3.82 步骤三计算完成
ME(kcal)=DE-(0.77*蛋白质质量)
=3.82-(0.77*0.38)=3.53 步骤四计算完成
4、每日喂食量计算
计算公式:产品每日喂食量(g)=能量需求*选定产品1喂食比例/ME(产品1)
热量需求在前面已经计算过了
举例用户的猫咪所需要的热量需求是 300KJ,假定用户只喂养果蔬冻干,果蔬冻干在产品后台
输入的信息是粗蛋白质 60%,粗脂肪 15%,粗灰分 10%,粗纤维6%,水分 6%
按照上述产品产能计算流程:干物质=1-6%=94%
NEF(%)=1-60%*(1-6%)-15%*(1-6%)-10%*(1-6%)-6%*(1-6%)-6%=8.46%
蛋白质质量=60%*94%=0.564
脂肪质量=15%*94%=0.141
粗纤维质量=6%*94%=0.056
干物质中粗纤维含量占比=0.056/94%*100=5.96
步骤一:GE(kcal)=5.7*蛋白质质量+9.4*脂肪质量+4.1*(NEF+粗纤维质量)
=5.7*0.564+9.4*0.141+4.1*(8.46%+0.056)=5.12
步骤二:能量消化率(%)=87.9-(0.88*干物质中粗纤维百分含量)
=87.9-(0.88*5.96)=82.6552
步骤三:DE(kcal)=GE*能量消化率的百分数/100
=5.12*82.6552/100=4.23
步骤四:ME(kcal)=DE-(0.77*蛋白质质量)
=4.23-(0.77*0.564)=3.79
所以1g的果蔬冻干可以供能3.79KJ
猫咪1天需要的能量是300KJ,这些能量全部由冻干提供,则每日需要吃的冻干=300*100%/3.79=79.2g
举例2:猫咪每日需要能量300KJ,吃主食餐盒和果蔬冻干,其中果蔬冻干占比60%,主食餐盒40%,1g主食餐盒提供能量为1.2KJ,1g的果蔬冻干可以供能3.79KJ
所需果蔬冻干=300*60%/3.79=47.5g
所需主食餐盒=300*40%/1.2=100g
+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,