index.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <script setup lang="ts">
  2. import FeedFlogan from '@/pages/feed-calculator/components/FeedFlogan.vue'
  3. import right from '@/static/image/pet-parameters/right.png'
  4. import edit from '@/static/image/start-filing/edit.png'
  5. import ToolApi from '@/utils'
  6. interface RecordList {
  7. title: string
  8. options: string[]
  9. aimIndex: number
  10. }
  11. const titleName = ref<string>('开始建档')
  12. const safeHeight = ToolApi.getSafeHeight()
  13. const recordList = ref<RecordList[]>([
  14. { title: '宠物名字', options: ['子龙'], aimIndex: 0 },
  15. { title: '品种', options: ['好猫'], aimIndex: 0 },
  16. { title: '性别', options: ['男孩'], aimIndex: 0 },
  17. { title: '出生日期', options: ['2月2日'], aimIndex: 0 },
  18. { title: '体重', options: ['2kg'], aimIndex: 0 },
  19. ])
  20. const feedFloganBottom = ref<number>(13)
  21. function handleAimChange(e: CustomEvent, index: number) {
  22. recordList.value[index].aimIndex = e.detail.value
  23. }
  24. function handleNext() {
  25. uni.navigateTo({ url: '/pages/feed-calculator/index' })
  26. }
  27. </script>
  28. <template>
  29. <TitleBar :title-name="titleName" />
  30. <view class="flex flex-col bg-[#F5F6F7] overflow-y-auto" :style="`height:calc(100vh - ${safeHeight}px)`">
  31. <view class="w-[80px] h-[80px] rounded-full bg-[#D9D9D9] relative mt-[88px] mx-auto">
  32. <view class="absolute right-1 bottom-1 w-[18px] h-[18px] bg-[#0052D9] rounded-full flex items-center justify-center">
  33. <image :src="edit" class="w-[10px] h-[10px]" />
  34. </view>
  35. </view>
  36. <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">
  37. <view class="whitespace-nowrap">
  38. {{ item.title }}
  39. </view>
  40. <view class="flex justify-center items-center">
  41. <picker :value="item.aimIndex" :range="item.options" @change="handleAimChange($event, index)">
  42. <view class="uni-input">
  43. {{ item.options[item.aimIndex] }}
  44. </view>
  45. </picker>
  46. <image :src="right" class="w-[24px] h-[24px]" />
  47. </view>
  48. </view>
  49. <view class="flex items-center justify-center">
  50. <button class="w-[176px] h-[47px] flex items-center justify-center bg-[#4545E5] border-none text-[white] rounded-3xl mt-[58px]" @tap="handleNext">
  51. 下一题
  52. </button>
  53. </view>
  54. <FeedFlogan :bottom="feedFloganBottom" />
  55. </view>
  56. </template>
  57. <style scoped>
  58. </style>