From e10c1b1120cf64cdcd6728e9e64a33fe45a29500 Mon Sep 17 00:00:00 2001 From: pan Date: Fri, 4 Sep 2026 09:10:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E6=B7=BB=E5=8A=A0=E5=86=99?= =?UTF-8?q?=E5=85=A5heroSet.ts=E7=9A=84=E5=8A=9F=E8=83=BD=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=92=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增了写入heroSet.ts的操作按钮,添加了二次确认弹窗和后端写入接口调用逻辑,支持将当前英雄数据覆盖写入到指定配置文件的对应区域。 --- put/web/src/App.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/put/web/src/App.vue b/put/web/src/App.vue index ebb5964c..f7f699fe 100644 --- a/put/web/src/App.vue +++ b/put/web/src/App.vue @@ -6,6 +6,7 @@ 刷新配置数据 保存到服务器 导出 hexport.ts + 写入 heroSet.ts
@@ -288,6 +289,22 @@ async function doExport() { } } +async function doApply() { + try { + await ElMessageBox.confirm( + `将用 ${heroes.value.length} 个英雄直接覆盖 heroSet.ts 的英雄配置区域(@hero-setup:heroes-begin/end 标记之间),怪物配置不受影响。`, + '写入确认', + { confirmButtonText: '覆盖写入', cancelButtonText: '取消', type: 'warning' } + ) + } catch { return } + try { + const r = await api.applyHeroes(heroes.value) + ElMessage.success(`已写入 ${r.count} 个英雄 → ${r.path}`) + } catch (e) { + ElMessage.error('写入失败: ' + (e?.response?.data?.error || e.message)) + } +} + onMounted(() => { loadMeta() loadHeroes()