Bläddra i källkod

fix: 创建任务页输入框高度不足、截止时间选择器列数不匹配

Sisyphus Agent 2 dagar sedan
förälder
incheckning
6cb999d6bc
1 ändrade filer med 14 tillägg och 6 borttagningar
  1. 14 6
      cfc-frontend/pages/tasks/create-task.vue

+ 14 - 6
cfc-frontend/pages/tasks/create-task.vue

@@ -153,8 +153,8 @@ actionTypes: [
 { value: 'cart', label: '购物(加购)' },
 { value: 'order', label: '购物(支付/收货)' }
 ],
-dateTimeRange: [[], [], [], []],
-dateTimeIndex: [0, 0, 0, 0],
+dateTimeRange: [[], [], [], [], []],
+dateTimeIndex: [0, 0, 0, 0, 0],
 deadlineText: '',
 submitting: false
 }
@@ -251,6 +251,8 @@ minutes.push(i.toString().padStart(2, '0') + '分')
 }
 
 this.dateTimeRange = [years, months, days, hours, minutes]
+// 默认选中当前日期时间
+this.dateTimeIndex = [0, month - 1, day - 1, hour, Math.floor(minute / 5)]
 },
 onChildrenChange(e) {
 this.selectedChildIds = e.detail.value
@@ -291,17 +293,23 @@ this.deadlineText = `${year}年${month}月${day}日 ${hour.toString().padStart(2
 this.form.deadline = new Date(year, month - 1, day, hour, minute)
 },
 onColumnChange(e) {
-// 处理月份变化时更新天数
-if (e.detail.column === 1) {
-const month = e.detail.value + 1
+const column = e.detail.column
+this.$set(this.dateTimeIndex, column, e.detail.value)
+// 年、月变化时更新当月天数(含闰年处理)
+if (column === 0 || column === 1) {
 const now = new Date()
 const year = now.getFullYear() + this.dateTimeIndex[0]
+const month = this.dateTimeIndex[1] + 1
 const daysInMonth = new Date(year, month, 0).getDate()
 const days = []
 for (let i = 1; i <= daysInMonth; i++) {
 days.push(i + '日')
 }
 this.$set(this.dateTimeRange, 2, days)
+// 若选中的日超出新月天数,回退到最后一天
+if (this.dateTimeIndex[2] >= daysInMonth) {
+this.$set(this.dateTimeIndex, 2, daysInMonth - 1)
+}
 }
 },
 onRepeatChange(e) {
@@ -399,7 +407,7 @@ this.form.requireInput = e.detail.value
 .form-item { margin-bottom: 30rpx; }
 .label { display: block; font-size: 28rpx; color: #333; margin-bottom: 10rpx; }
 .input, .textarea { border: 1rpx solid #ddd; border-radius: 10rpx; padding: 20rpx; font-size: 28rpx; width: 100%; box-sizing: border-box; }
-.input { height: 80rpx; }
+.input { height: 96rpx; }
 .textarea { height: 150rpx; }
 .picker { border: 1rpx solid #ddd; border-radius: 10rpx; padding: 20rpx; font-size: 28rpx; color: #666; }
 .form-hint { display: block; font-size: 22rpx; color: #999; margin-top: 8rpx; }