diff --git a/wwwroot/create_page.ui b/wwwroot/create_page.ui new file mode 100644 index 0000000..20c7b28 --- /dev/null +++ b/wwwroot/create_page.ui @@ -0,0 +1,76 @@ +{ + "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/api/create_world.dspy')}}", + "method": "POST", + "submit_label": "创建", + "fields": [ + { + "name": "name", + "label": "世界名称", + "uitype": "str", + "required": true, + "placeholder": "输入世界名称" + }, + { + "name": "code", + "label": "世界编码", + "uitype": "str", + "placeholder": "留空自动生成" + }, + { + "name": "description", + "label": "描述", + "uitype": "text" + }, + { + "name": "world_type", + "label": "世界类型", + "uitype": "code", + "dataurl": "{{entire_url('/world/api/get_search_world_type.dspy')}}", + "valueField": "world_type", + "textField": "world_type_text" + }, + { + "name": "status", + "label": "状态", + "uitype": "code", + "dataurl": "{{entire_url('/world/api/get_search_status.dspy')}}", + "valueField": "status", + "textField": "status_text" + }, + { + "name": "config_json", + "label": "世界配置JSON", + "uitype": "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 9aa7bad..43303cd 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -10,7 +10,7 @@ "subwidgets": [{"widgettype": "Text", "options": {"label": "世界列表"}}]}, {"widgettype": "VBox", "options": {"backgroundColor": "#FFFFFF", "padding": "20px", "cursor": "pointer"}, "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.world_content", - "options": {"url": "{{entire_url('/world/api/create_world.dspy')}}"}, "mode": "replace"}], + "options": {"url": "{{entire_url('/world/create_page.ui')}}"}, "mode": "replace"}], "subwidgets": [{"widgettype": "Text", "options": {"label": "新建世界"}}]} ]}, {"widgettype": "VBox", "id": "world_content", "options": {"width": "100%", "flex": "1", "marginTop": "20px"}}