Skip to content

Commit

Permalink
1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
CBIhalsen committed Feb 18, 2025
1 parent df6cf39 commit f6fe99d
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 5 deletions.
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ def delete_article():
return jsonify({'error': 'Missing article ID'}), 400

# 调用删除函数
success = delete_entry(int(article_id)),decrease_count()
print('删除',article_id)
success = delete_entry(int(article_id)) and decrease_count()
print('zzz',success)

if success:
return jsonify({'message': 'Article deleted successfully'}), 200
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"count": "44",
"count": 2,
"translation_services": {
"doubao": {
"auth_key": "XX",
Expand Down
34 changes: 31 additions & 3 deletions static/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,44 @@

// 显示主页
function showHome() {
document.getElementById('recentread').innerHTML = 'Recent Reading';
document.getElementById('articleContainer').style.display = '';
document.getElementById('viewAllSection').style.display = 'flex';
document.querySelector('.sidebar-menu a[onclick="showHome()"]').classList.add('active');
document.querySelector('.sidebar-menu a[onclick="showAllRecent()"]').classList.remove('active');
loadArticles(true,true); // true表示只显示前3条
document.querySelector('.sidebar-menu a[onclick="showSetup()"]').classList.remove('active'); // 添加这行
loadArticles(true,true);
document.getElementById('t-container').style.display = '';
}

// 显示所有最近阅读
function showAllRecent() {
document.getElementById('recentread').innerHTML = 'Recent Reading';

document.getElementById('articleContainer').style.display = '';
document.getElementById('viewAllSection').style.display = 'none';
document.querySelector('.sidebar-menu a[onclick="showHome()"]').classList.remove('active');
document.querySelector('.sidebar-menu a[onclick="showAllRecent()"]').classList.add('active');
loadArticles(false,true); // false表示显示所有数据
document.querySelector('.sidebar-menu a[onclick="showSetup()"]').classList.remove('active'); // 添加这行
loadArticles(false,true);
document.getElementById('t-container').style.display = '';
}
// 添加新的函数处理 Setup steps
function showSetup() {
// 隐藏其他部分(如果需要的话)


document.getElementById('recentread').innerHTML = 'config.json';
document.getElementById('articleContainer').style.display = 'none';
document.getElementById('viewAllSection').style.display = 'none';


// 移除其他菜单项的 active 类
document.querySelector('.sidebar-menu a[onclick="showHome()"]').classList.remove('active');
document.querySelector('.sidebar-menu a[onclick="showAllRecent()"]').classList.remove('active');

// 给 Setup steps 添加 active 类
document.querySelector('.sidebar-menu a[onclick="showSetup()"]').classList.add('active');
document.getElementById('t-container').style.display = 'block';
}

// 显示上传模态框
Expand All @@ -26,6 +52,8 @@

}



// 显示设置模态框
function showSettings() {
document.getElementById('settingsModal').style.display = 'block';
Expand Down
16 changes: 16 additions & 0 deletions static/2.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,22 @@ function initSettings() {
});
}

function getecount() {
fetch('/api/get-default-services')
.then(response => response.json())
.then(data => {
if (data.success && data.data) {
const settings = data.data;

document.getElementById('count_article').textContent = ` Articles in Total: ${settings.count} `;
}
})
.catch(error => {
console.error('获取设置失败:', error);
alert('获取设置失败,请稍后重试');
});
}


// 页面加载时初始化设置
document.addEventListener('DOMContentLoaded', initSettings);
1 change: 1 addition & 0 deletions static/3.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ function deleteArticle(articleId) {

const value = document.getElementById('record_show_staute').getAttribute('data-value') === 'true';
loadArticles(value,false)
getecount()
} else {
throw new Error('删除失败');
}
Expand Down

0 comments on commit f6fe99d

Please sign in to comment.