yumoqing 9bb5c9e506 促销码扫码流程: dspy端点改为UI公开入口,登录后绑定并跳转主页
- 新建 promote/index.ui: 公开入口,未登录显示登录按钮,已登录自动跳dspy
- QR URL 改为 promote/index.ui (原 promote.dspy)
- load_path.py 注册 promote/index.ui 为 any 角色
- index.dspy 绑定成功后显示返回首页按钮跳转主页
- 修复 generate_promo_code sale_id: get_user() -> get_userid()
2026-07-06 13:34:25 +08:00

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') + '?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 %}