diff --git a/pages/meetingDetail/index.vue b/pages/meetingDetail/index.vue index 81ef91e..c8d196d 100644 --- a/pages/meetingDetail/index.vue +++ b/pages/meetingDetail/index.vue @@ -434,56 +434,44 @@ }, handleStartTimeConfirm(e) { - const date = new Date(e.value); - - // 补零函数:确保数字是两位数 - const padZero = num => num.toString().padStart(2, '0'); - - const year = date.getFullYear(); - const month = padZero(date.getMonth() + 1); // 月份补零 - const day = padZero(date.getDate()); // 日期补零 - const hours = padZero(date.getHours()); // 小时补零 - - const dateString = this.mode === 'year-month' ? - `${year}-${month}` // 年月模式:2023-01 - : - `${year}-${month}-${day} ${hours}:00`; // 完整模式:2023-01-02 09:00 - - // this.startTime = dateString; - // this.startTimePickerValue = dateString; - // this.showStartTimePicker = false; - this.startTime = `2025-08-${e.day} ${e.hour}:00`; - this.startTimePickerValue = this.startTime; - this.showStartTimePicker = false; + // 对于uView的datetime-picker,e.value是时间戳 + const date = new Date(e.value); + + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + + this.startTime = `${year}-${month}-${day} ${hours}:${minutes}`; + this.startTimePickerValue = this.startTime; + this.showStartTimePicker = false; + + // 如果结束时间早于开始时间,自动调整结束时间 + if (new Date(this.endTime) < new Date(this.startTime)) { + const endDate = new Date(date.getTime() + 60 * 60 * 1000); // 加1小时 + this.endTime = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')} ${String(endDate.getHours()).padStart(2, '0')}:${String(endDate.getMinutes()).padStart(2, '0')}`; + this.endTimePickerValue = this.endTime; + } }, handleEndTimeConfirm(e) { - const date = new Date(e.value); - - // 补零函数:确保数字是两位数 - const padZero = num => num.toString().padStart(2, '0'); - - const year = date.getFullYear(); - const month = padZero(date.getMonth() + 1); // 月份补零 - const day = padZero(date.getDate()); // 日期补零 - const hours = padZero(date.getHours()); // 小时补零 - - const dateString = this.mode === 'year-month' ? - `${year}-${month}` // 年月模式:2023-01 - : - `${year}-${month}-${day} ${hours}:00`; // 完整模式:2023-01-02 09:00 - - // this.endTime = dateString; - // this.endTimePickerValue = dateString; - // this.showEndTimePicker = false; - this.endTime = `2025-08-${e.day} ${e.hour}:00`; - this.endTimePickerValue = this.endTime; - this.showEndTimePicker = false; - - console.log('格式化后的结束时间:', this.endTime); - // this.validateTime(); // 如果需要验证时间范围,取消注释 + const date = new Date(e.value); + + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + + this.endTime = `${year}-${month}-${day} ${hours}:${minutes}`; + this.endTimePickerValue = this.endTime; + this.showEndTimePicker = false; + + // 验证时间是否合理 + this.validateTime(); }, - + adjustEndTime() { console.log(this.startTime) const [startH, startM] = this.startTime.split(':').map(Number); diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 57b7956..7b4b992 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -668,7 +668,7 @@ padding: 20rpx; min-height: 100vh; box-sizing: border-box; - padding-bottom: 190rpx; + padding-bottom: calc(190rpx + 100rpx + 80rpx); } .user-info-card { background: #fff; diff --git a/pages/neighborList/index.vue b/pages/neighborList/index.vue index 6efd3b9..830576d 100644 --- a/pages/neighborList/index.vue +++ b/pages/neighborList/index.vue @@ -17,7 +17,9 @@ - + + + + 发帖 diff --git a/pages/serviceTickets/index.vue b/pages/serviceTickets/index.vue index d7a27a8..9e7ebb8 100644 --- a/pages/serviceTickets/index.vue +++ b/pages/serviceTickets/index.vue @@ -156,15 +156,21 @@ export default { methods: { // 新增手机号验证方法 validatePhone() { - if (!this.customerPhone) return true; - const phoneReg = /^1[3-9]\d{9}$/; - if (!phoneReg.test(this.customerPhone)) { - uni.showToast({ + const phoneReg = /^1[3-9]\d{9}$/; + if (!this.customerPhone) { + uni.showToast({ + title: '请填写联系电话', + icon: 'none' + }); + return false; + } + if (!phoneReg.test(this.customerPhone)) { + uni.showToast({ title: '请输入正确的手机号码', icon: 'none' - }); - return false; - } + }); + return false; + } return true; }, // 显示上传选项