diff --git a/components/LCCalendar/LCCalendar.vue b/components/LCCalendar/LCCalendar.vue
index f622576..03d7a51 100644
--- a/components/LCCalendar/LCCalendar.vue
+++ b/components/LCCalendar/LCCalendar.vue
@@ -5,13 +5,14 @@
-
+
{{selectDateStr}}
+
@@ -26,14 +27,26 @@
-
+
{{item.day}}
休市
- 66家
- 商业航天
+
+
+ {{getCalendarItemByDate(item.date)?.zt_count}}家
+
+
+
+ {{getCalendarItemByDate(item.date)?.top_sector || '-'}}
+
+
@@ -42,8 +55,10 @@
-
+
{{item.day}}
@@ -51,10 +66,18 @@
休市
- 66家
- 商业航天
+
+
+ {{getCalendarItemByDate(item.date)?.zt_count}}家
+
+
+
+ {{getCalendarItemByDate(item.date)?.top_sector || '-'}}
+
+
-
@@ -63,241 +86,405 @@
-
+ }
+ },
+ /**
+ * 点击下个月
+ */
+ clickNextMonth() {
+ if (this.selectMonthIndex < this.monthDateList.length - 1) {
+ this.selectMonthIndex++
+ let monthList = this.monthDateList[this.selectMonthIndex]
+ let year = ''
+ let month = ''
+ for (let item of monthList) {
+ if (item.isCurrentMonth) {
+ year = item.year
+ month = item.month
+ break
+ }
+ }
+ let lastDay = ''
+ for (let item of monthList) {
+ if (item.isLastDay) {
+ lastDay = item.day
+ break
+ }
+ }
+ this.selectMonth = year + '年' + month + '月'
+ this.startDateStr = year + '-' + (month > 9 ? month : ('0' + month)) + '-' + '01'
+ this.endDateStr = year + '-' + (month > 9 ? month : ('0' + month)) + '-' + lastDay
+ console.log('点击下个月');
+ this.selectYear = year
+ this.Month = month;
+ this.getCalendarCombinedData()
+ }
+ },
+ monthChange(e) {
+ let currentDate = new Date();
+ //当前年份
+ let currentYear = currentDate.getFullYear()
+ //选中年月
+ let yearMonth = e.detail.value
+ let selectYear = parseInt(yearMonth.split('-')[0])
+ let selectMonth = parseInt(yearMonth.split('-')[1])
+ this.selectMonthIndex = (selectYear - (currentYear - 20)) * 12 + selectMonth - 1
+ this.selectMonth = selectYear + '年' + selectMonth + '月'
+ this.startDateStr = selectYear + '-' + (selectMonth > 9 ? selectMonth : ('0' + selectMonth)) + '-' + '01'
+ let lastDayOfMonth = new Date(selectYear, selectMonth, 0);
+ this.endDateStr = selectYear + '-' + (selectMonth > 9 ? selectMonth : ('0' + selectMonth)) + '-' +
+ lastDayOfMonth.getDate()
+ console.log('月份变更');
+ // 月份切换时更新接口数据
+ this.selectYear = selectYear;
+ this.Month = selectMonth;
+ this.getCalendarCombinedData();
+ },
+ /**
+ * 点击选择开始日期和结束日期
+ * @param {Object} item
+ */
+ clickSelectDate(item, index) { // 新增index参数
+ if (!item.isCurrentMonth) return
+ if (this.selectDateStr != item.date) {
+ this.selectDateStr = item.date
+ // 1. 获取该日期的接口数据
+ const apiData = this.getCalendarItemByDate(item.date) || {};
+ // 2. 合并本地item和接口数据,补充默认值
+ const mergedItem = {
+ ...item, // 本地日期基础数据
+ zt_count: apiData.zt_count || 0, // 涨停家数,默认0
+ top_sector: apiData.top_sector || '-', // 热门板块,默认'-'
+ zaban_rate: apiData.zaban_rate || '0%', // 炸板率,示例字段
+ isWeekend: index % 7 === 0 || index % 7 === 6 // 是否周末
+ };
+ this.chgStockData = mergedItem;
+ // 3. 解析日期,触发事件传递合并后的item
+ const [year, month, day] = item.date.split('-').map(Number);
+ this.emitDateChange(year, month, day, mergedItem);
+ console.log('点击某天(含接口数据)', mergedItem);
+ }
+ }
+ }
+ }
+