core&ui: fix pagination sort parameter (#1094)

This commit is contained in:
Liu Hao authored and GitHub committed 2025-11-20 15:44:13 +00:00
1 parent 88e86d8667
commit f69d3cb77d
4 files changed
+10 -7

No files matched your search

+6 -3
View File
@@ -170,15 +170,17 @@ export class ProblemMainHandler extends Handler {
pdocs.map((i) => i.docId),
));
}
let qs = sortStrategy !== 'default' ? `sort=${sortStrategy}` : '';
if (q) qs += `${qs ? '&' : ''}q=${encodeURIComponent(q)}`;
if (pjax) {
this.response.body = {
title: this.renderTitle(this.translate('problem_main')),
fragments: (await Promise.all([
this.renderHTML('partials/problem_list.html', {
page, ppcount, pcount, pdocs, psdict, qs: q, sort: sortStrategy,
page, ppcount, pcount, pdocs, psdict, qs, q, sort: sortStrategy,
}),
this.renderHTML('partials/problem_stat.html', { pcount, pcountRelation: this.queryContext.pcountRelation }),
this.renderHTML('partials/problem_lucky.html', { qs: q }),
this.renderHTML('partials/problem_lucky.html', { q }),
])).map((i) => ({ html: i })),
};
} else {
@@ -189,7 +191,8 @@ export class ProblemMainHandler extends Handler {
pcountRelation: this.queryContext.pcountRelation,
pdocs,
psdict,
qs: q,
qs,
q,
sort: sortStrategy,
};
}