mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
兼容IE
This commit is contained in:
1 parent
627e64a901
commit
1df19a7aa9
17 files changed
+62
-105
No files matched your search
+11
-10
@@ -32,25 +32,26 @@ class ProblemHandler extends Handler {
|
||||
this.checkPerm(PERM_VIEW_PROBLEM);
|
||||
}
|
||||
|
||||
async get({ page = 1, category = null }) {
|
||||
async get({ page = 1, category = '' }) {
|
||||
this.response.template = 'problem_main.html';
|
||||
const q = {};
|
||||
let psdict = {};
|
||||
if (category) q.category = category;
|
||||
if (!this.user.hasPerm(PERM_VIEW_PROBLEM_HIDDEN)) q.hidden = false;
|
||||
const pdocs = await problem.getMany(q, { pid: 1 }, page, constants.PROBLEM_PER_PAGE);
|
||||
const [pdocs, pcount] = await paginate(
|
||||
problem.getMulti(q).sort({ pid: 1 }),
|
||||
page,
|
||||
constants.PROBLEM_PER_PAGE,
|
||||
);
|
||||
if (this.user.hasPerm(PERM_LOGGEDIN)) {
|
||||
psdict = await problem.getListStatus(this.user._id, pdocs.map((pdoc) => pdoc._id));
|
||||
}
|
||||
const path = [
|
||||
['Hydro', '/'],
|
||||
['problem_main', null],
|
||||
];
|
||||
this.response.body = {
|
||||
path: [
|
||||
['Hydro', '/'],
|
||||
['problem_main', null],
|
||||
],
|
||||
page,
|
||||
pdocs,
|
||||
psdict,
|
||||
category: '',
|
||||
path, page, pcount, pdocs, psdict, category,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user