fix: save_tags shows close button to dismiss popup after result
This commit is contained in:
parent
13b36df084
commit
87ce210b58
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user