feat: 主页 Header 加语言切换 + RBAC 用户登录(参考 sage shell)

This commit is contained in:
p 2026-08-14 11:59:14 +08:00
parent d4bc917327
commit d0fe4c98cf
3 changed files with 76 additions and 0 deletions

35
wwwroot/i18n/language.ui Normal file
View File

@ -0,0 +1,35 @@
{
"id": "language",
"widgettype": "Text",
"options": {
"tip": "切换语言",
"otext": "🌐",
"cwidth": 4,
"css": "clickable",
"cfontsize": 1.2
},
"binds": [
{
"wid": "self",
"event": "click",
"actiontype": "urlwidget",
"target": "Popup",
"popup_options": {
"eventpos": true,
"cwidth": 11,
"cheight": 10,
"dismiss_events": ["command"]
},
"options": {
"url": "{{entire_url('menu.ui')}}"
}
},
{
"wid": "app",
"event": "lang",
"actiontype": "script",
"target": "self",
"script": "this.set_otext(bricks.app.lang)"
}
]
}

29
wwwroot/i18n/menu.ui Normal file
View File

@ -0,0 +1,29 @@
{
"widgettype": "Menu",
"options": {
"cwidth": 11,
"target": "app",
"items": [
{
"name": "zh",
"label": "中文",
"script": "this.change_language('zh')"
},
{
"name": "en",
"label": "English",
"script": "this.change_language('en')"
},
{
"name": "jp",
"label": "日本語",
"script": "this.change_language('jp')"
},
{
"name": "ko",
"label": "한국어",
"script": "this.change_language('ko')"
}
]
}
}

View File

@ -46,6 +46,18 @@
},
{
"widgettype": "Filler"
},
{
"widgettype": "urlwidget",
"options": {
"url": "{{entire_url('i18n/language.ui')}}"
}
},
{
"widgettype": "urlwidget",
"options": {
"url": "{{entire_url('/rbac/user/user_panel.ui')}}"
}
}
]
},