[fix] 沒滿21分bug
This commit is contained in:
parent
4279c449b5
commit
8f169badee
@ -49,13 +49,19 @@ export default function Play() {
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
const score: number[] = JSON.parse(data.score);
|
||||
const win: number = score.indexOf(data.winScore);
|
||||
const win: number = score.indexOf(data.winScore) === -1
|
||||
? score.indexOf(score[0] > score[1] ? score[0] : score[1])
|
||||
: score.indexOf(data.winScore);
|
||||
const team: string[] = JSON.parse(data.team).flat();
|
||||
const winTeam: string[] = JSON.parse(data.team)[win];
|
||||
const scoreList: number[] = JSON.parse(data.scoreList);
|
||||
setTime(dayjs(data.time * 1000).format("YYYY-MM-DD HH:mm:ss"));
|
||||
setTeam(team);
|
||||
if (win === -1) {
|
||||
setWinTeam("不明");
|
||||
} else {
|
||||
setWinTeam(winTeam[0] + "、" + winTeam[1]);
|
||||
}
|
||||
setScore(score[0] + ":" + score[1]);
|
||||
setScoreList(scoreList);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user