优化激活状态更新逻辑,移除多余的调试日志,提升代码可读性和维护性。
This commit is contained in:
parent
10c990bd95
commit
ee7daf9ad1
@ -542,33 +542,24 @@ function updateActiveStatus(results) {
|
||||
|
||||
// 收集所有被激活的羁绊和棋子
|
||||
const activeSynergies = new Set();
|
||||
const activeSynergyNames = new Set(); // 添加名称集合
|
||||
const activeSynergyNames = new Set();
|
||||
const activeChess = new Set();
|
||||
const activeChessNames = new Set(); // 添加名称集合
|
||||
|
||||
console.log('更新激活状态:', results);
|
||||
const activeChessNames = new Set();
|
||||
|
||||
results.forEach(result => {
|
||||
// 添加激活的羁绊
|
||||
result.active_synergies.forEach(synergy => {
|
||||
console.log('激活羁绊:', synergy);
|
||||
if (synergy.id) activeSynergies.add(String(synergy.id)); // 确保ID是字符串
|
||||
if (synergy.name) activeSynergyNames.add(synergy.name); // 添加名称
|
||||
if (synergy.id) activeSynergies.add(String(synergy.id));
|
||||
if (synergy.name) activeSynergyNames.add(synergy.name);
|
||||
});
|
||||
|
||||
// 添加激活的棋子
|
||||
result.chess_list.forEach(chess => {
|
||||
console.log('激活棋子:', chess);
|
||||
if (chess.id) activeChess.add(String(chess.id)); // 确保ID是字符串
|
||||
if (chess.name) activeChessNames.add(chess.name); // 添加名称
|
||||
if (chess.id) activeChess.add(String(chess.id));
|
||||
if (chess.name) activeChessNames.add(chess.name);
|
||||
});
|
||||
});
|
||||
|
||||
console.log('所有激活的羁绊ID:', Array.from(activeSynergies));
|
||||
console.log('所有激活的羁绊名称:', Array.from(activeSynergyNames));
|
||||
console.log('所有激活的棋子ID:', Array.from(activeChess));
|
||||
console.log('所有激活的棋子名称:', Array.from(activeChessNames));
|
||||
|
||||
// 处理羁绊激活状态
|
||||
$('.synergy-weight-item').each(function() {
|
||||
const $item = $(this);
|
||||
@ -580,7 +571,6 @@ function updateActiveStatus(results) {
|
||||
activeSynergyNames.has(synergyName) ||
|
||||
activeSynergyNames.has(synergyName.toLowerCase())) {
|
||||
$item.addClass('active');
|
||||
console.log('激活羁绊:', synergyId, synergyName);
|
||||
}
|
||||
});
|
||||
|
||||
@ -595,14 +585,9 @@ function updateActiveStatus(results) {
|
||||
activeChessNames.has(chessName) ||
|
||||
activeChessNames.has(chessName.toLowerCase())) {
|
||||
$item.addClass('active');
|
||||
console.log('激活棋子:', chessId, chessName);
|
||||
}
|
||||
});
|
||||
|
||||
// 记录激活项目数量统计
|
||||
console.log('成功激活的羁绊数量:', $('.synergy-weight-item.active').length);
|
||||
console.log('成功激活的棋子数量:', $('.chess-weight-item.active').length);
|
||||
|
||||
// 根据当前复选框状态更新显示
|
||||
const showOnlyActiveSynergies = $('#show-only-active').is(':checked');
|
||||
const showOnlyActiveChess = $('#show-only-active-chess').is(':checked');
|
||||
|
Loading…
x
Reference in New Issue
Block a user