- Create stats.py with get_accounting_stats() helper function - Add 4 stat widgets: stat_total_balance, stat_today_consumption, stat_month_consumption, stat_account_count - Update index.ui to display stat cards row above navigation cards - Register get_accounting_stats in load_accounting()
54 lines
1.7 KiB
XML
54 lines
1.7 KiB
XML
{% set stats = get_accounting_stats(request) %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"bgcolor": "#1E293B",
|
|
"padding": "20px",
|
|
"borderRadius": "12px",
|
|
"border": "1px solid #334155",
|
|
"flex": "1",
|
|
"minHeight": "110px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"alignItems": "center",
|
|
"marginBottom": "12px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Svg",
|
|
"options": {
|
|
"svg": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#8B5CF6\" stroke-width=\"2\"><path d=\"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5\"/></svg>",
|
|
"width": "24px",
|
|
"height": "24px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Filler"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "¥{{'%.2f' % stats.month_amount}}",
|
|
"fontSize": "32px",
|
|
"fontWeight": "700",
|
|
"color": "#F1F5F9",
|
|
"lineHeight": "1.1"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "本月消费",
|
|
"fontSize": "14px",
|
|
"color": "#94A3B8",
|
|
"marginTop": "4px"
|
|
}
|
|
}
|
|
]
|
|
}
|