优化当前彩金池-安全线

This commit is contained in:
2026-03-17 14:40:28 +08:00
parent f6b4fb99f0
commit 5b5e923a0b
3 changed files with 11 additions and 5 deletions

View File

@@ -27,7 +27,7 @@
"profitCalcHint": "Sum of (win amount including BIGWIN minus 100 ticket cost) per round; refreshes every 2s while open.", "profitCalcHint": "Sum of (win amount including BIGWIN minus 100 ticket cost) per round; refreshes every 2s while open.",
"tierRuleTitle": "Tier Rule", "tierRuleTitle": "Tier Rule",
"tierRuleContent": "When player profit in this pool is below safety line, use player T*_weight; when above or equal, use pool T*_weight (kill).", "tierRuleContent": "When player profit in this pool is below safety line, use player T*_weight; when above or equal, use pool T*_weight (kill).",
"killScoreWeights": "Kill weights (type=1 read-only)", "killScoreWeights": "Kill weights",
"killWeightNote": "(Kill weights from pool config type=1; edit in list.)", "killWeightNote": "(Kill weights from pool config type=1; edit in list.)",
"btnResetProfit": "Reset Player Total Profit", "btnResetProfit": "Reset Player Total Profit",
"btnSaveSafetyLine": "Save Safety Line", "btnSaveSafetyLine": "Save Safety Line",

View File

@@ -27,8 +27,8 @@
"profitCalcHint": "计算方式:每局按“当前中奖金额(含超级大奖 BIGWIN减去抽奖券费用 100”累加弹窗打开期间每 2 秒自动刷新", "profitCalcHint": "计算方式:每局按“当前中奖金额(含超级大奖 BIGWIN减去抽奖券费用 100”累加弹窗打开期间每 2 秒自动刷新",
"tierRuleTitle": "抽奖档位规则", "tierRuleTitle": "抽奖档位规则",
"tierRuleContent": "当玩家在当前彩金池的累计盈利 低于安全线 时,按 玩家 的 T*_weight 权重抽取档位;当累计盈利 高于或等于安全线 时,按 当前彩金池 的 T*_weight 权重抽取档位(杀分)。", "tierRuleContent": "当玩家在当前彩金池的累计盈利 低于安全线 时,按 玩家 的 T*_weight 权重抽取档位;当累计盈利 高于或等于安全线 时,按 当前彩金池 的 T*_weight 权重抽取档位(杀分)。",
"killScoreWeights": "杀分权重type=1 只读)", "killScoreWeights": "杀分权重",
"killWeightNote": "(杀分权重来自奖池配置 type=1,请在列表中编辑对应记录)", "killWeightNote": "(杀分权重来自奖池配置,请在列表中编辑对应记录)",
"btnResetProfit": "重置玩家累计盈利", "btnResetProfit": "重置玩家累计盈利",
"btnSaveSafetyLine": "保存安全线", "btnSaveSafetyLine": "保存安全线",
"ruleSafetyLineRequired": "请输入安全线", "ruleSafetyLineRequired": "请输入安全线",

View File

@@ -27,6 +27,12 @@ function getModuleKey(locale: string, path: string): string {
let lastLoadedPath: string | null = null let lastLoadedPath: string | null = null
let lastLoadedLocale: string | null = null let lastLoadedLocale: string | null = null
/** 获取当前语言locale 可能是 string 或 Ref */
function getCurrentLocale(): string {
const loc = i18n.global.locale
return typeof loc === 'string' ? loc : (loc as { value: string }).value
}
/** /**
* 加载并合并页面翻译到 i18n 的 page 命名空间 * 加载并合并页面翻译到 i18n 的 page 命名空间
*/ */
@@ -36,7 +42,7 @@ export async function loadPageLocale(routePath: string): Promise<void> {
clearPageLocale() clearPageLocale()
return return
} }
const locale = i18n.global.locale.value const locale = getCurrentLocale()
const key = getModuleKey(locale, path) const key = getModuleKey(locale, path)
const modules = locale === LanguageEnum.EN ? enModules : zhModules const modules = locale === LanguageEnum.EN ? enModules : zhModules
const loader = modules[key] const loader = modules[key]
@@ -64,7 +70,7 @@ export async function loadPageLocale(routePath: string): Promise<void> {
* 清除 page 命名空间(进入无页面翻译的路由时调用) * 清除 page 命名空间(进入无页面翻译的路由时调用)
*/ */
export function clearPageLocale(): void { export function clearPageLocale(): void {
const locale = i18n.global.locale.value const locale = getCurrentLocale()
const messages = i18n.global.getLocaleMessage(locale) as Record<string, unknown> const messages = i18n.global.getLocaleMessage(locale) as Record<string, unknown>
if (messages && 'page' in messages) { if (messages && 'page' in messages) {
const next = { ...messages } const next = { ...messages }