This commit is contained in:
yumoqing 2026-01-14 09:41:56 +08:00
parent 2b3357d380
commit a300f56411
3 changed files with 89 additions and 74 deletions

View File

@ -26,16 +26,16 @@ async with db.sqlorContext(dbname) as sor:
"timeout":3, "timeout":3,
"auto_open":True, "auto_open":True,
"title":"Login", "title":"Login",
"message":"Welcome back" "message":f"{r[0].username} Welcome back"
}, },
"binds":[ "binds":[
{ {
"wid":"self", "wid":"self",
"event":"dismissed", "event":"opened",
"actiontype":"urlwidget", "actiontype":"urlwidget",
"target":"window", "target":"window.user_container",
"options":{ "options":{
"url":entire_url('/index.ui') "url":entire_url('/rbac/user/userinfo.ui')
} }
}, },
{ {

View File

@ -1,81 +1,15 @@
{% if get_user() %}
{ {
"widgettype":"HBox", "id":"user_container",
"widgettype":"VBox",
"options":{ "options":{
"css":"clickable",
"tip":"用户功能",
"cwidth":6 "cwidth":6
}, },
"binds":[
{
"wid":"self",
"event":"click",
"actiontype":"urlwidget",
"popup_options":{
"eventpos":true,
"cwidth":12,
"dismiss_events":["command"]
},
"target":"Popup",
"options":{
"url":"{{entire_url('/user_menu.ui')}}"
}
}
],
"subwidgets":[ "subwidgets":[
{ {
"widgettype":"Svg", "widgettype":"urlwidget",
"options":{ "options":{
"url":"{{entire_url('/bricks/imgs/user.svg')}}", "url":"{{entire_url('userinfo.ui')}}",
"rate":1.5
}
},
{
"widgettype":"Text",
"options":{
"cwidth": 4,
"text":"{{get_username()}}"
} }
} }
] ]
} }
{% else %}
{
"widgettype":"IconBar",
"options":{
"css":"filler",
"tools":[
{
"name":"login",
"tip":"点击登录",
"icon":"{{entire_url('/bricks/imgs/login.svg')}}"
},
{
"name":"register",
"tip":"点击注册",
"icon":"{{entire_url('/bricks/imgs/register.svg')}}"
}
]
},
"binds":[
{
"wid":"self",
"event":"login",
"actiontype":"urlwidget",
"target":"self",
"options":{
"url":"{{entire_url('login.ui')}}"
}
},
{
"wid":"self",
"event":"register",
"actiontype":"urlwidget",
"target":"self",
"options":{
"url":"{{entire_url('register.ui')}}"
}
}
]
}
{% endif %}

81
wwwroot/user/userinfo.ui Normal file
View File

@ -0,0 +1,81 @@
{% if get_user() %}
{
"widgettype":"HBox",
"options":{
"css":"clickable",
"tip":"用户功能",
"cwidth":6
},
"binds":[
{
"wid":"self",
"event":"click",
"actiontype":"urlwidget",
"popup_options":{
"eventpos":true,
"cwidth":12,
"dismiss_events":["command"]
},
"target":"Popup",
"options":{
"url":"{{entire_url('/user_menu.ui')}}"
}
}
],
"subwidgets":[
{
"widgettype":"Svg",
"options":{
"url":"{{entire_url('/bricks/imgs/user.svg')}}",
"rate":1.5
}
},
{
"widgettype":"Text",
"options":{
"cwidth": 4,
"text":"{{get_username()}}"
}
}
]
}
{% else %}
{
"widgettype":"IconBar",
"options":{
"css":"filler",
"tools":[
{
"name":"login",
"tip":"点击登录",
"icon":"{{entire_url('/bricks/imgs/login.svg')}}"
},
{
"name":"register",
"tip":"点击注册",
"icon":"{{entire_url('/bricks/imgs/register.svg')}}"
}
]
},
"binds":[
{
"wid":"self",
"event":"login",
"actiontype":"urlwidget",
"target":"self",
"options":{
"url":"{{entire_url('login.ui')}}"
}
},
{
"wid":"self",
"event":"register",
"actiontype":"urlwidget",
"target":"self",
"options":{
"url":"{{entire_url('register.ui')}}"
}
}
]
}
{% endif %}