feat: 喂养计划

This commit is contained in:
ilhamtahir committed 2025-01-01 22:50:38 +08:00
1 parent 6dfcc0076a
commit bde886d9e6
21 files changed
+107 -669

No files matched your search

@@ -1,9 +1,9 @@
<script setup lang="ts">
import type { FeedFormQuestions, PetCard, StepInfo, UserList } from '@/model/pet-manual'
import FeedSlogan from '@/pages/feed-calculator/components/FeedFlogan.vue'
import FeedForm from '@/pages/feed-calculator/components/FeedForm.vue'
import FeedSlogan from '@/pages/feed-calculator/components/FeedSlogan.vue'
import ProgressBar from '@/pages/feed-calculator/components/ProgressBar.vue'
import avator from '@/static/image/pet-parameters/avator.png'
import avator from '@/static/image/pet-parameters/avatar.png'
import right from '@/static/image/pet-parameters/right.png'
const props = defineProps<{
@@ -52,7 +52,8 @@ function handlePrevious() {
}
}
function handleAnswer(answer: PetCard) {
console.log(answer, '答案')
console.log(answer.name, '答案')
if (step.value === 2 || step.value === 7) {
emits('step', step.value)
}
+18 -23
View File
@@ -1,17 +1,18 @@
<script setup lang="ts">
import type { FeedFormQuestions, UserList } from '@/model/pet-manual'
import { PetBodyType } from '@/model/pet'
import FeedQuestionnaire from '@/pages/feed-calculator/components/FeedQuestionnaire.vue'
import FeedStart from '@/pages/feed-calculator/components/FeedStart.vue'
import FeedStep from '@/pages/feed-calculator/components/FeedStep.vue'
import avator from '@/static/image/pet-parameters/avator.png'
import cat from '@/static/image/pet-parameters/cat.png'
import dog from '@/static/image/pet-parameters/dog.png'
import emaciatedCat from '@/static/image/pet-parameters/form/emaciated_cat.png'
import idealWightCat from '@/static/image/pet-parameters/form/idealweight_cat.png'
import overWeightCat from '@/static/image/pet-parameters/form/overweight_cat.png'
import skinnyCat from '@/static/image/pet-parameters/form/skinny_cat.png'
import thinCat from '@/static/image/pet-parameters/form/thin_cat.png'
import underWeightCat from '@/static/image/pet-parameters/form/underweight_cat.png'
import extremelyObese from '@/static/image/body-type/extremely-obese.svg'
import extremelyThin from '@/static/image/body-type/extremely-thin.svg'
import ideal from '@/static/image/body-type/ideal.svg'
import obese from '@/static/image/body-type/obese.svg'
import overWeight from '@/static/image/body-type/overweight.svg'
import thin from '@/static/image/body-type/thin.svg'
import underWeight from '@/static/image/body-type/underweight.svg'
import veryThin from '@/static/image/body-type/very-thin.svg'
import avatar from '@/static/image/pet-parameters/avatar.png'
import ToolApi from '@/utils'
interface StepInfo {
@@ -22,27 +23,21 @@ const titleName = ref<string>('喂养计算器')
const safeHeight = ToolApi.getSafeHeight()
const stage = ref<number>(0)
const stepInfo = ref<StepInfo[]>([
{ step: 1, title: '宠物基础信息' },
{ step: 2, title: '身体状态信息' },
{ step: 3, title: '计算喂养计划' },
{ step: 1, title: '身体状态信息' },
{ step: 2, title: '计算喂养计划' },
{ step: 3, title: '完成统计' },
])
const controlFormDisplay = ref({
display1: true,
display2: false,
display3: false,
})
const feedFormQuestions = ref<FeedFormQuestions[]>([
{ title: '您的动物是?', question: [{ image: cat, name: '猫猫' }, { image: dog, name: '狗狗' }], formType: 1 },
{ title: '猫咪的性别?', question: [{ name: '男孩' }, { name: '女孩' }], formType: 2 },
{ title: '猫咪的年龄区间?', question: [{ name: '0-4个月' }, { name: '5-12个月' }], formType: 2 },
{ title: '猫咪是否活跃?', question: [{ name: '活跃' }, { name: '不活跃' }], formType: 2 },
{ title: '猫咪是否怀孕?', question: [{ name: '怀孕' }, { name: '未怀孕' }], formType: 2 },
{ title: '猫咪是否绝育?', question: [{ name: '绝育' }, { name: '未绝育' }], formType: 2 },
{ title: '猫咪是否在哺乳?', question: [{ name: '哺乳中' }, { name: '未哺乳' }], formType: 2 },
{ title: '请选择猫咪的体型', question: [{ image: emaciatedCat, name: '极度消廋' }, { image: skinnyCat, name: '非常廋' }, { image: thinCat, name: '消瘦' }, { image: underWeightCat, name: '体重偏低' }, { image: idealWightCat, name: '理想体重' }, { image: overWeightCat, name: '体重偏重' }], formType: 3 },
])
const feedFormQuestions = ref<FeedFormQuestions[]>(
[{ title: '猫咪是否活跃?', question: [{ name: '活跃', key: 'isActive', value: true }, { name: '不活跃', key: 'isActive', value: false }], formType: 2 }, { title: '猫咪是否怀孕?', question: [{ name: '怀孕', key: 'isPregnant', value: true }, { name: '未怀孕', key: 'isPregnant', value: false }], formType: 2 }, { title: '猫咪是否绝育?', question: [{ name: '绝育', key: 'isSterilization', value: true }, { name: '未绝育', key: 'isSterilization', value: false }], formType: 2 }, { title: '猫咪是否在哺乳?', question: [{ name: '哺乳中', key: 'isLactation', value: true }, { name: '未哺乳', key: 'isLactation', value: false }], formType: 2 }, { title: '请选择猫咪的体型', question:
[{ image: extremelyThin, name: '极度消廋', key: 'bodyType', value: PetBodyType.EXTREMELY_THIN }, { image: veryThin, name: '非常廋', key: 'bodyType', value: PetBodyType.VERY_THIN }, { image: thin, name: '消瘦', key: 'bodyType', value: PetBodyType.THIN }, { image: underWeight, name: '体重偏低', key: 'bodyType', value: PetBodyType.UNDERWEIGHT }, { image: ideal, name: '理想体重', key: 'bodyType', value: PetBodyType.IDEAL }, { image: overWeight, name: '体重偏重', key: 'bodyType', value: PetBodyType.OVERWEIGHT }, { image: obese, name: '肥胖', key: 'bodyType', value: PetBodyType.OBESE }, { image: extremelyObese, name: '极度肥胖', key: 'bodyType', value: PetBodyType.EXTREMELY_OBESE }], formType: 3 }],
)
const userList = ref<UserList>({
image: avator,
image: avatar,
username: '子龙',
type: ['年龄', '品种', '体重'],
})