61 lines
2.1 KiB
XML

{% set user = get_user() %}
{% set code = params_kw.get('code', '') %}
{% set qr_id = params_kw.get('id', '') %}
{% if code %}
{% set dspy_with_param = entire_url('./index.dspy') + '?code=' + code %}
{% elif qr_id %}
{% set dspy_with_param = entire_url('./index.dspy') + '?id=' + qr_id %}
{% else %}
{% set dspy_with_param = entire_url('./index.dspy') %}
{% endif %}
{% set login_back = entire_url('/rbac/user/login.ui') + '?back=' + dspy_with_param %}
{% set register_back = entire_url('/rbac/user/register') + '?back=' + dspy_with_param %}
{% if not user %}
{
"widgettype": "VBox",
"options": {"width": "100%", "height": "100%", "spacing": 16, "padding": "20px"},
"subwidgets": [
{
"widgettype": "Title",
"options": {"otext": "请先登录或注册", "level": 2, "i18n": true}
},
{
"widgettype": "Text",
"options": {"otext": "使用促销码需要先登录,登录后将自动为您激活。", "i18n": true}
},
{
"widgettype": "HBox",
"options": {"spacing": 10, "cheight": 3},
"subwidgets": [
{
"widgettype": "Button",
"options": {"label": "登录", "css": "primary"},
"binds": [{
"wid": "self", "event": "click",
"actiontype": "script", "target": "self",
"script": "window.location.href='{{login_back}}';"
}]
}
{% if not code %}
,
{
"widgettype": "Button",
"options": {"label": "注册", "css": "secondary"},
"binds": [{
"wid": "self", "event": "click",
"actiontype": "script", "target": "self",
"script": "window.location.href='{{register_back}}';"
}]
}
{% endif %}
]
}
]
}
{% else %}
{
"widgettype": "Text",
"options": {"text": "<script>window.location.href='{{dspy_with_param}}';</script>"}
}
{% endif %}