From 95441d649f5efc7eb253916319f07c906f836510 Mon Sep 17 00:00:00 2001 From: renzhijun <3051619471@qq.com> Date: Wed, 28 Jan 2026 14:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=8E=86=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/LCCalendar/LCCalendar.vue | 694 +++++++++++++++++---------- pages/geGuCenter/geGuCenter.vue | 34 +- pages/ztfx/ztfx.vue | 128 ++++- pagesStock/static/icon/ai-icon.png | Bin 2166 -> 1571 bytes request/api.js | 26 + 5 files changed, 633 insertions(+), 249 deletions(-) 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); + } + } + } + } +