From 12539b6b2fb94a776edf55e3bd815105cadf9223 Mon Sep 17 00:00:00 2001 From: "CSSC-WORK\\murmur" Date: Fri, 28 Jun 2024 08:33:59 +0800 Subject: [PATCH] post button's label --- res/cfg.json | 322 +++++++++-------------------------------------- 本地文档例程.bat | 23 ++++ 2 files changed, 84 insertions(+), 261 deletions(-) create mode 100644 本地文档例程.bat diff --git a/res/cfg.json b/res/cfg.json index c3d0dfd..4be0ca6 100644 --- a/res/cfg.json +++ b/res/cfg.json @@ -1,13 +1,16 @@ { "type": "page", "title": "Hello world", + "regions": [ + "body" + ], "body": [ { "type": "tpl", + "id": "u:f439a8330e02", "tpl": "初始页面", "wrapperComponent": "", - "inline": false, - "id": "u:f439a8330e02" + "inline": false }, { "type": "grid", @@ -33,6 +36,9 @@ { "type": "button-toolbar", "label": "按钮工具栏", + "data": { + "x": "yy" + }, "buttons": [ { "type": "button", @@ -40,17 +46,15 @@ "onEvent": { "click": { "actions": [ - { "api": { - "url": "/sendData", - "method": "post", - "requestAdaptor": "", - "adaptor": "", - "messages": {}, - "dataType": "json" - }}] + { + "ignoreError": false, + "script": "const buttonText = context.props.label;\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n }\n }\n }\n});\n", + "actionType": "custom" + } + ] } }, - "id": "u:d5479075ff42" + "id": "u:sendButtonText" }, { "type": "button", @@ -58,20 +62,11 @@ "onEvent": { "click": { "actions": [ - { - "ignoreError": false, - "outputVar": "responseResult", - "actionType": "ajax", - "options": {}, - "api": { - "url": "/sendData", - "method": "post", - "requestAdaptor": "", - "adaptor": "", - "messages": {}, - "data":{"&": "$$","sel":"${this.label}"} - } - } + { + "ignoreError": false, + "actionType": "custom", + "script": "const buttonText = context.props.label;\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n },\n successMessage: '请求成功',\n errorMessage: '请求失败'\n }\n }\n});\n" + } ] } }, @@ -116,23 +111,54 @@ "name": "number", "keyboard": true, "id": "u:d10a773ce8ee", - "step": 1, + "step": 12, "displayMode": "base", "size": "full", "mode": "inline", - "hint": "比如输入 a-xxxx-xxx" + "hint": "比如输入 a-xxxx-xxx", + "required": true, + "min": 225000, + "max": 500000, + "value": 225000, + "kilobitSeparator": true, + "suffix": "", + "unitOptions": [ + { + "label": "kHz", + "value": "k" + } + ] }, { "type": "button", - "label": "按钮", + "label": "按钮10", "onEvent": { "click": { - "actions": [] + "actions": [ + { + "ignoreError": false, + "actionType": "ajax", + "outputVar": "responseResult", + "options": {}, + "api": { + "url": "/sendData", + "method": "post", + "requestAdaptor": "", + "adaptor": "", + "messages": {}, + "data": { + "aa": "${number}" + } + }, + "expression": "${number!=\"\"}" + } + ] } }, "id": "u:c72878bb1458", "size": "md", - "block": false + "block": false, + "disabledOn": "${number!=\"\"}" }, { "type": "button-group-select", @@ -158,233 +184,7 @@ }, { "type": "collapse", - "key": "2", - "header": "超短波", - "body": [ - { - - "type": "button-toolbar", - "label": "按钮工具栏", - "buttons": [ - { - "type": "button", - "label": "按钮1", - "onEvent": { - "click": { - "actions": [] - } - }, - "id": "u:d5479075ff42" - }, - { - "type": "button", - "label": "按钮2", - "onEvent": { - "click": { - "actions": [] - } - }, - "id": "u:8eae2c306cc5" - }, - { - "type": "button", - "label": "按钮", - "id": "u:c440483f217b" - }, - { - "type": "button", - "label": "按钮", - "id": "u:5eb80129858e" - }, - { - "type": "button", - "label": "按钮", - "id": "u:92b3fbb4a8e5" - }, - { - "type": "button", - "label": "按钮", - "id": "u:fcec0c70c54c" - }, - { - "type": "button", - "label": "按钮", - "id": "u:68b551bbf8cb" - }, - { - "type": "button", - "label": "按钮", - "id": "u:5bb6c2e1889e" - } - ], - "id": "u:b6649c1b1585" - } - ], - "id": "u:b4de28d2cd49", - "active": false - }, - { - "type": "collapse", - "header": "北斗", - "body": [ - - { - "type": "button-toolbar", - "label": "按钮工具栏", - "buttons": [ - { - "type": "button", - "label": "按钮1", - "onEvent": { - "click": { - "actions": [] - } - }, - "id": "u:d5479075ff42" - }, - { - "type": "button", - "label": "按钮2", - "onEvent": { - "click": { - "actions": [] - } - }, - "id": "u:8eae2c306cc5" - }, - { - "type": "button", - "label": "按钮", - "id": "u:c440483f217b" - }, - { - "type": "button", - "label": "按钮", - "id": "u:5eb80129858e" - }, - { - "type": "button", - "label": "按钮", - "id": "u:92b3fbb4a8e5" - }, - { - "type": "button", - "label": "按钮", - "id": "u:fcec0c70c54c" - }, - { - "type": "button", - "label": "按钮", - "id": "u:68b551bbf8cb" - }, - { - "type": "button", - "label": "按钮", - "id": "u:5bb6c2e1889e" - } - ], - "id": "u:b6649c1b1585" - }, - { - "type": "input-number", - "label": "数字输入", - "name": "number", - "keyboard": true, - "id": "u:d10a773ce8ee", - "step": 1, - "displayMode": "base", - "size": "full", - "mode": "inline" - }, - { - "type": "button", - "label": "按钮", - "onEvent": { - "click": { - "actions": [] - } - }, - "id": "u:c72878bb1458", - "size": "md", - "block": false - }, - { - "type": "button-group-select", - "name": "buttonGroupSelect", - "label": "单选", - "inline": false, - "options": [ - { - "label": "选项1", - "value": "a" - }, - { - "label": "选项2", - "value": "b" - } - ], - "id": "u:5112d83e3943", - "multiple": false, - "value": "a" - }, - { - "type": "button-group-select", - "name": "buttonGroupSelect2", - "label": "单选", - "inline": false, - "options": [ - { - "label": "选项1", - "value": "a" - }, - { - "label": "选项2", - "value": "b" - } - ], - "id": "u:03b1b5d4011e", - "multiple": false, - "value": "b", - "size": "md", - "tiled": false - } - ], - "key": "3", - "id": "u:3a8ad47cac52" - }, - { - "type": "collapse", - "header": "数据链", - "body": [ - { - "type": "tpl", - "tpl": "内容", - "wrapperComponent": "", - "inline": false, - "id": "u:ac3d89c9a857" - } - ], - "key": "4", - "id": "u:4ed37447dabf" - }, - { - "type": "collapse", - "header": "密码", - "body": [ - { - "type": "tpl", - "tpl": "内容", - "wrapperComponent": "", - "inline": false, - "id": "u:2721f190d07b" - } - ], - "key": "5", - "id": "u:5bf93a5153cf" - }, - { - "type": "collapse", - "header": "天通", + "header": "调试", "body": [ { "type": "tpl", @@ -408,11 +208,11 @@ } ], "id": "u:ddf6e6d384e7", - "asideResizor": false, "pullRefresh": { "disabled": true }, - "regions": [ - "body" - ] + "data": { + "x": "xx" + }, + "asideResizor": false } \ No newline at end of file diff --git a/本地文档例程.bat b/本地文档例程.bat new file mode 100644 index 0000000..2509e55 --- /dev/null +++ b/本地文档例程.bat @@ -0,0 +1,23 @@ +@echo off +:: 切换到指定目录 +cd /d E:\github.Prj\amis + +:: 检查端口8888是否被占用 +netstat -an | find "8888" >nul +if %errorlevel% equ 0 ( + echo 服务已经在运行 +) else ( + :: 启动npm并保持窗口打开 + start cmd /k "npm start" + + :: 等待15秒以确保npm服务器启动 + timeout /t 3 /nobreak +) + +:: 打开默认浏览器并访问http://localhost:8888/ +start "" "http://localhost:8888/" +start "" "http://localhost:8888/packages/amis-editor/#/" + + +:: 结束脚本 +exit