fix: 保存后展示日记列表并将统计移动到右侧
This commit is contained in:
@@ -299,11 +299,13 @@ function saveCurrentEntry() {
|
||||
renderTranslate({ english: translation.english, chinese: translation.chinese });
|
||||
var found = entries.find(function(e) { return e.id === state.currentId; });
|
||||
if (found) setEditor(found);
|
||||
showDiaryListView();
|
||||
document.getElementById('btn-save').textContent = '\uD83D\uDCBE 已保存 \u2713';
|
||||
setTimeout(function() { document.getElementById('btn-save').textContent = '\uD83D\uDCBE 保存'; }, 1500);
|
||||
});
|
||||
}).catch(function() {
|
||||
}).catch(function(err) {
|
||||
document.getElementById('btn-save').textContent = '\uD83D\uDCBE 保存';
|
||||
alert((err && err.message) || '保存失败,请检查网络或登录状态');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -313,6 +315,13 @@ function newEntry() {
|
||||
document.getElementById('entry-text').focus();
|
||||
}
|
||||
|
||||
function showDiaryListView() {
|
||||
document.body.dataset.view = 'list';
|
||||
document.querySelectorAll('#mobile-nav button').forEach(function(btn) {
|
||||
btn.classList.toggle('active', btn.dataset.view === 'list');
|
||||
});
|
||||
}
|
||||
|
||||
// ----- Modal -----
|
||||
|
||||
var pendingDeleteId = null;
|
||||
|
||||
Reference in New Issue
Block a user