{ "widgettype": "VBox", "options": {"height": "100%", "width": "100%", "padding": "24px", "gap": "16px"}, "subwidgets": [ { "widgettype": "Title2", "options": {"text": "微信通道配置"} }, { "widgettype": "Text", "options": {"text": "系统级公众号配置(业主机构公众号,仅系统管理员)+ 用户微信绑定", "cfontsize": 0.85, "color": "#94a3b8"} }, { "widgettype": "VBox", "id": "admin_section", "options": {"css": "card", "padding": "16px", "gap": "12px"}, "subwidgets": [ { "widgettype": "Title3", "options": {"text": "公众号配置(系统管理员)"} }, { "widgettype": "Form", "id": "wechat_form", "options": { "name": "wechat_form", "cols": 2, "fields": [ {"name": "name", "uitype": "str", "label": "公众号名称", "cwidth": 12}, {"name": "appid", "uitype": "str", "label": "AppID", "cwidth": 12}, {"name": "appsecret", "uitype": "password", "label": "AppSecret", "cwidth": 12, "placeholder": "留空则不修改"}, {"name": "token", "uitype": "str", "label": "校验Token", "cwidth": 12}, {"name": "encoding_aes_key", "uitype": "str", "label": "加密Key(可选)", "cwidth": 12}, {"name": "enabled", "uitype": "code", "label": "启用", "cwidth": 12, "dataurl": "/pipeline-sdlc/api/wechat_config.dspy?action=opts_enabled", "valueField": "k", "textField": "v"} ] } }, { "widgettype": "Button", "options": {"name": "save_config", "label": "保存配置", "css": "primary"}, "binds": [ { "wid": "self", "event": "click", "actiontype": "script", "target": "self", "script": "var f=bricks.getWidgetById('wechat_form',bricks.app);if(!f||!f.form_element){bricks.alert('表单未加载');return;}var d={};var els=f.form_element.querySelectorAll('[name]');els.forEach(function(e){d[e.getAttribute('name')]=e.value||'';});d.action='save';var body=Object.keys(d).map(function(k){return encodeURIComponent(k)+'='+encodeURIComponent(d[k]);}).join('&');fetch('/pipeline-sdlc/api/wechat_config.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:body}).then(function(r){return r.json()}).then(function(j){bricks.alert(j.success?'保存成功':'保存失败: '+(j.error||''));}).catch(function(e){bricks.alert('保存失败: '+e);});" } ] } ] }, { "widgettype": "VBox", "id": "bind_section", "options": {"css": "card", "padding": "16px", "gap": "12px"}, "subwidgets": [ { "widgettype": "Title3", "options": {"text": "绑定我的微信"} }, { "widgettype": "Text", "id": "bind_status", "options": {"text": "加载中...", "cfontsize": 0.9, "color": "#64748b"} }, { "widgettype": "Button", "options": {"name": "gen_code_btn", "label": "生成绑定验证码", "css": "primary"}, "binds": [ { "wid": "self", "event": "click", "actiontype": "script", "target": "self", "script": "fetch('/pipeline-sdlc/api/wechat_binding.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'action=gen_code'}).then(function(r){return r.json()}).then(function(j){if(!j.success){bricks.alert('生成失败: '+(j.error||''));return;}var code=j.code;var tip=bricks.getWidgetById('bind_tip',bricks.app);if(tip){tip.options.text='验证码:'+code+'(10分钟有效)。请关注公众号后发送:绑定 '+code;}}).catch(function(e){bricks.alert('生成失败: '+e);});" } ] }, { "widgettype": "Text", "id": "bind_tip", "options": {"text": "", "cfontsize": 0.9, "color": "#2563eb"} }, { "widgettype": "Text", "options": {"text": "绑定步骤:1. 点「生成绑定验证码」拿到 6 位码 → 2. 关注公众号「能做事的AI」→ 3. 给公众号发「绑定 验证码」完成绑定", "cfontsize": 0.8, "color": "#94a3b8"} } ] } ] }