mirror of
https://github.com/zhinianboke/xianyu-auto-reply.git
synced 2025-09-03 10:58:49 +08:00
Revert "优化结构"
This reverts commit 04a391616ffbb856e393dc8ba04b487c768e13d6.
This commit is contained in:
parent
b09cd98e97
commit
26f1738001
@ -1,4 +1,4 @@
|
||||
// ==================== 全局变量 ====================
|
||||
// 全局变量
|
||||
const apiBase = location.origin;
|
||||
let keywordsData = {};
|
||||
let currentCookieId = '';
|
||||
@ -14,8 +14,6 @@ let accountKeywordCache = {};
|
||||
let cacheTimestamp = 0;
|
||||
const CACHE_DURATION = 30000; // 30秒缓存
|
||||
|
||||
// ==================== 页面导航功能 ====================
|
||||
|
||||
// 菜单切换功能
|
||||
function showSection(sectionName) {
|
||||
console.log('切换到页面:', sectionName); // 调试信息
|
||||
@ -101,8 +99,6 @@ function toggleSidebar() {
|
||||
document.getElementById('sidebar').classList.toggle('show');
|
||||
}
|
||||
|
||||
// ==================== 仪表盘管理 ====================
|
||||
|
||||
// 加载仪表盘数据
|
||||
async function loadDashboard() {
|
||||
try {
|
||||
@ -243,8 +239,6 @@ function updateDashboardAccountsList(accounts) {
|
||||
});
|
||||
}
|
||||
|
||||
// ==================== 关键词缓存管理 ====================
|
||||
|
||||
// 获取账号关键词数量(带缓存)- 包含普通关键词和商品关键词
|
||||
async function getAccountKeywordCount(accountId) {
|
||||
const now = Date.now();
|
||||
@ -286,8 +280,6 @@ function clearKeywordCache() {
|
||||
cacheTimestamp = 0;
|
||||
}
|
||||
|
||||
// ==================== 账号列表管理 ====================
|
||||
|
||||
// 刷新账号列表(用于自动回复页面)
|
||||
async function refreshAccountList() {
|
||||
try {
|
||||
@ -347,7 +339,7 @@ async function refreshAccountList() {
|
||||
// 分组显示:先显示启用的账号,再显示禁用的账号
|
||||
const enabledAccounts = accountsWithKeywords.filter(account => {
|
||||
const enabled = account.enabled === undefined ? true : account.enabled;
|
||||
console.log(`账号 ${account.id} 过滤状态: enabled=${account.enabled}, 判断为启用=${enabled}`);
|
||||
console.log(`账号 ${account.id} 过滤状态: enabled=${account.enabled}, 判断为启用=${enabled}`); // 调试信息
|
||||
return enabled;
|
||||
});
|
||||
const disabledAccounts = accountsWithKeywords.filter(account => {
|
||||
@ -883,8 +875,6 @@ async function deleteKeyword(cookieId, index) {
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 通用工具函数 ====================
|
||||
|
||||
// 显示/隐藏加载动画
|
||||
function toggleLoading(show) {
|
||||
document.getElementById('loading').classList.toggle('d-none', !show);
|
||||
@ -969,8 +959,6 @@ async function fetchJSON(url, opts = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== Cookie管理 ====================
|
||||
|
||||
// 加载Cookie列表
|
||||
async function loadCookies() {
|
||||
try {
|
||||
@ -1193,13 +1181,8 @@ async function delCookie(id) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 内联编辑Cookie
|
||||
* @param {string} id - 账号ID
|
||||
* @param {string} currentValue - 当前Cookie值
|
||||
* @param {Event} event - 点击事件对象
|
||||
*/
|
||||
function editCookieInline(id, currentValue, event) {
|
||||
// 内联编辑Cookie
|
||||
function editCookieInline(id, currentValue) {
|
||||
const row = event.target.closest('tr');
|
||||
const cookieValueCell = row.querySelector('.cookie-value');
|
||||
const originalContent = cookieValueCell.innerHTML;
|
||||
@ -1579,14 +1562,11 @@ async function checkAuth() {
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 应用初始化 ====================
|
||||
|
||||
// 初始化事件监听
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
// 首先检查认证状态
|
||||
const isAuthenticated = await checkAuth();
|
||||
if (!isAuthenticated) return;
|
||||
|
||||
// 添加Cookie表单提交
|
||||
document.getElementById('addForm').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
@ -1877,12 +1857,8 @@ async function saveDefaultReply() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试默认回复(占位函数)
|
||||
* @param {string} accountId - 账号ID
|
||||
*/
|
||||
// 测试默认回复(占位函数)
|
||||
function testDefaultReply(accountId) {
|
||||
console.log('测试默认回复功能,账号ID:', accountId);
|
||||
showToast('测试功能开发中...', 'info');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user