|
|
@@ -15,9 +15,21 @@ const emits = defineEmits<{
|
|
|
back: [void]
|
|
|
step: [number]
|
|
|
}>()
|
|
|
-const step = ref(0)
|
|
|
-const addPage = ref(1)
|
|
|
-const isUserPage = ref(false)
|
|
|
+const step = ref<number>(0)
|
|
|
+const addPage = ref<number>(1)
|
|
|
+const isUserPage = ref<boolean>(false)
|
|
|
+const aimList = ref<string[]>(['增肥', '减肥'])
|
|
|
+const aimIndex = ref<number>(0)
|
|
|
+const weightList = ref<string[]>(['6kg', '7kg'])
|
|
|
+const weightIndex = ref<number>(0)
|
|
|
+function handleAimChange(e: CustomEvent, type: string) {
|
|
|
+ if (type === 'aim') {
|
|
|
+ aimIndex.value = e.detail.value
|
|
|
+ }
|
|
|
+ else if (type === 'weight') {
|
|
|
+ weightIndex.value = e.detail.value
|
|
|
+ }
|
|
|
+}
|
|
|
const progressNumber = computed<number>(() => {
|
|
|
return Math.ceil((step.value + 1) / (props.list.length + addPage.value) * 100)
|
|
|
})
|
|
|
@@ -76,20 +88,27 @@ function handleAnswer(answer: PetCard) {
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="w-[calc(100% - 32px)] mx-[16px] h-[56px] bg-[white] rounded-t-3 mt-4 flex items-center card_border_bottom p-4 justify-between">
|
|
|
- <view>喂养目标</view>
|
|
|
+ <view class="whitespace-nowrap">
|
|
|
+ 喂养目标
|
|
|
+ </view>
|
|
|
+
|
|
|
<view class="flex justify-center items-center">
|
|
|
- <text class="mr-3">
|
|
|
- 增肥
|
|
|
- </text>
|
|
|
+ <picker :value="aimIndex" :range="aimList" @change="handleAimChange($event, 'aim')">
|
|
|
+ <view class="uni-input">
|
|
|
+ {{ aimList[aimIndex] }}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
<image :src="right" class="w-[24px] h-[24px]" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="w-[calc(100% - 32px)] mx-[16px] h-[56px] bg-[white] rounded-b-3 flex items-center p-4 justify-between">
|
|
|
<view>目标体重</view>
|
|
|
<view class="flex justify-center items-center">
|
|
|
- <text class="mr-3">
|
|
|
- 6kg
|
|
|
- </text>
|
|
|
+ <picker :value="weightIndex" :range="weightList" @change="handleAimChange($event, 'weight')">
|
|
|
+ <view class="uni-input">
|
|
|
+ {{ weightList[weightIndex] }}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
<image :src="right" class="w-[24px] h-[24px]" />
|
|
|
</view>
|
|
|
</view>
|