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) { handleStartTimeConfirm(e) {
const date = new Date(e.value); // uViewdatetime-pickere.value
const date = new Date(e.value);
// const year = date.getFullYear();
const padZero = num => num.toString().padStart(2, '0'); 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(); this.startTime = `${year}-${month}-${day} ${hours}:${minutes}`;
const month = padZero(date.getMonth() + 1); // this.startTimePickerValue = this.startTime;
const day = padZero(date.getDate()); // this.showStartTimePicker = false;
const hours = padZero(date.getHours()); //
const dateString = this.mode === 'year-month' ? //
`${year}-${month}` // 2023-01 if (new Date(this.endTime) < new Date(this.startTime)) {
: const endDate = new Date(date.getTime() + 60 * 60 * 1000); // 1
`${year}-${month}-${day} ${hours}:00`; // 2023-01-02 09:00 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;
// 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;
}, },
handleEndTimeConfirm(e) { handleEndTimeConfirm(e) {
const date = new Date(e.value); const date = new Date(e.value);
// const year = date.getFullYear();
const padZero = num => num.toString().padStart(2, '0'); 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(); this.endTime = `${year}-${month}-${day} ${hours}:${minutes}`;
const month = padZero(date.getMonth() + 1); // this.endTimePickerValue = this.endTime;
const day = padZero(date.getDate()); // this.showEndTimePicker = false;
const hours = padZero(date.getHours()); //
const dateString = this.mode === 'year-month' ? //
`${year}-${month}` // 2023-01 this.validateTime();
:
`${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(); //
}, },
adjustEndTime() { adjustEndTime() {

View File

@ -668,7 +668,7 @@
padding: 20rpx; padding: 20rpx;
min-height: 100vh; min-height: 100vh;
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 190rpx; padding-bottom: calc(190rpx + 100rpx + 80rpx);
} }
.user-info-card { .user-info-card {
background: #fff; background: #fff;

View File

@ -17,7 +17,9 @@
</view> </view>
<view class="right" @click="goPage('helpInfo','')"> <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 class="right-font">发帖</view>
</view> </view>
</view> </view>

View File

@ -156,15 +156,21 @@ export default {
methods: { methods: {
// //
validatePhone() { validatePhone() {
if (!this.customerPhone) return true; const phoneReg = /^1[3-9]\d{9}$/;
const phoneReg = /^1[3-9]\d{9}$/; if (!this.customerPhone) {
if (!phoneReg.test(this.customerPhone)) { uni.showToast({
uni.showToast({ title: '请填写联系电话',
icon: 'none'
});
return false;
}
if (!phoneReg.test(this.customerPhone)) {
uni.showToast({
title: '请输入正确的手机号码', title: '请输入正确的手机号码',
icon: 'none' icon: 'none'
}); });
return false; return false;
} }
return true; return true;
}, },
// //