🐛 Fix web control panel (#72)

修复web控制面板各种按钮的操作问题
This commit is contained in:
Akkia 2024-01-03 19:46:12 +08:00 committed by GitHub
parent e9fbdb09f3
commit 31787de95f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 30 deletions

View File

@ -72,4 +72,4 @@ async def set_remote_plugin_status(data: dict):
else:
plugin_manager.remove_plugin(module_name)
await reload_all()
return {"status": 0, "msg": f'成功{"开启" if status else "关闭"} {module_name}'}
return {"status": 0, "msg": f'成功{"安装" if status else "卸载"} {module_name}'}

View File

@ -23,21 +23,32 @@ card = Card(
offText="未忽略",
onEvent={
"change": {
"actions": {
"actionType": "ajax",
"args": {
"api": {
"url": "/pagermaid/api/set_ignore_group_status",
"method": "post",
"actions": [
{
"actionType": "ajax",
"args": {
"api": {
"url": "/pagermaid/api/set_ignore_group_status",
"method": "post",
"dataType": "json",
"data": {
"id": "${id}",
"status": "${IF(event.data.value, 1, 0)}",
},
},
"onSuccess": {
"type": "tpl",
"tpl": "${payload.msg}", # 使用返回的 msg 字段作为成功消息
},
"onError": {
"type": "tpl",
"tpl": "操作失败",
},
"status": "${event.data.value}",
"id": "${id}",
},
"messages": {
"success": '成功${IF(event.data.value, "忽略", "取消忽略")}了 ${title}',
"failed": "操作失败",
},
"status": "${event.data.value}",
"id": "${id}",
},
}
]
}
},
)

View File

@ -20,10 +20,19 @@ card = Card(
"api": {
"url": "/pagermaid/api/set_local_plugin_status",
"method": "post",
"dataType": "json",
"data": {
"plugin": "${name}",
"status": "${IF(event.data.value, 1, 0)}",
},
},
"messages": {
"success": '成功${IF(event.data.value, "开启", "禁用")}了 ${name}',
"failed": "操作失败",
"onSuccess": {
"type": "tpl",
"tpl": "${payload.msg}", # 使用返回的 msg 字段作为成功消息
},
"onError": {
"type": "tpl",
"tpl": "操作失败",
},
"status": "${event.data.value}",
"plugin": "${name}",

View File

@ -16,21 +16,32 @@ card = Card(
offText="未安装",
onEvent={
"change": {
"actions": {
"actionType": "ajax",
"args": {
"api": {
"url": "/pagermaid/api/set_remote_plugin_status",
"method": "post",
"actions": [
{
"actionType": "ajax",
"args": {
"api": {
"url": "/pagermaid/api/set_remote_plugin_status",
"method": "post",
"dataType": "json",
"data": {
"plugin": "${name}",
"status": "${IF(event.data.value, 1, 0)}",
},
},
"onSuccess": {
"type": "tpl",
"tpl": "${payload.msg}", # 使用返回的 msg 字段作为成功消息
},
"onError": {
"type": "tpl",
"tpl": "操作失败",
},
"status": "${event.data.value}",
"plugin": "${name}",
},
"messages": {
"success": '成功${IF(event.data.value, "安装", "卸载")}了 ${name}',
"failed": "操作失败",
},
"status": "${event.data.value}",
"plugin": "${name}",
},
}
]
}
},
)