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) {