mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-22 10:38:52 +00:00
8e29af1875
Support web login
65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
from amis import InputText, Switch, Card, CardsCRUD, PageSchema, Page
|
|
|
|
card = Card(
|
|
header=Card.Header(
|
|
title="$name",
|
|
description="$des",
|
|
avatarText="$name",
|
|
avatarTextClassName="overflow-hidden",
|
|
),
|
|
actions=[],
|
|
toolbar=[
|
|
Switch(
|
|
name="enable",
|
|
value="${status}",
|
|
onText="已安装",
|
|
offText="未安装",
|
|
onEvent={
|
|
"change": {
|
|
"actions": {
|
|
"actionType": "ajax",
|
|
"args": {
|
|
"api": {
|
|
"url": "/pagermaid/api/set_remote_plugin_status",
|
|
"method": "post",
|
|
},
|
|
"messages": {
|
|
"success": '成功${IF(event.data.value, "安装", "卸载")}了 ${name}',
|
|
"failed": "操作失败",
|
|
},
|
|
"status": "${event.data.value}",
|
|
"plugin": "${name}",
|
|
},
|
|
}
|
|
}
|
|
},
|
|
)
|
|
],
|
|
)
|
|
cards_curd = CardsCRUD(
|
|
mode="cards",
|
|
title="",
|
|
syncLocation=False,
|
|
api="/pagermaid/api/get_remote_plugins",
|
|
loadDataOnce=True,
|
|
source="${rows | filter:name:match:keywords_name | filter:des:match:keywords_description}",
|
|
filter={
|
|
"body": [
|
|
InputText(name="keywords_name", label="插件名"),
|
|
InputText(name="keywords_description", label="插件描述"),
|
|
]
|
|
},
|
|
perPage=12,
|
|
autoJumpToTopOnPagerChange=True,
|
|
placeholder="暂无插件信息",
|
|
footerToolbar=["switch-per-page", "pagination"],
|
|
columnsCount=3,
|
|
card=card,
|
|
)
|
|
page = PageSchema(
|
|
url="/plugins/remote",
|
|
icon="fa fa-cloud-download",
|
|
label="插件仓库",
|
|
schema=Page(title="插件仓库", body=cards_curd),
|
|
)
|