diff --git a/wwwroot/create_page.ui b/wwwroot/create_page.ui new file mode 100644 index 0000000..05270a9 --- /dev/null +++ b/wwwroot/create_page.ui @@ -0,0 +1,68 @@ +{ + "widgettype": "VBox", + "options": { + "width": "100%", + "height": "100%", + "padding": "20px" + }, + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "label": "生成快照", + "fontSize": "20px" + } + }, + { + "widgettype": "Form", + "options": { + "title": "生成世界快照(聚合世界/场景/实体当前状态)", + "submit_url": "{{entire_url('/world_snapshot/api/create_snapshot.dspy')}}", + "method": "POST", + "submit_label": "生成快照", + "fields": [ + { + "name": "world_id", + "label": "目标世界", + "uitype": "code", + "required": true, + "dataurl": "{{entire_url('/world_snapshot/api/get_search_world_id.dspy')}}", + "valueField": "value", + "textField": "text" + }, + { + "name": "name", + "label": "快照名称", + "uitype": "str", + "required": true + }, + { + "name": "snapshot_type", + "label": "快照类型", + "uitype": "code", + "dataurl": "{{entire_url('/world_snapshot/api/get_search_snapshot_type.dspy')}}", + "valueField": "snapshot_type", + "textField": "snapshot_type_text" + }, + { + "name": "status", + "label": "状态", + "uitype": "code", + "dataurl": "{{entire_url('/world_snapshot/api/get_search_status.dspy')}}", + "valueField": "status", + "textField": "status_text" + } + ] + }, + "binds": [ + { + "wid": "self", + "event": "submited", + "actiontype": "script", + "target": "self", + "script": "event.params.json().then(function(r){if(r&&r.widgettype){bricks.widgetBuild(r,bricks.Body)}else{var ok=r&&r.success;new bricks.Message({title:ok?'成功':'失败',message:ok?('已创建'+(r.id?(' id='+r.id):'')):(r&&r.message?r.message:'操作失败'),timeout:4})}})" + } + ] + } + ] +} \ No newline at end of file diff --git a/wwwroot/index.ui b/wwwroot/index.ui index b387e10..63c7b18 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -11,7 +11,7 @@ {"widgettype": "Text", "options": {"label": "查看、编辑、删除世界快照", "fontSize": "12px", "color": "#888888"}} ]}, {"widgettype": "VBox", "options": {"backgroundColor": "#FFFFFF", "padding": "20px", "cursor": "pointer"}, - "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.world_snapshot_content", "options": {"url": "{{entire_url('/world_snapshot/api/create_snapshot.dspy')}}", "method": "GET"}, "mode": "replace"}], + "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.world_snapshot_content", "options": {"url": "{{entire_url('/world_snapshot/create_page.ui')}}", "method": "GET"}, "mode": "replace"}], "subwidgets": [ {"widgettype": "Text", "options": {"label": "生成快照", "fontSize": "16px"}}, {"widgettype": "Text", "options": {"label": "聚合世界/场景/实体当前状态", "fontSize": "12px", "color": "#888888"}}