feat:增加文件写入安全约束
This commit is contained in:
@@ -44,12 +44,40 @@
|
||||
.page-content { flex: 1; overflow-y: auto; background: #f5f5f5; }
|
||||
.page-content::-webkit-scrollbar { display: none; }
|
||||
|
||||
/* 日期栏 */
|
||||
.date-bar {
|
||||
background: #fff; padding: 12px 16px 14px; text-align: center;
|
||||
/* 筛选栏 */
|
||||
.filter-bar {
|
||||
background: #fff; padding: 10px 16px; display: flex;
|
||||
align-items: center; justify-content: space-between;
|
||||
border-bottom: 0.5px solid #f0f0f0;
|
||||
}
|
||||
.date-text { font-size: 15px; font-weight: 600; color: #1a1a1a; }
|
||||
.canteen-selector {
|
||||
display: flex; align-items: center; gap: 4px; cursor: pointer;
|
||||
font-size: 15px; font-weight: 600; color: #1a1a1a; position: relative;
|
||||
}
|
||||
.canteen-selector .arrow { font-size: 10px; color: #999; transition: transform 0.2s; }
|
||||
.canteen-selector.open .arrow { transform: rotate(180deg); }
|
||||
.canteen-dropdown {
|
||||
position: absolute; top: 100%; left: 0; margin-top: 8px;
|
||||
background: #fff; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.12);
|
||||
min-width: 140px; z-index: 100; overflow: hidden; display: none;
|
||||
}
|
||||
.canteen-dropdown.show { display: block; }
|
||||
.canteen-option {
|
||||
padding: 12px 16px; font-size: 14px; color: #333; cursor: pointer;
|
||||
border-bottom: 0.5px solid #f5f5f5;
|
||||
}
|
||||
.canteen-option:last-child { border-bottom: none; }
|
||||
.canteen-option:active { background: #f5f5f5; }
|
||||
.canteen-option.selected { color: #1677ff; font-weight: 600; }
|
||||
.date-picker {
|
||||
display: flex; align-items: center; gap: 6px; cursor: pointer;
|
||||
}
|
||||
.date-picker input {
|
||||
border: none; background: none; font-size: 14px; color: #1a1a1a;
|
||||
font-weight: 500; width: 120px; text-align: right; cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
.date-picker .cal-icon { font-size: 16px; color: #1677ff; }
|
||||
|
||||
/* 餐次 Tab */
|
||||
.meal-tabs {
|
||||
@@ -138,14 +166,26 @@
|
||||
<div class="nav-bar">
|
||||
<a class="nav-back" href="eat-recipe.html">‹</a>
|
||||
<div class="nav-title">今日食谱</div>
|
||||
<div class="nav-action">📅</div>
|
||||
</div>
|
||||
|
||||
<!-- 内容区 -->
|
||||
<div class="page-content">
|
||||
<!-- 日期 -->
|
||||
<div class="date-bar">
|
||||
<div class="date-text" id="dateText"></div>
|
||||
<!-- 筛选栏:食堂 + 日期 -->
|
||||
<div class="filter-bar">
|
||||
<div class="canteen-selector" id="canteenSelector">
|
||||
<span class="canteen-name" id="canteenName">一号食堂</span>
|
||||
<span class="arrow">▼</span>
|
||||
<div class="canteen-dropdown" id="canteenDropdown">
|
||||
<div class="canteen-option selected" data-val="一号食堂">一号食堂</div>
|
||||
<div class="canteen-option" data-val="二号食堂">二号食堂</div>
|
||||
<div class="canteen-option" data-val="三号食堂">三号食堂</div>
|
||||
<div class="canteen-option" data-val="清真食堂">清真食堂</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="date-picker">
|
||||
<input type="date" id="dateInput">
|
||||
<span class="cal-icon">📅</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 餐次切换 -->
|
||||
@@ -368,11 +408,37 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/* 动态设置今日日期 */
|
||||
/* 日期控件默认当天 */
|
||||
var now = new Date();
|
||||
var weekDays = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
|
||||
var dateStr = now.getFullYear() + '年' + (now.getMonth()+1) + '月' + now.getDate() + '日 ' + weekDays[now.getDay()];
|
||||
document.getElementById('dateText').textContent = dateStr;
|
||||
var y = now.getFullYear(), m = String(now.getMonth()+1).padStart(2,'0'), d = String(now.getDate()).padStart(2,'0');
|
||||
document.getElementById('dateInput').value = y + '-' + m + '-' + d;
|
||||
|
||||
/* 食堂选择器 */
|
||||
var selector = document.getElementById('canteenSelector');
|
||||
var dropdown = document.getElementById('canteenDropdown');
|
||||
var nameEl = document.getElementById('canteenName');
|
||||
|
||||
selector.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
selector.classList.toggle('open');
|
||||
dropdown.classList.toggle('show');
|
||||
});
|
||||
|
||||
document.querySelectorAll('.canteen-option').forEach(function(opt) {
|
||||
opt.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
document.querySelectorAll('.canteen-option').forEach(function(o){ o.classList.remove('selected'); });
|
||||
opt.classList.add('selected');
|
||||
nameEl.textContent = opt.dataset.val;
|
||||
selector.classList.remove('open');
|
||||
dropdown.classList.remove('show');
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('click', function() {
|
||||
selector.classList.remove('open');
|
||||
dropdown.classList.remove('show');
|
||||
});
|
||||
|
||||
/* 餐次 Tab 切换 */
|
||||
var tabs = document.querySelectorAll('.meal-tab');
|
||||
|
||||
Reference in New Issue
Block a user