diff --git a/pages/pray/pray.vue b/pages/pray/pray.vue index d76ce3f..1276b6f 100644 --- a/pages/pray/pray.vue +++ b/pages/pray/pray.vue @@ -97,8 +97,8 @@ export default { forOthers: false, // 默认不为他人祈福 wish: '' }, - prayerTypes: ['个人祈福', '为他人祈福', '家庭祈福', '事业祈福', '学业祈福', '健康祈福', '财运祈福', '姻缘祈福', '其他祈福'], - selectedPrayerType: '个人祈福', + prayerTypes: ['学业', '健康', '姻缘', '财运', '消灾'], + selectedPrayerType: '学业', showPicker: false } }, @@ -189,23 +189,42 @@ export default { resetForm() { this.formData = { name: '', - prayerType: '个人祈福', + prayerType: '学业', forOthers: false, wish: '' } - this.selectedPrayerType = '个人祈福' + this.selectedPrayerType = '学业' }, // 显示祈福类型选择器 showPrayerTypePicker() { + console.log('开始显示祈福类型选择器'); + console.log('可选项:', this.prayerTypes); + uni.showActionSheet({ itemList: this.prayerTypes, success: (res) => { - this.selectedPrayerType = this.prayerTypes[res.index]; - this.formData.prayerType = this.selectedPrayerType; + console.log('选择器回调参数:', res); + console.log('选择的索引:', res.tapIndex); + + if (res.tapIndex !== undefined && res.tapIndex >= 0 && res.tapIndex < this.prayerTypes.length) { + const selectedType = this.prayerTypes[res.tapIndex]; + console.log('选择的祈福类型:', selectedType); + + // 更新选中的祈福类型 + this.selectedPrayerType = selectedType; + + // 同步更新表单数据 + this.formData.prayerType = selectedType; + + console.log('更新后的selectedPrayerType:', this.selectedPrayerType); + console.log('更新后的formData.prayerType:', this.formData.prayerType); + } else { + console.error('无效的选择索引:', res.tapIndex); + } }, fail: (res) => { - console.error('用户取消选择'); + console.log('用户取消选择或选择失败:', res); } }); } @@ -332,7 +351,7 @@ page { } .input-field{ - padding-left: 20rpx; + padding-left: 40rpx; } } @@ -344,7 +363,7 @@ page { display: flex; align-items: center; justify-content: space-between; - padding:0 30rpx 0 30rpx; + padding:0 30rpx 0 66rpx; width: 100%; @@ -414,7 +433,7 @@ page { height: 140rpx; //border: 1rpx solid #e10c0c; border-radius: 12rpx; - padding: 0 20rpx 0 20rpx; + padding: 0 20rpx 0 66rpx; font-size: 28rpx; color: #333; box-sizing: border-box;