fix: harden bd leader history more params

This commit is contained in:
170-carry 2026-04-29 11:27:45 +08:00
parent ff759a9898
commit d19b96059f
3 changed files with 14 additions and 7 deletions

View File

@ -7,8 +7,13 @@
</head>
<body>
<script>
var search = window.location.search
window.location = "https://h5.haiyihy.com/hyapp/bd-leader-center/index.html" + search
var target = new URL("https://h5.haiyihy.com/hyapp/bd-leader-center/index.html")
var source = new URL(window.location.href)
source.searchParams.forEach(function (value, key) {
target.searchParams.set(key, value)
})
target.searchParams.set("h5v", "20260429-0335")
window.location.replace(target.toString())
</script>
</body>
</html>
</html>

View File

@ -168,6 +168,6 @@
<div class="toast" id="toast" role="status" aria-live="polite" hidden></div>
</div>
<script src="./script.js?v=20260429-0315" defer></script>
<script src="./script.js?v=20260429-0335" defer></script>
</body>
</html>

View File

@ -679,7 +679,7 @@
more.className = "more-button";
more.type = "button";
more.textContent = message("more");
more.addEventListener("click", () => showHistoryMore(item?.billBelong));
more.addEventListener("click", () => showHistoryMore(item));
row.appendChild(more);
}
return row;
@ -739,6 +739,7 @@
function normalizeDateText(value) {
return digitMaps.reduce((textValue, [from, to]) => textValue.split(from).join(to), String(value || ""))
.replace(/&amp;/gi, "&")
.replace(/&(?:rlm|lrm);/gi, "")
.replace(/&nbsp;/gi, " ")
.replace(/[\u061c\u200e\u200f]/g, "")
@ -762,6 +763,7 @@
function normalizeBillBelong(value) {
const textValue = normalizeDateText(value);
if (!textValue) return "";
if (/^\d{6,8}$/.test(textValue)) return textValue;
const isoMatch = textValue.match(/^(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?/);
if (isoMatch) {
@ -804,8 +806,8 @@
return "";
}
function historyMorePath(billBelong) {
const normalized = normalizeBillBelong(billBelong);
function historyMorePath(source) {
const normalized = normalizeBillBelong(source?.billBelong ?? source?.period ?? source?.billTitle ?? source);
return normalized ? `/team/bd/leader/history/more?billBelong=${encodeURIComponent(normalized)}` : "";
}