|
@@ -153,27 +153,32 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
async createReward() {
|
|
async createReward() {
|
|
|
- if (!this.newReward.title || !this.newReward.pointsRequired) {
|
|
|
|
|
- uni.showToast({ title: '请填写完整信息', icon: 'none' })
|
|
|
|
|
|
|
+ if (!this.newReward.title) {
|
|
|
|
|
+ uni.showToast({ title: '请填写心愿名称', icon: 'none' })
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
if (this.currentRole === 'parent') {
|
|
if (this.currentRole === 'parent') {
|
|
|
- // 家长模式:创建家长心愿
|
|
|
|
|
|
|
+ // 家长模式:创建家长心愿,需要填写积分
|
|
|
|
|
+ if (!this.newReward.pointsRequired) {
|
|
|
|
|
+ uni.showToast({ title: '请填写所需积分', icon: 'none' })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
await createParentWishlist({
|
|
await createParentWishlist({
|
|
|
title: this.newReward.title,
|
|
title: this.newReward.title,
|
|
|
pointsRequired: parseInt(this.newReward.pointsRequired)
|
|
pointsRequired: parseInt(this.newReward.pointsRequired)
|
|
|
})
|
|
})
|
|
|
|
|
+ uni.showToast({ title: '添加成功', icon: 'success' })
|
|
|
} else {
|
|
} else {
|
|
|
- // 孩子模式:创建孩子心愿
|
|
|
|
|
|
|
+ // 孩子模式:创建孩子心愿,积分为0,等待家长填写
|
|
|
await createReward({
|
|
await createReward({
|
|
|
title: this.newReward.title,
|
|
title: this.newReward.title,
|
|
|
- pointsRequired: parseInt(this.newReward.pointsRequired),
|
|
|
|
|
childId: this.currentChildId
|
|
childId: this.currentChildId
|
|
|
|
|
+ // pointsRequired不传,默认为0
|
|
|
})
|
|
})
|
|
|
|
|
+ uni.showToast({ title: '已提交,等待家长填写积分', icon: 'success' })
|
|
|
}
|
|
}
|
|
|
- uni.showToast({ title: '添加成功', icon: 'success' })
|
|
|
|
|
this.showAddModal = false
|
|
this.showAddModal = false
|
|
|
this.newReward = { title: '', pointsRequired: '' }
|
|
this.newReward = { title: '', pointsRequired: '' }
|
|
|
this.loadRewards()
|
|
this.loadRewards()
|
|
@@ -280,6 +285,25 @@ export default {
|
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+.form-label {
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ margin-bottom: 10rpx;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.form-label .required {
|
|
|
|
|
+ color: #FF6B6B;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.form-tip {
|
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
|
+ color: #999;
|
|
|
|
|
+ padding: 20rpx;
|
|
|
|
|
+ background: #f5f5f5;
|
|
|
|
|
+ border-radius: 10rpx;
|
|
|
|
|
+ margin-bottom: 20rpx;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
.modal-btns {
|
|
.modal-btns {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
gap: 20rpx;
|
|
gap: 20rpx;
|