UNPKG

press-next

Version:

Vue3 组件库,支持 Composition API

45 lines (41 loc) 1.03 kB
/** * 获取 battleId */ export function getBattleId(nodeItem: any) { let curBo = 0; if (nodeItem?.sch_score?.cur_bo) { curBo = nodeItem.sch_score.cur_bo; } if (nodeItem.battle_list) { const rNode = nodeItem.battle_list.find((battle: any) => { if (battle.bonum === curBo && +battle.rematch_state !== 100) { return true; } }); return rNode ? rNode : {}; } return {}; } export function getFirstValidBattle(nodeItem: any) { const battleList = nodeItem?.battle_list || []; for (const battle of battleList) { if (battle.rematch_state != 100) { return battle; } } } export function getRedSide(nodeItem: any) { let curBo = 0; if (nodeItem?.sch_score?.cur_bo) { curBo = nodeItem.sch_score.cur_bo; } if (nodeItem.battle_list) { const rNode = nodeItem.battle_list.find((battle: any) => { if (battle.bonum === curBo && +battle.rematch_state !== 100) { return true; } }); return rNode ? rNode.red_side : ''; } return ''; }