feat: 完成喂养计划,宠物信息填充

This commit is contained in:
ilhamtahir committed 2025-01-01 18:36:27 +08:00
1 parent 08d03cfbe0
commit 6dfcc0076a
15 files changed
+276 -38

No files matched your search

@@ -1,6 +1,5 @@
<script setup lang="ts">
import type { StepInfo } from '@/model/pet-manual'
import FeedFlogan from '@/pages/feed-calculator/components/FeedFlogan.vue'
import FeedStep from '@/pages/feed-calculator/components/FeedStep.vue'
import feedTitle from '@/static/image/feed-plan/feed-title.png'
+28 -33
View File
@@ -1,30 +1,18 @@
<script setup lang="ts">
import FeedFlogan from '@/pages/feed-calculator/components/FeedFlogan.vue'
import right from '@/static/image/pet-parameters/right.png'
import PickerItem from '@/components/PickerItem.vue'
import FeedSlogan from '@/pages/feed-calculator/components/FeedFlogan.vue'
import edit from '@/static/image/start-filing/edit.png'
import { useFeedingPlanStore } from '@/stores/feeding-plan'
import ToolApi from '@/utils'
interface RecordList {
title: string
options: string[]
aimIndex: number
}
const safeHeight = ToolApi.getSafeHeight()
const recordList = ref<RecordList[]>([
{ title: '宠物名字', options: ['子龙'], aimIndex: 0 },
{ title: '品种', options: ['好猫'], aimIndex: 0 },
{ title: '性别', options: ['男孩'], aimIndex: 0 },
{ title: '出生日期', options: ['2月2日'], aimIndex: 0 },
{ title: '体重', options: ['2kg'], aimIndex: 0 },
])
const feedFloganBottom = ref<number>(13)
function handleAimChange(e: CustomEvent, index: number) {
recordList.value[index].aimIndex = e.detail.value
}
const feedSloganBottom = ref<number>(13)
function handleNext() {
uni.navigateTo({ url: '/pages/feed-calculator/index' })
}
const { pet, petTypeOptions, genderOptions } = useFeedingPlanStore()
</script>
<template>
@@ -34,19 +22,26 @@ function handleNext() {
<image :src="edit" class="w-[10px] h-[10px]" />
</view>
</view>
<view v-for="(item, index) in recordList" :key="index" :style="{ marginTop: index === 0 ? '28px' : index === 1 ? '16px' : '', borderRadius: index === 0 ? '12px' : index === 1 ? '12px 12px 0 0' : index === recordList.length - 1 ? '0 0 12px 12px' : '0px' }" class="w-[calc(100% - 32px)] mx-[16px] h-[56px] bg-[white] flex items-center card_border_bottom p-4 justify-between">
<view class="whitespace-nowrap">
{{ item.title }}
</view>
<view class="flex justify-center items-center">
<picker :value="item.aimIndex" :range="item.options" @change="handleAimChange($event, index)">
<view class="uni-input">
{{ item.options[item.aimIndex] }}
</view>
</picker>
<image :src="right" class="w-[24px] h-[24px]" />
</view>
<view class="w-full px-4 flex flex-col gap-4 mt-[28px]">
<CellGroup class="w-full bg-[#fff] shadow-cell-group rounded-3 overflow-hidden">
<Cell title="宠物名称">
<PopupInput v-model="pet.name" placeholder="请输入宠物名称" />
</Cell>
</CellGroup>
<CellGroup class="w-full bg-[#fff] shadow-cell-group rounded-3 overflow-hidden">
<Cell title="品种" border>
<PickerItem v-model="pet.type" :options="petTypeOptions" />
</Cell>
<Cell title="性别" border>
<PickerItem v-model="pet.gender" :options="genderOptions" />
</Cell>
<Cell title="出生日期" border>
<PickerDate v-model="pet.birthday" />
</Cell>
<Cell title="体重">
<PopupInput v-model="pet.weight" placeholder="请输入宠物体重" suffix="kg" />
</Cell>
</CellGroup>
</view>
<view class="flex items-center justify-center">
@@ -54,7 +49,7 @@ function handleNext() {
下一题
</button>
</view>
<FeedFlogan :bottom="feedFloganBottom" />
<FeedSlogan :bottom="feedSloganBottom" />
</view>
</template>