<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>极简日期列表</title>
<link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-100-M/font-awesome/6.0.0/css/all.min.css">
<link rel="stylesheet" href="https://s2.ssl.qhres2.com/static/56662140ef7d5d03.css">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<style>
:root {
--primary-color: #2c3e50;
--secondary-color: #95a5a6;
--background-color: #f9f9f9;
--border-color: #e0e0e0;
--text-color: #333;
--highlight-color: #3498db;
}
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
background-color: var(--background-color);
color: var(--text-color);
margin: 0;
padding: 0;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.container {
max-width: 800px;
margin: 3rem auto;
padding: 0 1.5rem;
animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.header {
text-align: center;
margin-bottom: 2.5rem;
position: relative;
}
.header h1 {
font-weight: 300;
font-size: 2.2rem;
letter-spacing: 1px;
color: var(--primary-color);
margin-bottom: 0.5rem;
}
.header p {
color: var(--secondary-color);
font-size: 0.9rem;
letter-spacing: 0.5px;
}
.date-list-container {
background: white;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
overflow: hidden;
}
.date-list-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.2rem 1.5rem;
border-bottom: 1px solid var(--border-color);
background-color: var(--primary-color);
color: white;
}
.date-list-header h2 {
font-weight: 400;
font-size: 1.2rem;
margin: 0;
}
.month-indicator {
font-size: 0.9rem;
opacity: 0.9;
}
.date-list {
list-style: none;
padding: 0;
margin: 0;
}
.date-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.5rem;
border-bottom: 1px solid var(--border-color);
transition: all 0.2s ease;
}
.date-item:last-child {
border-bottom: none;
}
.date-item:hover {
background-color: rgba(0, 0, 0, 0.02);
}
.date-info {
display: flex;
align-items: center;
}
.day-number {
font-size: 1.8rem;
font-weight: 300;
width: 2.5rem;
text-align: center;
color: var(--primary-color);
}
.day-details {
margin-left: 1.5rem;
}
.day-name {
font-size: 0.9rem;
color: var(--secondary-color);
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 0.2rem;
}
.full-date {
font-size: 0.85rem;
color: var(--secondary-color);
}
.today-badge {
background-color: var(--highlight-color);
color: white;
font-size: 0.7rem;
padding: 0.2rem 0.5rem;
border-radius: 10px;
margin-left: 1rem;
}
.empty-state {
padding: 3rem 1.5rem;
text-align: center;
color: var(--secondary-color);
}
.empty-state i {
font-size: 2rem;
margin-bottom: 1rem;
opacity: 0.5;
}
.empty-state p {
margin: 0;
}
</style>
</head>
<body>
<div id="app" class="container">
<div class="header">
<h1>日期概览</h1>
<p>Current Month's Date List - Sorted Descending</p>
</div>
<div class="date-list-container">
<div class="date-list-header">
<h2>日期列表</h2>
<span class="month-indicator">{{ currentMonthName }}</span>
</div>
<ul class="date-list" v-if="filteredDates.length > 0">
<li class="date-item" v-for="date in filteredDates" :key="date.fullDate">
<div class="date-info">
<div class="day-number">{{ date.day }}</div>
<div class="day-details">
<div class="day-name">{{ date.dayName }}</div>
<div class="full-date">{{ date.fullDate }}</div>
</div>
</div>
<span class="today-badge" v-if="date.isToday">Aujourd'hui</span>
</li>
</ul>
<div class="empty-state" v-else>
<i class="far fa-calendar-alt"></i>
<p>本月没有可用的日期</p>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
currentDate: new Date(),
dates: []
}
},
computed: {
currentMonthName() {
const options = { month: 'long', year: 'numeric' };
return this.currentDate.toLocaleDateString('zh-CN', options);
},
filteredDates() {
const today = new Date();
today.setHours(0, 0, 0, 0);
return this.dates
.filter(date => {
const dateObj = new Date(date.fullDate);
return dateObj <= today;
})
.sort((a, b) => {
return new Date(b.fullDate) - new Date(a.fullDate);
});
}
},
created() {
this.generateDates();
},
methods: {
generateDates() {
const year = this.currentDate.getFullYear();
const month = this.currentDate.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
const today = new Date();
today.setHours(0, 0, 0, 0);
const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
for (let day = 1; day <= daysInMonth; day++) {
const date = new Date(year, month, day);
const dayName = dayNames[date.getDay()];
const formattedDate = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
this.dates.push({
day: day,
dayName: dayName,
fullDate: formattedDate,
isToday: date.getTime() === today.getTime()
});
}
}
}
});
</script>
</body>
</html>