Unify portal return action across finance business surfaces

This commit is contained in:
leefer
2026-09-25 20:27:12 +08:00
parent 8ceb157e5e
commit 53e9ccf57d
2 changed files with 26 additions and 2 deletions
+4 -2
View File
@@ -166,9 +166,11 @@ class PortalMixin:
home = base_url("PORTAL_PUBLIC_URL")
script = '<script>window.PORTAL_HOME=' + json.dumps(home) + ';</script>'
style = '<style>.account-box,.portal-native-account{display:none!important}</style>'
style += '<link rel="stylesheet" href="/portal-return.css?v=20260924">'
style += '<style>.topbar.jn-portal-bar{position:sticky;padding-top:10px;padding-bottom:10px}</style>'
body = body.replace('</head>', script + style + '</head>')
body = body.replace('<nav class="side-nav">', '<nav class="side-nav"><a data-return-portal href="'
+ html.escape(home, quote=True) + '">← 返回统一门户</a>')
portal_link = '<a class="jn-portal-return" data-return-portal title="返回统一门户" aria-label="返回统一门户" href="' + html.escape(home, quote=True) + '"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m3 10 9-7 9 7v10a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1Z"/></svg><span>统一门户</span></a>'
body = body.replace('<div class="topbar">', '<div class="topbar jn-portal-bar">' + portal_link)
data = body.encode("utf-8")
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
+22
View File
@@ -0,0 +1,22 @@
/* Shared portal navigation: same geometry in all four applications. */
.jn-portal-bar { position: relative; min-height: 56px; box-sizing: border-box; padding-right: 160px !important; }
a.jn-portal-return, a.jn-portal-return:link, a.jn-portal-return:visited {
position: absolute; top: 10px; right: 16px; z-index: 2;
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
box-sizing: border-box; height: 36px; min-width: 124px; padding: 0 12px;
border: 1px solid #e7c7c3; border-radius: 10px; margin: 0;
background: #fff7f5; color: #a92e24; box-shadow: 0 1px 2px rgba(64,25,20,.04);
font: 600 13px/1.2 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;
text-decoration: none; white-space: nowrap; cursor: pointer;
}
a.jn-portal-return svg { width: 18px; height: 18px; flex: none; }
a.jn-portal-return span { color: inherit !important; font: inherit; }
a.jn-portal-return:hover { background: #faeae6; color: #92251d; border-color: #d99c94; text-decoration: none; }
a.jn-portal-return:focus-visible { outline: 3px solid #b83a2d; outline-offset: 3px; }
[data-theme="night"] a.jn-portal-return { background: #382927; border-color: #70504b; color: #ffb4a8; }
[data-theme="night"] a.jn-portal-return:hover { background: #4a312c; color: #ffd0c7; }
@media (max-width: 600px) {
.jn-portal-bar { padding-right: 124px !important; }
a.jn-portal-return, a.jn-portal-return:link, a.jn-portal-return:visited { right: 12px; min-width: 102px; gap: 6px; padding: 0 9px; }
}
@media print { a.jn-portal-return { display: none !important; } }