mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: 支持客观题配置
This commit is contained in:
1 parent
cb91c6ba71
commit
ec4971d213
7 files changed
+179
-5
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import React from 'react';
|
||||
|
||||
export default class MessagePadContainer extends React.PureComponent {
|
||||
Textbox(args, name) {
|
||||
return (
|
||||
<label htmlFor={`textbox${name}`}>
|
||||
{args.desc}
|
||||
<div name={`form_item_${name}`} className="textbox-container">
|
||||
<input type="text" name={name} id={`textbox${name}`} className="textbox"></input>
|
||||
</div>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
Radio(args, name) {
|
||||
return (
|
||||
<>
|
||||
{args.desc}
|
||||
{args.choices.map((i) => (
|
||||
<label className="radiobox" htmlFor={`radio${name}`}>
|
||||
<input type="radio" name={name} id={`radio${name}`} value={i} /> {i} <br />
|
||||
</label>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<form>
|
||||
{this.props.panel.map((i, name) => (
|
||||
<div className="row">
|
||||
<div className="medium-7 columns form__item end">
|
||||
{i.type === 'textbox' && this.Textbox(i, name)}
|
||||
{i.type === 'radio' && this.Radio(i, name)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<input type="submit" className="button rounded primary" value="提交" />
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user