From b58188330b35f730a4da3340bdcc13e8a8fdbb38 Mon Sep 17 00:00:00 2001 From: zhengpengju Date: Tue, 8 Mar 2022 14:20:52 +0800 Subject: [PATCH] fix bug --- admin/config/config.ts | 4 ++-- .../pages/questionbank/components/AnswersEditor.tsx | 12 +++++++----- admin/src/pages/questionbank/index.tsx | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/admin/config/config.ts b/admin/config/config.ts index 82d6c11..216ffe5 100644 --- a/admin/config/config.ts +++ b/admin/config/config.ts @@ -144,7 +144,7 @@ export default defineConfig({ name: '考试规则维护', routes: [ { - name: '模拟考试规则维护', + name: '模拟考试规则设置', icon: 'smile', path: '/examinationrules/normal', component: './examinationrules/normal', @@ -164,7 +164,7 @@ export default defineConfig({ hideInMenu: true, }, { - name: '资质考试规则维护', + name: '资质考试规则设置', icon: 'smile', path: '/examinationrules/attestation', component: './examinationrules/attestation', diff --git a/admin/src/pages/questionbank/components/AnswersEditor.tsx b/admin/src/pages/questionbank/components/AnswersEditor.tsx index 29f44cc..7d741cd 100644 --- a/admin/src/pages/questionbank/components/AnswersEditor.tsx +++ b/admin/src/pages/questionbank/components/AnswersEditor.tsx @@ -37,11 +37,11 @@ const formItemLayoutWithOutLabel = { }, }; console.log('first'); -const AnswersSelector = () => { - +const AnswersSelector = (props) => { + const {type} = props; return ( { > - {fields.length > 1 ? ( + {(fields.length > 1) && (type !== 2) && remove(field.name)} /> - ) : null} + } ))} + { (type !== 2) && + } )} diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx index 596aa88..7dd0fad 100644 --- a/admin/src/pages/questionbank/index.tsx +++ b/admin/src/pages/questionbank/index.tsx @@ -207,7 +207,7 @@ const QuestionBank = () => { hideInForm: false, hideInSearch: true, renderFormItem: (item, { defaultRender, ...rest }, form) => ( - + ), formItemProps: { rules: [ @@ -239,12 +239,13 @@ const QuestionBank = () => { console.log('====0') } console.log('answers??',form.getFieldValue('answers')?.length) - console.log('addType?.value', addType?.value) + console.log('addType?.value', addType?.value) + // 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) ? :