core: objective

This commit is contained in:
undefined committed 2021-07-29 00:26:32 +08:00
1 parent de5b908272
commit 47b7866053
14 files changed
+31 -18

No files matched your search

@@ -171,7 +171,7 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
unmountReact();
}
async function loadSubjective() {
async function loadObjective() {
try {
let s = '';
try {
@@ -189,15 +189,15 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
const props = yaml.load(s);
if (!(props instanceof Array)) return;
$('.outer-loader-container').show();
const [{ default: Subjective }, React, ReactDOM] = await Promise.all([
import('vj/components/subjective-question/index'),
const [{ default: Objective }, React, ReactDOM] = await Promise.all([
import('vj/components/objective-question/index'),
import('react'),
import('react-dom'),
]);
ReactDOM.render(
<div className="section__body typo">
<Subjective panel={props} target={UiContext.postSubmitUrl}></Subjective>
<Objective panel={props} target={UiContext.postSubmitUrl}></Objective>
</div>,
$('.problem-content').get(0),
);
@@ -265,7 +265,7 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
$('span.tags').show();
});
$('[name="problem-sidebar__download').on('click', handleClickDownloadProblem);
if (UiContext.pdoc.config?.type === 'subjective') loadSubjective();
if (UiContext.pdoc.config?.type === 'objective') loadObjective();
if (pagename !== 'contest_detail_problem') initChart();
});