1
This commit is contained in:
parent
0cc0a04508
commit
5d3f1b9c81
@ -434,54 +434,42 @@
|
||||
},
|
||||
|
||||
handleStartTimeConfirm(e) {
|
||||
const date = new Date(e.value);
|
||||
// 对于uView的datetime-picker,e.value是时间戳
|
||||
const date = new Date(e.value);
|
||||
|
||||
// 补零函数:确保数字是两位数
|
||||
const padZero = num => num.toString().padStart(2, '0');
|
||||
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');
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = padZero(date.getMonth() + 1); // 月份补零
|
||||
const day = padZero(date.getDate()); // 日期补零
|
||||
const hours = padZero(date.getHours()); // 小时补零
|
||||
this.startTime = `${year}-${month}-${day} ${hours}:${minutes}`;
|
||||
this.startTimePickerValue = this.startTime;
|
||||
this.showStartTimePicker = false;
|
||||
|
||||
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;
|
||||
// 如果结束时间早于开始时间,自动调整结束时间
|
||||
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 date = new Date(e.value);
|
||||
|
||||
// 补零函数:确保数字是两位数
|
||||
const padZero = num => num.toString().padStart(2, '0');
|
||||
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');
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = padZero(date.getMonth() + 1); // 月份补零
|
||||
const day = padZero(date.getDate()); // 日期补零
|
||||
const hours = padZero(date.getHours()); // 小时补零
|
||||
this.endTime = `${year}-${month}-${day} ${hours}:${minutes}`;
|
||||
this.endTimePickerValue = this.endTime;
|
||||
this.showEndTimePicker = false;
|
||||
|
||||
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(); // 如果需要验证时间范围,取消注释
|
||||
// 验证时间是否合理
|
||||
this.validateTime();
|
||||
},
|
||||
|
||||
adjustEndTime() {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -17,7 +17,9 @@
|
||||
</view>
|
||||
|
||||
<view class="right" @click="goPage('helpInfo','')">
|
||||
<view class="right-icon">+</view>
|
||||
<view class="">
|
||||
<u-icon name="plus-circle" color="#2979ff" size="50"></u-icon>
|
||||
</view>
|
||||
<view class="right-font">发帖</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -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;
|
||||
},
|
||||
// 显示上传选项
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user