From eaffe01f48fdc9decd76e64307b2b0fd2b8d34d3 Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Mon, 19 Aug 2019 22:22:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=B1=BB=E5=88=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowEditor.Web/locales/zh-CN.json | 3 ++- .../editor/assets/window/CategoryWindow.jsx | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ShadowEditor.Web/locales/zh-CN.json b/ShadowEditor.Web/locales/zh-CN.json index 641c76e6..77e9e807 100644 --- a/ShadowEditor.Web/locales/zh-CN.json +++ b/ShadowEditor.Web/locales/zh-CN.json @@ -643,5 +643,6 @@ "Cannot deserialize scene data.": "无法解析场景数据!", "Total {{totalPage}} Pages": "共{{totalPage}}页", "Create": "添加", - "Please select a record.": "请选择数据" + "Please select a record.": "请选择数据", + "Delete this category?": "是否删除该类别?" } \ No newline at end of file diff --git a/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx b/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx index bfdc002e..ae632ce4 100644 --- a/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx +++ b/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx @@ -108,7 +108,33 @@ class CategoryWindow extends React.Component { } handleDelete() { + const { selected } = this.state; + if (!selected) { + app.toast(_t('Please select a record.')); + return; + } + + app.confirm({ + title: _t('Query'), + content: _t('Delete this category?'), + onOK: () => { + fetch(`${app.options.server}/api/Category/Delete?ID=${selected.ID}`, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }).then(response => { + response.json().then(json => { + if (json.Code === 200) { + this.updateUI(); + } else { + app.toast(json.Msg); + } + }); + }); + } + }); } handleSelect(obj) {