fix(资讯页面): 修复日历组件日期范围及样式问题

调整日历组件的最小日期为当前日期,修复日期格式不一致问题。优化页面多个视图容器的样式,移除冗余代码并统一格式。修改日期选择逻辑,确保时间格式统一。
This commit is contained in:
zzp 2025-09-23 12:55:32 +08:00
parent 654b908f16
commit 680f074c37
1 changed files with 24 additions and 19 deletions

View File

@ -58,8 +58,7 @@
<indexMenuTitle title="资讯评分分布区间"></indexMenuTitle> <indexMenuTitle title="资讯评分分布区间"></indexMenuTitle>
<Line style="margin-top: 30rpx" :data="lineData"></Line> <Line style="margin-top: 30rpx" :data="lineData"></Line>
<view <view style="display: flex; flex-direction: column; text-align: center; justify-content: center; align-items: center; padding-bottom: 30rpx">
style="display: flex; flex-direction: column; text-align: center; justify-content: center; align-items: center; padding-bottom: 30rpx">
<InfoSummary style="width: 85%" :count="newsNum"></InfoSummary> <InfoSummary style="width: 85%" :count="newsNum"></InfoSummary>
</view> </view>
</view> </view>
@ -67,10 +66,9 @@
<view style="background-color: white; margin-top: 40rpx"> <view style="background-color: white; margin-top: 40rpx">
<div style="display: flex; justify-content: space-between; align-items: center"> <div style="display: flex; justify-content: space-between; align-items: center">
<indexMenuTitle title="资讯头条 Top20"></indexMenuTitle> <indexMenuTitle title="资讯头条 Top20"></indexMenuTitle>
<view <view style="display: flex; align-items: center; margin-right: 15rpx; font-size: 30rpx; gap: 10rpx; margin-top: 10rpx" @click="showCalendar">
style="display: flex; align-items: center; margin-right: 15rpx;font-size: 30rpx;gap: 10rpx;margin-top: 10rpx;"> {{ chooseDate.startDate.split(" ")[0] }}
{{ chooseDate.startDate.split(' ')[0] }} <u-icon name="calendar" size="26" style="margin-right: 10rpx"></u-icon>
<u-icon name="calendar" size="26" style="margin-right: 10rpx; " @click="showCalendar"></u-icon>
</view> </view>
<!-- <view style="display: flex; align-items: center; gap: 25rpx;margin-right: 15px;margin-top: 10px;"> <!-- <view style="display: flex; align-items: center; gap: 25rpx;margin-right: 15px;margin-top: 10px;">
@ -83,8 +81,7 @@
</view> </view>
<view style="background-color: white; margin-top: 40rpx"> <view style="background-color: white; margin-top: 40rpx">
<view <view style="display: flex; justify-content: space-between; align-items: center; padding-right: 30rpx; height: 100rpx">
style="display: flex; justify-content: space-between; align-items: center; padding-right: 30rpx; height: 100rpx">
<indexMenuTitle title="热门行业池 Top10"></indexMenuTitle> <indexMenuTitle title="热门行业池 Top10"></indexMenuTitle>
<view style="display: flex; gap: 3rpx"> <view style="display: flex; gap: 3rpx">
<text class="view-all" @click="onViewAll(0)">查看全部</text> <text class="view-all" @click="onViewAll(0)">查看全部</text>
@ -96,8 +93,7 @@
</view> </view>
<view style="background-color: white; margin-top: 40rpx"> <view style="background-color: white; margin-top: 40rpx">
<view <view style="display: flex; justify-content: space-between; align-items: center; padding-right: 30rpx; height: 100rpx">
style="display: flex; justify-content: space-between; align-items: center; padding-right: 30rpx; height: 100rpx">
<indexMenuTitle title="风口概念池 Top10"></indexMenuTitle> <indexMenuTitle title="风口概念池 Top10"></indexMenuTitle>
<view style="display: flex; gap: 3rpx"> <view style="display: flex; gap: 3rpx">
<text class="view-all" @click="onViewAll(1)">查看全部</text> <text class="view-all" @click="onViewAll(1)">查看全部</text>
@ -110,11 +106,20 @@
<view class="logout" @click="loginOut" v-if="Session.get('token')">退出登录</view> <view class="logout" @click="loginOut" v-if="Session.get('token')">退出登录</view>
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose" <LoginPopup
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" /> :show="LoginShow"
@handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback"
@handlePopupErrorCallback="handlePopupErrorCallback" />
<u-calendar :show="calendarShow" :min-date="minDate" closeOnClickOverlay :max-date="maxDate" <u-calendar
@confirm="calendarConfirm" @close="calendarShow = false"> :show="calendarShow"
min-date="2025-01-01"
closeOnClickOverlay
:max-date="maxDate"
monthNum="12"
@confirm="calendarConfirm"
@close="calendarShow = false">
</u-calendar> </u-calendar>
</view> </view>
</template> </template>
@ -144,8 +149,8 @@ const year = d.getFullYear();
let month = d.getMonth() + 1; let month = d.getMonth() + 1;
month = month < 10 ? `0${month}` : month; month = month < 10 ? `0${month}` : month;
const date = d.getDate(); const date = d.getDate();
const maxDate = `${year}-${month}-${date + 1}`; const maxDate = `${year}-${month}-${date} 23:59:59`;
const minDate = `${year}-${month}-${date - 20}`; const minDate = `${year}-${month}-${date}`;
const calendarShow = ref(false); const calendarShow = ref(false);
const newsList = ref([]); const newsList = ref([]);
@ -182,10 +187,10 @@ const chooseDate = reactive({
const today = new Date(); const today = new Date();
function calendarConfirm(dateList) { function calendarConfirm(dateList) {
console.log("🚀 ~ calendarConfirm ~ dateList:", dateList) console.log("🚀 ~ calendarConfirm ~ dateList:", dateList);
if (dateList && dateList.length > 0) { if (dateList && dateList.length > 0) {
chooseDate.startDate = dateList[0] + ' 00:00:00'; chooseDate.startDate = dateList[0] + " 00:00:00";
chooseDate.endDate = dateList[dateList.length - 1] + ' 23:59:59'; chooseDate.endDate = dateList[dateList.length - 1] + " 23:59:59";
} }
getNewsList(); getNewsList();
calendarShow.value = false; calendarShow.value = false;