xialiang 3 years ago
commit dae2c0281d

@ -59,7 +59,7 @@ const Analysis: FC<AnalysisProps> = () => {
<IntroduceRow />
</Suspense>
<Suspense fallback={null}>
{/** 课程浏览量/月柱形图 */}
{/** 课程浏览量/月柱形图 需要处理 */}
<CourseRow
rangePickerValue={rangePickerValue}
salesData={data?.salesData || []}

@ -15,7 +15,51 @@ import { useRequest } from 'umi';
const { Step } = Steps;
// 秒数转化为时分秒
const formatSeconds= (value)=>{
// 秒
let second = parseInt(value)
// 分
let minute = 0
// 小时
let hour = 0
// 天
// let day = 0
// 如果秒数大于60将秒数转换成整数
if (second > 60) {
// 获取分钟除以60取整数得到整数分钟
minute = parseInt(second / 60)
// 获取秒数,秒数取佘,得到整数秒数
second = parseInt(second % 60)
// 如果分钟大于60将分钟转换成小时
if (minute > 60) {
// 获取小时获取分钟除以60得到整数小时
hour = parseInt(minute / 60)
// 获取小时后取佘的分获取分钟除以60取佘的分
minute = parseInt(minute % 60)
// 如果小时大于24将小时转换成天
// if (hour > 23) {
// // 获取天数获取小时除以24得到整天数
// day = parseInt(hour / 24)
// // 获取天数后取余的小时获取小时除以24取余的小时
// hour = parseInt(hour % 24)
// }
}
}
let result = '' + parseInt(second) + ' 秒 '
if (minute > 0) {
result = '' + parseInt(minute) + ' 分 ' + result
}
if (hour > 0) {
result = '' + parseInt(hour) + ' 小时 ' + result
}
// if (day > 0) {
// result = '' + parseInt(day) + '天' + result
// }
console.log('result', result)
return result
}
export default () => {
const uuid = uuidv4()
console.log('uuid', uuidv4());
@ -131,12 +175,24 @@ export default () => {
const [selectedCourse, setSelectedCourse] = useState(0);
const [menu, setMenu] = useState();
const [timeData, setTimeData] = useState(0);
useEffect(() => {
let secondValue = 3000; // 秒 截至时间 - 服务器当前时间
setTimeData(secondValue)
const timer = setInterval(() => { //
setTimeData((secondValue > 1) ? secondValue-- : 0);
}, 1000);
return ()=>{
clearInterval(timer) // 清理计算器
}
},[])
/** 获取课程数据 */
const { data: listData } = useRequest(() => {
return queryCourseList();
});
useEffect(() => {
console.log('listData', listData)
setInterval(() => {
@ -261,6 +317,9 @@ export default () => {
<Radio value={4} defaultChecked>D</Radio>
</Radio.Group>
<a onClick={()=>{}}>rrrrr</a>
<div style={{padding:24,fontSize:30}}>{formatSeconds(timeData)}</div>
</>
)
};

@ -177,7 +177,7 @@ const ExaminationRules: React.FC = () => {
valueType: 'text',
hideInSearch: true,
hideInForm: false,
renderText: (val: string) => `${val}`,
renderText: (val: string) => `${val || '-'}`,
},
{
title: '通过线',
@ -186,7 +186,7 @@ const ExaminationRules: React.FC = () => {
valueType: 'text',
hideInSearch: true,
hideInForm: false,
renderText: (val: string) => `${val}`,
renderText: (val: string) => `${val || '-'}`,
},
{
title: '操作',

@ -8,7 +8,7 @@ import { Button, Checkbox, Col, Divider, Input, List, Menu, message, Radio, Row,
import { PageContainer } from '@ant-design/pro-layout';
import ProDescriptions from '@ant-design/pro-descriptions';
import styles from './index.less'
import { saveRules, querySubjectList, queryRulesView, queryRulesList, queryRulesPaper, saveQuestionTypeScore, autoPaperOfficial, queryPaperQuestionList } from '../../service';
import { saveRules, querySubjectList, queryRulesView, queryRulesList, queryRulesPaper, saveQuestionTypeScore, autoPaperOfficial, queryPaperQuestionList, updateScore } from '../../service';
import { queryQuestionList, queryQuestionType } from '@/pages/questionbank/service';
import ProTable, { ActionType, EditableProTable, ProColumns } from '@ant-design/pro-table';
//import { TableListPagination } from '@/pages/ListTableList2/data';
@ -120,7 +120,7 @@ export default () => {
valueType: 'text',
hideInSearch: true,
hideInForm: false,
renderText: (val: string) => `${val || 0}`,
renderText: (val: string) => `${val || '-'}`,
},
{
title: '通过线',
@ -322,7 +322,6 @@ export default () => {
}}
>
<div style={{ margin: '0' }}>
{`试卷`}
<ProTable
page
headerTitle={false}
@ -361,8 +360,7 @@ export default () => {
page_number: value.current,
page_size: value.pageSize
}
);
);
const _questionTypeCountData = [];
_data.question_list[0]?.question_type_count.forEach((item)=>{
@ -480,19 +478,31 @@ export default () => {
width="60%"
visible={scoreModalVisible}
onVisibleChange={handleScoreModalVisible}
footer={null}
onFinish={async () => {
const values = setterRef.current?.getData()
const values = setterRef.current?.getData() // 获取题型分值数据
const passSocre = setterRef.current?.getValue() // 获取通过分数线
console.log('批量设置分值v::::', values);
const {code, data: paper, msg} = await saveQuestionTypeScore({rules_id:Number(params?.id), type_score: JSON.stringify(values)})
console.log('paper', paper)
// 总分及通过分
let _sumScore = 0;
values?.forEach((item: { score: number; })=>{
console.log('item--',item)
_sumScore += item?.score
})
console.log('_sumScore', _sumScore)
// 需要处理
console.log('passSocre',passSocre)
//console.log('sumScore',sumScore)
const {success} = await updateScore({rules_id:Number(params?.id), pass_socre: passSocre, sum_score: _sumScore})
//setSumScore(_sumScore)
// setUuidPaper(paper?.paper_uuid)
// message.success('提交成功');
handleScoreModalVisible(false)
return true;
}}
>
<ScoreSetter ref={setterRef} questionTypeValues={questionTypeValues} />
<ScoreSetter ref={setterRef} questionTypeValues={questionTypeValues || false} />
</ModalForm>
<ModalForm
title={`试卷详情`}

@ -163,7 +163,7 @@ const QuestionPaper = (props: any, ref: any) => {
parsingMap.clear();
}
}, [data]);
//saveQuestion
return (
<PageContainer content={false} extraContent={false} className={styles.questionbank}>
@ -315,7 +315,7 @@ const QuestionPaper = (props: any, ref: any) => {
console.log('item', item);
return (
<List.Item>
<Typography.Text mark={false}>{`${(record?.question_type === 2) ? ['T','F'][key] : labels[key]}. ${item?.answer}`}</Typography.Text>
<Typography.Text mark={false}>{`${(record?.question_type === 2) ? ['A','B'][key] : labels[key]}. ${item?.answer}`}</Typography.Text>
</List.Item>)
}}
/>
@ -335,7 +335,7 @@ const QuestionPaper = (props: any, ref: any) => {
answer = labels?.filter((x, idx, self)=>answertrue[idx] === `${idx}`).toString()
break;
case 2: // 判断
answer = ['T', 'F']?.filter((x, idx, self)=>answertrue[idx] === `${idx}`).toString()
answer = ['A', 'B']?.filter((x, idx, self)=>answertrue[idx] === `${idx}`).toString()
break;
}
console.log('expandedDescRowKeys', expandedDescRowKeys)

@ -112,6 +112,7 @@ const QuestionSelector = (props: any, ref: any) => {
return selectedRowsState;
},
}));
return (
<>
<ProTable

@ -35,8 +35,11 @@ export type TableListItem = {
// React.forwardRef 接受渲染函数作为参数。React 将使用 props 和 ref 作为参数来调用此函数。此函数应返回 React 节点。
const ScoreSetter = (props: any, ref: any) => {
const {questionTypeValues} = props
console.log('questionTypeValues', questionTypeValues)
const {questionTypeValues } = props
console.log('questionTypeValues:::', questionTypeValues)
//console.log('passScoreValue:::', passScoreValue)
const match = useRouteMatch();
console.log('match', match);
@ -47,8 +50,10 @@ const ScoreSetter = (props: any, ref: any) => {
const [dataSource, setDataSource] = useState([]);
//const [selectedRowsState, setSelectedRows] = useState<API.RuleListItem[]>([]);
//const [addType, setAddType] = useState({name: '', value: 0});
let sumScore = 0 // 总分
const [sumScore, setSumScore] = useState(0);
const [passScore, setPassScore] = useState(0); // 设置通过分数线
//let sumScore = 0 // 总分
const formRef = useRef();
@ -70,7 +75,7 @@ const ScoreSetter = (props: any, ref: any) => {
render: (text, record, index) =>
<Space direction='horizontal'>
<span></span>
<Form.Item style={{margin:0}} name={`score[${index}]`}><InputNumber type="number" defaultValue={questionTypeValues ? questionTypeValues[index]?.score : 0} placeholder="请输入" size="small" onChange={(value)=>{
<Form.Item style={{margin:0}} name={`score[${index}]`}><InputNumber min={0} type="number" defaultValue={questionTypeValues ? questionTypeValues[index]?.score : 0} placeholder="请输入" size="small" onChange={(value)=>{
console.log('row', index)
console.log('v1',value)
const _data = [];
@ -88,8 +93,8 @@ const ScoreSetter = (props: any, ref: any) => {
<span></span>
{ (record?.code === 1) &&
<>
<span>:: </span>
<Form.Item style={{margin:0}} name={`score_harf`}><InputNumber type="number" defaultValue={questionTypeValues ? questionTypeValues[index]?.score_harf : 0} placeholder="请输入" size="small" name='score_harf' onChange={(value)=>{
<span>:</span>
<Form.Item style={{margin:0}} name={`score_harf`}><InputNumber min={0} type="number" defaultValue={questionTypeValues ? questionTypeValues[index]?.score_harf : 0} placeholder="请输入" size="small" name='score_harf' onChange={(value)=>{
//
const _data = [];
console.log('typeScore',typeScore)
@ -107,7 +112,7 @@ const ScoreSetter = (props: any, ref: any) => {
title: '题目数量',
dataIndex: 'count',
width: 80,
render: (text, _, index) => <>{questionTypeValues ? questionTypeValues[index].count : '0'}</>,
render: (text, _, index) => <>{questionTypeValues ? questionTypeValues[index]?.count : '0'}</>,
/*
editable: (text, record, index) => {
return true;
@ -119,8 +124,6 @@ const ScoreSetter = (props: any, ref: any) => {
//key: 'age',
width: 80,
render: (text, _, index) => {
//console.log('===',typeScore ? typeScore[index].score * questionTypeValues[index].count : '0')
sumScore = sumScore + ((typeScore && questionTypeValues) ? typeScore[index]?.score * questionTypeValues[index]?.count : 0)
return <>
{(typeScore && questionTypeValues) ? typeScore[index]?.score * questionTypeValues[index]?.count : '0'}
</>
@ -170,12 +173,27 @@ const ScoreSetter = (props: any, ref: any) => {
//return ()=>{}
}, [data]);
/** 计算总分 */
useEffect(() => {
console.log('typeScore', typeScore)
let _sum = 0;
typeScore?.forEach((item, index)=>{
_sum += item.score * questionTypeValues[index]?.count;
})
setSumScore(_sum)
//return ()=>{}
}, [typeScore]);
// 暴露组件的方法 接受外部获取的ref
useImperativeHandle(ref, () => ({
// 构造ref的获取数据方法
getData: () => {
return typeScore;
},
getValue: () => {
return passScore;
},
}));
return (
@ -185,7 +203,9 @@ const ScoreSetter = (props: any, ref: any) => {
<EditableProTable
title={()=>{
return <Space> {sumQuestion} , {sumScore} 线
<Form.Item style={{margin:0}} name='win' initialValue={0}><InputNumber /></Form.Item>
<Form.Item style={{margin:0}} name='pass_socre' initialValue={0}><InputNumber min={0} onChange={(value)=>{
setPassScore(value)
}} /></Form.Item>
</Space>}}
//formMapRef={formMapRef}
//rowKey={'code'}

@ -47,15 +47,7 @@ type DataSourceType = {
children?: DataSourceType[];
};
const defaultData: DataSourceType[] = new Array(10).fill(1).map((_, index) => {
return {
id: (Date.now() + index).toString(),
title: `章节${index}`,
decs: '这个活动真好玩',
state: 'open',
created_at: '2020-05-26T09:42:56Z',
};
});
// 需要处理
// React.forwardRef 接受渲染函数作为参数。React 将使用 props 和 ref 作为参数来调用此函数。此函数应返回 React 节点。
const AutoSelector = (props: any, ref: any) => {
/** 获取章节数据 */
@ -86,7 +78,7 @@ const AutoSelector = (props: any, ref: any) => {
//key: 'code',
dataIndex: `type${item?.code}`,
render: ( item, { defaultRender, ...rest }, form) => {
return <Form.Item style={{margin:0}} ><InputNumber defaultValue={1}
return <Form.Item style={{margin:0}} ><InputNumber min={0} defaultValue={1}
onChange={(value)=>{
//
const _data = [];
@ -105,8 +97,8 @@ const AutoSelector = (props: any, ref: any) => {
// 暴露组件的方法 接受外部获取的ref
useImperativeHandle(ref, () => ({
// 构造ref的获取数据方法
createPaper: () => { // 组卷
//return selectedRowsState;
getData: () => { // 组卷数据
return [];
},
}));
@ -148,10 +140,10 @@ const AutoSelector = (props: any, ref: any) => {
// setDataSource
}}
toolBarRender={false}
/*
/*
editable={{
type: 'multiple',
editableKeys,
//editableKeys,
actionRender: (row, config, defaultDoms) => {
return [defaultDoms.delete];
},
@ -159,9 +151,9 @@ const AutoSelector = (props: any, ref: any) => {
console.log('rrrr',record, recordList)
// setDataSource(recordList);
},
onChange: setEditableRowKeys,
//onChange: setEditableRowKeys,
}}
*/
*/
/>
</>
);

@ -315,7 +315,7 @@ const QuestionPaper = (props: any, ref: any) => {
console.log('item', item);
return (
<List.Item>
<Typography.Text mark={false}>{`${(record?.question_type === 2) ? ['T','F'][key] : labels[key]}. ${item?.answer}`}</Typography.Text>
<Typography.Text mark={false}>{`${(record?.question_type === 2) ? ['A','B'][key] : labels[key]}. ${item?.answer}`}</Typography.Text>
</List.Item>)
}}
/>
@ -335,7 +335,7 @@ const QuestionPaper = (props: any, ref: any) => {
answer = labels?.filter((x, idx, self)=>answertrue[idx] === `${idx}`).toString()
break;
case 2: // 判断
answer = ['T', 'F']?.filter((x, idx, self)=>answertrue[idx] === `${idx}`).toString()
answer = ['A', 'B']?.filter((x, idx, self)=>answertrue[idx] === `${idx}`).toString()
break;
}
console.log('expandedDescRowKeys', expandedDescRowKeys)

@ -152,7 +152,7 @@ const ExaminationRules: React.FC = () => {
valueType: 'text',
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`,
renderText: (val: string) => `${val || '-'}`,
},
{
title: '通过线',
@ -161,7 +161,7 @@ const ExaminationRules: React.FC = () => {
valueType: 'text',
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`,
renderText: (val: string) => `${val || '-'}`,
},
{
title: '操作',

@ -16,7 +16,7 @@ import { Button, Checkbox, Col, Divider, Dropdown, Form, Input, List, Menu, mess
import { PageContainer } from '@ant-design/pro-layout';
import ProDescriptions from '@ant-design/pro-descriptions';
import styles from './index.less'
import { saveRules, querySubjectList, queryRulesView, queryTempQuestionList, saveQuestionTypeScore } from '../../service';
import { saveRules, querySubjectList, queryRulesView, queryTempQuestionList, saveQuestionTypeScore, queryRulesPaper, updateScore } from '../../service';
import { queryCourseView } from '@/pages/course/option/service';
import { queryQuestionList, queryQuestionById, queryQuestionType } from '@/pages/questionbank/service';
import { PlusOutlined, DownOutlined, DeleteOutlined, DownloadOutlined, UploadOutlined, EyeInvisibleOutlined, EyeOutlined, EditOutlined, ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons';
@ -30,6 +30,7 @@ import ScoreSetter from '../../components/ScoreSetter';
import AutoSelector from '../components/AutoSelector';
import { ConsoleMessage } from 'puppeteer-core';
import { getSubjectInfo } from '@/pages/course/subject/service';
import { forEach } from 'lodash';
/**
*
@ -85,13 +86,6 @@ const handleAppend = async (rules_id: number, rows: any[]) => {
}
};
const waitTime = (time: number = 100) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, time);
});
};
const labels = ['A','B','C','D','E','F','G','H','I','J','K']
// 模拟考试规则维护
export default () => {
@ -103,10 +97,15 @@ export default () => {
const [subjectId, setSubjectId] = useState<number>(0); // 关联主题id
const [subjectName, setSubjectName] = useState(''); // 关联主题name
const [questionTypeValues, setQuestionTypeValues] = useState([]); // 题型数据[{count:0, score:0, score_harf:0}]
const [uuidPaper, setUuidPaper] = useState<number>(0);
const [createType, setCreateType] = useState<number>(1); // 组卷类型
const [rulesName, setRulesName] = useState<string>(''); // 组卷类型
const [sumScore, setSumScore] = useState<number>(0); // 总分
const [passScore, setPassScore] = useState<number>(0); // 通过分数线
const [typeQuestionCount, setTypeQuestionCount] = useState([0, 0, 0]); // 临时卷 各题型数量
const formRef = useRef<ProFormInstance>();
@ -120,6 +119,7 @@ export default () => {
const [questionType, setQuestionType] = useState([]); // 题型
const [scoreValues, SetscoreValues] = useState([]); // 分值 [{"question_type": "0","score": "3","score_harf": "0"},]
const [paperInfo, setPaperInfo] = useState({})
/** 获取题型 */
const { data: questionTypeData } = useRequest(() => {
@ -141,13 +141,52 @@ export default () => {
/** 组卷,查询试题临时表(当前选题列表) */
const { data: questions, run } = useRequest(async (params) => {
console.log('questions', questions)
return queryTempQuestionList(params);
const _data = await queryTempQuestionList(params);
return _data;
},{
manual: true,
formatResult: (result) => {
return result?.table_List;
}});
/** 从临时表中计算各题型数量 */
useEffect(() => {
let _data = [0, 0, 0]; // 当前仅支持 单选 / 多选 / 判断 的顺序
console.log('questions-info', questions)
questions?.forEach((item)=>{
_data[Number(item?.question_type)] += 1
})
setTypeQuestionCount(_data);
return ()=>{
/** 退出当前页面清空Map */
//parsingMap.clear();
}
}, [questions]);
//
const { data: paperData, run: runPaper } = useRequest(async (params) => {
console.log('paperData', paperData)
/**
* rules_id: params?.id,
page_number: value.current,
page_size: value.pageSize
*/
return queryRulesPaper(params);
},{
manual: true,
formatResult: (result) => {
return result?.question_list;
}});
useEffect(() => {
console.log('paperData2', paperData)
if(paperData?.length > 0){
console.log('paperData[0]', paperData[0])
setPaperInfo(paperData[0])
}
console.log('PaperInfo', paperInfo)
}, [paperData]);
console.log(params, 'params');
let ruleData = {}
@ -256,7 +295,7 @@ export default () => {
width="md"
initialValue={ruleData?.examination_time}
rules={[{ required: true, message: '请输入考试时长' }]}
tooltip="限制考试时长的情况下,用户考试中离开,倒计时不会停止。" />
tooltip="单位(分钟)" />
</>
)}
</Col>
@ -275,6 +314,7 @@ export default () => {
onFinish={async () => {
console.log(formRef.current?.getFieldsValue());
setCurrentStep(2) // 设置步骤号
runPaper({rules_id: params?.id })
return true;
}}
>
@ -349,7 +389,6 @@ export default () => {
</Space>
</ProCard>
</Col>
<Col span={6} style={{ paddingLeft: 24 }}>
<div style={{ background: '#ffffff', padding: 24 }}>
@ -359,7 +398,7 @@ export default () => {
<Divider style={{ margin: '6px 0', opacity: 0.5 }} />
<Space direction="vertical">
{ questionType.map((item)=>{
return <Typography>{item?.name} { '-' } { '-' } </Typography>
return <Typography>{item?.name} { typeQuestionCount[Number(item.code)] } { '-' } </Typography>
}
)}
</Space>
@ -378,6 +417,17 @@ export default () => {
}}></Button>
<Button size="large" block onClick={()=>{
/**
*
* [{count: 0, score: 0, score_harf: 0},{count: 0, score: 0, score_harf: 0},{count: 0, score: 0, score_harf: 0}]
*/
//
const _data = []
typeQuestionCount?.forEach((item)=>{
_data.push({count: item, score: 0, score_harf: 0})
})
setQuestionTypeValues(_data)
console.log('typeQuestionCount', typeQuestionCount);
handleScoreModalVisible(true)
}}></Button>
<Button size="large" type="primary" block onClick={async ()=>{
@ -428,15 +478,13 @@ export default () => {
<ProDescriptions.Item dataIndex="examination_time" label="考试时长" valueType="text" renderText={(text)=>(`${text} 分钟`)} />
<ProDescriptions.Item dataIndex="grade" label="试卷信息" valueType="text" render={()=>{
{/** 需要从试卷 或 临时试卷 中读取 需要处理 */}
return <Space direction="vertical">
<span> 0 , 100 </span>
<span> 0 , {paperInfo?.sum_score} </span>
<span>: 0 : 0 : 0 </span>
<span>线 60 </span>
</Space>
<span>线 {paperInfo?.pass_score} </span>
</Space>
}} />
</ProDescriptions>
}
</Col>
@ -447,11 +495,9 @@ export default () => {
<ModalForm
title={`手动组卷`}
//
width="60%"
visible={selectorModalVisible}
onVisibleChange={handleSelectorModalVisible}
footer={null}
onFinish={async (values) => {
console.log('v::::', values.name);
const rows = selectorRef?.current?.getSelectedRows()
@ -466,8 +512,7 @@ export default () => {
page_number: 1
}); // 获取当前选题列表
// message.success('提交成功');
handleSelectorModalVisible(false)
handleSelectorModalVisible(false)
return true;
}}
>
@ -479,11 +524,13 @@ export default () => {
width="60%"
visible={autoModalVisible}
onVisibleChange={ handleAutoModalVisible }
footer={null}
onFinish={async () => {
const values = autoRef?.current?.getData()
const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(values)})
console.log('paper', paper)
onFinish={async () => {
// 需要处理
//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)})
//console.log('paper', paper)
//setUuidPaper(paper?.paper_uuid)
// message.success('提交成功');
handleAutoModalVisible(false)
@ -498,12 +545,26 @@ export default () => {
width="60%"
visible={scoreModalVisible}
onVisibleChange={handleScoreModalVisible}
footer={null}
onFinish={async () => {
const values = setterRef.current?.getData()
console.log('批量设置分值v::::', values);
onFinish={async () => {
console.log('typeQuestionCount', typeQuestionCount)
const values = setterRef.current?.getData() // 获取题型分值数据
const passSocre = setterRef.current?.getValue() // 获取通过分数线
console.log('批量设置分值v::::2', values);
// 题型分数
const {code, data: paper, msg} = await saveQuestionTypeScore({rules_id:Number(params?.id), type_score: JSON.stringify(values)})
// 总分及通过分
let _sumScore = 0;
values?.forEach((item)=>{
console.log('item--',item)
_sumScore += item?.score
})
//console.log('_sumScore', _sumScore)
//console.log('passScore',passScore)
console.log('sumScore',sumScore)
const {success} = await updateScore({rules_id:Number(params?.id), pass_socre: passSocre, sum_score: _sumScore})
setSumScore(_sumScore)
console.log('paper', paper)
// setUuidPaper(paper?.paper_uuid)
// message.success('提交成功');
@ -511,7 +572,7 @@ export default () => {
return true;
}}
>
<ScoreSetter ref={setterRef} />
<ScoreSetter ref={setterRef} questionTypeValues={questionTypeValues || false} />
</ModalForm>
</PageContainer>

@ -160,6 +160,16 @@ export async function queryTempQuestionList(
});
}
/** 19 组卷,删除临时表数据 */
export async function delTempQuestion(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/zygh/training/rules/delTempQuestion', {
data,
method: 'POST',
requestType: "form",
...(options || {}),
});
}
/** 组卷详情查询 */
export async function queryRulesPaper(
params: {
@ -218,6 +228,16 @@ export async function saveQuestionTypeScore(data: Record<string, any>, options?:
});
}
/** 24 组卷保存总分与通过线也可以使用01接口维护 */
export async function updateScore(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/zygh/training/rules/updateScore', {
data,
method: 'POST',
requestType: "form",
...(options || {}),
});
}
/** 22 组卷,资质考试组卷 */
export async function autoPaperOfficial(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/zygh/training/rules/autoPaperOfficial', {
@ -228,4 +248,12 @@ export async function autoPaperOfficial(data: Record<string, any>, options?: Rec
});
}
/** 27 组卷,交换临时表顺序 */
export async function exchangeSortNum(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/zygh/training/rules/exchangeSortNum', {
data,
method: 'POST',
requestType: "form",
...(options || {}),
});
}

@ -211,6 +211,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
onChange={(id) => {
area_id=id;
handleSearch('');
run()
}}
>
<Option key={0} value={0}></Option>

@ -42,7 +42,7 @@ const Analysis: FC<AnalysisProps> = () => {
getTimeDistance('year'),
);
const { loading, data } = useRequest(fakeChartData);
// const { loading, data } = useRequest(fakeChartData);
const selectDate = (type: TimeType) => {
setRangePickerValue(getTimeDistance(type));
@ -73,61 +73,55 @@ const Analysis: FC<AnalysisProps> = () => {
};
let salesPieData;
if (salesType === 'all') {
salesPieData = data?.salesTypeData;
} else {
salesPieData = salesType === 'online' ? data?.salesTypeDataOnline : data?.salesTypeDataOffline;
}
const menu = (
<Menu>
<Menu.Item></Menu.Item>
<Menu.Item></Menu.Item>
</Menu>
);
const dropdownGroup = (
<span className={styles.iconGroup}>
<Dropdown overlay={menu} placement="bottomRight">
<EllipsisOutlined />
</Dropdown>
</span>
);
const handleChangeSalesType = (e: RadioChangeEvent) => {
setSalesType(e.target.value);
};
const handleTabChange = (key: string) => {
setCurrentTabKey(key);
};
const activeKey = currentTabKey || (data?.offlineData[0] && data?.offlineData[0].name) || '';
// if (salesType === 'all') {
// salesPieData = data?.salesTypeData;
// } else {
// salesPieData = salesType === 'online' ? data?.salesTypeDataOnline : data?.salesTypeDataOffline;
// }
//
// const handleChangeSalesType = (e: RadioChangeEvent) => {
// setSalesType(e.target.value);
// };
//
// const handleTabChange = (key: string) => {
// setCurrentTabKey(key);
// };
//
// const activeKey = currentTabKey || (data?.offlineData[0] && data?.offlineData[0].name) || '';
return (
<GridContent>
<>
<Suspense fallback={<PageLoading />}>
<IntroduceRow loading={loading} visitData={data?.visitData || []} />
<IntroduceRow
// loading={loading}
// visitData={data?.visitData || []}
/>
</Suspense>
<Suspense fallback={null}>
<TrainCard
rangePickerValue={rangePickerValue}
salesData={data?.salesData || []}
// salesData={data?.salesData || []}
isActive={isActive}
handleRangePickerChange={handleRangePickerChange}
loading={loading}
// loading={loading}
selectDate={selectDate}
/>
</Suspense>
<Suspense fallback={null}>
<CertificateRow loading={loading} visitData={data?.visitData || []} />
<CertificateRow
// loading={loading}
// visitData={data?.visitData || []}
/>
</Suspense>
<Suspense fallback={null}>
<AchievementRow loading={loading} visitData={data?.visitData || []} />
<AchievementRow
// loading={loading}
// visitData={data?.visitData || []}
/>
</Suspense>
</>

@ -197,22 +197,27 @@ const QuestionBank = () => {
hideInForm: false,
hideInSearch: true,
renderFormItem: (item, { defaultRender, ...rest }, form) => {
// 需要处理
// 需要处理 关联长度变化及编辑回显
console.log('edit answertrue11', item)
console.log('form::::::',form.getFieldValue('answertrue'))
// 0 单选 1 多选 2 判断
return (addType?.value !== 1 ) ?
<ProFormRadio.Group
label=""
initialValue={'A'}
<Radio.Group
name="answertrue"
defaultValue={'A'}
options={['A', 'B', 'C', 'D']}
onChange={(e)=>{
form.setFieldsValue({answertrue: 'B'})
}}
/>
:
<ProFormCheckbox.Group
name="answertrue"
label=""
initialValue={[item]}
initialValue={[]}
options={['A', 'B', 'C', 'D']}
/>
},
/*
formItemProps: {
@ -249,7 +254,7 @@ const QuestionBank = () => {
// tooltip="最长为 6 位汉字,需要与考生身份证一致"
placeholder="请填写试题解析"
// rules={[{ required: true }]}
value="锦书"
value=""
// disabled
/>
),
@ -428,7 +433,7 @@ const QuestionBank = () => {
console.log('item', item);
return (
<List.Item>
<Typography.Text mark={false}>{`${(record?.question_type === 2) ? ['T','F'][key] : labels[key]}. ${item?.answer}`}</Typography.Text>
<Typography.Text mark={false}>{`${(record?.question_type === 2) ? ['A','B'][key] : labels[key]}. ${item?.answer}`}</Typography.Text>
</List.Item>)
}}
/>
@ -448,7 +453,7 @@ const QuestionBank = () => {
answer = labels?.filter((x, idx, self)=>`${answertrue[idx]}` === `1`).toString()
break;
case 2: // 判断
answer = ['T', 'F']?.filter((x, idx, self)=>`${answertrue[idx]}` === `1`).toString()
answer = ['A', 'B']?.filter((x, idx, self)=>`${answertrue[idx]}` === `1`).toString()
break;
}
console.log('expandedDescRowKeys', expandedDescRowKeys)

@ -82,14 +82,14 @@ export default defineConfig({
{
name: '资质考试答题',
icon: 'dashboard',
path: '/dashboard/qualification/examAnswer/:examination_id/:examination_name',
path: '/dashboard/qualification/examAnswer/:examination_id/:examination_name/:time/:duration',
component: './dashboard/qualification/examAnswer',
hideInMenu: true,
},
{
name: '资质考试結果頁面',
icon: 'dashboard',
path: '/dashboard/qualification/result/:pass_score/:score/:sum_score/:examination_id/:examination_name',
path: '/dashboard/qualification/result/:pass_score/:score/:sum_score/:examination_id/:examination_name/:time',
component: './dashboard/qualification/result',
hideInMenu: true,
},

@ -14,7 +14,51 @@ import ProCard from '@ant-design/pro-card';
const CheckboxGroup = Checkbox.Group;
const { Paragraph } = Typography;
// 秒数转化为时分秒
const formatSeconds = (value) => {
// 秒
let second = parseInt(value)
// 分
let minute = 0
// 小时
let hour = 0
// 天
// let day = 0
// 如果秒数大于60将秒数转换成整数
if (second > 60) {
// 获取分钟除以60取整数得到整数分钟
minute = parseInt(second / 60)
// 获取秒数,秒数取佘,得到整数秒数
second = parseInt(second % 60)
// 如果分钟大于60将分钟转换成小时
if (minute > 60) {
// 获取小时获取分钟除以60得到整数小时
hour = parseInt(minute / 60)
// 获取小时后取佘的分获取分钟除以60取佘的分
minute = parseInt(minute % 60)
// 如果小时大于24将小时转换成天
// if (hour > 23) {
// // 获取天数获取小时除以24得到整天数
// day = parseInt(hour / 24)
// // 获取天数后取余的小时获取小时除以24取余的小时
// hour = parseInt(hour % 24)
// }
}
}
let result = '' + parseInt(second) + ' 秒 '
if (minute > 0) {
result = '' + parseInt(minute) + ' 分 ' + result
}
if (hour > 0) {
result = '' + parseInt(hour) + ' 小时 ' + result
}
// if (day > 0) {
// result = '' + parseInt(day) + '天' + result
// }
// console.log('result', result)
return result
}
const CardList = () => {
const formRef = useRef<ActionType>();
@ -39,8 +83,20 @@ const CardList = () => {
const [questionNowNum, setQuestionNowNum] = useState(0)
const [questionNum, setQuestioNum] = useState(0)
const [timeData, setTimeData] = useState(0);
useEffect(() => {
let secondValue = params.time; // 秒 截至时间 - 服务器当前时间
setTimeData(secondValue)
// console.log(secondValue);
const timer = setInterval(() => { //
setTimeData((secondValue >= 1) ? secondValue-- : 0);
}, 1000);
return () => {
clearInterval(timer) // 清理计算器
}
}, [])
const params = useParams();
@ -150,7 +206,10 @@ const CardList = () => {
},
onSuccess: (result, params) => {
if (result.success) {
history.push(`/dashboard/qualification/result/${result.data.pass_score}/${result.data.score}/${result.data.sum_score}/${params.examination_id}/${params.examination_name}`);
const time = new Date(timeData).getTime();
const timeDiff = params.duration / 1000 - time;
// console.log('timeDiff',timeDiff)
history.push(`/dashboard/qualification/result/${result.data.pass_score}/${result.data.score}/${result.data.sum_score}/${params.examination_id}/${params.examination_name}/${timeDiff}`);
}
}
});
@ -159,6 +218,7 @@ const CardList = () => {
useEffect(() => {
// 已选择题目回显
formRef?.current?.setFieldsValue({ note: questionNow.answerId });
@ -428,7 +488,7 @@ const CardList = () => {
<div style={{ background: '#ffffff', padding: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
<strong></strong>
<Typography>614</Typography>
<Typography>{formatSeconds(timeData)}</Typography>
<Divider style={{ margin: '6px 0', opacity: 0.5 }} />
<strong></strong>
<Typography>{questionNowNum}/{questionNum}</Typography>
@ -485,27 +545,15 @@ const CardList = () => {
<Button size="large" type="primary"
onClick={() => {
const questionFinishId = []
questionTypeList.map((e, i) => {
questionTypeList[i].children.map((e, index) => {
const answerId = e.answerId
answerId !== "" ? questionFinishId.push({
answer_id: (answerId instanceof Array) ? answerId.join(',') : answerId,
question_id: e.id,
question_type: e.question_type
}) : ""
})
})
const questionFinish = {
answers: JSON.stringify(questionFinishId),
examination_id: params.examination_id,
person_id: cookie.load('person_id'),
paper_id: rulesPaperInfo
}
// console.log(questionFinish, 'questionFinish', rulesPaperInfo)
runFinishExamination(questionFinish)
// console.log(paperInfo)
// console.log(questionTypeList)
// console.log(questionNow)

@ -7,7 +7,7 @@ import { PageContainer } from '@ant-design/pro-layout';
import moment from 'moment';
import EditableLinkGroup from './components/EditableLinkGroup';
import styles from './style.less';
import {getExaminationById,getExaminationRuleById ,getPersonPaperId } from './service';
import {getExaminationById,getExaminationRuleById ,getPersonPaperId,getCurrentDate } from './service';
import cookie from 'react-cookies';
import OfflineData from './components/OfflineData';
@ -50,6 +50,16 @@ const Qualification = () => {
}
});
const getTime=(time)=>{
const current_date=new Date(time.current_date.replace(/-/g, "/"))
const start_date=new Date(rule.examination_start_time.replace(/-/g, "/"));
const end_date=new Date(rule.examination_end_time.replace(/-/g, "/"));
const duration=end_date.getTime()-start_date.getTime();
const dateDiff=end_date.getTime()-current_date.getTime();
const date=dateDiff/1000;
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.examination_name}/${date}/${duration}`)
}
return (
<div className="qualification" style={{height:window.innerHeight-200,background:'#fff',width:'100%',padding:20}}>
<div ><span className="title" onClick={()=>{history.push('/dashboard/workplace')}} style={{color:'#8C8C8C',cursor:'pointer',}}></span> / </div>
@ -75,11 +85,16 @@ const Qualification = () => {
<span className='condition-text' >{rule?rule.pass_score===null?'--':rule.pass_score:'--'}</span>
</div>
<div style={{textAlign:'center'}}>
<Button type={"primary"} onClick={() => {
<Button type={"primary"} onClick={async() => {
if(paperId===''){
message.warning('您已参加过考试,不能开始考试!');
}else {
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.examination_name}`)}}
const time = await getCurrentDate();
getTime(time);
// history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.examination_name}`)
}
}
}

@ -11,6 +11,51 @@ import {getExaminationById,getPersonPaperId } from './service';
import cookie from 'react-cookies';
import OfflineData from './components/OfflineData';
// 秒数转化为时分秒
const formatSeconds = (value) => {
// 秒
let second = parseInt(value)
// 分
let minute = 0
// 小时
let hour = 0
// 天
// let day = 0
// 如果秒数大于60将秒数转换成整数
if (second > 60) {
// 获取分钟除以60取整数得到整数分钟
minute = parseInt(second / 60)
// 获取秒数,秒数取佘,得到整数秒数
second = parseInt(second % 60)
// 如果分钟大于60将分钟转换成小时
if (minute > 60) {
// 获取小时获取分钟除以60得到整数小时
hour = parseInt(minute / 60)
// 获取小时后取佘的分获取分钟除以60取佘的分
minute = parseInt(minute % 60)
// 如果小时大于24将小时转换成天
// if (hour > 23) {
// // 获取天数获取小时除以24得到整天数
// day = parseInt(hour / 24)
// // 获取天数后取余的小时获取小时除以24取余的小时
// hour = parseInt(hour % 24)
// }
}
}
let result = '' + parseInt(second) + ' 秒 '
if (minute > 0) {
result = '' + parseInt(minute) + ' 分 ' + result
}
if (hour > 0) {
result = '' + parseInt(hour) + ' 小时 ' + result
}
// if (day > 0) {
// result = '' + parseInt(day) + '天' + result
// }
console.log('result', result)
return result
}
import './index.less';
const Result = () => {
const [examinationInfo, setExamination] = useState({});
@ -32,6 +77,7 @@ const Result = () => {
}
};
useEffect(() => {
getPass()
}, []);
@ -60,7 +106,7 @@ const Result = () => {
<div style={{width:'12rem',margin:'0 auto'}}>
<div className='condition' >
<div className='condition-title' ></div>
<span className='condition-text' >--</span>
<span className='condition-text' >{params?formatSeconds(params.time):'--分钟'}</span>
</div>
<div className='condition' >
<div className='condition-title' ></div>

@ -26,6 +26,15 @@ export async function getPersonPaperId(params: {
params,
});
}
//获取当前时间
export async function getCurrentDate(params: {
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/examination/getCurrentDate', {
params,
});
}

Loading…
Cancel
Save