修复databi
This commit is contained in:
parent
300d53a0cd
commit
5400f1dd57
@ -24,7 +24,9 @@ export function DatabiHeader({
|
||||
appOptions = [],
|
||||
countryId,
|
||||
countryOptions = defaultCountryOptions,
|
||||
error = "",
|
||||
filtersLoading = false,
|
||||
loading = false,
|
||||
onScreenChange,
|
||||
onAppChange,
|
||||
onCountryChange,
|
||||
@ -143,7 +145,10 @@ export function DatabiHeader({
|
||||
value={countryId}
|
||||
valueLabel={countryLabel}
|
||||
/>
|
||||
<span className="live-dot">实时</span>
|
||||
<span className={error ? "live-dot live-dot--warn" : "live-dot"} title={error || ""}>
|
||||
{error ? "异常" : loading ? "刷新中" : "实时"}
|
||||
</span>
|
||||
{error ? <span className="header-error">{error}</span> : null}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
@ -13,11 +13,19 @@ const eventLabels = {
|
||||
page_open: "页面打开",
|
||||
config_load_success: "配置成功",
|
||||
config_load_failed: "配置失败",
|
||||
gesture_select: "选择手势",
|
||||
match_api: "匹配接口",
|
||||
match_cancel: "取消匹配",
|
||||
stake_selected: "选择档位",
|
||||
stake_select: "选择档位",
|
||||
match_click: "点击匹配",
|
||||
match_success: "匹配成功",
|
||||
animation_start: "进入开奖",
|
||||
preload_complete: "预加载完成",
|
||||
reveal_enter: "进入开奖",
|
||||
roll_api: "开奖接口",
|
||||
settlement_show: "结算展示",
|
||||
play_again: "再来一局",
|
||||
play_again_click: "再来一局",
|
||||
exit_click: "退出"
|
||||
};
|
||||
|
||||
@ -688,6 +688,15 @@
|
||||
box-shadow: 0 0 14px rgba(247, 163, 58, 0.72);
|
||||
}
|
||||
|
||||
.header-error {
|
||||
max-width: 220px;
|
||||
overflow: hidden;
|
||||
color: #f7a33a;
|
||||
font-size: 12px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.metric-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import AddCircleOutlineOutlined from "@mui/icons-material/AddCircleOutlineOutlined";
|
||||
import RemoveCircleOutlineOutlined from "@mui/icons-material/RemoveCircleOutlineOutlined";
|
||||
import RefreshOutlined from "@mui/icons-material/RefreshOutlined";
|
||||
import SettingsOutlined from "@mui/icons-material/SettingsOutlined";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
@ -108,7 +109,7 @@ export function SelfGamePage() {
|
||||
label: "机器人",
|
||||
width: "minmax(190px, .9fr)",
|
||||
render: (game) =>
|
||||
`${game.robotEnabled ? "启用" : "关闭"} · ${game.robotMatchWaitMs}ms · 胜率 ${game.robotUserWinRatePercent ?? 50}%`,
|
||||
`${game.robotEnabled ? "启用" : "关闭"} · ${game.robotMatchWaitMs}ms · 玩家胜率 ${game.robotUserWinRatePercent ?? 50}%`,
|
||||
},
|
||||
{
|
||||
key: "updated",
|
||||
@ -119,15 +120,26 @@ export function SelfGamePage() {
|
||||
{
|
||||
key: "actions",
|
||||
label: "操作",
|
||||
width: "128px",
|
||||
width: "176px",
|
||||
render: (game) => (
|
||||
<AdminRowActions>
|
||||
<AdminActionIconButton disabled={!canUpdate} label="配置骰子" onClick={() => openConfig(game)}>
|
||||
<SettingsOutlined fontSize="small" />
|
||||
</AdminActionIconButton>
|
||||
<AdminActionIconButton disabled={!canUpdate} label="调整奖池" onClick={() => openPool(game)}>
|
||||
<AdminActionIconButton
|
||||
disabled={!canUpdate}
|
||||
label="增加奖池"
|
||||
onClick={() => openPool(game, "in")}
|
||||
>
|
||||
<AddCircleOutlineOutlined fontSize="small" />
|
||||
</AdminActionIconButton>
|
||||
<AdminActionIconButton
|
||||
disabled={!canUpdate}
|
||||
label="扣除奖池"
|
||||
onClick={() => openPool(game, "out")}
|
||||
>
|
||||
<RemoveCircleOutlineOutlined fontSize="small" />
|
||||
</AdminActionIconButton>
|
||||
</AdminRowActions>
|
||||
),
|
||||
},
|
||||
@ -141,9 +153,13 @@ export function SelfGamePage() {
|
||||
setActiveAction("config");
|
||||
};
|
||||
|
||||
const openPool = (game) => {
|
||||
const openPool = (game, direction) => {
|
||||
setActiveGame(game);
|
||||
setPoolForm(defaultPoolForm);
|
||||
setPoolForm({
|
||||
...defaultPoolForm,
|
||||
direction,
|
||||
reason: direction === "out" ? "admin_deduct" : "admin_adjust",
|
||||
});
|
||||
setActiveAction("pool");
|
||||
};
|
||||
|
||||
@ -179,7 +195,7 @@ export function SelfGamePage() {
|
||||
reason: poolForm.reason,
|
||||
});
|
||||
await load();
|
||||
showToast("奖池已调整", "success");
|
||||
showToast(poolForm.direction === "out" ? "奖池已扣除" : "奖池已增加", "success");
|
||||
closeDialog();
|
||||
} catch (err) {
|
||||
showToast(err.message || "调整奖池失败", "error");
|
||||
@ -285,8 +301,8 @@ function ConfigDialog({ form, loading, open, setForm, onClose, onSubmit }) {
|
||||
onChange={(event) => setForm({ ...form, robotMatchWaitMs: event.target.value })}
|
||||
/>
|
||||
<TextField
|
||||
helperText="50 为正常规则"
|
||||
label="机器人胜率 %"
|
||||
helperText="机器人局真人玩家胜率,50 为正常规则"
|
||||
label="玩家胜率 %"
|
||||
type="number"
|
||||
value={form.robotUserWinRatePercent}
|
||||
slotProps={{ htmlInput: { max: 100, min: 0 } }}
|
||||
@ -304,29 +320,24 @@ function ConfigDialog({ form, loading, open, setForm, onClose, onSubmit }) {
|
||||
}
|
||||
|
||||
function PoolDialog({ form, loading, open, setForm, onClose, onSubmit }) {
|
||||
const isDeduct = form.direction === "out";
|
||||
return (
|
||||
<AdminFormDialog
|
||||
loading={loading}
|
||||
open={open}
|
||||
submitLabel="确认调整"
|
||||
title="调整奖池"
|
||||
submitLabel={isDeduct ? "确认扣除" : "确认增加"}
|
||||
title={isDeduct ? "扣除奖池" : "增加奖池"}
|
||||
onClose={onClose}
|
||||
onSubmit={onSubmit}
|
||||
>
|
||||
<AdminFormFieldGrid>
|
||||
<TextField disabled label="方向" value={isDeduct ? "扣除" : "增加"} />
|
||||
<TextField
|
||||
label="方向"
|
||||
select
|
||||
value={form.direction}
|
||||
onChange={(event) => setForm({ ...form, direction: event.target.value })}
|
||||
>
|
||||
<MenuItem value="in">增加</MenuItem>
|
||||
<MenuItem value="out">减少</MenuItem>
|
||||
</TextField>
|
||||
<TextField
|
||||
helperText={isDeduct ? "不能扣成负数" : ""}
|
||||
label="金币"
|
||||
type="number"
|
||||
value={form.amountCoin}
|
||||
slotProps={{ htmlInput: { min: 1 } }}
|
||||
onChange={(event) => setForm({ ...form, amountCoin: event.target.value })}
|
||||
/>
|
||||
<TextField
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user