press-next
Version:
Vue3 组件库,支持 Composition API
23 lines (19 loc) • 800 B
text/typescript
import {
COMPONENT_STATUS_MAP,
} from '../utils';
export function getKnockoutCardStatusCode(cardState: Record<string, any>) {
const { sch_state: schState, battle_state: battleState } = cardState;
// 赛程状态 0未开始,100已开打进行中,200已结束
// 对局状态 0:未开打 100:已经开打,可以准备 200:等待创建游戏房间 300:游戏房间创建中 400:游戏房间已经创建,前往游戏 500:游戏对局进行中 600:游戏已经结束,读取战绩中 700:对局已经结束
if (!schState
|| schState < 100
|| !battleState
|| battleState < 100
) {
return COMPONENT_STATUS_MAP.NOT_START;
}
if (schState >= 200 || battleState >= 600) {
return COMPONENT_STATUS_MAP.END;
}
return COMPONENT_STATUS_MAP.ING;
}