Commit 23ffa71f authored by spc's avatar spc

feeding

parent b83d595c
This diff is collapsed.
......@@ -148,32 +148,6 @@
<image :src="feedingRecordRes.add_btn" class="add-btn-img" />
</view>
<!-- 添加记录弹窗 -->
<view class="popup-mask" v-if="showPopup" @click="closePopup">
<view class="popup-content" @click.stop>
<view class="popup-title">添加喂养记录</view>
<view class="form-item">
<text class="label">时间:</text>
<picker mode="time" :value="newRecord.time" @change="onTimeChange">
<view class="picker">{{ newRecord.time || '请选择时间' }}</view>
</picker>
</view>
<view class="form-item">
<text class="label">类型:</text>
<picker :range="feedingTypes" @change="onTypeChange">
<view class="picker">{{ newRecord.type || '请选择类型' }}</view>
</picker>
</view>
<view class="form-item">
<text class="label">内容:</text>
<input class="input" v-model="newRecord.content" placeholder="请输入具体内容" maxlength="50" />
</view>
<view class="popup-buttons">
<button class="cancel-btn" @click="closePopup">取消</button>
<button class="confirm-btn" @click="saveRecord">保存</button>
</view>
</view>
</view>
<!-- 编辑弹窗 -->
<view class="popup-mask" v-if="showEditPopup" @click="closeEditPopup">
......@@ -198,7 +172,7 @@
</view>
<view class="popup-buttons">
<button class="cancel-btn" @click="closeEditPopup">取消</button>
<button class="confirm-btn" @click="saveEditRecord">保存</button>
<button class="confirm-btn" @click="saveEditRecord">保存修改</button>
</view>
</view>
</view>
......@@ -392,6 +366,10 @@ const calendarDates = computed(() => {
return dates
})
function goToFeedingIndex() {
uni.navigateBack()
}
// 方法
function createDateObject(date) {
const today = new Date()
......@@ -622,7 +600,7 @@ function editRecord(index) {
const record = todayRecords.value[index]
if (!record) return
editForm.value = {
time: record.time || '',
time: getCurrentTime(), // 使用当前时间作为最新时间
type: record.type || '',
content: record.foodDetails || record.content || '' // 优先使用foodDetails
}
......@@ -1149,7 +1127,18 @@ function formatDateTimeString(dateString, timeString) {
const [hours, minutes] = timeString.split(':');
date.setHours(parseInt(hours, 10));
date.setMinutes(parseInt(minutes, 10));
return date.toISOString(); // 使用ISO格式的时间戳
date.setSeconds(0);
date.setMilliseconds(0);
// 使用本地时间而不是UTC时间,避免时区问题
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hour = String(date.getHours()).padStart(2, '0');
const minute = String(date.getMinutes()).padStart(2, '0');
const second = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day}T${hour}:${minute}:${second}`;
}
function loadBabyFeedingRecords(baby) {
......@@ -1966,7 +1955,7 @@ function testApiIntegration() {
button {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
border-radius: 50rpx;
font-size: 32rpx;
border: none;
font-weight: 600;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment