add:新增宠物、进度卡片组件页面

This commit is contained in:
zlong committed 2024-12-14 16:48:35 +08:00
1 parent 7d9a931b12
commit cf82fb2d07
9 files changed
+61 -15

No files matched your search

@@ -0,0 +1,16 @@
<script setup lang="ts">
import feedSlogan from '@/static/image/feed-plan/feed-slogan.png'
import ToolApi from '@/utils'
const safeBottomMenuHeight = ToolApi.getMenuButtonInfoHeight()
</script>
<template>
<view class="w-screen fixed left-0" :style="{ bottom: `${safeBottomMenuHeight + 70}px` }">
<image :src="feedSlogan" class="w-[138px] h-[38px] mx-auto" />
</view>
</template>
<style scoped>
</style>
@@ -0,0 +1,57 @@
<script setup lang="ts">
const props = withDefaults(defineProps<{
list: Array<{
step: number
title: string
}>
stage: number
}>(), {
stage: -1,
})
</script>
<template>
<view v-for="(item, index) in props.list" :key="index">
<view class="flex">
<view class="flex items-center justify-center text-[white]" :class="props.stage === index ? 'step_select' : props.stage === -1 ? 'step' : 'step step_left' ">
{{ item.step }}
</view>
<view class="ml-1 font-pingfangsc tracking-[0.8px]" :class="props.stage === index ? 'step_title_select' : 'step_title' ">
{{ item.title }}
</view>
</view>
<view v-if="index !== props.list.length - 1" class="w-[1px] h-[13px] bg-[#999] mt-1 mb-1 step_line" :class="props.stage === -1 ? 'step_line' : 'step_line_select' " />
</view>
</template>
<style scoped>
.step{
background: #999999;
width: 21px;
height: 21px;
border-radius: 30px;
}
.step_left{
margin-left: 3px;
}
.step_select{
background: #0052D9;
width: 27px;
height: 27px;
border-radius: 20px;
}
.step_title{
color: #999999;
font-size:16px;
}
.step_title_select{
color: #151515;
font-size: 20px;
}
.step_line{
margin-left: 10px;
}
.step_line_select{
margin-left: 13px;
}
</style>
+35 -14
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import FeedStep from '@/components/FeedStep.vue'
import feedSlogan from '@/static/image/feed-plan/feed-slogan.png'
import FeedFlogan from '@/pages/feed-plan/components/FeedFlogan.vue'
import FeedStep from '@/pages/feed-plan/components/FeedStep.vue'
import feedTitle from '@/static/image/feed-plan/feed-title.png'
import back from '@/static/image/pet-parameters/back.png'
import cat from '@/static/image/pet-parameters/cat.png'
import dog from '@/static/image/pet-parameters/dog.png'
import ToolApi from '@/utils'
interface StepInfo {
@@ -10,17 +13,20 @@ interface StepInfo {
}
const titleName = ref<string>('喂养计算器')
const safeHeight = ToolApi.getSafeHeight()
const safeBottomMenuHeight = ToolApi.getMenuButtonInfoHeight()
const stepInfo = ref<StepInfo[]>([
{ step: 1, title: '宠物基础信息' },
{ step: 2, title: '身体状态信息' },
{ step: 3, title: '计算喂养计划' },
])
const controlFormDisplay = ref({
display1: true,
display1: false,
display2: false,
display3: false,
display3: true,
})
const animalCard = ref([
{ image: cat, name: '猫猫' },
{ image: dog, name: '狗狗' },
])
function handleReady() {
controlFormDisplay.value = {
display1: false,
@@ -28,11 +34,9 @@ function handleReady() {
display3: false,
}
controlFormDisplay.value.display2 = true
const timerId: NodeJS.Timeout
timerId = setTimeout(() => {
setTimeout(() => {
controlFormDisplay.value.display2 = false
controlFormDisplay.value.display3 = true
clearTimeout(timerId)
}, 2000)
}
</script>
@@ -48,22 +52,39 @@ function handleReady() {
<view class="h-[121px] ml-15 mt-14">
<FeedStep :list="stepInfo" />
</view>
<FeedFlogan />
<view class="flex items-center justify-center">
<button class="w-[176px] h-[47px] flex items-center justify-center bg-[#4545E5] border-none text-[white] rounded-3xl mt-[87px]" @tap="handleReady">
准备好了
</button>
</view>
<view class="w-full fixed left-0" :style="{ bottom: `${safeBottomMenuHeight + 70}px` }">
<image :src="feedSlogan" class="w-[138px] h-[38px] mx-auto" />
</view>
</view>
<view v-show="controlFormDisplay.display2" class="flex items-center justify-center w-full h-full">
<FeedStep :list="stepInfo" :stage="stepInfo[0].step - 1" />
</view>
<view v-show="controlFormDisplay.display3">
123
<view class="m-4 flex items-center">
<image :src="back" class="w-[6px] h-[10px]" />
<text class="text-[12px] font-pingfangsc ml-1">
返回
</text>
<view class="flex-1 h-[6px] bg-[#E7E7E7] ml-3 rounded relative">
<view class="absolute h-[6px] bg-[#0052D9] rounded" style="width: 80%" />
</view>
<text class="text-[12px] font-pingfangsc ml-3">
80%
</text>
</view>
<view class="mt-[69px] w-full flex justify-center items-center text-[20px] font-bold">
您的宠物是?
</view>
<view class="flex w-full justify-center items-center mt-[37px] gap-3">
<view v-for="(item, index) in animalCard" :key="index" class="w-[136px] h-[154px] bg-[white] rounded-lg flex justify-center">
<image v-if="index === 0" :src="animalCard[0].image" class="w-[76px] h-[69px] mt-[40px]" />
<image v-else :src="animalCard[1].image" class="w-[96px] h-[73px] mt-[35px]" />
</view>
</view>
<FeedFlogan />
</view>
</view>
</template>