mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: optimize problem_list pjax
This commit is contained in:
1 parent
48564767ca
commit
594e97194b
1 file changed
+3
-5
@@ -139,7 +139,8 @@ const defaultSearch = async (domainId: string, q: string, options?: ProblemSearc
|
||||
export class ProblemMainHandler extends Handler {
|
||||
@param('page', Types.PositiveInt, true)
|
||||
@param('q', Types.Content, true)
|
||||
async get(domainId: string, page = 1, q = '') {
|
||||
@param('pjax', Types.Boolean)
|
||||
async get(domainId: string, page = 1, q = '', pjax = false) {
|
||||
this.response.template = 'problem_main.html';
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
const query = buildQuery(this.user);
|
||||
@@ -203,7 +204,7 @@ export class ProblemMainHandler extends Handler {
|
||||
).then((res) => Object.assign(psdict, res))),
|
||||
);
|
||||
}
|
||||
if (this.request.json) {
|
||||
if (pjax) {
|
||||
this.response.body = {
|
||||
title: this.renderTitle(this.translate('problem_main')),
|
||||
fragments: (await Promise.all([
|
||||
@@ -213,9 +214,6 @@ export class ProblemMainHandler extends Handler {
|
||||
this.renderHTML('partials/problem_stat.html', { pcount, pcountRelation }),
|
||||
this.renderHTML('partials/problem_lucky.html', { qs: q }),
|
||||
])).map((i) => ({ html: i })),
|
||||
raw: {
|
||||
page, pcount, ppcount, pdocs, psdict, category,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
this.response.body = {
|
||||
|
||||
Reference in new issue
Block a user