feat: expose game safe height

This commit is contained in:
zhx 2026-06-02 17:42:50 +08:00
parent 79ed201975
commit f7a401a183
3 changed files with 14 additions and 1 deletions

View File

@ -33,6 +33,7 @@ export interface GameCatalogDto {
launchUrl?: string;
launchMode: string;
orientation: string;
safeHeight: number;
minCoin: number;
status: string;
sortOrder: number;
@ -198,6 +199,7 @@ function normalizeCatalog(game: Partial<GameCatalogDto>): GameCatalogDto {
launchUrl: stringValue(game.launchUrl),
launchMode: normalizeLaunchMode(game.launchMode),
orientation: stringValue(game.orientation || "portrait"),
safeHeight: numberValue(game.safeHeight),
minCoin: numberValue(game.minCoin),
status: stringValue(game.status || "active"),
sortOrder: numberValue(game.sortOrder),

View File

@ -25,6 +25,7 @@ const defaultGameForm = {
gameUrl: "",
launchMode: "full_screen",
orientation: "portrait",
safeHeight: 0,
minCoin: 0,
status: "active",
sortOrder: 0,
@ -495,6 +496,7 @@ function gameToForm(game, platforms = []) {
gameUrl: resolveGameURLFromPlatforms(platforms, game),
launchMode: normalizeLaunchMode(game.launchMode),
orientation: game.orientation || "portrait",
safeHeight: Number(game.safeHeight || 0),
minCoin: Number(game.minCoin || 0),
status: game.status || "active",
sortOrder: Number(game.sortOrder || 0),
@ -561,6 +563,7 @@ function gamePayload(form) {
coverUrl: form.coverUrl.trim(),
launchMode: normalizeLaunchMode(form.launchMode),
orientation: form.orientation.trim() || "portrait",
safeHeight: Number(form.safeHeight || 0),
minCoin: Number(form.minCoin || 0),
status: form.status.trim() || "active",
sortOrder: Number(form.sortOrder || 0),

View File

@ -76,7 +76,9 @@ const baseColumns = [
render: (game) => (
<div className={styles.stack}>
<span>{launchModeLabel(game.launchMode)}</span>
<span className={styles.meta}>{game.orientation}</span>
<span className={styles.meta}>
{game.orientation} · 安全高 {formatNumber(game.safeHeight)}
</span>
</div>
),
},
@ -349,6 +351,12 @@ function GameFormDialog({ form, loading, mode, open, page, onClose, onSubmit })
</MenuItem>
))}
</TextField>
<TextField
label="安全高"
type="number"
value={form.safeHeight}
onChange={(event) => page.setGameForm({ ...form, safeHeight: event.target.value })}
/>
<TextField
label="游戏 URL"
className={styles.fullField}