From f5dfe0b2963308446813ac074da74450152bca2e Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 20 Apr 2026 11:23:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BE=A4=E7=BA=A7=E9=85=8D=E7=BD=AE):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BE=A4=E6=98=BE=E7=A4=BA=E3=80=81=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=85=A5=E5=8F=A3=E5=92=8CJSON=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 列表中群信息改为群名主展示,ID弱化展示 - 模板入口改为按插件动态显示:仅选择群成员变更监控时显示欢迎模板按钮 - 移除顶部通用快捷模板,减少误导 - JSON编辑区升级为多行自适应编辑器,增加等宽字体与格式化按钮 --- .../templates/group_plugin_config.html | 88 +++++++++++++++---- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/admin/dashboard/templates/group_plugin_config.html b/admin/dashboard/templates/group_plugin_config.html index 551223d..7917a57 100644 --- a/admin/dashboard/templates/group_plugin_config.html +++ b/admin/dashboard/templates/group_plugin_config.html @@ -31,10 +31,17 @@ - + - + + + @@ -61,17 +68,14 @@ - -
- - 进群欢迎表单模板 - - 点击后自动切换到“群成员变更监控 / welcome”标准表单 -
-
- + +
+
{% raw %}{{ item.name }}{% endraw %}
+
{% raw %}{{ item.wxid }}{% endraw %}
+
+
@@ -91,11 +95,16 @@ 高级JSON - + +
+ + 欢迎配置模板(welcome) + + 仅当插件为“群成员变更监控”时显示 +
+
+ - +
+ 格式化 JSON +
+ +
@@ -185,6 +203,16 @@ new Vue({ this.loadRows() }, computed: { + groupNameMap() { + const map = {} + ;(this.groupOptions || []).forEach(item => { + map[String(item.wxid)] = String(item.name || item.wxid) + }) + return map + }, + isMemberChangePlugin() { + return this.form.plugin_name === '群成员变更监控' + }, // 仅当命中当前已接入模板时启用标准表单,其它插件继续使用JSON高级模式。 isWelcomeTemplateForm() { return this.form.plugin_name === '群成员变更监控' && this.form.config_key === 'welcome' @@ -230,6 +258,18 @@ new Vue({ } }, methods: { + getGroupName(groupId) { + return this.groupNameMap[String(groupId)] || String(groupId || '-') + }, + formatJsonText() { + try { + const parsed = JSON.parse(this.form.config_json_text || '{}') + this.form.config_json_text = JSON.stringify(parsed, null, 2) + this.$message.success('JSON 已格式化') + } catch (e) { + this.$message.error('JSON 格式错误,无法格式化') + } + }, renderTemplate(template) { let result = String(template || '') Object.entries(this.previewVariables).forEach(([k, v]) => { @@ -417,5 +457,19 @@ new Vue({ .preview-box p{margin:0 0 4px 0} .quick-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap} .quick-tip{font-size:12px;color:#64748b} +.group-cell{display:flex;flex-direction:column;gap:4px} +.group-name{font-size:14px;font-weight:600;color:#0f172a} +.group-id{font-size:12px;color:#94a3b8} +.group-option{display:flex;flex-direction:column;line-height:1.35;padding:2px 0} +.group-option-name{font-size:13px;color:#0f172a} +.group-option-id{font-size:12px;color:#94a3b8} +.json-toolbar{display:flex;justify-content:flex-end;margin-bottom:8px} +.json-editor .el-textarea__inner{ + font-family:Consolas,"SFMono-Regular","Courier New",monospace; + font-size:13px; + line-height:1.6; + background:#f8fbff; + border:1px solid #d7e6f5; +} {% endblock %}