- Add get_usage_trend() and get_amount_trend() functions for day-over-day comparison - Display trend arrows (up/down/flat) with percentage change in stat_today_usage and stat_today_amount - Add colored left borders to all stat cards for visual distinction: - Blue: usage, total users - Purple: amount, total orgs - Green: active users, new users this month - Cyan: concurrent users - Red: errors - Enhance visual hierarchy with accent colors matching SVG icons
93 lines
3.6 KiB
XML
93 lines
3.6 KiB
XML
{% set trend = get_amount_trend(request) %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"css": "stat-card",
|
|
"padding": "20px",
|
|
"borderRadius": "12px",
|
|
"flex": "1",
|
|
"minHeight": "110px",
|
|
"borderLeft": "4px solid {% if trend.trend == 'up' %}#22c55e{% elif trend.trend == 'down' %}#ef4444{% else %}#8b5cf6{% endif %}"
|
|
},
|
|
"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=\"currentColor\" stroke-width=\"2\"><path d=\"M12 6v12m6-6H6\"/></svg>",
|
|
"width": "24px",
|
|
"height": "24px",
|
|
"color": "#8b5cf6"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Filler"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"css": "stat-value",
|
|
"text": "¥{{trend.value|round(2)}}",
|
|
"fontSize": "32px",
|
|
"fontWeight": "700",
|
|
"lineHeight": "1.1"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"alignItems": "center",
|
|
"marginTop": "4px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"css": "stat-label",
|
|
"fontSize": "14px",
|
|
"otext": "今日交易金额",
|
|
"i18n": true
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Filler"
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"alignItems": "center",
|
|
"gap": "4px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Svg",
|
|
"options": {
|
|
"svg": "{% if trend.trend == 'up' %}<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#22c55e\" stroke-width=\"2\"><polyline points=\"18 15 12 9 6 15\"></polyline></svg>{% elif trend.trend == 'down' %}<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#ef4444\" stroke-width=\"2\"><polyline points=\"6 9 12 15 18 9\"></polyline></svg>{% else %}<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#94a3b8\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg>{% endif %}",
|
|
"width": "16px",
|
|
"height": "16px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "{{trend.percentage|round(1)}}%",
|
|
"fontSize": "12px",
|
|
"fontWeight": "600",
|
|
"color": "{% if trend.trend == 'up' %}#22c55e{% elif trend.trend == 'down' %}#ef4444{% else %}#94a3b8{% endif %}"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|