优化多语言翻译

This commit is contained in:
2026-03-20 10:29:31 +08:00
parent b689a40595
commit 6ff65afcb5
19 changed files with 768 additions and 279 deletions

View File

@@ -117,7 +117,8 @@
right: 0, right: 0,
left: 0, left: 0,
bottom: 0, // 增加底部间距 bottom: 0, // 增加底部间距
containLabel: true outerBoundsMode: 'same' as const,
outerBoundsContain: 'axisLabel' as const
} }
const options: EChartsOption = { const options: EChartsOption = {

View File

@@ -75,7 +75,8 @@
right: 20, right: 20,
bottom: props.showDataZoom ? 80 : 20, bottom: props.showDataZoom ? 80 : 20,
left: 20, left: 20,
containLabel: true outerBoundsMode: 'same',
outerBoundsContain: 'axisLabel'
}, },
tooltip: getTooltipStyle('axis', { tooltip: getTooltipStyle('axis', {
axisPointer: { axisPointer: {

View File

@@ -64,7 +64,8 @@
right: 20, right: 20,
bottom: 20, bottom: 20,
left: 20, left: 20,
containLabel: true outerBoundsMode: 'same',
outerBoundsContain: 'axisLabel'
}, },
tooltip: props.showTooltip tooltip: props.showTooltip
? getTooltipStyle('item', { ? getTooltipStyle('item', {

View File

@@ -345,7 +345,9 @@ export function useChart(options: UseChartOptions = {}) {
right: 15, right: 15,
bottom: 8, bottom: 8,
left: 0, left: 0,
containLabel: true, // ECharts 6替代已弃用的 containLabel需配合 outerBounds 布局,避免控制台告警)
outerBoundsMode: 'same' as const,
outerBoundsContain: 'axisLabel' as const,
...baseGrid ...baseGrid
} }

View File

@@ -1,12 +1,13 @@
{ {
"toolbar": { "toolbar": {
"weightRatio": "Weight Ratio", "weightRatio": "Weight Ratio",
"weightTest": "Test Weight" "weightTest": "Test Weights"
}, },
"search": { "search": {
"tier": "Tier", "tier": "Tier",
"clockwise": "Clockwise", "clockwise": "Clockwise",
"anticlockwise": "Anticlockwise" "anticlockwise": "Counter-clockwise",
"optionBigwin": "BIGWIN"
}, },
"table": { "table": {
"startIndex": "Start Index", "startIndex": "Start Index",
@@ -17,5 +18,67 @@
"realEv": "Real EV", "realEv": "Real EV",
"remark": "Remark", "remark": "Remark",
"weight": "Weight" "weight": "Weight"
},
"weightShared": {
"xAxisEndIndex": "End Index",
"xAxisGridNumber": "Points",
"emptyTier": "No data for this tier",
"sumLineDual": "Tier weight sum (clockwise): {cw}; counter-clockwise: {ccw} (each row 110000, ratio draw within tier, sum not limited)",
"sumLineSingle": "Tier weight sum: {sum} (each row 110000, ratio draw within tier, sum not limited)",
"t4t5NoteSingle": "T4 and T5 have a single outcome; no weight configuration.",
"t4t5NoteDual": "T4 and T5 have a single outcome when hit; no weight configuration.",
"colEndIndexId": "End Index (id)",
"colGridNumber": "Points (grid_number)",
"colDicePoints": "Dice Points",
"colRealEv": "Real EV",
"colUiText": "Display Text",
"colRemark": "Remark",
"colWeightCwDir": "Clockwise weight (direction=0)",
"colWeightCcwDir": "Counter-clockwise weight (direction=1)",
"weightColSuffix": "Weight (1-10000)",
"fetchFail": "Failed to load weight data",
"nothingToSubmit": "Nothing to submit",
"submitFail": "Save failed",
"btnCancel": "Cancel",
"btnSubmit": "Submit",
"saveSuccess": "Saved successfully"
},
"weightEdit": {
"title": "Dice Reward (dice_reward) Weight Ratio",
"globalTip": "You are editing weights on dice_reward (DiceReward), split by end_index into clockwise and counter-clockwise; the draw uses the set for the current direction."
},
"weightRatio": {
"title": "Weight Ratio",
"globalTip": "Configure dice_reward weights: first by direction (clockwise / counter-clockwise), then by tier (T1T5); each row weight 110000, ratio draw within tier.",
"tabClockwise": "Clockwise",
"tabCounterclockwise": "Counter-clockwise"
},
"weightTest": {
"title": "One-Click Weight Test",
"alertTitle": "Bonus pool logic",
"alertBody": "Same as playStart draw: uses name=default safety line and kill switch; when profit is below the line, paid tickets use player tier weights (custom below), free tickets use killScore; when profit reaches the line and kill is on, both use killScore.",
"stepPaid": "Paid ticket",
"stepFree": "Free ticket",
"labelLotteryTypePaid": "Test pool type",
"labelLotteryTypeFree": "Test pool type",
"placeholderPaidPool": "Leave empty for custom tier odds below (default: default)",
"placeholderFreePool": "Leave empty for custom tier odds below (default: killScore)",
"tierProbHint": "Custom tier odds (T1T5), each 0100%, sum of five must not exceed 100%",
"tierFieldLabel": "Tier {tier} (%)",
"tierSumError": "Current sum of five tiers is {sum}%, cannot exceed 100%",
"labelCwCount": "Clockwise spins",
"labelCcwCount": "Counter-clockwise spins",
"placeholderSelect": "Please select",
"btnPrev": "Back",
"btnNext": "Next",
"btnStart": "Start test",
"btnCancel": "Cancel",
"warnTotalSpins": "At least one of paid/free direction spin counts must be greater than 0",
"warnPaidTierSumPositive": "When no paid pool is selected, T1T5 odds sum must be greater than 0",
"warnPaidTierSumMax": "Paid T1T5 odds sum cannot exceed 100%",
"warnFreeTierSumPositive": "When no free pool is selected, T1T5 odds sum must be greater than 0",
"warnFreeTierSumMax": "Free T1T5 odds sum cannot exceed 100%",
"successCreated": "Test job created and will run in background. Check player draw records (test data) for results.",
"failCreate": "Failed to create test job"
} }
} }

View File

@@ -1,7 +1,74 @@
{ {
"toolbar": { "toolbar": {
"gameRewardConfig": "Game Reward Config", "gameRewardConfig": "Game Reward Config",
"createRewardRef": "Create Reward Reference" "createRewardRef": "Create Reward Reference",
"createRewardRefTitle": "Rule: start_index=config(grid_number).id; clockwise end_index=(start_index+grid_number)%26; counter-clockwise end_index=start_index-grid_number>=0?start_index-grid_number:26+start_index-grid_number"
},
"configPage": {
"tabIndex": "Reward Index",
"tabBigwin": "Big Win Weights",
"tipIndex": "Dice points must be between 5 and 30 and unique in this table.",
"tipBigwin": "Left to right: big-win points (read-only), display text, real EV, remark, weight (0~10000). Points 5 and 30 are fixed at 100%. This tab saves big-win weights only.",
"colId": "Index (id)",
"colDicePoints": "Dice Points",
"colDisplayText": "Display Text",
"colDisplayTextEn": "Display Text (EN)",
"colRealEv": "Real Settlement",
"colTier": "Tier",
"colRemark": "Remark",
"placeholderTierSelect": "Tier",
"placeholderDisplayZh": "Display text (Chinese)",
"placeholderDisplayEn": "Display text (English)",
"placeholderRemark": "Remark",
"btnSave": "Save",
"btnReset": "Reset",
"colBigwinPoints": "Big-Win Points",
"colDisplayInfo": "Display Info",
"colDisplayInfoEn": "Display Info (EN)",
"colRealPrize": "Real Prize",
"colWeightRange": "Weight (0-10000)",
"placeholderDisplayInfoZh": "Display info (Chinese)",
"placeholderDisplayInfoEn": "Display info (English)",
"weightFixedTip": "Points 5 and 30 are fixed at 100%",
"emptyBigwin": "No BIGWIN tier rows. Set tier to BIGWIN in the Reward Index tab first.",
"confirmCreateRefTitle": "Create Reward Reference",
"confirmCreateRefMsg": "Create reward reference by rule: start_index is the id of the cell for grid_number in reward config; clockwise end_index=(start_index+roll)%26; counter-clockwise end_index=start_index-roll if >=0 else 26+start_index-roll. Existing data will be cleared, then 26 points (530) for both directions will be generated. Continue?",
"confirmCreateRefOk": "Create",
"confirmCreateRefCancel": "Cancel",
"createRefSuccess": "Created for 26 dice points (530), clockwise + counter-clockwise: clockwise added {cwNew}, counter-clockwise added {ccwNew}; clockwise updated {cwUp}, counter-clockwise updated {ccwUp}{skippedPart}",
"createRefSuccessSkipped": "; {n} point(s) used fallback start index",
"createRefSuccessSimple": "Created successfully",
"createRefFail": "Failed to create reward reference",
"loadIndexFail": "Failed to load reward index config",
"saveSuccess": "Saved successfully",
"saveFail": "Save failed",
"resetIndexReloaded": "Reward index reloaded from server",
"resetBigwinReloaded": "Big win weights reloaded from server",
"warnNoIndexToSave": "No reward index rows to save",
"warnGridRange": "Dice points must be between {min} and {max}",
"dupJoiner": ", ",
"warnDupGrid": "Duplicate dice points in this table: {list}",
"warnNoBigwinToSave": "No BIGWIN rows to save",
"warnBigwinDupGrid": "Duplicate big-win points in this table: {list}",
"infoNoBigwin": "No BIGWIN rows. Set tier to BIGWIN in the Reward Index tab first."
},
"weightRatio": {
"title": "T1T5 Weight Ratio (Clockwise / Counter-clockwise)",
"globalTip": "Weights come from dice_reward, split by end index (DiceRewardConfig.id) into clockwise and counter-clockwise; draw uses the weight set for the current direction.",
"xAxisEndIndex": "End Index",
"emptyTier": "No data for this tier",
"sumLine": "Tier weight sum (clockwise): {cw}; counter-clockwise: {ccw} (each row 110000, ratio draw within tier, sum not limited)",
"t4t5Note": "T4 and T5 have a single outcome; no weight configuration.",
"colEndIndexId": "End Index (id)",
"colDicePoints": "Dice Points",
"colRealEv": "Real EV",
"colUiText": "Display Text",
"colWeightCw": "Clockwise weight (1-10000)",
"colWeightCcw": "Counter-clockwise weight (1-10000)",
"fetchFail": "Failed to load weight ratio data",
"nothingToSubmit": "Nothing to submit",
"submitFail": "Save failed",
"saveSuccess": "Saved successfully"
}, },
"search": { "search": {
"dicePoints": "Dice Points", "dicePoints": "Dice Points",

View File

@@ -4,6 +4,8 @@
}, },
"table": { "table": {
"id": "ID", "id": "ID",
"clockwiseAbbr": "CW",
"counterclockwiseAbbr": "CCW",
"status": "Status", "status": "Status",
"paidDraw": "Paid Draw", "paidDraw": "Paid Draw",
"freeDraw": "Free Draw", "freeDraw": "Free Draw",
@@ -27,5 +29,51 @@
"ruleTestCountRequired": "Test count is required", "ruleTestCountRequired": "Test count is required",
"addSuccess": "Added successfully", "addSuccess": "Added successfully",
"editSuccess": "Updated successfully" "editSuccess": "Updated successfully"
},
"detail": {
"title": "Test Record Detail",
"sectionBasic": "Basic Info",
"recordId": "Record ID",
"testCount": "Test count",
"testCountSuffix": " runs",
"createTime": "Created at",
"admin": "Operator",
"paidPoolId": "Paid lottery pool config ID",
"freePoolId": "Free lottery pool config ID",
"bigwinSnapshot": "BIGWIN weight snapshot",
"sectionPaidTier": "Paid draw tier odds (T1T5, used in test)",
"sectionFreeTier": "Free draw tier odds (T1T5, used in test)",
"colTier": "Tier",
"colWeight": "Weight",
"colPercent": "Share",
"emptyPaidTier": "No paid tier data (legacy records may only have tier_weights_snapshot)",
"emptyFreeTier": "No free tier data",
"sectionSnapshot": "Weight snapshot (T1T5 / BIGWIN used in test)",
"subCw": "Clockwise (non-BIGWIN)",
"subCcw": "Counter-clockwise (non-BIGWIN)",
"colGridNumber": "Dice points",
"emptyCw": "No clockwise data",
"emptyCcw": "No counter-clockwise data",
"subBigwin": "BIGWIN (DiceRewardConfig snapshot)",
"emptyBigwinTable": "No BIGWIN data",
"sectionResult": "Landing stats (count per grid_number)",
"chartXAxis": "Dice points (grid_number)",
"emptyResult": "No landing data",
"resultTotal": "Total landings: {n}",
"btnImport": "Import to current config",
"importTitle": "Import to production config",
"importDesc": "Import this test record into DiceReward (cell weights), DiceRewardConfig (BIGWIN weight), and DiceLotteryPoolConfig (paid/free T1T5 odds). Select target pools.",
"importPaidLabel": "Import paid tier odds to pool",
"importPaidPlaceholder": "Select a pool (paid pool recommended)",
"importPaidTip": "If empty, uses paid pool ID saved on this record",
"importFreeLabel": "Import free tier odds to pool",
"importFreePlaceholder": "Select a pool (free pool recommended)",
"importFreeTip": "If empty, uses free pool ID saved on this record",
"btnConfirmImport": "Confirm import",
"importSuccess": "Imported. DiceReward, DiceRewardConfig (BIGWIN), and pool config refreshed.",
"importFail": "Import failed",
"dash": "—",
"dirCw": "Clockwise",
"dirCcw": "Counter-clockwise"
} }
} }

View File

@@ -6,7 +6,8 @@
"search": { "search": {
"tier": "档位", "tier": "档位",
"clockwise": "顺时针", "clockwise": "顺时针",
"anticlockwise": "逆时针" "anticlockwise": "逆时针",
"optionBigwin": "BIGWIN"
}, },
"table": { "table": {
"startIndex": "起始索引", "startIndex": "起始索引",
@@ -17,5 +18,67 @@
"realEv": "实际中奖金额", "realEv": "实际中奖金额",
"remark": "备注", "remark": "备注",
"weight": "权重(1-10000)" "weight": "权重(1-10000)"
},
"weightShared": {
"xAxisEndIndex": "结束索引",
"xAxisGridNumber": "点数",
"emptyTier": "该档位暂无配置数据",
"sumLineDual": "当前档位权重合计(顺时针):{cw};逆时针:{ccw}(各条 1-10000档位内按权重比抽取和不限制",
"sumLineSingle": "当前档位权重合计:{sum}(各条 1-10000档位内按权重比抽取和不限制",
"t4t5NoteSingle": "T4、T5 仅单一结果,无需配置权重。",
"t4t5NoteDual": "T4、T5 档位抽中时仅有一个结果,无需配置权重。",
"colEndIndexId": "结束索引(id)",
"colGridNumber": "点数(grid_number)",
"colDicePoints": "色子点数",
"colRealEv": "实际中奖金额",
"colUiText": "显示文本",
"colRemark": "备注",
"colWeightCwDir": "顺时针权重(direction=0)",
"colWeightCcwDir": "逆时针权重(direction=1)",
"weightColSuffix": "权重(1-10000)",
"fetchFail": "获取权重数据失败",
"nothingToSubmit": "没有可提交的配置",
"submitFail": "保存失败",
"btnCancel": "取消",
"btnSubmit": "提交",
"saveSuccess": "保存成功"
},
"weightEdit": {
"title": "奖励对照表dice_reward权重配比",
"globalTip": "编辑的是奖励对照表dice_reward / DiceReward 模型的权重按结束索引end_index区分顺时针与逆时针两套权重抽奖时按当前方向取对应权重。"
},
"weightRatio": {
"title": "权重配比",
"globalTip": "配置奖励对照表dice_reward的权重一级按方向顺时针/逆时针二级按档位T1-T5各条权重 1-10000档位内按权重比抽取。",
"tabClockwise": "顺时针",
"tabCounterclockwise": "逆时针"
},
"weightTest": {
"title": "一键测试权重",
"alertTitle": "彩金池逻辑说明",
"alertBody": "与 playStart 抽奖逻辑一致:使用 name=default 的安全线、杀分开关;盈利未达安全线时,付费抽奖券使用玩家自身权重(下方自定义档位),免费抽奖券使用 killScore 配置;盈利达到安全线且杀分开启时,付费/免费均使用 killScore 配置。",
"stepPaid": "付费抽奖券",
"stepFree": "免费抽奖券",
"labelLotteryTypePaid": "测试数据档位类型",
"labelLotteryTypeFree": "测试数据档位类型",
"placeholderPaidPool": "不选则下方自定义档位概率(默认 default",
"placeholderFreePool": "不选则下方自定义档位概率(默认 killScore",
"tierProbHint": "自定义档位概率T1T5每档 0-100%,五档之和不能超过 100%",
"tierFieldLabel": "档位 {tier}%",
"tierSumError": "当前五档之和为 {sum}%,不能超过 100%",
"labelCwCount": "顺时针次数",
"labelCcwCount": "逆时针次数",
"placeholderSelect": "请选择",
"btnPrev": "上一步",
"btnNext": "下一步",
"btnStart": "开始测试",
"btnCancel": "取消",
"warnTotalSpins": "付费或免费至少一种方向次数之和大于 0",
"warnPaidTierSumPositive": "付费未选奖池时T1T5 档位概率之和需大于 0",
"warnPaidTierSumMax": "付费档位概率 T1T5 之和不能超过 100%",
"warnFreeTierSumPositive": "免费未选奖池时T1T5 档位概率之和需大于 0",
"warnFreeTierSumMax": "免费档位概率 T1T5 之和不能超过 100%",
"successCreated": "测试任务已创建,后台将自动执行。请在【玩家抽奖记录(测试数据)】中查看生成的测试数据",
"failCreate": "创建测试任务失败"
} }
} }

View File

@@ -1,7 +1,74 @@
{ {
"toolbar": { "toolbar": {
"gameRewardConfig": "游戏奖励配置", "gameRewardConfig": "游戏奖励配置",
"createRewardRef": "创建奖励对照" "createRewardRef": "创建奖励对照",
"createRewardRefTitle": "按规则start_index=config(grid_number).id顺时针 end_index=(start_index+grid_number)%26逆时针 end_index=start_index-grid_number≥0?start_index-grid_number:26+start_index-grid_number"
},
"configPage": {
"tabIndex": "奖励索引",
"tabBigwin": "大奖权重",
"tipIndex": "色子点数须在 530 之间且本表内不重复。",
"tipBigwin": "从左至右:中大奖点数(不可改)、显示信息、实际中奖、备注、权重(0~10000)。点数 5、30 权重固定 100%。本表单独立提交,仅提交大奖权重。",
"colId": "索引(id)",
"colDicePoints": "色子点数",
"colDisplayText": "显示文本",
"colDisplayTextEn": "显示文本(英文)",
"colRealEv": "真实结算",
"colTier": "所属档位",
"colRemark": "备注",
"placeholderTierSelect": "档位",
"placeholderDisplayZh": "显示文本(中文)",
"placeholderDisplayEn": "显示文本(英文)",
"placeholderRemark": "备注",
"btnSave": "保存",
"btnReset": "重置",
"colBigwinPoints": "中大奖点数",
"colDisplayInfo": "显示信息",
"colDisplayInfoEn": "显示信息(英文)",
"colRealPrize": "实际中奖",
"colWeightRange": "权重(0-10000)",
"placeholderDisplayInfoZh": "显示信息(中文)",
"placeholderDisplayInfoEn": "显示信息(英文)",
"weightFixedTip": "点数 5、30 固定 100%",
"emptyBigwin": "暂无 BIGWIN 档位配置,请在「奖励索引」中设置 tier 为 BIGWIN。",
"confirmCreateRefTitle": "创建奖励对照",
"confirmCreateRefMsg": "按规则创建奖励对照:起始索引 start_index=奖励配置中 grid_number 对应格位的 id顺时针 end_index=(start_index+摇取点数)%26逆时针 end_index=start_index-摇取点数≥0 则取该值,否则 26+start_index-摇取点数。先清空现有数据再为 5-30 共 26 个点数、顺/逆时针分别生成。是否继续?",
"confirmCreateRefOk": "确定创建",
"confirmCreateRefCancel": "取消",
"createRefSuccess": "已按 5-30 共 26 个点数、顺时针+逆时针创建:顺时针新增 {cwNew} 条、逆时针新增 {ccwNew} 条;顺时针更新 {cwUp} 条、逆时针更新 {ccwUp} 条{skippedPart}",
"createRefSuccessSkipped": "{n} 个点数使用兜底起始索引",
"createRefSuccessSimple": "创建成功",
"createRefFail": "创建奖励对照失败",
"loadIndexFail": "获取奖励索引配置失败",
"saveSuccess": "保存成功",
"saveFail": "保存失败",
"resetIndexReloaded": "已重新加载奖励索引,恢复为服务器最新数据",
"resetBigwinReloaded": "已重新加载,大奖权重恢复为服务器最新数据",
"warnNoIndexToSave": "暂无奖励索引数据可保存",
"warnGridRange": "色子点数必须在 {min}{max} 之间",
"dupJoiner": "、",
"warnDupGrid": "色子点数在本表内不能重复,重复的点数为:{list}",
"warnNoBigwinToSave": "暂无 BIGWIN 档位配置可保存",
"warnBigwinDupGrid": "大奖权重本表内点数不能重复,重复的点数为:{list}",
"infoNoBigwin": "暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN"
},
"weightRatio": {
"title": "T1-T5 权重配比(顺时针/逆时针)",
"globalTip": "权重来自奖励对照表dice_reward按结束索引DiceRewardConfig.id区分顺时针与逆时针两套权重抽奖时按当前方向取对应权重。",
"xAxisEndIndex": "结束索引",
"emptyTier": "该档位暂无配置数据",
"sumLine": "当前档位权重合计(顺时针):{cw};逆时针:{ccw}(各条 1-10000档位内按权重比抽取和不限制",
"t4t5Note": "T4、T5 档位抽中时仅有一个结果,无需配置权重。",
"colEndIndexId": "结束索引(id)",
"colDicePoints": "色子点数",
"colRealEv": "实际中奖金额",
"colUiText": "显示文本",
"colWeightCw": "顺时针权重(1-10000)",
"colWeightCcw": "逆时针权重(1-10000)",
"fetchFail": "获取权重配比数据失败",
"nothingToSubmit": "没有可提交的配置",
"submitFail": "保存失败",
"saveSuccess": "保存成功"
}, },
"search": { "search": {
"dicePoints": "色子点数(摇取5-30)", "dicePoints": "色子点数(摇取5-30)",

View File

@@ -4,6 +4,8 @@
}, },
"table": { "table": {
"id": "ID", "id": "ID",
"clockwiseAbbr": "顺",
"counterclockwiseAbbr": "逆",
"status": "状态", "status": "状态",
"paidDraw": "付费抽取", "paidDraw": "付费抽取",
"freeDraw": "免费抽取", "freeDraw": "免费抽取",
@@ -27,5 +29,51 @@
"ruleTestCountRequired": "测试次数100/500/1000必需填写", "ruleTestCountRequired": "测试次数100/500/1000必需填写",
"addSuccess": "新增成功", "addSuccess": "新增成功",
"editSuccess": "修改成功" "editSuccess": "修改成功"
},
"detail": {
"title": "测试记录详情",
"sectionBasic": "基本信息",
"recordId": "记录ID",
"testCount": "测试次数",
"testCountSuffix": "次",
"createTime": "创建时间",
"admin": "执行管理员",
"paidPoolId": "付费奖池配置ID",
"freePoolId": "免费奖池配置ID",
"bigwinSnapshot": "BIGWIN 权重快照",
"sectionPaidTier": "付费抽奖档位概率T1-T5测试时使用",
"sectionFreeTier": "免费抽奖档位概率T1-T5测试时使用",
"colTier": "档位",
"colWeight": "权重",
"colPercent": "占比",
"emptyPaidTier": "暂无付费档位数据(旧记录可能仅保存 tier_weights_snapshot",
"emptyFreeTier": "暂无免费档位数据",
"sectionSnapshot": "权重配比快照(测试时使用的 T1-T5/BIGWIN 配置)",
"subCw": "顺时针(非 BIGWIN",
"subCcw": "逆时针(非 BIGWIN",
"colGridNumber": "色子点数",
"emptyCw": "暂无顺时针数据",
"emptyCcw": "暂无逆时针数据",
"subBigwin": "BIGWIN按 DiceRewardConfig 配置快照)",
"emptyBigwinTable": "暂无 BIGWIN 数据",
"sectionResult": "落点统计(各 grid_number 出现次数)",
"chartXAxis": "色子点数 (grid_number)",
"emptyResult": "暂无落点数据",
"resultTotal": "总落点次数:{n}",
"btnImport": "导入到当前配置",
"importTitle": "导入到正式配置",
"importDesc": "将本测试记录导入DiceReward格子权重、DiceRewardConfigBIGWIN weight、DiceLotteryPoolConfig付费/免费 T1-T5 档位概率)。请选择要写入的奖池。",
"importPaidLabel": "导入付费档位概率到奖池",
"importPaidPlaceholder": "选择任意奖池(建议付费池)",
"importPaidTip": "不选则使用本记录保存时的付费奖池配置 ID",
"importFreeLabel": "导入免费档位概率到奖池",
"importFreePlaceholder": "选择任意奖池(建议免费池)",
"importFreeTip": "不选则使用本记录保存时的免费奖池配置 ID",
"btnConfirmImport": "确认导入",
"importSuccess": "导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置",
"importFail": "导入失败",
"dash": "—",
"dirCw": "顺时针",
"dirCcw": "逆时针"
} }
} }

View File

@@ -15,7 +15,7 @@
<el-option label="T3" value="T3" /> <el-option label="T3" value="T3" />
<el-option label="T4" value="T4" /> <el-option label="T4" value="T4" />
<el-option label="T5" value="T5" /> <el-option label="T5" value="T5" />
<el-option label="BIGWIN" value="BIGWIN" /> <el-option :label="$t('page.search.optionBigwin')" value="BIGWIN" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@@ -1,32 +1,30 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="奖励对照表dice_reward权重配比" :title="$t('page.weightEdit.title')"
width="900px" width="900px"
align-center align-center
:close-on-click-modal="false" :close-on-click-modal="false"
@close="handleClose" @close="handleClose"
> >
<div class="global-tip"> <div class="global-tip">
编辑的是<strong>奖励对照表dice_reward / DiceReward 模型</strong {{ $t('page.weightEdit.globalTip') }}
>的权重<strong>结束索引end_index</strong>区分
<strong>顺时针</strong><strong>逆时针</strong>两套权重抽奖时按当前方向取对应权重
</div> </div>
<div v-loading="loading" class="dialog-body"> <div v-loading="loading" class="dialog-body">
<el-tabs v-model="activeTier" type="card"> <el-tabs v-model="activeTier" type="card">
<el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t"> <el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div> <div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
<template v-else> <template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'"> <div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<div class="chart-row"> <div class="chart-row">
<ArtBarChart <ArtBarChart
x-axis-name="结束索引" :x-axis-name="$t('page.weightShared.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)" :x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'clockwise')" :data="getTierChartData(t, 'clockwise')"
height="180px" height="180px"
/> />
<ArtBarChart <ArtBarChart
x-axis-name="结束索引" :x-axis-name="$t('page.weightShared.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)" :x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'counterclockwise')" :data="getTierChartData(t, 'counterclockwise')"
height="180px" height="180px"
@@ -34,42 +32,50 @@
</div> </div>
</div> </div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'"> <div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计顺时针<strong>{{ getTierSum(t, 'clockwise') }}</strong> {{
逆时针<strong>{{ getTierSum(t, 'counterclockwise') }}</strong> $t('page.weightShared.sumLineDual', {
各条 1-10000和不限制 cw: getTierSum(t, 'clockwise'),
ccw: getTierSum(t, 'counterclockwise')
})
}}
</div> </div>
<div class="weight-sum weight-sum-t4t5" v-else>T4T5 仅单一结果无需配置权重</div> <div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
<el-table :data="getTierItems(t)" border size="small" class="weight-table"> <el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column <el-table-column
label="结束索引(id)" :label="$t('page.weightShared.colEndIndexId')"
prop="id" prop="id"
width="90" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column label="色子点数" prop="grid_number" width="80" align="center" />
<el-table-column <el-table-column
label="实际中奖金额" :label="$t('page.weightShared.colDicePoints')"
prop="grid_number"
width="80"
align="center"
/>
<el-table-column
:label="$t('page.weightShared.colRealEv')"
prop="real_ev" prop="real_ev"
width="90" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="显示文本" :label="$t('page.weightShared.colUiText')"
prop="ui_text" prop="ui_text"
min-width="70" min-width="70"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="备注" :label="$t('page.weightShared.colRemark')"
prop="remark" prop="remark"
min-width="70" min-width="70"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column label="顺时针权重(direction=0)" min-width="160" align="center"> <el-table-column :label="$t('page.weightShared.colWeightCwDir')" min-width="160" align="center">
<template #default="{ row }"> <template #default="{ row }">
<div class="weight-cell-vertical"> <div class="weight-cell-vertical">
<div class="weight-slider-wrap"> <div class="weight-slider-wrap">
@@ -146,7 +152,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="逆时针权重(direction=1)" min-width="160" align="center"> <el-table-column :label="$t('page.weightShared.colWeightCcwDir')" min-width="160" align="center">
<template #default="{ row }"> <template #default="{ row }">
<div class="weight-cell-vertical"> <div class="weight-cell-vertical">
<div class="weight-slider-wrap"> <div class="weight-slider-wrap">
@@ -232,8 +238,10 @@
</el-tabs> </el-tabs>
</div> </div>
<template #footer> <template #footer>
<el-button @click="handleClose">取消</el-button> <el-button @click="handleClose">{{ $t('page.weightShared.btnCancel') }}</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交</el-button> <el-button type="primary" :loading="submitting" @click="handleSubmit">{{
$t('page.weightShared.btnSubmit')
}}</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
@@ -242,6 +250,9 @@
import api from '../../../api/reward/index' import api from '../../../api/reward/index'
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue' import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
/** 供模板 v-for 使用 */ /** 供模板 v-for 使用 */
@@ -430,7 +441,7 @@
grouped.value = parsePayload(res) grouped.value = parsePayload(res)
}) })
.catch(() => { .catch(() => {
ElMessage.error('获取权重数据失败') ElMessage.error(t('page.weightShared.fetchFail'))
}) })
.finally(() => { .finally(() => {
loading.value = false loading.value = false
@@ -456,19 +467,19 @@
function handleSubmit() { function handleSubmit() {
const items = collectItems() const items = collectItems()
if (items.length === 0) { if (items.length === 0) {
ElMessage.info('没有可提交的配置') ElMessage.info(t('page.weightShared.nothingToSubmit'))
return return
} }
submitting.value = true submitting.value = true
api api
.batchUpdateWeights(items) .batchUpdateWeights(items)
.then(() => { .then(() => {
ElMessage.success('保存成功') ElMessage.success(t('page.weightShared.saveSuccess'))
emit('success') emit('success')
handleClose() handleClose()
}) })
.catch((e: { message?: string }) => { .catch((e: { message?: string }) => {
ElMessage.error(e?.message ?? '保存失败') ElMessage.error(e?.message ?? t('page.weightShared.submitFail'))
}) })
.finally(() => { .finally(() => {
submitting.value = false submitting.value = false

View File

@@ -1,78 +1,76 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="权重配比" :title="$t('page.weightRatio.title')"
width="900px" width="900px"
align-center align-center
:close-on-click-modal="false" :close-on-click-modal="false"
@close="handleClose" @close="handleClose"
> >
<div class="global-tip"> <div class="global-tip">
配置<strong>奖励对照表dice_reward</strong>的权重一级按<strong>方向</strong>顺时针/逆时针二级按<strong>档位</strong>T1-T5各条权重 {{ $t('page.weightRatio.globalTip') }}
1-10000档位内按权重比抽取
</div> </div>
<div v-loading="loading" class="dialog-body"> <div v-loading="loading" class="dialog-body">
<!-- 一级方向懒加载避免逆时针柱状图在隐藏容器内初始化导致不显示二级档位 --> <!-- 一级方向懒加载避免逆时针柱状图在隐藏容器内初始化导致不显示二级档位 -->
<el-tabs v-model="activeDirection" type="card" class="direction-tabs" :lazy="true"> <el-tabs v-model="activeDirection" type="card" class="direction-tabs" :lazy="true">
<el-tab-pane label="顺时针" name="0"> <el-tab-pane :label="$t('page.weightRatio.tabClockwise')" name="0">
<el-tabs v-model="activeTier" type="card" class="tier-tabs"> <el-tabs v-model="activeTier" type="card" class="tier-tabs">
<el-tab-pane v-for="t in tierKeys" :key="'cw-' + t" :label="t" :name="t"> <el-tab-pane v-for="t in tierKeys" :key="'cw-' + t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div> <div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
<template v-else> <template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'"> <div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<ArtBarChart <ArtBarChart
:key="'cw-' + activeDirection + '-' + t" :key="'cw-' + activeDirection + '-' + t"
x-axis-name="点数" :x-axis-name="$t('page.weightShared.xAxisGridNumber')"
:x-axis-data="getTierChartLabels(t)" :x-axis-data="getTierChartLabels(t)"
:data="getTierChartDataForCurrentDirection(t)" :data="getTierChartDataForCurrentDirection(t)"
height="180px" height="180px"
/> />
</div> </div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'"> <div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计<strong>{{ getTierSumForCurrentDirection(t) }}</strong> {{
各条 1-10000档位内按权重比抽取和不限制 $t('page.weightShared.sumLineSingle', { sum: getTierSumForCurrentDirection(t) })
}}
</div> </div>
<div class="weight-sum weight-sum-t4t5" v-else <div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
>T4T5 仅单一结果无需配置权重</div
>
<el-table :data="getTierItems(t)" border size="small" class="weight-table"> <el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column <el-table-column
label="点数(grid_number)" :label="$t('page.weightShared.colGridNumber')"
prop="grid_number" prop="grid_number"
width="110" width="110"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="结束索引(id)" :label="$t('page.weightShared.colEndIndexId')"
prop="id" prop="id"
width="90" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="实际中奖金额" :label="$t('page.weightShared.colRealEv')"
prop="real_ev" prop="real_ev"
width="90" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="显示文本" :label="$t('page.weightShared.colUiText')"
prop="ui_text" prop="ui_text"
min-width="70" min-width="70"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="备注" :label="$t('page.weightShared.colRemark')"
prop="remark" prop="remark"
min-width="70" min-width="70"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
:label="currentDirectionLabel + ' 权重(1-10000)'" :label="currentWeightColumnLabel"
min-width="200" min-width="200"
align="center" align="center"
> >
@@ -156,65 +154,64 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="逆时针" name="1"> <el-tab-pane :label="$t('page.weightRatio.tabCounterclockwise')" name="1">
<el-tabs v-model="activeTier" type="card" class="tier-tabs"> <el-tabs v-model="activeTier" type="card" class="tier-tabs">
<el-tab-pane v-for="t in tierKeys" :key="'ccw-' + t" :label="t" :name="t"> <el-tab-pane v-for="t in tierKeys" :key="'ccw-' + t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div> <div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
<template v-else> <template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'"> <div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<ArtBarChart <ArtBarChart
:key="'ccw-' + activeDirection + '-' + t" :key="'ccw-' + activeDirection + '-' + t"
x-axis-name="点数" :x-axis-name="$t('page.weightShared.xAxisGridNumber')"
:x-axis-data="getTierChartLabels(t)" :x-axis-data="getTierChartLabels(t)"
:data="getTierChartDataForCurrentDirection(t)" :data="getTierChartDataForCurrentDirection(t)"
height="180px" height="180px"
/> />
</div> </div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'"> <div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计:<strong>{{ getTierSumForCurrentDirection(t) }}</strong> {{
(各条 1-10000档位内按权重比抽取和不限制 $t('page.weightShared.sumLineSingle', { sum: getTierSumForCurrentDirection(t) })
}}
</div> </div>
<div class="weight-sum weight-sum-t4t5" v-else <div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
>T4、T5 仅单一结果,无需配置权重。</div
>
<el-table :data="getTierItems(t)" border size="small" class="weight-table"> <el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column <el-table-column
label="点数(grid_number)" :label="$t('page.weightShared.colGridNumber')"
prop="grid_number" prop="grid_number"
width="110" width="110"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="结束索引(id)" :label="$t('page.weightShared.colEndIndexId')"
prop="id" prop="id"
width="90" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="实际中奖金额" :label="$t('page.weightShared.colRealEv')"
prop="real_ev" prop="real_ev"
width="90" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="显示文本" :label="$t('page.weightShared.colUiText')"
prop="ui_text" prop="ui_text"
min-width="70" min-width="70"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
label="备注" :label="$t('page.weightShared.colRemark')"
prop="remark" prop="remark"
min-width="70" min-width="70"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
:label="currentDirectionLabel + ' 权重(1-10000)'" :label="currentWeightColumnLabel"
min-width="200" min-width="200"
align="center" align="center"
> >
@@ -301,13 +298,14 @@
</el-tabs> </el-tabs>
</div> </div>
<template #footer> <template #footer>
<el-button @click="handleClose">取消</el-button> <el-button @click="handleClose">{{ $t('page.weightShared.btnCancel') }}</el-button>
<el-button <el-button
v-permission="'dice:reward:index:batchUpdateWeights'" v-permission="'dice:reward:index:batchUpdateWeights'"
type="primary" type="primary"
:loading="submitting" :loading="submitting"
@click="handleSubmit" @click="handleSubmit"
>提交</el-button> >{{ $t('page.weightShared.btnSubmit') }}</el-button
>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
@@ -316,6 +314,9 @@
import api from '../../../api/reward/index' import api from '../../../api/reward/index'
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue' import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t, locale } = useI18n()
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
type DirectionKey = 'clockwise' | 'counterclockwise' type DirectionKey = 'clockwise' | 'counterclockwise'
@@ -366,9 +367,14 @@
T5: { '0': [], '1': [] } T5: { '0': [], '1': [] }
}) })
const currentDirectionLabel = computed(() => const currentWeightColumnLabel = computed(() => {
activeDirection.value === '0' ? '顺时针' : '逆时针' locale.value
) const dirLabel =
activeDirection.value === '0'
? t('page.weightRatio.tabClockwise')
: t('page.weightRatio.tabCounterclockwise')
return `${dirLabel} ${t('page.weightShared.weightColSuffix')}`
})
const tierKeys = TIER_KEYS const tierKeys = TIER_KEYS
@@ -470,7 +476,7 @@
grouped.value = parsePayload(res) grouped.value = parsePayload(res)
}) })
.catch(() => { .catch(() => {
ElMessage.error('获取权重数据失败') ElMessage.error(t('page.weightShared.fetchFail'))
}) })
.finally(() => { .finally(() => {
loading.value = false loading.value = false
@@ -499,19 +505,19 @@
function handleSubmit() { function handleSubmit() {
const items = collectItems() const items = collectItems()
if (items.length === 0) { if (items.length === 0) {
ElMessage.info('没有可提交的配置') ElMessage.info(t('page.weightShared.nothingToSubmit'))
return return
} }
submitting.value = true submitting.value = true
api api
.batchUpdateWeights(items) .batchUpdateWeights(items)
.then(() => { .then(() => {
ElMessage.success('保存成功') ElMessage.success(t('page.weightShared.saveSuccess'))
emit('success') emit('success')
handleClose() handleClose()
}) })
.catch((e: { message?: string }) => { .catch((e: { message?: string }) => {
ElMessage.error(e?.message ?? '保存失败') ElMessage.error(e?.message ?? t('page.weightShared.submitFail'))
}) })
.finally(() => { .finally(() => {
submitting.value = false submitting.value = false

View File

@@ -1,33 +1,31 @@
<template> <template>
<ElDialog <ElDialog
v-model="visible" v-model="visible"
title="一键测试权重" :title="$t('page.weightTest.title')"
width="560px" width="560px"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
@close="onClose" @close="onClose"
> >
<ElAlert <ElAlert type="info" :closable="false" show-icon class="weight-test-tip">
type="info" <template #title>{{ $t('page.weightTest.alertTitle') }}</template>
:closable="false" {{ $t('page.weightTest.alertBody') }}
show-icon
class="weight-test-tip"
>
<template #title>彩金池逻辑说明</template>
playStart 抽奖逻辑一致使用 name=default 的安全线杀分开关盈利未达安全线时付费抽奖券使用玩家自身权重下方自定义档位免费抽奖券使用 killScore 配置盈利达到安全线且杀分开启时付费/免费均使用 killScore 配置
</ElAlert> </ElAlert>
<ElForm ref="formRef" :model="form" label-width="140px"> <ElForm ref="formRef" :model="form" label-width="140px">
<ElSteps :active="currentStep" finish-status="success" simple class="steps-wrap"> <ElSteps :active="currentStep" finish-status="success" simple class="steps-wrap">
<ElStep title="付费抽奖券" /> <ElStep :title="$t('page.weightTest.stepPaid')" />
<ElStep title="免费抽奖券" /> <ElStep :title="$t('page.weightTest.stepFree')" />
</ElSteps> </ElSteps>
<!-- 第一页付费抽奖券 --> <!-- 第一页付费抽奖券 -->
<div v-show="currentStep === 0" class="step-panel"> <div v-show="currentStep === 0" class="step-panel">
<ElFormItem label="测试数据档位类型" prop="paid_lottery_config_id"> <ElFormItem
:label="$t('page.weightTest.labelLotteryTypePaid')"
prop="paid_lottery_config_id"
>
<ElSelect <ElSelect
v-model="form.paid_lottery_config_id" v-model="form.paid_lottery_config_id"
placeholder="不选则下方自定义档位概率(默认 default" :placeholder="$t('page.weightTest.placeholderPaidPool')"
clearable clearable
filterable filterable
style="width: 100%" style="width: 100%"
@@ -41,11 +39,13 @@
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<template v-if="form.paid_lottery_config_id == null"> <template v-if="form.paid_lottery_config_id == null">
<div class="tier-label">自定义档位概率T1T5每档 0-100%五档之和不能超过 100%</div> <div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
<ElRow :gutter="12" class="tier-row"> <ElRow :gutter="12" class="tier-row">
<ElCol v-for="t in tierKeys" :key="'paid-' + t" :span="8"> <ElCol v-for="t in tierKeys" :key="'paid-' + t" :span="8">
<div class="tier-field"> <div class="tier-field">
<label class="tier-field-label">档位 {{ t }}%</label> <label class="tier-field-label">{{
$t('page.weightTest.tierFieldLabel', { tier: t })
}}</label>
<input <input
type="number" type="number"
:value="getPaidTier(t)" :value="getPaidTier(t)"
@@ -58,17 +58,25 @@
</div> </div>
</ElCol> </ElCol>
</ElRow> </ElRow>
<div v-if="paidTierSum > 100" class="tier-error" <div v-if="paidTierSum > 100" class="tier-error">{{
>当前五档之和为 {{ paidTierSum }}%不能超过 100%</div $t('page.weightTest.tierSumError', { sum: paidTierSum })
> }}</div>
</template> </template>
<ElFormItem label="顺时针次数" prop="paid_s_count" required> <ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="paid_s_count" required>
<ElSelect v-model="form.paid_s_count" placeholder="请选择" style="width: 100%"> <ElSelect
v-model="form.paid_s_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" /> <ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="逆时针次数" prop="paid_n_count" required> <ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="paid_n_count" required>
<ElSelect v-model="form.paid_n_count" placeholder="请选择" style="width: 100%"> <ElSelect
v-model="form.paid_n_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" /> <ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
@@ -76,10 +84,13 @@
<!-- 第二页免费抽奖券 --> <!-- 第二页免费抽奖券 -->
<div v-show="currentStep === 1" class="step-panel"> <div v-show="currentStep === 1" class="step-panel">
<ElFormItem label="测试数据档位类型" prop="free_lottery_config_id"> <ElFormItem
:label="$t('page.weightTest.labelLotteryTypeFree')"
prop="free_lottery_config_id"
>
<ElSelect <ElSelect
v-model="form.free_lottery_config_id" v-model="form.free_lottery_config_id"
placeholder="不选则下方自定义档位概率(默认 killScore" :placeholder="$t('page.weightTest.placeholderFreePool')"
clearable clearable
filterable filterable
style="width: 100%" style="width: 100%"
@@ -93,11 +104,13 @@
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<template v-if="form.free_lottery_config_id == null"> <template v-if="form.free_lottery_config_id == null">
<div class="tier-label">自定义档位概率T1T5每档 0-100%五档之和不能超过 100%</div> <div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
<ElRow :gutter="12" class="tier-row"> <ElRow :gutter="12" class="tier-row">
<ElCol v-for="t in tierKeys" :key="'free-' + t" :span="8"> <ElCol v-for="t in tierKeys" :key="'free-' + t" :span="8">
<div class="tier-field"> <div class="tier-field">
<label class="tier-field-label">档位 {{ t }}%</label> <label class="tier-field-label">{{
$t('page.weightTest.tierFieldLabel', { tier: t })
}}</label>
<input <input
type="number" type="number"
:value="getFreeTier(t)" :value="getFreeTier(t)"
@@ -110,17 +123,25 @@
</div> </div>
</ElCol> </ElCol>
</ElRow> </ElRow>
<div v-if="freeTierSum > 100" class="tier-error" <div v-if="freeTierSum > 100" class="tier-error">{{
>当前五档之和为 {{ freeTierSum }}%不能超过 100%</div $t('page.weightTest.tierSumError', { sum: freeTierSum })
> }}</div>
</template> </template>
<ElFormItem label="顺时针次数" prop="free_s_count" required> <ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="free_s_count" required>
<ElSelect v-model="form.free_s_count" placeholder="请选择" style="width: 100%"> <ElSelect
v-model="form.free_s_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" /> <ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="逆时针次数" prop="free_n_count" required> <ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="free_n_count" required>
<ElSelect v-model="form.free_n_count" placeholder="请选择" style="width: 100%"> <ElSelect
v-model="form.free_n_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" /> <ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
@@ -128,19 +149,23 @@
</ElForm> </ElForm>
<template #footer> <template #footer>
<ElButton v-if="currentStep > 0" :disabled="running" @click="currentStep--">上一步</ElButton> <ElButton v-if="currentStep > 0" :disabled="running" @click="currentStep--">{{
<ElButton v-if="currentStep < 1" type="primary" :disabled="running" @click="currentStep++" $t('page.weightTest.btnPrev')
>下一步</ElButton }}</ElButton>
> <ElButton v-if="currentStep < 1" type="primary" :disabled="running" @click="currentStep++">{{
$t('page.weightTest.btnNext')
}}</ElButton>
<ElButton <ElButton
v-if="currentStep === 1" v-if="currentStep === 1"
v-permission="'dice:reward:index:startWeightTest'" v-permission="'dice:reward:index:startWeightTest'"
type="primary" type="primary"
:loading="running" :loading="running"
@click="handleStart" @click="handleStart"
>开始测试</ElButton >{{ $t('page.weightTest.btnStart') }}</ElButton
> >
<ElButton :disabled="running" @click="visible = false">取消</ElButton> <ElButton :disabled="running" @click="visible = false">{{
$t('page.weightTest.btnCancel')
}}</ElButton>
</template> </template>
</ElDialog> </ElDialog>
</template> </template>
@@ -148,6 +173,10 @@
<script setup lang="ts"> <script setup lang="ts">
import api from '../../../api/reward/index' import api from '../../../api/reward/index'
import lotteryPoolApi from '../../../api/lottery_pool_config/index' import lotteryPoolApi from '../../../api/lottery_pool_config/index'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const countOptions = [0, 100, 500, 1000, 5000] const countOptions = [0, 100, 500, 1000, 5000]
const tierKeys = ['T1', 'T2', 'T3', 'T4', 'T5'] as const const tierKeys = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
@@ -169,7 +198,9 @@
}) })
const lotteryOptions = ref<Array<{ id: number; name: string }>>([]) const lotteryOptions = ref<Array<{ id: number; name: string }>>([])
/** 付费抽奖券可选档位name=default */ /** 付费抽奖券可选档位name=default */
const paidLotteryOptions = computed(() => lotteryOptions.value.filter((r) => r.name === 'default')) const paidLotteryOptions = computed(() =>
lotteryOptions.value.filter((r) => r.name === 'default')
)
/** 免费抽奖券可选档位:优先 name=killScore若无则显示全部以便下拉有选项 */ /** 免费抽奖券可选档位:优先 name=killScore若无则显示全部以便下拉有选项 */
const freeLotteryOptions = computed(() => { const freeLotteryOptions = computed(() => {
const list = lotteryOptions.value.filter((r) => r.name === 'killScore') const list = lotteryOptions.value.filter((r) => r.name === 'killScore')
@@ -216,7 +247,10 @@
async function loadLotteryOptions() { async function loadLotteryOptions() {
try { try {
const list = await lotteryPoolApi.getOptions() const list = await lotteryPoolApi.getOptions()
lotteryOptions.value = list.map((r: { id: number; name: string }) => ({ id: r.id, name: r.name })) lotteryOptions.value = list.map((r: { id: number; name: string }) => ({
id: r.id,
name: r.name
}))
// 付费抽奖券默认使用 name=default // 付费抽奖券默认使用 name=default
const normal = list.find((r: { name?: string }) => r.name === 'default') const normal = list.find((r: { name?: string }) => r.name === 'default')
if (normal) { if (normal) {
@@ -229,7 +263,7 @@
} else if (list.length > 0) { } else if (list.length > 0) {
form.free_lottery_config_id = list[0].id form.free_lottery_config_id = list[0].id
} }
} catch (_) { } catch {
lotteryOptions.value = [] lotteryOptions.value = []
} }
} }
@@ -256,7 +290,7 @@
function validateForm(): boolean { function validateForm(): boolean {
if (form.paid_s_count + form.paid_n_count + form.free_s_count + form.free_n_count <= 0) { if (form.paid_s_count + form.paid_n_count + form.free_s_count + form.free_n_count <= 0) {
ElMessage.warning('付费或免费至少一种方向次数之和大于 0') ElMessage.warning(t('page.weightTest.warnTotalSpins'))
return false return false
} }
const needPaidTier = form.paid_lottery_config_id == null const needPaidTier = form.paid_lottery_config_id == null
@@ -264,22 +298,22 @@
if (needPaidTier) { if (needPaidTier) {
const sum = paidTierSum.value const sum = paidTierSum.value
if (sum <= 0) { if (sum <= 0) {
ElMessage.warning('付费未选奖池时T1T5 档位概率之和需大于 0') ElMessage.warning(t('page.weightTest.warnPaidTierSumPositive'))
return false return false
} }
if (sum > 100) { if (sum > 100) {
ElMessage.warning('付费档位概率 T1T5 之和不能超过 100%') ElMessage.warning(t('page.weightTest.warnPaidTierSumMax'))
return false return false
} }
} }
if (needFreeTier) { if (needFreeTier) {
const sum = freeTierSum.value const sum = freeTierSum.value
if (sum <= 0) { if (sum <= 0) {
ElMessage.warning('免费未选奖池时T1T5 档位概率之和需大于 0') ElMessage.warning(t('page.weightTest.warnFreeTierSumPositive'))
return false return false
} }
if (sum > 100) { if (sum > 100) {
ElMessage.warning('免费档位概率 T1T5 之和不能超过 100%') ElMessage.warning(t('page.weightTest.warnFreeTierSumMax'))
return false return false
} }
} }
@@ -291,13 +325,11 @@
running.value = true running.value = true
try { try {
await api.startWeightTest(buildPayload()) await api.startWeightTest(buildPayload())
ElMessage.success( ElMessage.success(t('page.weightTest.successCreated'))
'测试任务已创建,后台将自动执行。请在【玩家抽奖记录(测试数据)】中查看生成的测试数据'
)
visible.value = false visible.value = false
emit('success') emit('success')
} catch (e: any) { } catch (e: any) {
ElMessage.error(e?.message || '创建测试任务失败') ElMessage.error(e?.message || t('page.weightTest.failCreate'))
} finally { } finally {
running.value = false running.value = false
} }

View File

@@ -10,7 +10,7 @@
:loading="createRewardLoading" :loading="createRewardLoading"
@click="handleCreateRewardReference" @click="handleCreateRewardReference"
v-ripple v-ripple
title="按规则start_index=config(grid_number).id顺时针 end_index=(start_index+grid_number)%26逆时针 end_index=start_index-grid_number≥0?start_index-grid_number:26+start_index-grid_number" :title="$t('page.toolbar.createRewardRefTitle')"
> >
{{ $t('page.toolbar.createRewardRef') }} {{ $t('page.toolbar.createRewardRef') }}
</ElButton> </ElButton>
@@ -18,9 +18,9 @@
</template> </template>
<ElTabs v-model="activeTab" type="card" class="top-tabs"> <ElTabs v-model="activeTab" type="card" class="top-tabs">
<ElTabPane label="奖励索引" name="index"> <ElTabPane :label="$t('page.configPage.tabIndex')" name="index">
<div class="tab-panel"> <div class="tab-panel">
<div class="panel-tip">色子点数须在 530 之间且本表内不重复</div> <div class="panel-tip">{{ $t('page.configPage.tipIndex') }}</div>
<div class="table-scroll-wrap"> <div class="table-scroll-wrap">
<ElTable <ElTable
v-loading="loading" v-loading="loading"
@@ -29,12 +29,12 @@
size="default" size="default"
class="config-table" class="config-table"
> >
<ElTableColumn label="索引(id)" prop="id" width="60" align="center"> <ElTableColumn :label="$t('page.configPage.colId')" prop="id" width="60" align="center">
<template #default="{ row }"> <template #default="{ row }">
<span>{{ row.id }}</span> <span>{{ row.id }}</span>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="色子点数" min-width="100" align="center"> <ElTableColumn :label="$t('page.configPage.colDicePoints')" min-width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInputNumber <ElInputNumber
v-model="row.grid_number" v-model="row.grid_number"
@@ -46,17 +46,25 @@
/> />
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="显示文本" min-width="100" align="center"> <ElTableColumn :label="$t('page.configPage.colDisplayText')" min-width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInput v-model="row.ui_text" size="small" placeholder="显示文本(中文)" /> <ElInput
v-model="row.ui_text"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayZh')"
/>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="显示文本(英文)" min-width="120" align="center"> <ElTableColumn :label="$t('page.configPage.colDisplayTextEn')" min-width="120" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInput v-model="row.ui_text_en" size="small" placeholder="显示文本(英文)" /> <ElInput
v-model="row.ui_text_en"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayEn')"
/>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="真实结算" min-width="110" align="center"> <ElTableColumn :label="$t('page.configPage.colRealEv')" min-width="110" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInputNumber <ElInputNumber
v-model="row.real_ev" v-model="row.real_ev"
@@ -66,11 +74,11 @@
/> />
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="所属档位" width="100" align="center"> <ElTableColumn :label="$t('page.configPage.colTier')" width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElSelect <ElSelect
v-model="row.tier" v-model="row.tier"
placeholder="档位" :placeholder="$t('page.configPage.placeholderTierSelect')"
clearable clearable
size="small" size="small"
class="full-width" class="full-width"
@@ -83,9 +91,13 @@
</ElSelect> </ElSelect>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="备注" min-width="140" align="center"> <ElTableColumn :label="$t('page.configPage.colRemark')" min-width="140" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInput v-model="row.remark" size="small" placeholder="备注" /> <ElInput
v-model="row.remark"
size="small"
:placeholder="$t('page.configPage.placeholderRemark')"
/>
</template> </template>
</ElTableColumn> </ElTableColumn>
</ElTable> </ElTable>
@@ -96,18 +108,15 @@
type="primary" type="primary"
:loading="savingIndex" :loading="savingIndex"
@click="handleSaveIndex" @click="handleSaveIndex"
>保存</ElButton >{{ $t('page.configPage.btnSave') }}</ElButton
> >
<ElButton @click="handleResetIndex">重置</ElButton> <ElButton @click="handleResetIndex">{{ $t('page.configPage.btnReset') }}</ElButton>
</div> </div>
</div> </div>
</ElTabPane> </ElTabPane>
<ElTabPane label="大奖权重" name="bigwin"> <ElTabPane :label="$t('page.configPage.tabBigwin')" name="bigwin">
<div class="tab-panel"> <div class="tab-panel">
<div class="panel-tip" <div class="panel-tip">{{ $t('page.configPage.tipBigwin') }}</div>
>从左至右中大奖点数不可改显示信息实际中奖备注权重(0~10000)点数 530
权重固定 100%本表单独立提交仅提交大奖权重</div
>
<div class="table-scroll-wrap"> <div class="table-scroll-wrap">
<ElTable <ElTable
v-loading="loading" v-loading="loading"
@@ -116,22 +125,30 @@
size="default" size="default"
class="config-table bigwin-table" class="config-table bigwin-table"
> >
<ElTableColumn label="中大奖点数" width="100" align="center"> <ElTableColumn :label="$t('page.configPage.colBigwinPoints')" width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<span class="readonly-value">{{ row.grid_number }}</span> <span class="readonly-value">{{ row.grid_number }}</span>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="显示信息" min-width="140" align="center"> <ElTableColumn :label="$t('page.configPage.colDisplayInfo')" min-width="140" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInput v-model="row.ui_text" size="small" placeholder="显示信息(中文)" /> <ElInput
v-model="row.ui_text"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayInfoZh')"
/>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="显示信息(英文)" min-width="160" align="center"> <ElTableColumn :label="$t('page.configPage.colDisplayInfoEn')" min-width="160" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInput v-model="row.ui_text_en" size="small" placeholder="显示信息(英文)" /> <ElInput
v-model="row.ui_text_en"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayInfoEn')"
/>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="实际中奖" min-width="120" align="center"> <ElTableColumn :label="$t('page.configPage.colRealPrize')" min-width="120" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInputNumber <ElInputNumber
v-model="row.real_ev" v-model="row.real_ev"
@@ -141,12 +158,16 @@
/> />
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="备注" min-width="140" align="center"> <ElTableColumn :label="$t('page.configPage.colRemark')" min-width="140" align="center">
<template #default="{ row }"> <template #default="{ row }">
<ElInput v-model="row.remark" size="small" placeholder="备注" /> <ElInput
v-model="row.remark"
size="small"
:placeholder="$t('page.configPage.placeholderRemark')"
/>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn label="权重(0-10000)" min-width="220" align="center"> <ElTableColumn :label="$t('page.configPage.colWeightRange')" min-width="220" align="center">
<template #default="{ row }"> <template #default="{ row }">
<div class="weight-cell"> <div class="weight-cell">
<ElSlider <ElSlider
@@ -167,15 +188,15 @@
class="weight-input" class="weight-input"
/> />
</div> </div>
<span v-if="isBigwinWeightDisabled(row)" class="weight-tip" <span v-if="isBigwinWeightDisabled(row)" class="weight-tip">{{
>点数 530 固定 100%</span $t('page.configPage.weightFixedTip')
> }}</span>
</template> </template>
</ElTableColumn> </ElTableColumn>
</ElTable> </ElTable>
</div> </div>
<div v-if="bigwinRows.length === 0 && !loading" class="empty-tip"> <div v-if="bigwinRows.length === 0 && !loading" class="empty-tip">
暂无 BIGWIN 档位配置请在奖励索引中设置 tier BIGWIN {{ $t('page.configPage.emptyBigwin') }}
</div> </div>
<div class="tab-footer"> <div class="tab-footer">
<ElButton <ElButton
@@ -183,9 +204,9 @@
type="primary" type="primary"
:loading="savingBigwin" :loading="savingBigwin"
@click="handleSaveBigwin" @click="handleSaveBigwin"
>保存</ElButton >{{ $t('page.configPage.btnSave') }}</ElButton
> >
<ElButton @click="handleResetBigwin">重置</ElButton> <ElButton @click="handleResetBigwin">{{ $t('page.configPage.btnReset') }}</ElButton>
</div> </div>
</div> </div>
</ElTabPane> </ElTabPane>
@@ -196,8 +217,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { useI18n } from 'vue-i18n'
import api from '../../api/reward_config/index' import api from '../../api/reward_config/index'
const { t } = useI18n()
/** 第一页:奖励索引行(来自 DiceRewardConfig 表) */ /** 第一页:奖励索引行(来自 DiceRewardConfig 表) */
interface IndexRow { interface IndexRow {
id: number id: number
@@ -247,11 +271,11 @@
async function handleCreateRewardReference() { async function handleCreateRewardReference() {
try { try {
await ElMessageBox.confirm( await ElMessageBox.confirm(
'按规则创建奖励对照:起始索引 start_index=奖励配置中 grid_number 对应格位的 id顺时针 end_index=(start_index+摇取点数)%26逆时针 end_index=start_index-摇取点数≥0 则取该值,否则 26+start_index-摇取点数。先清空现有数据再为 5-30 共 26 个点数、顺/逆时针分别生成。是否继续?', t('page.configPage.confirmCreateRefMsg'),
'创建奖励对照', t('page.configPage.confirmCreateRefTitle'),
{ {
confirmButtonText: '确定创建', confirmButtonText: t('page.configPage.confirmCreateRefOk'),
cancelButtonText: '取消', cancelButtonText: t('page.configPage.confirmCreateRefCancel'),
type: 'warning' type: 'warning'
} }
) )
@@ -262,14 +286,23 @@
try { try {
const res: any = await api.createRewardReference() const res: any = await api.createRewardReference()
const data = res?.data ?? res const data = res?.data ?? res
const msg = let msg = t('page.configPage.createRefSuccessSimple')
typeof data === 'object' && data !== null if (typeof data === 'object' && data !== null) {
? `已按 5-30 共26个点数、顺时针+逆时针创建:顺时针新增 ${data.created_clockwise ?? 0} 条、逆时针新增 ${data.created_counterclockwise ?? 0} 条;顺时针更新 ${data.updated_clockwise ?? 0} 条、逆时针更新 ${data.updated_counterclockwise ?? 0}${(data.skipped ?? 0) > 0 ? `${data.skipped} 个点数使用兜底起始索引` : ''}` const skipped = Number(data.skipped ?? 0)
: '创建成功' const skippedPart =
skipped > 0 ? t('page.configPage.createRefSuccessSkipped', { n: skipped }) : ''
msg = t('page.configPage.createRefSuccess', {
cwNew: data.created_clockwise ?? 0,
ccwNew: data.created_counterclockwise ?? 0,
cwUp: data.updated_clockwise ?? 0,
ccwUp: data.updated_counterclockwise ?? 0,
skippedPart
})
}
ElMessage.success(msg) ElMessage.success(msg)
loadIndexList() loadIndexList()
} catch (e: any) { } catch (e: any) {
ElMessage.error(e?.message ?? '创建奖励对照失败') ElMessage.error(e?.message ?? t('page.configPage.createRefFail'))
} finally { } finally {
createRewardLoading.value = false createRewardLoading.value = false
} }
@@ -288,7 +321,7 @@
indexRowsSnapshot = rows.map((r) => ({ ...r })) indexRowsSnapshot = rows.map((r) => ({ ...r }))
}) })
.catch(() => { .catch(() => {
ElMessage.error('获取奖励索引配置失败') ElMessage.error(t('page.configPage.loadIndexFail'))
}) })
.finally(() => { .finally(() => {
loading.value = false loading.value = false
@@ -319,18 +352,20 @@
function validateIndexFormForSave(): string | null { function validateIndexFormForSave(): string | null {
const toSave = indexRows.value.filter((r) => r.tier !== 'BIGWIN') const toSave = indexRows.value.filter((r) => r.tier !== 'BIGWIN')
if (toSave.length === 0) { if (toSave.length === 0) {
return '暂无奖励索引数据可保存' return t('page.configPage.warnNoIndexToSave')
} }
const nums = toSave.map((r) => Number(r.grid_number)) const nums = toSave.map((r) => Number(r.grid_number))
const outOfRange = nums.filter( const outOfRange = nums.filter(
(n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX (n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX
) )
if (outOfRange.length > 0) { if (outOfRange.length > 0) {
return `色子点数必须在 ${GRID_NUMBER_MIN}${GRID_NUMBER_MAX} 之间` return t('page.configPage.warnGridRange', { min: GRID_NUMBER_MIN, max: GRID_NUMBER_MAX })
} }
const duplicates = findDuplicateValues(nums) const duplicates = findDuplicateValues(nums)
if (duplicates.length > 0) { if (duplicates.length > 0) {
return `色子点数在本表内不能重复,重复的点数为:${duplicates.join('、')}` return t('page.configPage.warnDupGrid', {
list: duplicates.join(t('page.configPage.dupJoiner'))
})
} }
return null return null
} }
@@ -355,10 +390,10 @@
remark: r.remark remark: r.remark
})) }))
await api.batchUpdate(indexPayload) await api.batchUpdate(indexPayload)
ElMessage.success('保存成功') ElMessage.success(t('page.configPage.saveSuccess'))
indexRowsSnapshot = indexRows.value.map((r) => ({ ...r })) indexRowsSnapshot = indexRows.value.map((r) => ({ ...r }))
} catch (e: any) { } catch (e: any) {
ElMessage.error(e?.message ?? '保存失败') ElMessage.error(e?.message ?? t('page.configPage.saveFail'))
} finally { } finally {
savingIndex.value = false savingIndex.value = false
} }
@@ -367,25 +402,27 @@
/** 奖励索引页:重置为本页数据(重新拉取列表) */ /** 奖励索引页:重置为本页数据(重新拉取列表) */
function handleResetIndex() { function handleResetIndex() {
loadIndexList() loadIndexList()
ElMessage.info('已重新加载奖励索引,恢复为服务器最新数据') ElMessage.info(t('page.configPage.resetIndexReloaded'))
} }
/** 大奖权重表单校验:点数在本表内不重复 */ /** 大奖权重表单校验:点数在本表内不重复 */
function validateBigwinFormForSave(): string | null { function validateBigwinFormForSave(): string | null {
const rows = bigwinRows.value const rows = bigwinRows.value
if (rows.length === 0) { if (rows.length === 0) {
return '暂无 BIGWIN 档位配置可保存' return t('page.configPage.warnNoBigwinToSave')
} }
const nums = rows.map((r) => Number(r.grid_number)) const nums = rows.map((r) => Number(r.grid_number))
const outOfRange = nums.filter( const outOfRange = nums.filter(
(n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX (n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX
) )
if (outOfRange.length > 0) { if (outOfRange.length > 0) {
return `色子点数必须在 ${GRID_NUMBER_MIN}${GRID_NUMBER_MAX} 之间` return t('page.configPage.warnGridRange', { min: GRID_NUMBER_MIN, max: GRID_NUMBER_MAX })
} }
const duplicates = findDuplicateValues(nums) const duplicates = findDuplicateValues(nums)
if (duplicates.length > 0) { if (duplicates.length > 0) {
return `大奖权重本表内点数不能重复,重复的点数为:${duplicates.join('、')}` return t('page.configPage.warnBigwinDupGrid', {
list: duplicates.join(t('page.configPage.dupJoiner'))
})
} }
return null return null
} }
@@ -394,7 +431,7 @@
async function handleSaveBigwin() { async function handleSaveBigwin() {
const rows = bigwinRows.value const rows = bigwinRows.value
if (rows.length === 0) { if (rows.length === 0) {
ElMessage.info('暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN') ElMessage.info(t('page.configPage.infoNoBigwin'))
return return
} }
const err = validateBigwinFormForSave() const err = validateBigwinFormForSave()
@@ -421,10 +458,10 @@
: Math.max(0, Math.min(10000, Math.floor(r.weight))) : Math.max(0, Math.min(10000, Math.floor(r.weight)))
})) }))
await api.saveBigwinWeightsByGrid(weightItems) await api.saveBigwinWeightsByGrid(weightItems)
ElMessage.success('保存成功') ElMessage.success(t('page.configPage.saveSuccess'))
loadIndexList() loadIndexList()
} catch (e: any) { } catch (e: any) {
ElMessage.error(e?.message ?? '保存失败') ElMessage.error(e?.message ?? t('page.configPage.saveFail'))
} finally { } finally {
savingBigwin.value = false savingBigwin.value = false
} }
@@ -433,7 +470,7 @@
/** 大奖权重页重置重新拉取列表BIGWIN 数据随之更新) */ /** 大奖权重页重置重新拉取列表BIGWIN 数据随之更新) */
function handleResetBigwin() { function handleResetBigwin() {
loadIndexList() loadIndexList()
ElMessage.info('已重新加载,大奖权重恢复为服务器最新数据') ElMessage.info(t('page.configPage.resetBigwinReloaded'))
} }
onMounted(() => { onMounted(() => {

View File

@@ -113,7 +113,7 @@
/** /**
* 表单验证规则(权重已迁移至权重配比弹窗) * 表单验证规则(权重已迁移至权重配比弹窗)
*/ */
const rules = reactive<FormRules>({ const rules = computed<FormRules>(() => ({
grid_number: [{ required: true, message: t('page.form.ruleDicePointsRequired'), trigger: 'blur' }], grid_number: [{ required: true, message: t('page.form.ruleDicePointsRequired'), trigger: 'blur' }],
ui_text: [{ required: true, message: t('page.form.ruleUiTextRequired'), trigger: 'blur' }], ui_text: [{ required: true, message: t('page.form.ruleUiTextRequired'), trigger: 'blur' }],
ui_text_en: [{ max: 255, message: t('page.form.ruleUiTextEnMax'), trigger: 'blur' }], ui_text_en: [{ max: 255, message: t('page.form.ruleUiTextEnMax'), trigger: 'blur' }],
@@ -122,7 +122,7 @@
weight: [ weight: [
{ type: 'number', min: 0, max: 10000, message: t('page.form.ruleBigWinWeightRange'), trigger: 'blur' } { type: 'number', min: 0, max: 10000, message: t('page.form.ruleBigWinWeightRange'), trigger: 'blur' }
] ]
}) }))
/** 点数 5、30 固定 100% 中大奖,权重不可改 */ /** 点数 5、30 固定 100% 中大奖,权重不可改 */
const isBigwinWeightDisabled = computed( const isBigwinWeightDisabled = computed(

View File

@@ -1,29 +1,29 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="T1-T5 权重配比(顺时针/逆时针)" :title="$t('page.weightRatio.title')"
width="900px" width="900px"
align-center align-center
:close-on-click-modal="false" :close-on-click-modal="false"
@close="handleClose" @close="handleClose"
> >
<div class="global-tip"> <div class="global-tip">
权重来自<strong>奖励对照表dice_reward</strong><strong>结束索引DiceRewardConfig.id</strong>区分<strong>顺时针</strong><strong>逆时针</strong>两套权重抽奖时按当前方向取对应权重 {{ $t('page.weightRatio.globalTip') }}
</div> </div>
<el-tabs v-model="activeTier" type="card"> <el-tabs v-model="activeTier" type="card">
<el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t"> <el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip"> 该档位暂无配置数据 </div> <div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightRatio.emptyTier') }}</div>
<template v-else> <template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'"> <div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<div class="chart-row"> <div class="chart-row">
<ArtBarChart <ArtBarChart
x-axis-name="结束索引" :x-axis-name="$t('page.weightRatio.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)" :x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'clockwise')" :data="getTierChartData(t, 'clockwise')"
height="180px" height="180px"
/> />
<ArtBarChart <ArtBarChart
x-axis-name="结束索引" :x-axis-name="$t('page.weightRatio.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)" :x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'counterclockwise')" :data="getTierChartData(t, 'counterclockwise')"
height="180px" height="180px"
@@ -31,20 +31,41 @@
</div> </div>
</div> </div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'"> <div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计顺时针<strong>{{ getTierSumForValidation(t, 'clockwise') }}</strong> {{
逆时针<strong>{{ getTierSumForValidation(t, 'counterclockwise') }}</strong> $t('page.weightRatio.sumLine', {
各条 1-10000档位内按权重比抽取和不限制 cw: getTierSumForValidation(t, 'clockwise'),
ccw: getTierSumForValidation(t, 'counterclockwise')
})
}}
</div> </div>
<div class="weight-sum weight-sum-t4t5" v-else> <div class="weight-sum weight-sum-t4t5" v-else>
T4T5 档位抽中时仅有一个结果无需配置权重 {{ $t('page.weightRatio.t4t5Note') }}
</div> </div>
<el-table :data="getTierItems(t)" border size="small" class="weight-table"> <el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column label="结束索引(id)" prop="id" width="90" align="center" show-overflow-tooltip /> <el-table-column
<el-table-column label="色子点数" prop="grid_number" width="80" align="center" /> :label="$t('page.weightRatio.colEndIndexId')"
<el-table-column label="实际中奖金额" prop="real_ev" width="90" align="center" show-overflow-tooltip /> prop="id"
<el-table-column label="显示文本" prop="ui_text" min-width="70" align="center" show-overflow-tooltip /> width="90"
<el-table-column label="备注" prop="remark" min-width="70" align="center" show-overflow-tooltip /> align="center"
<el-table-column label="顺时针权重(1-10000)" min-width="160" align="center"> show-overflow-tooltip
/>
<el-table-column :label="$t('page.weightRatio.colDicePoints')" prop="grid_number" width="80" align="center" />
<el-table-column
:label="$t('page.weightRatio.colRealEv')"
prop="real_ev"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
:label="$t('page.weightRatio.colUiText')"
prop="ui_text"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column :label="$t('page.table.remark')" prop="remark" min-width="70" align="center" show-overflow-tooltip />
<el-table-column :label="$t('page.weightRatio.colWeightCw')" min-width="160" align="center">
<template #default="{ row }"> <template #default="{ row }">
<div class="weight-cell-vertical"> <div class="weight-cell-vertical">
<div class="weight-slider-wrap"> <div class="weight-slider-wrap">
@@ -87,7 +108,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="逆时针权重(1-10000)" min-width="160" align="center"> <el-table-column :label="$t('page.weightRatio.colWeightCcw')" min-width="160" align="center">
<template #default="{ row }"> <template #default="{ row }">
<div class="weight-cell-vertical"> <div class="weight-cell-vertical">
<div class="weight-slider-wrap"> <div class="weight-slider-wrap">
@@ -135,13 +156,14 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<template #footer> <template #footer>
<el-button @click="handleClose">取消</el-button> <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
<el-button <el-button
v-permission="'dice:reward_config:index:batchUpdateWeights'" v-permission="'dice:reward_config:index:batchUpdateWeights'"
type="primary" type="primary"
:loading="submitting" :loading="submitting"
@click="handleSubmit" @click="handleSubmit"
>提交</el-button> >{{ $t('table.form.submit') }}</el-button
>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
@@ -150,6 +172,9 @@
import api from '../../../api/reward_config/index' import api from '../../../api/reward_config/index'
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue' import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
type DirectionKey = 'clockwise' | 'counterclockwise' type DirectionKey = 'clockwise' | 'counterclockwise'
@@ -340,7 +365,7 @@
grouped.value = parseWeightRatioPayload(res) grouped.value = parseWeightRatioPayload(res)
}) })
.catch(() => { .catch(() => {
ElMessage.error('获取权重配比数据失败') ElMessage.error(t('page.weightRatio.fetchFail'))
}) })
} }
@@ -363,19 +388,19 @@
function handleSubmit() { function handleSubmit() {
const items = collectItems() const items = collectItems()
if (items.length === 0) { if (items.length === 0) {
ElMessage.info('没有可提交的配置') ElMessage.info(t('page.weightRatio.nothingToSubmit'))
return return
} }
submitting.value = true submitting.value = true
api api
.batchUpdateWeights(items) .batchUpdateWeights(items)
.then(() => { .then(() => {
ElMessage.success('保存成功') ElMessage.success(t('page.weightRatio.saveSuccess'))
emit('success') emit('success')
handleClose() handleClose()
}) })
.catch((e: { message?: string }) => { .catch((e: { message?: string }) => {
ElMessage.error(e?.message ?? '保存失败') ElMessage.error(e?.message ?? t('page.weightRatio.submitFail'))
}) })
.finally(() => { .finally(() => {
submitting.value = false submitting.value = false

View File

@@ -42,11 +42,17 @@
</template> </template>
<!-- 付费抽取顺时针逆时针抽取次数兼容旧数据用 s_count/n_count --> <!-- 付费抽取顺时针逆时针抽取次数兼容旧数据用 s_count/n_count -->
<template #paid_draw="{ row }"> <template #paid_draw="{ row }">
<span> {{ getPaidS(row) }} / {{ getPaidN(row) }}</span> <span
>{{ $t('page.table.clockwiseAbbr') }} {{ getPaidS(row) }} /
{{ $t('page.table.counterclockwiseAbbr') }} {{ getPaidN(row) }}</span
>
</template> </template>
<!-- 免费抽取顺时针逆时针抽取次数 --> <!-- 免费抽取顺时针逆时针抽取次数 -->
<template #free_draw="{ row }"> <template #free_draw="{ row }">
<span> {{ row.free_s_count ?? 0 }} / {{ row.free_n_count ?? 0 }}</span> <span
>{{ $t('page.table.clockwiseAbbr') }} {{ row.free_s_count ?? 0 }} /
{{ $t('page.table.counterclockwiseAbbr') }} {{ row.free_n_count ?? 0 }}</span
>
</template> </template>
<!-- 平台赚取金额 --> <!-- 平台赚取金额 -->
<template #platform_profit="{ row }"> <template #platform_profit="{ row }">
@@ -127,7 +133,7 @@
if (s === -1) return t('page.table.statusFail') if (s === -1) return t('page.table.statusFail')
if (s === 1) return t('page.table.statusDone') if (s === 1) return t('page.table.statusDone')
if (s === 0 || s === 2) return t('page.table.statusTesting') if (s === 0 || s === 2) return t('page.table.statusTesting')
return '—' return t('page.detail.dash')
} }
// 付费抽取次数(兼容旧数据:无 paid_s_count 时用 s_count // 付费抽取次数(兼容旧数据:无 paid_s_count 时用 s_count
@@ -144,9 +150,10 @@
// 平台赚取金额展示(未完成或空显示 —) // 平台赚取金额展示(未完成或空显示 —)
function formatPlatformProfit(v: unknown): string { function formatPlatformProfit(v: unknown): string {
if (v === null || v === undefined || v === '') return '—' const dash = t('page.detail.dash')
if (v === null || v === undefined || v === '') return dash
const n = Number(v) const n = Number(v)
if (Number.isNaN(n)) return '—' if (Number.isNaN(n)) return dash
return String(n) return String(n)
} }

View File

@@ -1,7 +1,7 @@
<template> <template>
<el-drawer <el-drawer
v-model="visible" v-model="visible"
title="测试记录详情" :title="$t('page.detail.title')"
:size="drawerSize" :size="drawerSize"
direction="rtl" direction="rtl"
destroy-on-close destroy-on-close
@@ -9,37 +9,39 @@
> >
<template v-if="record"> <template v-if="record">
<div class="detail-section"> <div class="detail-section">
<div class="section-title">基本信息</div> <div class="section-title">{{ $t('page.detail.sectionBasic') }}</div>
<el-descriptions :column="2" border size="small"> <el-descriptions :column="2" border size="small">
<el-descriptions-item label="记录ID"> <el-descriptions-item :label="$t('page.detail.recordId')">
{{ record.id }} {{ record.id }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="测试次数">{{ record.test_count }} </el-descriptions-item> <el-descriptions-item :label="$t('page.detail.testCount')"
<el-descriptions-item label="创建时间"> >{{ record.test_count }}{{ $t('page.detail.testCountSuffix') }}</el-descriptions-item
{{ record.create_time || '—' }} >
<el-descriptions-item :label="$t('page.detail.createTime')">
{{ record.create_time || $t('page.detail.dash') }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="执行管理员"> <el-descriptions-item :label="$t('page.detail.admin')">
{{ record.admin_name ?? record.admin_id ?? '—' }} {{ record.admin_name ?? record.admin_id ?? $t('page.detail.dash') }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="付费奖池配置ID"> <el-descriptions-item :label="$t('page.detail.paidPoolId')">
{{ record.paid_lottery_config_id ?? record.lottery_config_id ?? '—' }} {{ record.paid_lottery_config_id ?? record.lottery_config_id ?? $t('page.detail.dash') }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="免费奖池配置ID"> <el-descriptions-item :label="$t('page.detail.freePoolId')">
{{ record.free_lottery_config_id ?? '—' }} {{ record.free_lottery_config_id ?? $t('page.detail.dash') }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="BIGWIN 权重快照"> <el-descriptions-item :label="$t('page.detail.bigwinSnapshot')">
<template v-if="bigwinWeightDisplay.length"> <template v-if="bigwinWeightDisplay.length">
<span v-for="item in bigwinWeightDisplay" :key="item.grid" class="mr-2"> <span v-for="item in bigwinWeightDisplay" :key="item.grid" class="mr-2">
{{ item.grid }}:{{ item.weight }} {{ item.grid }}:{{ item.weight }}
</span> </span>
</template> </template>
<template v-else></template> <template v-else>{{ $t('page.detail.dash') }}</template>
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</div> </div>
<div class="detail-section"> <div class="detail-section">
<div class="section-title">付费抽奖档位概率T1-T5测试时使用</div> <div class="section-title">{{ $t('page.detail.sectionPaidTier') }}</div>
<el-table <el-table
v-if="paidTierTableData.length" v-if="paidTierTableData.length"
:data="paidTierTableData" :data="paidTierTableData"
@@ -48,17 +50,17 @@
class="tier-weights-table" class="tier-weights-table"
max-height="160" max-height="160"
> >
<el-table-column prop="tier" label="档位" width="80" align="center" /> <el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="weight" label="权重" width="100" align="center" /> <el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="100" align="center" />
<el-table-column prop="percent" label="占比" width="100" align="center" /> <el-table-column prop="percent" :label="$t('page.detail.colPercent')" width="100" align="center" />
</el-table> </el-table>
<div v-else class="empty-tip"> <div v-else class="empty-tip">
暂无付费档位数据旧记录可能仅保存 tier_weights_snapshot {{ $t('page.detail.emptyPaidTier') }}
</div> </div>
</div> </div>
<div class="detail-section"> <div class="detail-section">
<div class="section-title">免费抽奖档位概率T1-T5测试时使用</div> <div class="section-title">{{ $t('page.detail.sectionFreeTier') }}</div>
<el-table <el-table
v-if="freeTierTableData.length" v-if="freeTierTableData.length"
:data="freeTierTableData" :data="freeTierTableData"
@@ -67,18 +69,18 @@
class="tier-weights-table" class="tier-weights-table"
max-height="160" max-height="160"
> >
<el-table-column prop="tier" label="档位" width="80" align="center" /> <el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="weight" label="权重" width="100" align="center" /> <el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="100" align="center" />
<el-table-column prop="percent" label="占比" width="100" align="center" /> <el-table-column prop="percent" :label="$t('page.detail.colPercent')" width="100" align="center" />
</el-table> </el-table>
<div v-else class="empty-tip">暂无免费档位数据</div> <div v-else class="empty-tip">{{ $t('page.detail.emptyFreeTier') }}</div>
</div> </div>
<div class="detail-section"> <div class="detail-section">
<div class="section-title">权重配比快照测试时使用的 T1-T5/BIGWIN 配置</div> <div class="section-title">{{ $t('page.detail.sectionSnapshot') }}</div>
<div class="snapshot-group"> <div class="snapshot-group">
<div class="snapshot-subtitle">顺时针 BIGWIN</div> <div class="snapshot-subtitle">{{ $t('page.detail.subCw') }}</div>
<el-table <el-table
:data="snapshotClockwise" :data="snapshotClockwise"
border border
@@ -86,15 +88,15 @@
max-height="180" max-height="180"
class="snapshot-table" class="snapshot-table"
> >
<el-table-column prop="tier" label="档位" width="80" align="center" /> <el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" /> <el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
<el-table-column prop="weight" label="权重" width="90" align="center" /> <el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
</el-table> </el-table>
<div v-if="!snapshotClockwise.length" class="empty-tip">暂无顺时针数据</div> <div v-if="!snapshotClockwise.length" class="empty-tip">{{ $t('page.detail.emptyCw') }}</div>
</div> </div>
<div class="snapshot-group"> <div class="snapshot-group">
<div class="snapshot-subtitle">逆时针 BIGWIN</div> <div class="snapshot-subtitle">{{ $t('page.detail.subCcw') }}</div>
<el-table <el-table
:data="snapshotCounterclockwise" :data="snapshotCounterclockwise"
border border
@@ -102,15 +104,15 @@
max-height="180" max-height="180"
class="snapshot-table" class="snapshot-table"
> >
<el-table-column prop="tier" label="档位" width="80" align="center" /> <el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" /> <el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
<el-table-column prop="weight" label="权重" width="90" align="center" /> <el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
</el-table> </el-table>
<div v-if="!snapshotCounterclockwise.length" class="empty-tip">暂无逆时针数据</div> <div v-if="!snapshotCounterclockwise.length" class="empty-tip">{{ $t('page.detail.emptyCcw') }}</div>
</div> </div>
<div class="snapshot-group"> <div class="snapshot-group">
<div class="snapshot-subtitle">BIGWIN DiceRewardConfig 配置快照</div> <div class="snapshot-subtitle">{{ $t('page.detail.subBigwin') }}</div>
<el-table <el-table
:data="bigwinTableData" :data="bigwinTableData"
border border
@@ -118,25 +120,25 @@
max-height="180" max-height="180"
class="snapshot-table" class="snapshot-table"
> >
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" /> <el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
<el-table-column prop="weight" label="权重" width="90" align="center" /> <el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
</el-table> </el-table>
<div v-if="!bigwinTableData.length" class="empty-tip">暂无 BIGWIN 数据</div> <div v-if="!bigwinTableData.length" class="empty-tip">{{ $t('page.detail.emptyBigwinTable') }}</div>
</div> </div>
</div> </div>
<div class="detail-section"> <div class="detail-section">
<div class="section-title">落点统计 grid_number 出现次数</div> <div class="section-title">{{ $t('page.detail.sectionResult') }}</div>
<div class="chart-wrap"> <div class="chart-wrap">
<ArtBarChart <ArtBarChart
x-axis-name="色子点数 (grid_number)" :x-axis-name="$t('page.detail.chartXAxis')"
:x-axis-data="chartLabels" :x-axis-data="chartLabels"
:data="chartData" :data="chartData"
height="280px" height="280px"
/> />
</div> </div>
<div v-if="resultTotal === 0" class="empty-tip">暂无落点数据</div> <div v-if="resultTotal === 0" class="empty-tip">{{ $t('page.detail.emptyResult') }}</div>
<div v-else class="result-summary">总落点次数{{ resultTotal }}</div> <div v-else class="result-summary">{{ $t('page.detail.resultTotal', { n: resultTotal }) }}</div>
</div> </div>
<div class="detail-section footer-actions"> <div class="detail-section footer-actions">
@@ -146,7 +148,7 @@
:loading="importing" :loading="importing"
@click="openImport" @click="openImport"
> >
导入到当前配置 {{ $t('page.detail.btnImport') }}
</el-button> </el-button>
</div> </div>
</template> </template>
@@ -154,21 +156,19 @@
<!-- 导入弹窗 --> <!-- 导入弹窗 -->
<el-dialog <el-dialog
v-model="importVisible" v-model="importVisible"
title="导入到正式配置" :title="$t('page.detail.importTitle')"
width="520px" width="520px"
align-center align-center
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<p class="import-desc"> <p class="import-desc">
将本测试记录导入<strong>DiceReward</strong>格子权重 {{ $t('page.detail.importDesc') }}
<strong>DiceRewardConfig</strong>BIGWIN weight
<strong>DiceLotteryPoolConfig</strong>付费/免费 T1-T5 档位概率请选择要写入的奖池
</p> </p>
<el-form label-width="160px"> <el-form label-width="160px">
<el-form-item label="导入付费档位概率到奖池"> <el-form-item :label="$t('page.detail.importPaidLabel')">
<el-select <el-select
v-model="importPaidLotteryConfigId" v-model="importPaidLotteryConfigId"
placeholder="选择任意奖池(建议付费池)" :placeholder="$t('page.detail.importPaidPlaceholder')"
clearable clearable
filterable filterable
style="width: 100%" style="width: 100%"
@@ -180,12 +180,12 @@
:value="opt.id" :value="opt.id"
/> />
</el-select> </el-select>
<div class="form-tip">不选则使用本记录保存时的付费奖池配置 ID</div> <div class="form-tip">{{ $t('page.detail.importPaidTip') }}</div>
</el-form-item> </el-form-item>
<el-form-item label="导入免费档位概率到奖池"> <el-form-item :label="$t('page.detail.importFreeLabel')">
<el-select <el-select
v-model="importFreeLotteryConfigId" v-model="importFreeLotteryConfigId"
placeholder="选择任意奖池(建议免费池)" :placeholder="$t('page.detail.importFreePlaceholder')"
clearable clearable
filterable filterable
style="width: 100%" style="width: 100%"
@@ -197,17 +197,18 @@
:value="opt.id" :value="opt.id"
/> />
</el-select> </el-select>
<div class="form-tip">不选则使用本记录保存时的免费奖池配置 ID</div> <div class="form-tip">{{ $t('page.detail.importFreeTip') }}</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="importVisible = false">取消</el-button> <el-button @click="importVisible = false">{{ $t('common.cancel') }}</el-button>
<el-button <el-button
v-permission="'dice:reward_config_record:index:importFromRecord'" v-permission="'dice:reward_config_record:index:importFromRecord'"
type="primary" type="primary"
:loading="importing" :loading="importing"
@click="confirmImport" @click="confirmImport"
>确认导入</el-button> >{{ $t('page.detail.btnConfirmImport') }}</el-button
>
</template> </template>
</el-dialog> </el-dialog>
</el-drawer> </el-drawer>
@@ -218,6 +219,9 @@
import recordApi from '../../../api/reward_config_record/index' import recordApi from '../../../api/reward_config_record/index'
import lotteryConfigApi from '../../../api/lottery_pool_config/index' import lotteryConfigApi from '../../../api/lottery_pool_config/index'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t, locale } = useI18n()
const GRID_NUMBERS = [ const GRID_NUMBERS = [
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@@ -278,22 +282,24 @@
const importFreeLotteryConfigId = ref<number | null>(null) const importFreeLotteryConfigId = ref<number | null>(null)
const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([]) const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
function tierWeightsToTableData(t: Record<string, number> | null | undefined) { function tierWeightsToTableData(weightsMap: Record<string, number> | null | undefined) {
if (!t || typeof t !== 'object') return [] const dash = t('page.detail.dash')
if (!weightsMap || typeof weightsMap !== 'object') return []
const tiers = ['T1', 'T2', 'T3', 'T4', 'T5'] const tiers = ['T1', 'T2', 'T3', 'T4', 'T5']
const rows = tiers.map((tier) => { const rows = tiers.map((tier) => {
const w = t[tier] ?? t[tier.toLowerCase()] ?? 0 const w = weightsMap[tier] ?? weightsMap[tier.toLowerCase()] ?? 0
return { tier, weight: w } return { tier, weight: w }
}) })
const total = rows.reduce((sum, r) => sum + r.weight, 0) const total = rows.reduce((sum, r) => sum + r.weight, 0)
return rows.map((r) => ({ return rows.map((r) => ({
tier: r.tier, tier: r.tier,
weight: r.weight, weight: r.weight,
percent: total > 0 ? `${((r.weight / total) * 100).toFixed(1)}%` : '—' percent: total > 0 ? `${((r.weight / total) * 100).toFixed(1)}%` : dash
})) }))
} }
const paidTierTableData = computed(() => { const paidTierTableData = computed(() => {
locale.value
const r = props.record const r = props.record
const paidFromRecord = r?.paid_tier_weights const paidFromRecord = r?.paid_tier_weights
const snapshot = r?.tier_weights_snapshot const snapshot = r?.tier_weights_snapshot
@@ -315,6 +321,7 @@
}) })
const freeTierTableData = computed(() => { const freeTierTableData = computed(() => {
locale.value
const r = props.record const r = props.record
const freeFromRecord = r?.free_tier_weights const freeFromRecord = r?.free_tier_weights
const snapshot = r?.tier_weights_snapshot const snapshot = r?.tier_weights_snapshot
@@ -362,6 +369,8 @@
}) })
const snapshotTableData = computed(() => { const snapshotTableData = computed(() => {
locale.value
const dash = t('page.detail.dash')
const snapshot = props.record?.weight_config_snapshot as const snapshot = props.record?.weight_config_snapshot as
| Array<{ | Array<{
tier?: string tier?: string
@@ -374,11 +383,12 @@
return snapshot.map((item) => { return snapshot.map((item) => {
const dir = item.direction const dir = item.direction
return { return {
tier: item.tier ?? '—', tier: item.tier ?? dash,
direction: dir, direction: dir,
direction_label: dir === 0 ? '顺时针' : dir === 1 ? '逆时针' : '—', direction_label:
grid_number: item.grid_number ?? '—', dir === 0 ? t('page.detail.dirCw') : dir === 1 ? t('page.detail.dirCcw') : dash,
weight: item.weight ?? '—' grid_number: item.grid_number ?? dash,
weight: item.weight ?? dash
} }
}) })
}) })
@@ -468,11 +478,11 @@
paid_lottery_config_id: importPaidLotteryConfigId.value ?? undefined, paid_lottery_config_id: importPaidLotteryConfigId.value ?? undefined,
free_lottery_config_id: importFreeLotteryConfigId.value ?? undefined free_lottery_config_id: importFreeLotteryConfigId.value ?? undefined
}) })
ElMessage.success('导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置') ElMessage.success(t('page.detail.importSuccess'))
importVisible.value = false importVisible.value = false
emit('import-done') emit('import-done')
} catch (e: any) { } catch (e: any) {
ElMessage.error(e?.message ?? '导入失败') ElMessage.error(e?.message ?? t('page.detail.importFail'))
} finally { } finally {
importing.value = false importing.value = false
} }