From 4b2b0633ad50327d681b7d2e307efb1beec2f2b2 Mon Sep 17 00:00:00 2001 From: murmur Date: Fri, 28 Jun 2024 23:41:01 +0800 Subject: [PATCH] add switch to cfg --- res/cfg.json | 158 ++++++++++++++++++++++++--------------------------- 1 file changed, 73 insertions(+), 85 deletions(-) diff --git a/res/cfg.json b/res/cfg.json index a62222f..868f783 100644 --- a/res/cfg.json +++ b/res/cfg.json @@ -71,95 +71,62 @@ } }, "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": "freq", - "keyboard": true, - "id": "numberInput", - "step": 12, - "displayMode": "base", - "size": "full", - "mode": "inline", - "hint": "请输入一个225000到500000之间的数字", - "required": true, - "min": 225000, - "max": 500000, - "value":"225000", - "kilobitSeparator": true, - "unitOptions": [ - { - "label": "kHz" - } - ] - }, - { - "type": "button", - "label": "提交", - "id": "submitButton", - "size": "md", - "block": false, - "disabledOn": "freq === undefined || freq === ''", - "onEvent": { - "click": { - "actions": [ - { - "ignoreError": false, - "actionType": "ajax", - "outputVar": "responseResult", - "api": { - "url": "/sendData", - "method": "post", - "data": { - "frequency": "${freq}" - } - }, - "messages": { - "success": "数据已成功发送", - "failed": "发送数据失败,请重试" - } - } - ] - } - } - }, - - + { + "type": "input-number", + "label": "数字输入", + "name": "freq", + "keyboard": true, + "id": "numberInput", + "step": 12, + "displayMode": "base", + "size": "full", + "mode": "inline", + "required": true, + "min": 225000, + "max": 500000, + "value": 225000, + "kilobitSeparator": true, + "unitOptions": [ + { + "label": "kHz" + } + ], + "placeholder": "225,000到500,000之间" + }, + { + "type": "button", + "label": "提交", + "id": "submitButton", + "size": "md", + "block": false, + "disabledOn": "freq === undefined || freq === ''", + "onEvent": { + "click": { + "actions": [ + { + "ignoreError": false, + "actionType": "ajax", + "outputVar": "responseResult", + "api": { + "url": "/sendData", + "method": "post", + "data": { + "frequency": "${freq}" + } + }, + "messages": { + "success": "数据已成功发送", + "failed": "发送数据失败,请重试" + } + } + ] + } + } + }, { "type": "button-group-select", "name": "buttonGroupSelect", @@ -178,6 +145,27 @@ "id": "u:5112d83e3943", "multiple": false, "value": "a" + }, + { + "type": "switch", + "label": "天通", + "option": "说明", + "name": "switch", + "falseValue": false, + "trueValue": true, + "id": "u:bd2f8c0b2176", + "onEvent": { + "change": { + "weight": 0, + "actions": [ + { + "ignoreError": false, + "actionType": "custom", + "script": "const buttonText = context.props.label + (!context.props.value?'开':'关');\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" + } + ] + } + } } ], "id": "u:53511e674086"