Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2c97ca1fb | ||
|
|
8188364813 | ||
|
|
b50d8e17e2 | ||
|
|
c70aeff2ed | ||
|
|
f63ab8b8ea | ||
|
|
b48e95c800 | ||
|
|
bf1be1aa9f | ||
|
|
083935f2da | ||
|
|
e6ae7f2eb4 | ||
|
|
24561e1f59 | ||
|
|
9fad18733e | ||
|
|
5e97f6d6d8 | ||
|
|
99bc6d3c6c | ||
|
|
5d3192dfaf | ||
|
|
9c9511e817 | ||
|
|
b5dbb13956 | ||
|
|
5ef340cb08 | ||
|
|
073b570681 | ||
|
|
ce0e374e86 | ||
|
|
f7bbc505b9 | ||
|
|
351e1f18ae |
5
app.py
5
app.py
@@ -136,8 +136,7 @@ def compute_stats():
|
||||
pillar = classify_auto(name)
|
||||
all_study_items.append({
|
||||
'name': name.strip(),
|
||||
'done': si.get('done', False) if isinstance(si, dict) else False,
|
||||
'note': si.get('note', '') if isinstance(si, dict) else '',
|
||||
'count': si.get('count', 0) if isinstance(si, dict) else 0,
|
||||
'pillar': pillar
|
||||
})
|
||||
|
||||
@@ -149,7 +148,7 @@ def compute_stats():
|
||||
isinstance(x, str) and x.strip() or
|
||||
isinstance(x, dict) and (x.get('mistake', '') or '').strip()
|
||||
))
|
||||
study_count = sum(1 for x in study if x.get('done'))
|
||||
study_count = sum(1 for x in study if x.get('count', 0) > 0)
|
||||
|
||||
total_morning += morning_count
|
||||
total_evening += evening_count
|
||||
|
||||
205
static/app.js
205
static/app.js
@@ -6,7 +6,8 @@
|
||||
State
|
||||
================================================================ */
|
||||
var calendarStatus = {}; // { "2026-W30": "pass", ... }
|
||||
var calYear; // 日历显示的年
|
||||
var calYear;
|
||||
var calMonth = new Date().getMonth(); // 月份索引 0-11
|
||||
var activePanel = 'daily';
|
||||
var weekOffset = 0;
|
||||
var lastSavedData = null;
|
||||
@@ -145,46 +146,58 @@
|
||||
renderCalendar();
|
||||
};
|
||||
|
||||
/** 渲染周历(4周一行 + 月份分组) */
|
||||
/** 切换月份 */
|
||||
window.changeCalMonth = function(dir) {
|
||||
calMonth += dir;
|
||||
if (calMonth > 11) { calMonth = 0; calYear++; }
|
||||
if (calMonth < 0) { calMonth = 11; calYear--; }
|
||||
renderCalendar();
|
||||
};
|
||||
|
||||
/** 渲染年-月-周选择器 */
|
||||
function renderCalendar() {
|
||||
document.getElementById('cal-year-label').textContent = calYear + '年';
|
||||
var yearStart = new Date(calYear, 0, 1);
|
||||
var yearEnd = new Date(calYear, 11, 31);
|
||||
document.getElementById('cal-month-label').textContent = (calMonth + 1) + '月';
|
||||
|
||||
// 计算该月包含的周
|
||||
var firstDay = new Date(calYear, calMonth, 1);
|
||||
var lastDay = new Date(calYear, calMonth + 1, 0);
|
||||
var monday = new Date(firstDay);
|
||||
monday.setDate(monday.getDate() - monday.getDay() + (monday.getDay() === 0 ? -6 : 1));
|
||||
var weeks = [];
|
||||
var d = new Date(yearStart);
|
||||
d.setDate(d.getDate() - d.getDay() + (d.getDay() === 0 ? -6 : 1));
|
||||
var lastMonth = -1;
|
||||
var monthsList = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
|
||||
while (d <= yearEnd) {
|
||||
var wk = fmtWeek(d);
|
||||
var mon = new Date(d);
|
||||
var mIdx = mon.getMonth();
|
||||
var isMonthStart = (mIdx !== lastMonth && mon.getDate() <= 7);
|
||||
weeks.push({ wk: wk, monthLabel: isMonthStart ? monthsList[mIdx] : '' });
|
||||
lastMonth = mIdx;
|
||||
d.setDate(d.getDate() + 7);
|
||||
while (monday <= lastDay) {
|
||||
weeks.push(fmtWeek(monday));
|
||||
monday.setDate(monday.getDate() + 7);
|
||||
}
|
||||
|
||||
var todayWk = fmtWeek(new Date());
|
||||
var el = document.getElementById('cal-week-list');
|
||||
var html = '';
|
||||
for (var i = 0; i < weeks.length; i++) {
|
||||
var we = weeks[i];
|
||||
var w = we.wk;
|
||||
var cls = 'cal-week-cell';
|
||||
var today = new Date();
|
||||
var wHtml = '';
|
||||
for (var i2 = 0; i2 < weeks.length; i2++) {
|
||||
var w = weeks[i2];
|
||||
var cls = 'cal-week-row';
|
||||
var status = calendarStatus[w];
|
||||
if (status) cls += ' ' + status;
|
||||
if (w === todayWk) cls += ' today';
|
||||
if (w === selectedWeek) cls += ' selected';
|
||||
if (we.monthLabel) cls += ' month-start';
|
||||
var wkNum = w.split('-W')[1].replace(/^0/, '');
|
||||
html += '<div class="' + cls + '" data-week="' + w + '" data-month="' + we.monthLabel + '" title="' + w + '">' +
|
||||
'<span class="wk-num">W' + wkNum + '</span>' +
|
||||
'<span class="wk-dot"></span>' +
|
||||
// 计算日期范围
|
||||
var monday = new Date(calYear, calMonth, 1);
|
||||
while (fmtWeek(monday) !== w) monday.setDate(monday.getDate() + 7);
|
||||
var sunday = new Date(monday);
|
||||
sunday.setDate(sunday.getDate() + 6);
|
||||
var dateRange = (monday.getMonth()+1) + '.' + monday.getDate() + ' - ' + sunday.getDate();
|
||||
var statusLabel = status === 'pass' ? '达标' : (status === 'fail' ? '未达标' : '未打卡');
|
||||
wHtml += '<div class="' + cls + '" data-week="' + w + '">' +
|
||||
'<div class="cal-wk-info">' +
|
||||
'<span class="cal-wk-label">第' + w.split('-W')[1].replace(/^0/, '') + '周</span>' +
|
||||
'<span class="cal-wk-date">' + dateRange + '</span>' +
|
||||
'</div>' +
|
||||
'<span class="cal-wk-badge">' + statusLabel + '</span>' +
|
||||
'</div>';
|
||||
}
|
||||
el.innerHTML = html;
|
||||
el.querySelectorAll('.cal-week-cell').forEach(function(cell) {
|
||||
cell.addEventListener('click', function() {
|
||||
var we = document.getElementById('cal-weeks');
|
||||
we.innerHTML = wHtml;
|
||||
we.querySelectorAll('.cal-week-row').forEach(function(row) {
|
||||
row.addEventListener('click', function() {
|
||||
var wk = this.dataset.week;
|
||||
if (wk) navigateToWeek(wk);
|
||||
});
|
||||
@@ -200,10 +213,11 @@
|
||||
}
|
||||
|
||||
window.goToCurrentWeek = function() {
|
||||
var now = fmtWeek(new Date());
|
||||
calYear = new Date().getFullYear();
|
||||
var now = new Date();
|
||||
calYear = now.getFullYear();
|
||||
calMonth = now.getMonth();
|
||||
renderCalendar();
|
||||
navigateToWeek(now);
|
||||
navigateToWeek(fmtWeek(now));
|
||||
};
|
||||
|
||||
/* ================================================================
|
||||
@@ -243,17 +257,13 @@
|
||||
}
|
||||
|
||||
var studyItems = [];
|
||||
var pItems = document.querySelectorAll('#study-list .preset-item');
|
||||
for (var k=0; k<pItems.length; k++) {
|
||||
var cb = pItems[k].querySelector('input[type="checkbox"]');
|
||||
var noteEl = pItems[k].querySelector('.preset-note');
|
||||
var nameEl = pItems[k].querySelector('.preset-name');
|
||||
var name = nameEl ? nameEl.textContent : '';
|
||||
if (cb && cb.checked) {
|
||||
studyItems.push({ name: name, done: true, note: noteEl ? noteEl.value.trim() : '' });
|
||||
} else {
|
||||
studyItems.push({ name: name, done: false, note: '' });
|
||||
}
|
||||
var sCards = document.querySelectorAll('#study-cards .study-card');
|
||||
for (var k=0; k<sCards.length; k++) {
|
||||
var nameEl = sCards[k].querySelector('.study-card-name');
|
||||
var countEl = sCards[k].querySelector('.study-card-count');
|
||||
var name = nameEl ? nameEl.textContent.trim() : '';
|
||||
var count = parseInt(countEl ? countEl.textContent : '0') || 0;
|
||||
studyItems.push({ name: name, count: count, last_checkin_date: sCards[k].dataset.lastDate || '' });
|
||||
}
|
||||
|
||||
return { morning: morningItems, evening: eveningItems, study: studyItems };
|
||||
@@ -281,16 +291,25 @@
|
||||
addEveningRow(item.mistake || '', item.improvement || '');
|
||||
}
|
||||
|
||||
// 勤学 — 渲染预设项目并回填状态
|
||||
// 勤学 — 渲染已保存习惯 + 未渲染预设
|
||||
var studyMap = {};
|
||||
for (var si=0; si<study.length; si++) {
|
||||
studyMap[study[si].name] = study[si];
|
||||
}
|
||||
document.getElementById('study-list').innerHTML = '';
|
||||
var rendered = {};
|
||||
document.getElementById('study-cards').innerHTML = '';
|
||||
for (var sk=0; sk<study.length; sk++) {
|
||||
var item = study[sk];
|
||||
if (item.name) {
|
||||
renderStudyCard(item.name, item.count || 0, item.last_checkin_date || '');
|
||||
rendered[item.name] = true;
|
||||
}
|
||||
}
|
||||
for (var sp=0; sp<PRESET_STUDY_ITEMS.length; sp++) {
|
||||
var sName = PRESET_STUDY_ITEMS[sp];
|
||||
var saved = studyMap[sName] || { done: false, note: '' };
|
||||
addPresetItem(sName, saved.done, saved.note || '');
|
||||
if (!rendered[sName]) {
|
||||
renderStudyCard(sName, 0, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,35 +352,68 @@
|
||||
container.appendChild(div);
|
||||
}
|
||||
|
||||
/* ── 勤学预设项目 ── */
|
||||
/* ── 勤学打卡卡片 ── */
|
||||
|
||||
function addPresetItem(name, done, note) {
|
||||
var container = document.getElementById('study-list');
|
||||
function renderStudyCard(name, count, lastDate) {
|
||||
var container = document.getElementById('study-cards');
|
||||
var today = fmtDate(new Date());
|
||||
var checked = count > 0;
|
||||
var checkedToday = lastDate === today;
|
||||
var btnText = checkedToday ? '已打卡' : '打卡';
|
||||
var div = document.createElement('div');
|
||||
div.className = 'preset-item' + (done ? ' active' : '');
|
||||
var noteEsc = esc(note || '');
|
||||
div.className = 'study-card' + (checked ? ' checked' : '');
|
||||
div.setAttribute('data-last-date', lastDate || '');
|
||||
div.innerHTML =
|
||||
'<label class="preset-check">' +
|
||||
'<input type="checkbox"' + (done ? ' checked' : '') + ' onchange="togglePresetNote(this)">' +
|
||||
'<span class="preset-name">' + esc(name) + '</span>' +
|
||||
'</label>' +
|
||||
'<textarea class="preset-note" placeholder="一句话备注…">' + noteEsc + '</textarea>';
|
||||
'<button class="study-card-del" onclick="deleteStudyItem(this)" title="删除">×</button>' +
|
||||
'<div class="study-card-info">' +
|
||||
'<span class="study-card-name">' + esc(name) + '</span>' +
|
||||
'<span class="study-card-count">' + count + '</span>' +
|
||||
'</div>' +
|
||||
'<button class="study-card-btn' + (checkedToday ? ' done' : '') + '" onclick="checkinStudy(this)">' + btnText + '</button>';
|
||||
container.appendChild(div);
|
||||
}
|
||||
|
||||
window.togglePresetNote = function(cb) {
|
||||
var item = cb.closest('.preset-item');
|
||||
if (item) {
|
||||
if (cb.checked) item.classList.add('active');
|
||||
else { item.classList.remove('active'); item.querySelector('.preset-note').value = ''; }
|
||||
}
|
||||
window.toggleStudyEdit = function() {
|
||||
var panel = document.getElementById('panel-daily');
|
||||
var btn = document.getElementById('study-edit-toggle');
|
||||
if (!panel || !btn) return;
|
||||
var editing = panel.classList.toggle('editing-study');
|
||||
btn.classList.toggle('active', editing);
|
||||
};
|
||||
|
||||
window.addStudyItem = function() {
|
||||
var name = prompt('请输入新习惯名称:');
|
||||
if (!name || !name.trim()) return;
|
||||
renderStudyCard(name.trim(), 0, '');
|
||||
triggerAutoSave();
|
||||
};
|
||||
|
||||
window.deleteStudyItem = function(btn) {
|
||||
var card = btn.closest('.study-card');
|
||||
var nameEl = card.querySelector('.study-card-name');
|
||||
if (nameEl && !confirm('确定删除「' + nameEl.textContent + '」?')) return;
|
||||
card.remove();
|
||||
triggerAutoSave();
|
||||
};
|
||||
|
||||
window.checkinStudy = function(btn) {
|
||||
var card = btn.closest('.study-card');
|
||||
var today = fmtDate(new Date());
|
||||
if (card.dataset.lastDate === today) { showToast('今天已打卡', 'info'); return; }
|
||||
var countEl = card.querySelector('.study-card-count');
|
||||
var count = parseInt(countEl.textContent) + 1;
|
||||
countEl.textContent = count;
|
||||
card.dataset.lastDate = today;
|
||||
card.classList.add('checked');
|
||||
btn.classList.add('done');
|
||||
btn.textContent = '已打卡';
|
||||
triggerAutoSave();
|
||||
};
|
||||
|
||||
function initStudyPresets() {
|
||||
document.getElementById('study-list').innerHTML = '';
|
||||
document.getElementById('study-cards').innerHTML = '';
|
||||
for (var i=0; i<PRESET_STUDY_ITEMS.length; i++) {
|
||||
addPresetItem(PRESET_STUDY_ITEMS[i], false, '');
|
||||
renderStudyCard(PRESET_STUDY_ITEMS[i], 0, '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,8 +485,6 @@
|
||||
};
|
||||
|
||||
window.addMorning = function() {
|
||||
var count = document.querySelectorAll('#morning-list .item-row').length;
|
||||
if (count >= 3) { showToast('最多 3 条立志', 'error'); return; }
|
||||
addMorningRow('');
|
||||
};
|
||||
window.addEvening = function() {
|
||||
@@ -461,6 +511,17 @@
|
||||
if (card) card.classList.add('active');
|
||||
};
|
||||
|
||||
/* 头像菜单 */
|
||||
window.toggleUserMenu = function(e) {
|
||||
e.stopPropagation();
|
||||
var dd = document.getElementById('user-dropdown');
|
||||
if (dd) dd.style.display = dd.style.display === 'none' ? 'block' : 'none';
|
||||
};
|
||||
document.addEventListener('click', function() {
|
||||
var dd = document.getElementById('user-dropdown');
|
||||
if (dd) dd.style.display = 'none';
|
||||
});
|
||||
|
||||
/* ================================================================
|
||||
Load & Auto Save Checkin
|
||||
================================================================ */
|
||||
@@ -474,7 +535,7 @@
|
||||
if (lastSavedWeek && lastSavedData !== null && currentStr !== lastSavedData) {
|
||||
var hasContent = currentData.morning.some(function(x){return x && x.trim();}) ||
|
||||
currentData.evening.some(function(x){return (x.mistake||'').trim() || (x.improvement||'').trim();}) ||
|
||||
currentData.study.some(function(x){return x.done;});
|
||||
currentData.study.some(function(x){return x.count > 0;});
|
||||
if (hasContent) {
|
||||
apiSaveCheckin(lastSavedWeek, currentData, function(){});
|
||||
}
|
||||
@@ -994,7 +1055,7 @@
|
||||
(info.evening_items || []).forEach(function(ei){ items.push({pillar: p, text: ei.mistake || ei.improvement, improvement: ei.improvement, type: 'evening'}); });
|
||||
}
|
||||
if (blueprintFilter === 'all' || blueprintFilter === 'study') {
|
||||
(info.study_items || []).forEach(function(si){ items.push({pillar: p, text: si.name, type: 'study', done: si.done, note: si.note}); });
|
||||
(info.study_items || []).forEach(function(si){ items.push({pillar: p, text: si.name, type: 'study', count: si.count}); });
|
||||
}
|
||||
});
|
||||
if (items.length === 0) {
|
||||
@@ -1012,7 +1073,7 @@
|
||||
items.forEach(function(item){
|
||||
var dot = '<span class="bp-pillar-dot" style="background:' + (pillarColors[item.pillar.name] || '#94A3B8') + '"></span>';
|
||||
var extra = '';
|
||||
if (item.type === 'study' && item.note) extra = '<span class="bp-item-note">' + esc(item.note) + '</span>';
|
||||
if (item.type === 'study' && item.count > 0) extra = '<span class="bp-item-note">打卡 ' + item.count + ' 次</span>';
|
||||
if (item.type === 'evening' && item.improvement) extra = '<span class="bp-item-note evening">→ ' + esc(item.improvement) + '</span>';
|
||||
html += '<div class="bp-list-item">' +
|
||||
dot +
|
||||
|
||||
260
static/style.css
260
static/style.css
@@ -71,6 +71,41 @@ body {
|
||||
gap: 8px;
|
||||
padding: 24px 12px 16px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sidebar-user .user-avatar {
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
.sidebar-user:hover .user-avatar { transform: scale(1.05); }
|
||||
|
||||
.user-dropdown {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: var(--card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: var(--shadow-hover);
|
||||
z-index: 100;
|
||||
min-width: 120px;
|
||||
padding: 4px;
|
||||
}
|
||||
.user-dropdown-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
color: var(--text-dim);
|
||||
text-decoration: none;
|
||||
border-radius: 6px;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.user-dropdown-item:hover {
|
||||
background: var(--danger-light);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.sidebar-user .user-name {
|
||||
@@ -146,6 +181,10 @@ body {
|
||||
gap: 8px;
|
||||
padding: 0 20px 20px;
|
||||
}
|
||||
.daily-sidebar .sidebar-stats {
|
||||
padding: 0;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
background: var(--bg);
|
||||
@@ -170,6 +209,45 @@ body {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Sidebar Dark Theme(左侧导航栏专属)
|
||||
═══════════════════════════════════════════ */
|
||||
.sidebar {
|
||||
background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
|
||||
border-right: 1px solid #334155;
|
||||
}
|
||||
.sidebar .user-name {
|
||||
color: #94A3B8;
|
||||
}
|
||||
.sidebar .user-avatar {
|
||||
background: #4F46E5;
|
||||
color: #FFF;
|
||||
}
|
||||
.sidebar .btn-logout-icon {
|
||||
color: #64748B;
|
||||
}
|
||||
.sidebar .btn-logout-icon:hover {
|
||||
background: rgba(248,113,113,0.15);
|
||||
color: #FCA5A5;
|
||||
}
|
||||
.sidebar .nav-item {
|
||||
color: #94A3B8;
|
||||
}
|
||||
.sidebar .nav-item:hover {
|
||||
background: rgba(99,102,241,0.08);
|
||||
color: #E2E8F0;
|
||||
}
|
||||
.sidebar .nav-item .icon-md {
|
||||
color: #6366F1;
|
||||
}
|
||||
.sidebar .nav-item:hover .icon-md { color: #818CF8; }
|
||||
.sidebar .nav-item.active {
|
||||
background: rgba(99,102,241,0.15);
|
||||
color: #FFF;
|
||||
border: 1px solid rgba(99,102,241,0.3);
|
||||
}
|
||||
.sidebar .nav-item.active .icon-md { color: #818CF8; }
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Calendar Widget
|
||||
═══════════════════════════════════════════ */
|
||||
@@ -177,6 +255,97 @@ body {
|
||||
.calendar-widget {
|
||||
padding: 0 16px 12px;
|
||||
}
|
||||
.calendar-widget.inline {
|
||||
margin: 0 0 16px;
|
||||
padding: 12px 0;
|
||||
border: 1.5px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--card);
|
||||
}
|
||||
.calendar-widget.inline .cal-header {
|
||||
padding: 0 14px 8px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.cal-nav-group { display: flex; gap: 4px; }
|
||||
.cal-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--card);
|
||||
cursor: pointer;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
.cal-nav:hover { background: var(--bg); color: var(--text); }
|
||||
/* 月份翻页行 */
|
||||
.cal-month-header {
|
||||
padding: 4px 14px 8px;
|
||||
}
|
||||
.cal-month-header .cal-month-label {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* 周列表行 */
|
||||
.cal-week-rows {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 8px 14px 10px;
|
||||
}
|
||||
.cal-week-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 10px;
|
||||
border: 0.5px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--card);
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.cal-week-row:hover { border-color: var(--primary); }
|
||||
.cal-week-row.today { border-color: var(--primary); }
|
||||
.cal-week-row.selected { background: var(--primary); color: #FFF; border-color: transparent; }
|
||||
.cal-week-row.selected .cal-wk-label,
|
||||
.cal-week-row.selected .cal-wk-date,
|
||||
.cal-week-row.selected .cal-wk-badge { color: #FFF; }
|
||||
.cal-week-row.selected .cal-wk-status { background: rgba(255,255,255,0.2); color: #FFF; }
|
||||
|
||||
.cal-wk-status {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.cal-wk-status.pass { background: var(--success-light); color: var(--success); }
|
||||
.cal-wk-status.fail { background: var(--danger-light); color: var(--danger); }
|
||||
.cal-wk-status.empty { background: var(--bg); color: var(--text-muted); }
|
||||
|
||||
.cal-wk-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
.cal-wk-label { font-size: 12px; font-weight: 600; color: var(--text); }
|
||||
.cal-wk-date { font-size: 10px; color: var(--text-muted); }
|
||||
.cal-wk-badge { font-size: 10px; color: var(--text-muted); }
|
||||
|
||||
/* 旧样式隐藏 */
|
||||
.cal-weeks { display: none; }
|
||||
.cal-week-cell { display: none; }
|
||||
|
||||
.cal-header {
|
||||
display: flex;
|
||||
@@ -505,27 +674,61 @@ body {
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Daily Grid — 三栏
|
||||
Daily Panel — 左右两栏布局
|
||||
═══════════════════════════════════════════ */
|
||||
|
||||
.daily-grid {
|
||||
display: block;
|
||||
.daily-layout {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
/* 左侧栏 */
|
||||
.daily-sidebar {
|
||||
width: 200px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.daily-sidebar .sidebar-stats {
|
||||
padding: 0;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.daily-sidebar .stat-item {
|
||||
background: var(--card);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.daily-sidebar .calendar-widget.inline {
|
||||
margin: 0;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--card);
|
||||
}
|
||||
|
||||
/* 右侧主区 */
|
||||
.daily-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
.card.daily-card { display: none; }
|
||||
.card.daily-card.active { display: flex; }
|
||||
|
||||
/* 每周打卡 Tab */
|
||||
.daily-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin-bottom: 16px;
|
||||
gap: 0;
|
||||
border-bottom: 1.5px solid var(--border);
|
||||
}
|
||||
.daily-tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 8px 16px;
|
||||
gap: 6px;
|
||||
padding: 8px 18px;
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: 13px;
|
||||
@@ -537,10 +740,12 @@ body {
|
||||
transition: all 0.15s;
|
||||
font-family: inherit;
|
||||
}
|
||||
.daily-tab .icon-sm { opacity: 0.6; }
|
||||
.daily-tab:hover { color: var(--text); }
|
||||
.daily-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
|
||||
.daily-tab.active .icon-sm { opacity: 1; }
|
||||
|
||||
.daily-grid { display: block; }
|
||||
.card.daily-card { display: none; }
|
||||
.card.daily-card.active { display: flex; }
|
||||
|
||||
/* ── Cards ── */
|
||||
|
||||
@@ -627,9 +832,8 @@ body {
|
||||
}
|
||||
|
||||
/* 编辑模式下才显示的元素 */
|
||||
.edit-only { display: none; }
|
||||
.card.editing .edit-only { display: flex; }
|
||||
.card.editing .btn-del { display: inline-flex; }
|
||||
.edit-only { display: flex; }
|
||||
.btn-edit-toggle:not(#study-edit-toggle) { display: none; }
|
||||
|
||||
/* 默认隐藏删除按钮 */
|
||||
.btn-del { display: none; }
|
||||
@@ -1578,3 +1782,29 @@ body {
|
||||
@media (max-width: 900px) {
|
||||
.quad-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
|
||||
}
|
||||
|
||||
/* 勤学打卡卡片 - 3×3网格 */
|
||||
#study-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
|
||||
.study-card { position:relative; display:flex; flex-direction:column; align-items:center; gap:10px; padding:18px 12px 14px; border:1px solid var(--border); border-radius:var(--radius); background:var(--card); transition:all 0.2s; text-align:center; }
|
||||
.study-card:hover { border-color:var(--primary); box-shadow:var(--shadow); }
|
||||
.study-card.checked { border-color:var(--success); background:var(--success-light); }
|
||||
.study-card-info { display:flex; flex-direction:column; align-items:center; gap:6px; flex:1; }
|
||||
.study-card-name { font-size:13px; color:var(--text); font-weight:500; line-height:1.4; min-height:36px; display:flex; align-items:center; }
|
||||
.study-card-count { font-size:24px; color:var(--text-muted); font-weight:600; background:var(--bg); border-radius:50%; width:40px; height:40px; display:flex; align-items:center; justify-content:center; }
|
||||
.study-card.checked .study-card-count { background:var(--success); color:#FFF; }
|
||||
.study-card-btn { padding:5px 14px; border:1px solid var(--primary); border-radius:var(--radius-sm); background:transparent; color:var(--primary); font-size:12px; font-weight:500; cursor:pointer; transition:all 0.15s; font-family:inherit; }
|
||||
.study-card-btn:hover { background:var(--primary); color:#FFF; }
|
||||
.study-card-btn.done { background:var(--success-light); color:var(--success); border-color:var(--success); cursor:default; }
|
||||
.study-card-del { display:none; }
|
||||
#panel-daily.editing-study .study-card-del { display:flex; align-items:center; justify-content:center; position:absolute; top:6px; right:6px; border:none; background:var(--danger-light); color:var(--danger); cursor:pointer; font-size:14px; width:22px; height:22px; border-radius:50%; line-height:1; }
|
||||
#panel-daily.editing-study .study-card-del:hover { background:var(--danger); color:#FFF; }
|
||||
.study-card.checked { border-color:var(--success); background:var(--success-light); }
|
||||
.study-card-info { display:flex; flex-direction:column; align-items:center; gap:4px; }
|
||||
.study-card-name { font-size:12px; color:var(--text); font-weight:500; line-height:1.3; }
|
||||
.study-card-count { font-size:18px; color:var(--text-muted); font-weight:700; background:var(--bg); border-radius:50%; width:32px; height:32px; display:flex; align-items:center; justify-content:center; }
|
||||
.study-card.checked .study-card-count { background:var(--success); color:#FFF; }
|
||||
.study-card-btn { padding:5px 12px; border:1px solid var(--primary); border-radius:var(--radius-sm); background:transparent; color:var(--primary); font-size:12px; font-weight:500; cursor:pointer; transition:all 0.15s; font-family:inherit; }
|
||||
.study-card-btn:hover { background:var(--primary); color:#FFF; }
|
||||
.study-card-btn.done { background:var(--success-light); color:var(--success); border-color:var(--success); cursor:default; }
|
||||
.edit-only-study { display: none; }
|
||||
#panel-daily.editing-study .edit-only-study { display: flex; }
|
||||
|
||||
@@ -40,12 +40,14 @@
|
||||
<aside class="sidebar">
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<div class="sidebar-user">
|
||||
<div class="sidebar-user" id="sidebar-user-menu" onclick="toggleUserMenu(event)">
|
||||
<div class="user-avatar">{{ username[0] }}</div>
|
||||
<span class="user-name">{{ username }}</span>
|
||||
<a href="/logout" class="btn-logout-icon" title="退出登录" onclick="return confirm('确定退出登录?')">
|
||||
<svg class="icon-sm"><use href="#icon-logout"/></svg>
|
||||
</a>
|
||||
<div class="user-dropdown" id="user-dropdown" style="display:none">
|
||||
<a class="user-dropdown-item" href="/logout" onclick="return confirm('确定退出登录?')">
|
||||
<svg class="icon-sm"><use href="#icon-logout"/></svg> 退出登录
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 功能入口 -->
|
||||
@@ -87,29 +89,70 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="daily-tabs">
|
||||
<button class="daily-tab active" data-tab="morning" onclick="switchDailyTab(this)">
|
||||
<svg class="icon-sm"><use href="#icon-sun"/></svg> 早间立志
|
||||
</button>
|
||||
<button class="daily-tab" data-tab="evening" onclick="switchDailyTab(this)">
|
||||
<svg class="icon-sm"><use href="#icon-magnifying-glass"/></svg> 责善改过
|
||||
</button>
|
||||
<button class="daily-tab" data-tab="study" onclick="switchDailyTab(this)">
|
||||
<svg class="icon-sm"><use href="#icon-book-open"/></svg> 勤学打卡
|
||||
</button>
|
||||
</div>
|
||||
<div class="daily-grid">
|
||||
<div class="daily-layout">
|
||||
<!-- 左侧:统计 + 日历 -->
|
||||
<div class="daily-sidebar">
|
||||
<div class="sidebar-stats" id="sidebar-stats">
|
||||
<div class="stat-item">
|
||||
<span class="stat-num" id="stat-days">--</span>
|
||||
<span class="stat-label">打卡周</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-num" id="stat-morning">--</span>
|
||||
<span class="stat-label">立志</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-num" id="stat-study">--</span>
|
||||
<span class="stat-label">勤学</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="calendar-widget inline">
|
||||
<div class="cal-header">
|
||||
<button class="cal-nav" onclick="changeCalYear(-1)">
|
||||
<svg class="icon-sm"><use href="#icon-chevron-left"/></svg>
|
||||
</button>
|
||||
<span class="cal-month-label" id="cal-year-label">2026年</span>
|
||||
<button class="cal-nav" onclick="changeCalYear(1)">
|
||||
<svg class="icon-sm"><use href="#icon-chevron-right"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="cal-header cal-month-header">
|
||||
<button class="cal-nav" onclick="changeCalMonth(-1)">
|
||||
<svg class="icon-sm"><use href="#icon-chevron-left"/></svg>
|
||||
</button>
|
||||
<span class="cal-month-label" id="cal-month-label">7月</span>
|
||||
<button class="cal-nav" onclick="changeCalMonth(1)">
|
||||
<svg class="icon-sm"><use href="#icon-chevron-right"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="cal-week-rows" id="cal-weeks"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 右侧:Tab + 内容 -->
|
||||
<div class="daily-main">
|
||||
<div class="daily-tabs">
|
||||
<button class="daily-tab active" data-tab="morning" onclick="switchDailyTab(this)">
|
||||
<svg class="icon-sm"><use href="#icon-sun"/></svg> 本周重点
|
||||
</button>
|
||||
<button class="daily-tab" data-tab="evening" onclick="switchDailyTab(this)">
|
||||
<svg class="icon-sm"><use href="#icon-magnifying-glass"/></svg> 责善改过
|
||||
</button>
|
||||
<button class="daily-tab" data-tab="study" onclick="switchDailyTab(this)">
|
||||
<svg class="icon-sm"><use href="#icon-book-open"/></svg> 勤学打卡
|
||||
</button>
|
||||
</div>
|
||||
<div class="daily-grid">
|
||||
<div class="card card-morning daily-card active" data-card="morning">
|
||||
<div class="card-head">
|
||||
<div class="card-head-left">
|
||||
<svg class="icon-h2"><use href="#icon-sun"/></svg>
|
||||
<h3>早间立志</h3>
|
||||
<h3>本周重点</h3>
|
||||
</div>
|
||||
<button class="btn-edit-toggle" onclick="toggleEditMode(this)" title="编辑">
|
||||
<svg class="icon-sm"><use href="#icon-pencil"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<p class="card-desc">本周最重要的 1~3 件事</p>
|
||||
<p class="card-desc">本周最重要的事</p>
|
||||
<div id="morning-list"></div>
|
||||
<button class="btn-add edit-only" onclick="addMorning()">
|
||||
<svg class="icon-sm"><use href="#icon-plus"/></svg> 增加一条
|
||||
@@ -133,13 +176,23 @@
|
||||
</div>
|
||||
<div class="card card-study daily-card" data-card="study">
|
||||
<div class="card-head">
|
||||
<svg class="icon-h2"><use href="#icon-book-open"/></svg>
|
||||
<h3>勤学打卡</h3>
|
||||
<div class="card-head-left">
|
||||
<svg class="icon-h2"><use href="#icon-book-open"/></svg>
|
||||
<h3>勤学打卡</h3>
|
||||
</div>
|
||||
<button class="btn-edit-toggle" id="study-edit-toggle" onclick="toggleStudyEdit()" title="编辑">
|
||||
<svg class="icon-sm"><use href="#icon-pencil"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<p class="card-desc">本周修行清单</p>
|
||||
<div id="study-list"></div>
|
||||
<div id="study-cards"></div>
|
||||
<button class="btn-add edit-only-study" onclick="addStudyItem()" style="margin-top:10px">
|
||||
<svg class="icon-sm"><use href="#icon-plus"/></svg> 增加习惯
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /daily-main -->
|
||||
</div><!-- /daily-layout -->
|
||||
</section>
|
||||
|
||||
<!-- ── 每周评分面板 ── -->
|
||||
|
||||
Reference in New Issue
Block a user