master
zhengpengju 3 years ago
parent 145aaaa5df
commit b58188330b

@ -144,7 +144,7 @@ export default defineConfig({
name: '考试规则维护', name: '考试规则维护',
routes: [ routes: [
{ {
name: '模拟考试规则维护', name: '模拟考试规则设置',
icon: 'smile', icon: 'smile',
path: '/examinationrules/normal', path: '/examinationrules/normal',
component: './examinationrules/normal', component: './examinationrules/normal',
@ -164,7 +164,7 @@ export default defineConfig({
hideInMenu: true, hideInMenu: true,
}, },
{ {
name: '资质考试规则维护', name: '资质考试规则设置',
icon: 'smile', icon: 'smile',
path: '/examinationrules/attestation', path: '/examinationrules/attestation',
component: './examinationrules/attestation', component: './examinationrules/attestation',

@ -37,11 +37,11 @@ const formItemLayoutWithOutLabel = {
}, },
}; };
console.log('first'); console.log('first');
const AnswersSelector = () => { const AnswersSelector = (props) => {
const {type} = props;
return ( return (
<Form.List <Form.List
initialValue={['','','','']} initialValue={type === 2 ? ['正确','错误'] : ['','','','']}
name="answers" name="answers"
rules={[ rules={[
{ {
@ -76,14 +76,15 @@ const AnswersSelector = () => {
> >
<Input placeholder="" style={{ width: '80%' }} /> <Input placeholder="" style={{ width: '80%' }} />
</Form.Item> </Form.Item>
{fields.length > 1 ? ( {(fields.length > 1) && (type !== 2) &&
<MinusCircleOutlined <MinusCircleOutlined
className="dynamic-delete-button" className="dynamic-delete-button"
onClick={() => remove(field.name)} onClick={() => remove(field.name)}
/> />
) : null} }
</Form.Item> </Form.Item>
))} ))}
{ (type !== 2) &&
<Form.Item> <Form.Item>
<Button <Button
type="dashed" type="dashed"
@ -95,6 +96,7 @@ const AnswersSelector = () => {
</Button> </Button>
<Form.ErrorList errors={errors} /> <Form.ErrorList errors={errors} />
</Form.Item> </Form.Item>
}
</> </>
)} )}
</Form.List> </Form.List>

@ -207,7 +207,7 @@ const QuestionBank = () => {
hideInForm: false, hideInForm: false,
hideInSearch: true, hideInSearch: true,
renderFormItem: (item, { defaultRender, ...rest }, form) => ( renderFormItem: (item, { defaultRender, ...rest }, form) => (
<AnswersSelector /> <AnswersSelector type={addType?.value} />
), ),
formItemProps: { formItemProps: {
rules: [ rules: [
@ -240,11 +240,12 @@ const QuestionBank = () => {
} }
console.log('answers??',form.getFieldValue('answers')?.length) console.log('answers??',form.getFieldValue('answers')?.length)
console.log('addType?.value', addType?.value) console.log('addType?.value', addType?.value)
// 0 单选 1 多选 2 判断 // 0 单选 1 多选 2 判断
return ((addType?.value === 0) || (Number(form.getFieldValue('question_type')) === 0) || Number(form.getFieldValue('question_type')) === 2) ? return ((addType?.value === 0 || addType?.value === 2) || (Number(form.getFieldValue('question_type')) === 0) || Number(form.getFieldValue('question_type')) === 2) ?
<Radio.Group <Radio.Group
name="answertrue" name="answertrue"
options={['A', 'B', 'C', 'D']} options={addType?.value === 0 ? ['A', 'B', 'C', 'D'] : ['A', 'B']}
/> />
: :
<Checkbox.Group <Checkbox.Group

Loading…
Cancel
Save