|
@@ -12,13 +12,13 @@
|
|
|
<scroll-view scroll-y class="content">
|
|
<scroll-view scroll-y class="content">
|
|
|
<!-- 签到日历标题 -->
|
|
<!-- 签到日历标题 -->
|
|
|
<view class="calendar-header">
|
|
<view class="calendar-header">
|
|
|
- <text class="calendar-title">11月签到日历</text>
|
|
|
|
|
|
|
+ <text class="calendar-title">{{ currentMonthText }}签到日历</text>
|
|
|
<text class="calendar-subtitle">红线相系,良缘成就一生欢喜。</text>
|
|
<text class="calendar-subtitle">红线相系,良缘成就一生欢喜。</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 月份选择 -->
|
|
<!-- 月份选择 -->
|
|
|
<view class="month-selector">
|
|
<view class="month-selector">
|
|
|
- <text class="month-text">2025年 11月</text>
|
|
|
|
|
|
|
+ <text class="month-text">{{ currentMonthText }}</text>
|
|
|
<view class="streak-badge">
|
|
<view class="streak-badge">
|
|
|
<text class="streak-text">红线季良缘</text>
|
|
<text class="streak-text">红线季良缘</text>
|
|
|
</view>
|
|
</view>
|
|
@@ -173,31 +173,43 @@ export default {
|
|
|
|
|
|
|
|
// 获取本月所有签到日期
|
|
// 获取本月所有签到日期
|
|
|
const checkinInfoRes = await api.matchmaker.checkinInfo(this.makerId, this.currentYear, this.currentMonth)
|
|
const checkinInfoRes = await api.matchmaker.checkinInfo(this.makerId, this.currentYear, this.currentMonth)
|
|
|
|
|
+ console.log('签到信息API响应:', JSON.stringify(checkinInfoRes, null, 2))
|
|
|
let checkinInfo = checkinInfoRes
|
|
let checkinInfo = checkinInfoRes
|
|
|
if (checkinInfoRes && checkinInfoRes.data) {
|
|
if (checkinInfoRes && checkinInfoRes.data) {
|
|
|
checkinInfo = checkinInfoRes.data
|
|
checkinInfo = checkinInfoRes.data
|
|
|
}
|
|
}
|
|
|
|
|
+ console.log('处理后的签到信息:', JSON.stringify(checkinInfo, null, 2))
|
|
|
|
|
|
|
|
// 获取已签到日期列表
|
|
// 获取已签到日期列表
|
|
|
this.signedDates = checkinInfo.checkedDates || []
|
|
this.signedDates = checkinInfo.checkedDates || []
|
|
|
|
|
+ console.log('已签到日期列表:', JSON.stringify(this.signedDates, null, 2))
|
|
|
|
|
+ console.log('已签到日期数量:', this.signedDates.length)
|
|
|
|
|
|
|
|
// 检查今日签到状态
|
|
// 检查今日签到状态
|
|
|
const statusRes = await api.matchmaker.checkinStatus(this.makerId)
|
|
const statusRes = await api.matchmaker.checkinStatus(this.makerId)
|
|
|
|
|
+ console.log('签到状态API响应:', statusRes)
|
|
|
let statusData = statusRes
|
|
let statusData = statusRes
|
|
|
if (statusRes && statusRes.data !== undefined) {
|
|
if (statusRes && statusRes.data !== undefined) {
|
|
|
statusData = statusRes.data
|
|
statusData = statusRes.data
|
|
|
}
|
|
}
|
|
|
this.isSigned = statusData === true || statusData?.isCheckedIn === true || statusData?.checked === true
|
|
this.isSigned = statusData === true || statusData?.isCheckedIn === true || statusData?.checked === true
|
|
|
|
|
+ console.log('今日签到状态:', this.isSigned)
|
|
|
|
|
+
|
|
|
|
|
+ // 更新日历,显示所有已签到日期
|
|
|
|
|
+ this.generateCalendar()
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.error('加载签到数据失败:', e)
|
|
console.error('加载签到数据失败:', e)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
generateCalendar() {
|
|
generateCalendar() {
|
|
|
|
|
+ console.log('开始生成日历,已签到日期:', this.signedDates)
|
|
|
const year = this.currentYear
|
|
const year = this.currentYear
|
|
|
const month = this.currentMonth
|
|
const month = this.currentMonth
|
|
|
|
|
+ console.log('当前年月:', year, month)
|
|
|
|
|
|
|
|
// 更新月份显示文本
|
|
// 更新月份显示文本
|
|
|
this.currentMonthText = `${year}年${month}月`
|
|
this.currentMonthText = `${year}年${month}月`
|
|
|
|
|
+ console.log('月份显示文本:', this.currentMonthText)
|
|
|
|
|
|
|
|
// 获取当月第一天是星期几
|
|
// 获取当月第一天是星期几
|
|
|
const firstDay = new Date(year, month - 1, 1).getDay()
|
|
const firstDay = new Date(year, month - 1, 1).getDay()
|
|
@@ -205,10 +217,12 @@ export default {
|
|
|
const daysInMonth = new Date(year, month, 0).getDate()
|
|
const daysInMonth = new Date(year, month, 0).getDate()
|
|
|
// 获取上月天数
|
|
// 获取上月天数
|
|
|
const prevMonthDays = new Date(year, month - 1, 0).getDate()
|
|
const prevMonthDays = new Date(year, month - 1, 0).getDate()
|
|
|
|
|
+ console.log('日历参数: 第一天星期几:', firstDay, '当月天数:', daysInMonth, '上月天数:', prevMonthDays)
|
|
|
|
|
|
|
|
// 获取今天的日期字符串
|
|
// 获取今天的日期字符串
|
|
|
const today = new Date()
|
|
const today = new Date()
|
|
|
const todayStr = this.formatDate(today)
|
|
const todayStr = this.formatDate(today)
|
|
|
|
|
+ console.log('今天日期:', todayStr)
|
|
|
|
|
|
|
|
const days = []
|
|
const days = []
|
|
|
|
|
|
|
@@ -227,11 +241,13 @@ export default {
|
|
|
const date = new Date(year, month - 1, i)
|
|
const date = new Date(year, month - 1, i)
|
|
|
const dateStr = this.formatDate(date)
|
|
const dateStr = this.formatDate(date)
|
|
|
const isToday = dateStr === todayStr
|
|
const isToday = dateStr === todayStr
|
|
|
|
|
+ const isSigned = this.signedDates.includes(dateStr)
|
|
|
|
|
+ console.log('生成日期:', dateStr, '是否已签到:', isSigned, '是否今天:', isToday)
|
|
|
|
|
|
|
|
days.push({
|
|
days.push({
|
|
|
day: i,
|
|
day: i,
|
|
|
isOtherMonth: false,
|
|
isOtherMonth: false,
|
|
|
- isSigned: this.signedDates.includes(dateStr),
|
|
|
|
|
|
|
+ isSigned: isSigned,
|
|
|
isToday: isToday
|
|
isToday: isToday
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -248,6 +264,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.calendarDays = days
|
|
this.calendarDays = days
|
|
|
|
|
+ console.log('生成的日历数据:', this.calendarDays)
|
|
|
},
|
|
},
|
|
|
// 格式化日期为YYYY-MM-DD
|
|
// 格式化日期为YYYY-MM-DD
|
|
|
formatDate(date) {
|
|
formatDate(date) {
|