PagerMaid-Pyro/pagermaid/web/pages/ignore_groups.py
omg-xtao 0c87310f77
🔖 Update to v1.4.1
 Support custom apt source
2023-07-01 16:42:23 +08:00

69 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from amis import (
InputText,
Switch,
Card,
CardsCRUD,
PageSchema,
Page,
)
card = Card(
header=Card.Header(
title="$title",
description="$id",
avatarText="$title",
avatarTextClassName="overflow-hidden",
),
actions=[],
toolbar=[
Switch(
name="enable",
value="${status}",
onText="已忽略",
offText="未忽略",
onEvent={
"change": {
"actions": {
"actionType": "ajax",
"args": {
"api": {
"url": "/pagermaid/api/set_ignore_group_status",
"method": "post",
},
"messages": {
"success": '成功${IF(event.data.value, "忽略", "取消忽略")}了 ${title}',
"failed": "操作失败",
},
"status": "${event.data.value}",
"id": "${id}",
},
}
}
},
)
],
)
cards_curd = CardsCRUD(
mode="cards",
title="",
syncLocation=False,
api="/pagermaid/api/get_ignore_group_list",
loadDataOnce=True,
source="${groups | filter:title:match:keywords_name}",
filter={"body": [InputText(name="keywords_name", label="群组名")]},
perPage=12,
autoJumpToTopOnPagerChange=True,
placeholder="群组列表为空",
footerToolbar=["switch-per-page", "pagination"],
columnsCount=3,
card=card,
)
page = PageSchema(
url="/bot_config/ignore_groups",
icon="fa fa-ban",
label="忽略群组",
schema=Page(
title="忽略群组", subTitle="忽略后Bot 不再响应指定群组的消息(群组列表将会缓存一小时)", body=cards_curd
),
)