fix: 用json.dumps包裹所有动态值确保JSON安全,in_plan用字符串比较'1'
This commit is contained in:
parent
ad56bd4b37
commit
c3cad2140f
@ -11,7 +11,7 @@
|
|||||||
{
|
{
|
||||||
"widgettype": "Text",
|
"widgettype": "Text",
|
||||||
"options": {
|
"options": {
|
||||||
"text": "产品折扣设置 - {{info.name or ''}}{% if info.customer %} ({{info.customer}}){% endif %}",
|
"text": "产品折扣设置 - {{json.dumps(info.name, ensure_ascii=False) if info.name else ''}}",
|
||||||
"fontSize": "16px",
|
"fontSize": "16px",
|
||||||
"fontWeight": "600",
|
"fontWeight": "600",
|
||||||
"color": "#F1F5F9",
|
"color": "#F1F5F9",
|
||||||
@ -59,16 +59,16 @@
|
|||||||
"width": "100%"
|
"width": "100%"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
{"widgettype": "Text", "options": {"text": "{{p.category_name or ''}}", "width": "20%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
{"widgettype": "Text", "options": {"text": {{json.dumps(p.category_name or '')}}, "width": "20%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
||||||
{"widgettype": "Text", "options": {"text": "{{p.product_name or ''}}", "width": "28%", "padding": "0 8px", "fontSize": "12px", "color": "#F1F5F9"}},
|
{"widgettype": "Text", "options": {"text": {{json.dumps(p.product_name or '')}}, "width": "28%", "padding": "0 8px", "fontSize": "12px", "color": "#F1F5F9"}},
|
||||||
{"widgettype": "Text", "options": {"text": "{{p.product_code or ''}}", "width": "18%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
{"widgettype": "Text", "options": {"text": {{json.dumps(p.product_code or '')}}, "width": "18%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
||||||
{
|
{
|
||||||
"widgettype": "UiFloat",
|
"widgettype": "UiFloat",
|
||||||
"options": {
|
"options": {
|
||||||
"width": "14%",
|
"width": "14%",
|
||||||
"padding": "0 8px",
|
"padding": "0 8px",
|
||||||
"name": "discount",
|
"name": "discount",
|
||||||
"value": "{{p.discount or '1.0'}}",
|
"value": {{json.dumps(p.discount or '1.0')}},
|
||||||
"placeholder": "0~1",
|
"placeholder": "0~1",
|
||||||
"dec_len": 2,
|
"dec_len": 2,
|
||||||
"fontSize": "12px"
|
"fontSize": "12px"
|
||||||
@ -83,16 +83,16 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"url": "{{entire_url('./save_discount.dspy')}}",
|
"url": "{{entire_url('./save_discount.dspy')}}",
|
||||||
"params": {
|
"params": {
|
||||||
"discountid": "{{params_kw.discountid}}",
|
"discountid": {{json.dumps(params_kw.discountid)}},
|
||||||
"old_discount": "{{p.discount or '1.0'}}",
|
"old_discount": {{json.dumps(p.discount or '1.0')}},
|
||||||
"productid": "{{p.productid}}",
|
"productid": {{json.dumps(p.productid)}},
|
||||||
"detail_id": "{{p.detail_id or ''}}"
|
"detail_id": {{json.dumps(p.detail_id or '')}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"widgettype": "Text", "options": {"text": "{% if p.in_plan == 1 %}✓方案内{% endif %}", "width": "16%", "padding": "0 8px", "fontSize": "11px", "color": "#34D399"}}
|
{"widgettype": "Text", "options": {"text": {% if p.in_plan == '1' %}"✓方案内"{% else %}""{% endif %}, "width": "16%", "padding": "0 8px", "fontSize": "11px", "color": "#34D399"}}
|
||||||
]
|
]
|
||||||
}{% if not loop.last %},{% endif %}
|
}{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user