refactor: CSS残留hex清理+内联样式提取+console.log降级+错误toast补全
- components.css: 10处hex替换为CSS变量(stoploss/watch/signal/alert-change/toast) - pages.css: 20+处hex替换(ss-dot信号强度/step操作色/summary-tag/trade-type/reason-item) - auth.css: 2处hex替换(login-error/login-success) - base.css: 新增30+公共CSS class(cursor-pointer/flex-center/input-mini/icon-sm等) - index.html: 41处内联style提取为CSS class(93→52) - app.js: 14处console.log降级为console.debug(减少生产日志噪音) - app.js: 5处用户可感知catch块补充showToast错误反馈
This commit is contained in:
+18
-13
@@ -541,10 +541,10 @@
|
||||
const response = await axios.get('/api/me');
|
||||
if (response.data.success && response.data.user) {
|
||||
this.currentUser = response.data.user;
|
||||
console.log('已登录:', this.currentUser.username);
|
||||
console.debug('已登录:', this.currentUser.username);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('未登录');
|
||||
console.debug('未登录');
|
||||
} finally {
|
||||
this.checkingAuth = false;
|
||||
}
|
||||
@@ -791,7 +791,7 @@
|
||||
return response.data.data.stock_name;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('获取股票名称失败');
|
||||
console.debug('获取股票名称失败');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -1235,19 +1235,19 @@
|
||||
|
||||
// 版本不匹配则强制刷新
|
||||
if (cacheVer < ALERT_CACHE_VERSION) {
|
||||
console.log(`缓存版本过旧(v${cacheVer} < v${ALERT_CACHE_VERSION}),强制刷新`);
|
||||
console.debug(`缓存版本过旧(v${cacheVer} < v${ALERT_CACHE_VERSION}),强制刷新`);
|
||||
} else {
|
||||
this.stockAlerts = cachedAlerts;
|
||||
console.log(`加载缓存数据: ${cachedAlerts.length}条, 更新时间: ${lastUpdate}, v${cacheVer}`);
|
||||
console.debug(`加载缓存数据: ${cachedAlerts.length}条, 更新时间: ${lastUpdate}, v${cacheVer}`);
|
||||
|
||||
if (cacheDate === today) {
|
||||
console.log('缓存是今天的,无需更新');
|
||||
console.debug('缓存是今天的,无需更新');
|
||||
this.alertsLoading = false;
|
||||
this.updateHoldingPricesFromAlerts();
|
||||
const cachedCodes = new Set(cachedAlerts.map(a => a.code));
|
||||
const newStocks = allStocks.filter(s => !cachedCodes.has(s.code));
|
||||
if (newStocks.length > 0) {
|
||||
console.log(`发现${newStocks.length}只新股票,增量更新`);
|
||||
console.debug(`发现${newStocks.length}只新股票,增量更新`);
|
||||
await this.analyzeNewStocks(newStocks, today);
|
||||
}
|
||||
return;
|
||||
@@ -1255,7 +1255,7 @@
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('加载缓存失败,将重新分析:', err);
|
||||
console.debug('加载缓存失败,将重新分析:', err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1264,7 +1264,7 @@
|
||||
this.alertsProgress = { current: 0, total: allStocks.length };
|
||||
|
||||
try {
|
||||
console.log(`开始信号分析 ${allStocks.length} 只股票...`);
|
||||
console.debug(`开始信号分析 ${allStocks.length} 只股票...`);
|
||||
const startTime = Date.now();
|
||||
|
||||
const response = await axios.post('/api/signal_alerts', {
|
||||
@@ -1273,14 +1273,14 @@
|
||||
});
|
||||
|
||||
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
||||
console.log(`信号分析完成,耗时 ${elapsed}s`);
|
||||
console.debug(`信号分析完成,耗时 ${elapsed}s`);
|
||||
|
||||
if (response.data.success) {
|
||||
const results = response.data.results || [];
|
||||
this.alertsProgress.current = allStocks.length;
|
||||
this.stockAlerts = [...results];
|
||||
|
||||
console.log(`成功: ${response.data.success_count}`);
|
||||
console.debug(`成功: ${response.data.success_count}`);
|
||||
|
||||
// 3. 保存到缓存
|
||||
this.saveAlertsCache(this.stockAlerts);
|
||||
@@ -1296,7 +1296,7 @@
|
||||
} catch (err) {
|
||||
console.error('批量分析请求失败:', err);
|
||||
// 回退到逐个分析
|
||||
console.log('回退到逐个分析模式...');
|
||||
console.debug('回退到逐个分析模式...');
|
||||
await this.analyzeStocksOneByOne(allStocks, today, forceRefresh);
|
||||
}
|
||||
|
||||
@@ -1445,7 +1445,7 @@
|
||||
lastUpdate: new Date().toISOString().replace('T', ' ').split('.')[0],
|
||||
version: ALERT_CACHE_VERSION
|
||||
});
|
||||
console.log('分析结果已保存到缓存');
|
||||
console.debug('分析结果已保存到缓存');
|
||||
} catch (err) {
|
||||
console.error('保存缓存失败:', err);
|
||||
}
|
||||
@@ -1562,6 +1562,7 @@
|
||||
await this.loadAvailableCash();
|
||||
} catch (err) {
|
||||
console.error('加载交易记录失败:', err);
|
||||
this.showToast('加载交易记录失败', 'error');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1752,6 +1753,7 @@
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('检查止损失败:', error);
|
||||
this.showToast('检查止损失败,请稍后重试', 'error');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2161,6 +2163,7 @@
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('技术信号检测失败:', err);
|
||||
this.showToast('技术信号检测失败,请稍后重试', 'error');
|
||||
} finally {
|
||||
this.techLoading = false;
|
||||
}
|
||||
@@ -2187,6 +2190,7 @@
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('批量技术信号检测失败:', err);
|
||||
this.showToast('批量检测失败,请稍后重试', 'error');
|
||||
} finally {
|
||||
this.techLoading = false;
|
||||
}
|
||||
@@ -2241,6 +2245,7 @@
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取扫描结果失败:', err);
|
||||
this.showToast('获取扫描结果失败,请稍后重试', 'error');
|
||||
} finally {
|
||||
this.fullScanLoading = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user