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 %}