From 319b72c735d08d24fa430913eea34a3a0dc94938 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 15 Aug 2026 10:11:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=AE=E4=BF=A1=E9=80=9A=E9=81=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2(=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E9=85=8D=E7=BD=AE=E8=A1=A8=E5=8D=95+=E7=94=A8?= =?UTF-8?q?=E6=88=B7openid=E7=BB=91=E5=AE=9A)+cockpit=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/sd_cockpit/index.ui | 17 +++++++ wwwroot/wechat_config/index.ui | 88 ++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 wwwroot/wechat_config/index.ui diff --git a/wwwroot/sd_cockpit/index.ui b/wwwroot/sd_cockpit/index.ui index 96e4f83..0f5b474 100644 --- a/wwwroot/sd_cockpit/index.ui +++ b/wwwroot/sd_cockpit/index.ui @@ -73,6 +73,23 @@ "script": "var pw=new bricks.PopupWindow({title:'\u6a21\u578b\u914d\u7f6e',cwidth:36,cheight:26,auto_open:true});bricks.widgetBuild({widgettype:'urlwidget',options:{url:'/pipeline_core/llm/index.ui',method:'GET'}},pw.content_w).then(function(w){if(w)pw.content_w.add_widget(w);});" } ] + }, + { + "widgettype": "Button", + "options": { + "name": "wechat_config", + "label": "\u5fae\u4fe1\u901a\u9053", + "css": "small" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "target": "self", + "script": "var pw=new bricks.PopupWindow({title:'\u5fae\u4fe1\u901a\u9053\u914d\u7f6e',cwidth:44,cheight:34,auto_open:true});bricks.widgetBuild({widgettype:'urlwidget',options:{url:'/pipeline-sdlc/wechat_config/index.ui',method:'GET'}},pw.content_w).then(function(w){if(w)pw.content_w.add_widget(w);});" + } + ] } ] }, diff --git a/wwwroot/wechat_config/index.ui b/wwwroot/wechat_config/index.ui new file mode 100644 index 0000000..248b530 --- /dev/null +++ b/wwwroot/wechat_config/index.ui @@ -0,0 +1,88 @@ +{ + "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": "HBox", + "options": {"gap": "8px", "alignItems": "center"}, + "subwidgets": [ + { + "widgettype": "Input", + "id": "openid_input", + "options": {"name": "openid_input", "placeholder": "输入您的微信 openid", "cwidth": 24} + }, + { + "widgettype": "Button", + "options": {"name": "bind_btn", "label": "绑定", "css": "primary"}, + "binds": [ + { + "wid": "self", "event": "click", "actiontype": "script", "target": "self", + "script": "var inp=bricks.getWidgetById('openid_input',bricks.app);var oid=(inp&&inp.options.value)||'';if(!oid){bricks.alert('请输入 openid');return;}var body='action=bind&openid='+encodeURIComponent(oid);fetch('/pipeline-sdlc/api/wechat_binding.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||''));if(j.success){var st=bricks.getWidgetById('bind_status',bricks.app);if(st)st.options.text='已绑定 openid: '+oid;}}).catch(function(e){bricks.alert('绑定失败: '+e);});" + } + ] + } + ] + } + ] + } + ] +}