This commit is contained in:
qiuyuan 2025-08-13 10:53:10 +08:00
parent 0cc0a04508
commit 5d3f1b9c81
4 changed files with 51 additions and 55 deletions

View File

@ -434,54 +434,42 @@
},
handleStartTimeConfirm(e) {
const date = new Date(e.value);
// uViewdatetime-pickere.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() {

View File

@ -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;

View File

@ -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>

View File

@ -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;
},
//