mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: hello subjective
This commit is contained in:
1 parent
385b8f4fe6
commit
4c7e51631b
8 files changed
+32
-13
No files matched your search
@@ -36,7 +36,7 @@ export default class SubjectiveContainer extends React.PureComponent {
|
||||
Textbox(args, name) {
|
||||
return (
|
||||
<label htmlFor={`textbox${name}`}>
|
||||
{args.desc}
|
||||
{name}. {args.desc}
|
||||
<div name={`form_item_${name}`} className="textbox-container">
|
||||
<input type="text" name={name} id={`textbox${name}`} className="textbox" onChange={this.onChange}></input>
|
||||
</div>
|
||||
@@ -47,7 +47,7 @@ export default class SubjectiveContainer extends React.PureComponent {
|
||||
Radio(args, name) {
|
||||
return (
|
||||
<>
|
||||
{args.desc}
|
||||
{name}. {args.desc}
|
||||
{args.choices.map((i) => (
|
||||
<label className="radiobox" htmlFor={`radio${name}${i}`} key={i}>
|
||||
<input type="radio" name={name} id={`radio${name}${i}`} value={i} onChange={this.onChange} /> {i} <br />
|
||||
@@ -67,7 +67,9 @@ export default class SubjectiveContainer extends React.PureComponent {
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<input type="submit" className="button rounded primary" value="提交" />
|
||||
{document.getElementsByClassName('nav__item--round').length
|
||||
? <input type="submit" disabled className="button rounded primary" value="登录后提交" />
|
||||
: <input type="submit" className="button rounded primary" value="提交" />}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.11.8",
|
||||
"version": "4.11.9",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
@@ -26,7 +26,7 @@
|
||||
"@blueprintjs/core": "^3.45.0",
|
||||
"@blueprintjs/icons": "^3.26.1",
|
||||
"@blueprintjs/select": "^3.16.4",
|
||||
"@hydrooj/utils": "^1.0.15",
|
||||
"@hydrooj/utils": "^1.0.20",
|
||||
"@undefined-moe/monaco-yaml": "^2.5.0",
|
||||
"ansi_up": "^5.0.1",
|
||||
"autoprefixer": "^9.8.6",
|
||||
|
||||
@@ -177,7 +177,20 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
|
||||
async function loadSubjective() {
|
||||
try {
|
||||
if (UiContext.pdoc.config?.type !== 'subjective') return;
|
||||
const props = yaml.load(document.getElementsByClassName('section__body typo')[0].innerText);
|
||||
let s = '';
|
||||
try {
|
||||
s = JSON.parse(UiContext.pdoc.content);
|
||||
} catch {
|
||||
s = UiContext.pdoc.content;
|
||||
}
|
||||
if (typeof s === 'object') {
|
||||
const langs = Object.keys(s);
|
||||
const f = langs.filter((i) => i.startsWith(UserContext.viewLang));
|
||||
if (s[UserContext.viewLang]) s = s[UserContext.viewLang];
|
||||
else if (f.length) s = s[f[0]];
|
||||
else s = s[langs[0]];
|
||||
}
|
||||
const props = yaml.load(s);
|
||||
if (!(props instanceof Array)) return;
|
||||
$('.outer-loader-container').show();
|
||||
const { default: Subjective } = await import('vj/components/subjective-question/index');
|
||||
|
||||
@@ -39,8 +39,11 @@
|
||||
</div>
|
||||
<div class="section__body">
|
||||
<ul class="problem__tags">
|
||||
<span class="bp3-tag bp3-large bp3-minimal problem__tag-item">{{ _('Time') }}: {{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms</span>
|
||||
<span class="bp3-tag bp3-large bp3-minimal problem__tag-item">{{ _('Memory') }}: {{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB</span>
|
||||
<span class="bp3-tag bp3-large bp3-minimal problem__tag-item">{{ _('Type') }}: {{ pdoc.config.type }}</span>
|
||||
{% if pdoc.config.type != 'subjective' and pdoc.config.type != 'submit_answer' %}
|
||||
<span class="bp3-tag bp3-large bp3-minimal problem__tag-item">{{ _('Time') }}: {{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms</span>
|
||||
<span class="bp3-tag bp3-large bp3-minimal problem__tag-item">{{ _('Memory') }}: {{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB</span>
|
||||
{% endif %}
|
||||
<a class="bp3-tag bp3-large bp3-minimal bp3-interactive problem__tag-item" href="{{ url('record_main', query={pid:pdoc.docId}) }}">{{ _('Submitted') }}: {{ pdoc.nSubmit }}</a>
|
||||
<a class="bp3-tag bp3-large bp3-minimal bp3-interactive problem__tag-item" href="{{ url('record_main', query={pid:pdoc.docId, status:1}) }}">{{ _('Accepted') }}: {{ pdoc.nAccept }}</a>
|
||||
<span class="bp3-tag bp3-large bp3-minimal problem__tag-item">{{ _('Accepted Ratio') }}: {% if pdoc.nSubmit > 0 %}{{ (100 * pdoc.nAccept / pdoc.nSubmit)|round|int }}%{% else %}{{ _('?') }}{% endif %}</span>
|
||||
|
||||
Reference in new issue
Block a user