diff --git a/admin/src/pages/examinationrules/components/QuestionSelector.tsx b/admin/src/pages/examinationrules/components/QuestionSelector.tsx
index 4fd58be..1f5c651 100644
--- a/admin/src/pages/examinationrules/components/QuestionSelector.tsx
+++ b/admin/src/pages/examinationrules/components/QuestionSelector.tsx
@@ -136,6 +136,11 @@ const QuestionSelector = (props: any, ref: any) => {
defaultPageSize: 10,
showSizeChanger: false,
}}
+ search={{
+ optionRender: false,
+ collapsed: false,
+ labelWidth: 40,
+ }}
actionRef={actionRef}
toolBarRender={false}
rowKey="id"
@@ -171,7 +176,6 @@ const QuestionSelector = (props: any, ref: any) => {
total: questions?.totalRow || 0,
};
}}
- //dataSource={dataSource}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
@@ -179,25 +183,6 @@ const QuestionSelector = (props: any, ref: any) => {
}}
columns={columns}
// grid={{ gutter: 16, column: 1 }}
- /*
- metas={{
- title: {
- dataIndex: 'question_stem',
- render: (text: React.ReactNode, record: T, index: number) => `1. ${text}`,
- },
- avatar: {
- dataIndex: 'question_type',
- valueType: 'text',
- render: (text: React.ReactNode, record: T, _: number) => {
- const _type = questionType?.filter((item, idx, self)=>{
- return item?.code === record.question_type
- });
- return `[${_type[0]?.name}]`
- },
- },
- description: {
- },
- }}*/
/>
>
);
diff --git a/admin/src/pages/examinationrules/normal/step/index.tsx b/admin/src/pages/examinationrules/normal/step/index.tsx
index 9f13809..e7c2b56 100644
--- a/admin/src/pages/examinationrules/normal/step/index.tsx
+++ b/admin/src/pages/examinationrules/normal/step/index.tsx
@@ -447,7 +447,7 @@ export default () => {
试卷信息与设置
- 共 {'0'} 题 {'-'} 分
+ 共 {questions?.length} 题 {'-'} 分
{questionType.map((item) => {
@@ -509,6 +509,7 @@ export default () => {
const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id })
console.log('subjectInfo', subjectInfo)
return { data: { ...result.bean, subject_name: subjectInfo.data.subject_name } };
+
}}
extra={false}
>
@@ -516,13 +517,12 @@ export default () => {
(`${text} 分钟`)} />
-
{
- {/** 需要从试卷 或 临时试卷 中读取 需要处理 */ }
+ {/** 从试卷中读取 临时卷必须保存后才进入此页 */ }
return
- 共 0 道题, {paperInfo?.sum_score} 分
- 单选: 0 道题 单选: 0 道题 单选: 0 道题
- 通过线 {paperInfo?.pass_score} 分
+ 共 {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} 道题, {paperInfo?.sum_score || '-'} 分
+ {paperInfo?.question_type_count?.map(item=>({`${item?.type_name} ${item?.count} 道题 `}))}
+ 通过线 {paperInfo?.pass_score || '-'} 分
}} />
@@ -569,7 +569,8 @@ export default () => {
//console.log('111')
//const values = autoRef?.current?.getData()
//console.log('2222')
- //const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(values)})
+ const values = [{"question_type":0,"chapter_list": [{ "chapter_id":76, "count":1 },{ "chapter_id":77, "count":1 }]}]
+ const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(values)})
//console.log('paper', paper)
//setUuidPaper(paper?.paper_uuid)
// message.success('提交成功');
diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx
index fa278f2..f2949bb 100644
--- a/admin/src/pages/questionbank/index.tsx
+++ b/admin/src/pages/questionbank/index.tsx
@@ -99,7 +99,8 @@ const QuestionBank = () => {
const type = history.location.pathname === '/questionbank/attestation' ? 1 : 0 ; // 题库类型
const actionRef = useRef();
-
+ const formRef = useRef();
+
const [questionType, setQuestionType] = useState([]);
const [parsing, setParsing] = useState();
@@ -114,6 +115,7 @@ const QuestionBank = () => {
const [pageNumber, setPageNumber] = useState(1)
//const [answertrueValues, setAnswertrueValues] = useState(); // 编辑试题答案项值
+ //const [options, setOptions] = useState([]); // 设置当前选项, 用于删除选项时判断
/** 表单项定义 */
const columns: ProColumns[] = [
@@ -233,7 +235,7 @@ const QuestionBank = () => {
dependencies:['answers'],
renderFormItem: (item, { defaultRender, ...rest }, form) => {
console.log('正确答案...', form.getFieldValue('answers'))
- // 需要处理 关联长度变化及编辑回显
+ // 关联长度变化及编辑回显
console.log('edit answertrue11', item)
console.log('form::::::',form.getFieldValue('answertrue'))
console.log('rest', rest)
@@ -245,12 +247,13 @@ const QuestionBank = () => {
for(let i=0; i {
title: '题干',
search: false,
dataIndex: 'question_stem',
- render: (text: React.ReactNode, record: T, index: number) => (<>{record?.id} {text}>),
+ render: (text: React.ReactNode, record: T, index: number) => ({record?.id} {text}),
},
avatar: {
title: '题型',
@@ -729,14 +732,41 @@ const QuestionBank = () => {
footer={null}
>
+ formRef={formRef}
layout="horizontal"
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
+ onValuesChange={()=>{
+ //console.log('formRef', formRef.current.getFieldInstance('answertrue'))
+ //console.log('formRef.current', formRef.current.getFieldsValue(['answertrue']))
+ //console.log('v', value)
+ //console.log('answers', formRef?.current?.getFieldValue('answers'))
+ const answerTrue = formRef?.current?.getFieldValue('answertrue');
+ let fixed_answertrue;
+ // 如果正确答案为字符串(单选 / 判断)
+ if(typeof answerTrue === 'string'){
+ console.log('string.....')
+ fixed_answertrue = labels.indexOf(answerTrue) < (formRef?.current?.getFieldValue('answers')?.length || 0) ? answerTrue : undefined;
+ }else if(answerTrue?.length > 0){
+ fixed_answertrue = answerTrue?.filter((item, key)=>{
+ return labels.indexOf(item) < (formRef?.current?.getFieldValue('answers')?.length || 0)
+ })
+ }
+ console.log('answerTrue', answerTrue)
+ /*
+ const */
+ //console.log('fixed', fixed_answertrue)
+ formRef?.current?.setFieldsValue({answertrue: fixed_answertrue})
+ }}
onFinish={async (values: any) => {
+ //console.log('formRef.current', formRef.current.getFieldsValue(['answertrue']))
+
// 表单处理
console.log('columns:', columns);
- console.log('values:', values);
+ console.log('values:', values);
+
+ return false
const opts = [];
values?.answers?.forEach((item, key)=>{
//