From f44e5f7f8303470b9866be94ecb25096ebd21a27 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 8 Sep 2026 23:57:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(opp):=20=E9=99=84=E4=BB=B6=E6=8C=89?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=89=AF=E6=9C=AC=E7=8A=B6=E6=80=81=E8=AF=9A?= =?UTF-8?q?=E5=AE=9E=E6=B8=B2=E6=9F=93=E2=80=94=E2=80=94=E5=B7=B2=E5=AD=98?= =?UTF-8?q?=E5=89=AF=E6=9C=AC=E6=89=8D=E7=BB=99=E4=B8=8B=E8=BD=BD=E6=8C=89?= =?UTF-8?q?=E9=92=AE,=E6=9C=AA=E5=AD=98(=E5=A6=82=E9=9C=80=E7=99=BB?= =?UTF-8?q?=E5=BD=95)=E7=BB=99=E6=89=93=E5=BC=80=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E9=A1=B5,=E4=B8=8D=E4=BC=AA=E8=A3=85=E5=8F=AF=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/opp_item_detail.dspy | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/wwwroot/api/opp_item_detail.dspy b/wwwroot/api/opp_item_detail.dspy index 8c85d07..e7bde03 100644 --- a/wwwroot/api/opp_item_detail.dspy +++ b/wwwroot/api/opp_item_detail.dspy @@ -154,12 +154,25 @@ else: size_txt = "%.1f MB" % (a_size / 1048576.0) elif a_size > 0: size_txt = "%.0f KB" % (a_size / 1024.0) - dl_query = "?tender_id=" + item_id - if a_id: - dl_query += "&att_id=" + a_id + act_btns = [] + if a.get("downloaded"): + # 平台已存副本 → 走代理下载 + 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: - 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({ "widgettype": "HBox", "options": {"width": "100%", "gap": "10px", "alignItems": "center", @@ -171,12 +184,8 @@ else: "wrap": True}}, {"widgettype": "Text", "options": {"text": size_txt, "cfontsize": 0.75, "color": "#94a3b8"}}, - {"widgettype": "Filler"}, - {"widgettype": "Button", "options": {"label": "下载", "css": "small"}, - "binds": [{"wid": "self", "event": "click", "actiontype": "script", - "target": "self", - "script": "window.location.href=" + _json.dumps(dl_href) + ";"}]} - ] + {"widgettype": "Filler"} + ] + act_btns }) return {