From 87ce210b5887ed1e6305310b038acec662252e75 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 6 Aug 2026 14:37:11 +0800 Subject: [PATCH] fix: save_tags shows close button to dismiss popup after result --- wwwroot/knowledge_bases_list/save_tags.dspy | 28 ++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/wwwroot/knowledge_bases_list/save_tags.dspy b/wwwroot/knowledge_bases_list/save_tags.dspy index 0cc1fa9..6f4381a 100644 --- a/wwwroot/knowledge_bases_list/save_tags.dspy +++ b/wwwroot/knowledge_bases_list/save_tags.dspy @@ -3,9 +3,17 @@ kb_id = ns.get('kb_id', '') doc_id = ns.get('media_id', '') tag_ids_str = ns.get('tag_ids', '') +close_btn = {"widgettype": "Button", "options": {"label": "\u5173\u95ed", "bgcolor": "#4a90d9", "color": "#fff", "padding": "5px 16px", "borderRadius": "6px"}, + "binds": [{"wid": "self", "event": "click", "actiontype": "script", + "script": "var pw=null;var w=this;while(w){if(w instanceof bricks.PopupWindow||w instanceof bricks.Popup){pw=w;break};w=w.parent};if(pw){pw.dismiss();pw.destroy()}"}]} + if not kb_id or not doc_id: - result = {"widgettype": "Text", "options": {"text": "\u274c \u53c2\u6570\u7f3a\u5931", - "cfontsize": 14, "color": "#e74c3c", "halign": "center", "padding": "20px"}} + result = {"widgettype": "VBox", "options": {"padding": "20px", "spacing": "12px", "alignItems": "center"}, + "subwidgets": [ + {"widgettype": "Text", "options": {"text": "\u274c \u53c2\u6570\u7f3a\u5931", + "cfontsize": 14, "color": "#e74c3c", "halign": "center"}}, + close_btn + ]} else: env = request._run_ns try: @@ -29,10 +37,18 @@ else: {"id": mt_id, "kb_id": kb_id, "mid": doc_id, "tid": tid}) added += 1 msg = "\u2705 \u5df2\u4fdd\u5b58\uff1a\u65b0\u589e " + str(added) + " \u4e2a\uff0c\u79fb\u9664 " + str(removed) + " \u4e2a" - result = {"widgettype": "Text", "options": {"text": msg, - "cfontsize": 14, "color": "#27ae60", "halign": "center", "padding": "20px"}} + result = {"widgettype": "VBox", "options": {"padding": "20px", "spacing": "12px", "alignItems": "center"}, + "subwidgets": [ + {"widgettype": "Text", "options": {"text": msg, + "cfontsize": 14, "color": "#27ae60", "halign": "center"}}, + close_btn + ]} except Exception as e: - result = {"widgettype": "Text", "options": {"text": "\u274c \u4fdd\u5b58\u5931\u8d25\uff1a" + str(e)[:100], - "cfontsize": 14, "color": "#e74c3c", "halign": "center", "padding": "20px"}} + result = {"widgettype": "VBox", "options": {"padding": "20px", "spacing": "12px", "alignItems": "center"}, + "subwidgets": [ + {"widgettype": "Text", "options": {"text": "\u274c \u4fdd\u5b58\u5931\u8d25\uff1a" + str(e)[:100], + "cfontsize": 14, "color": "#e74c3c", "halign": "center"}}, + close_btn + ]} return result