fix(opp): 附件按平台副本状态诚实渲染——已存副本才给下载按钮,未存(如需登录)给打开原始页,不伪装可下载
This commit is contained in:
parent
45cec8987e
commit
f44e5f7f83
@ -154,12 +154,25 @@ else:
|
|||||||
size_txt = "%.1f MB" % (a_size / 1048576.0)
|
size_txt = "%.1f MB" % (a_size / 1048576.0)
|
||||||
elif a_size > 0:
|
elif a_size > 0:
|
||||||
size_txt = "%.0f KB" % (a_size / 1024.0)
|
size_txt = "%.0f KB" % (a_size / 1024.0)
|
||||||
dl_query = "?tender_id=" + item_id
|
act_btns = []
|
||||||
if a_id:
|
if a.get("downloaded"):
|
||||||
dl_query += "&att_id=" + a_id
|
# 平台已存副本 → 走代理下载
|
||||||
|
dl_query = "?tender_id=" + item_id
|
||||||
|
if a_id:
|
||||||
|
dl_query += "&att_id=" + a_id
|
||||||
|
elif a_url:
|
||||||
|
dl_query += "&att_url=" + a_url
|
||||||
|
dl_href = dl_base + dl_query
|
||||||
|
act_btns.append({"widgettype": "Button", "options": {"label": "下载", "css": "small"},
|
||||||
|
"binds": [{"wid": "self", "event": "click", "actiontype": "script",
|
||||||
|
"target": "self",
|
||||||
|
"script": "window.location.href=" + _json.dumps(dl_href) + ";"}]})
|
||||||
elif a_url:
|
elif a_url:
|
||||||
dl_query += "&att_url=" + a_url
|
# 平台未存副本(如需登录才能取)→ 如实给原始页入口,不伪装成可下载
|
||||||
dl_href = dl_base + dl_query
|
act_btns.append({"widgettype": "Button", "options": {"label": "打开原始页", "css": "small"},
|
||||||
|
"binds": [{"wid": "self", "event": "click", "actiontype": "script",
|
||||||
|
"target": "self",
|
||||||
|
"script": "window.open(" + _json.dumps(a_url) + ",'_blank','noopener');"}]})
|
||||||
body.append({
|
body.append({
|
||||||
"widgettype": "HBox",
|
"widgettype": "HBox",
|
||||||
"options": {"width": "100%", "gap": "10px", "alignItems": "center",
|
"options": {"width": "100%", "gap": "10px", "alignItems": "center",
|
||||||
@ -171,12 +184,8 @@ else:
|
|||||||
"wrap": True}},
|
"wrap": True}},
|
||||||
{"widgettype": "Text", "options": {"text": size_txt,
|
{"widgettype": "Text", "options": {"text": size_txt,
|
||||||
"cfontsize": 0.75, "color": "#94a3b8"}},
|
"cfontsize": 0.75, "color": "#94a3b8"}},
|
||||||
{"widgettype": "Filler"},
|
{"widgettype": "Filler"}
|
||||||
{"widgettype": "Button", "options": {"label": "下载", "css": "small"},
|
] + act_btns
|
||||||
"binds": [{"wid": "self", "event": "click", "actiontype": "script",
|
|
||||||
"target": "self",
|
|
||||||
"script": "window.location.href=" + _json.dumps(dl_href) + ";"}]}
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user