diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 6b4c9aefa..6cf7bfabe 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -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, }; } diff --git a/packages/ui-default/templates/partials/problem_list.html b/packages/ui-default/templates/partials/problem_list.html index 259cc4df9..fcd743150 100644 --- a/packages/ui-default/templates/partials/problem_list.html +++ b/packages/ui-default/templates/partials/problem_list.html @@ -6,7 +6,7 @@ {% if not pdocs.length %} {{ nothing.render('Sorry, there are no problems in the problem set.') }} {% else %} - {{ paginator.render(page, ppcount, position='top', add_qs=('q=' + qs if qs else '')) }} + {{ paginator.render(page, ppcount, position='top', add_qs=qs) }} @@ -63,6 +63,6 @@ {%- endfor -%}
- {{ paginator.render(page, ppcount, add_qs=('q=' + qs if qs else '')) }} + {{ paginator.render(page, ppcount, add_qs=qs) }} {% endif %} diff --git a/packages/ui-default/templates/partials/problem_lucky.html b/packages/ui-default/templates/partials/problem_lucky.html index bc127a6b1..5b0aa7594 100644 --- a/packages/ui-default/templates/partials/problem_lucky.html +++ b/packages/ui-default/templates/partials/problem_lucky.html @@ -1,6 +1,6 @@

- + {{ _('Lucky') }}

diff --git a/packages/ui-default/templates/problem_main.html b/packages/ui-default/templates/problem_main.html index 29e183bbd..547c18dc4 100644 --- a/packages/ui-default/templates/problem_main.html +++ b/packages/ui-default/templates/problem_main.html @@ -8,7 +8,7 @@