继续落子修复;新增战绩;优化UI

This commit is contained in:
icezhb 2024-12-29 18:03:09 +08:00
parent c2a44ba7c7
commit c389bb7d95
2 changed files with 9 additions and 14 deletions

View File

@ -230,8 +230,6 @@ export default {
current: 0, current: 0,
max: 0, max: 0,
maxLose: 0, maxLose: 0,
player: 0,
computer: 0,
}, },
}, },
winningPositions: null, // winningPositions: null, //
@ -1238,14 +1236,15 @@ export default {
} else { } else {
stats.playerWins++ stats.playerWins++
stats.winningStreaks.current = Math.max(0, stats.winningStreaks.current) + 1 stats.winningStreaks.current = Math.max(0, stats.winningStreaks.current) + 1
stats.winningStreaks.max = Math.max(
stats.winningStreaks.max,
stats.winningStreaks.current,
)
} }
} else if (winner === (this.isPlayerBlack ? 1 : 2)) { } else if (winner === (this.isPlayerBlack ? 1 : 2)) {
stats.playerWins++ stats.playerWins++
stats.winningStreaks.current = Math.max(0, stats.winningStreaks.current) + 1 stats.winningStreaks.current = Math.max(0, stats.winningStreaks.current) + 1
stats.winningStreaks.player = Math.max( stats.winningStreaks.max = Math.max(stats.winningStreaks.max, stats.winningStreaks.current)
stats.winningStreaks.player,
stats.winningStreaks.current,
)
} else { } else {
stats.computerWins++ stats.computerWins++
stats.winningStreaks.current = Math.min(0, stats.winningStreaks.current) - 1 stats.winningStreaks.current = Math.min(0, stats.winningStreaks.current) - 1
@ -1255,11 +1254,6 @@ export default {
) )
} }
stats.winningStreaks.max = Math.max(
stats.winningStreaks.player,
stats.winningStreaks.computer,
)
// //
this.saveStatistics() this.saveStatistics()
}, },
@ -1306,6 +1300,7 @@ export default {
<style> <style>
/* 基础样式 */ /* 基础样式 */
.container { .container {
width: 100vw;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;

View File

@ -1,9 +1,9 @@
@import './base.css'; @import './base.css';
#app { #app {
max-width: 1280px; /* max-width: 1280px; */
margin: 0 auto; margin: 0 auto;
padding: 2rem; /* padding: 2rem; */
font-weight: normal; font-weight: normal;
} }
@ -30,6 +30,6 @@ a,
#app { #app {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
padding: 0 2rem; /* padding: 0 2rem; */
} }
} }