diff --git a/admin/config/config.ts b/admin/config/config.ts index 907d6e1..8bd160c 100644 --- a/admin/config/config.ts +++ b/admin/config/config.ts @@ -162,8 +162,8 @@ export default defineConfig({ component: './examinationrules/normal', }, { - name: '创建模拟考试规则', - icon: 'smile', + //name: '创建模拟考试规则', + //icon: 'smile', path: '/examinationrules/normal/step', component: './examinationrules/normal/step', hideInMenu: true, @@ -182,8 +182,8 @@ export default defineConfig({ component: './examinationrules/attestation', }, { - name: '新建资质考试规则', - icon: 'smile', + //name: '新建资质考试规则', + //icon: 'smile', path: '/examinationrules/attestation/step', component: './examinationrules/attestation/step', hideInMenu: true, diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx index 1a3242e..9c91007 100644 --- a/admin/src/pages/course/option/index.tsx +++ b/admin/src/pages/course/option/index.tsx @@ -28,7 +28,7 @@ const uuid = uuidv4(); const handleAdd = async (fields: TableListItem) => { const hide = message.loading('正在添加'); try { - await saveCourse({ ...fields, attachment_filesize: 0, }); + await saveCourse({ ...fields }); hide(); message.success('添加成功'); return true; @@ -45,7 +45,7 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); console.log('fields',fields) try { await saveCourse({ @@ -53,11 +53,11 @@ console.log('fields',fields) ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; @@ -255,7 +255,8 @@ const CourseList: React.FC = () => { beforeUpload={async (file) => { /** 获取视频文件信息 */ const {media: {track:[General, Video, Audio]}} = await getInfo(file) - if(Video.format !== 'AVC' || Audio.format !== 'AAC'){ + console.log('media',General,Video,Audio) + if(Video.Format !== 'AVC' || Audio.Format !== 'AAC'){ message.error('视频编码格式不正确(视频采用AVC,音频采用AAC)') return false; } @@ -300,7 +301,7 @@ const CourseList: React.FC = () => { hideInForm: true, hideInSearch: true, width: 100, - renderText: (val: string) => `${val} 字节`, + renderText: (val: number) => `${(val / 1024).toFixed(2)} KB`, formItemProps: { // 参照 https://ant.design/components/form-cn/#Rule rules: [ @@ -489,7 +490,7 @@ const CourseList: React.FC = () => { fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。 sources: [ { - src: (currentRow?.attachment_json?.url) || '/dsideal_yy/html/down/Syzx/3b/3b225da8-87a5-4619-82a4-664ae2b37e23.mp4', // 测试地址后续请删除 + src: '/dsideal_yy/html/' + currentRow?.attachment_json?.url, // 测试地址后续请删除 type: 'application/x-mpegURL' } ], @@ -578,11 +579,12 @@ const CourseList: React.FC = () => { //return false; // values.attachment_json.response.file.response.url //console.log('currentRow', currentRow) - console.log('values00000000000ss',values) + console.log('values00000000000ss',values) await handleAdd({ ...values, //course_id: currentRow?.course_id, - attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}` + attachment_json: `{"img":"", "name": "${values?.attachment_json?.file?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`, + attachment_filesize: values?.attachment_json?.file?.size, // 字节 }); handleCreateModalVisible(false); // 隐藏创建窗口 actionRef.current?.reloadAndRest?.(); diff --git a/admin/src/pages/course/subject/index.tsx b/admin/src/pages/course/subject/index.tsx index 5e1df6e..fd36042 100644 --- a/admin/src/pages/course/subject/index.tsx +++ b/admin/src/pages/course/subject/index.tsx @@ -104,18 +104,18 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await updateSubject({ ...currentRow, ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examination/certificate/index.tsx b/admin/src/pages/examination/certificate/index.tsx index 832ff9c..6f1ddbd 100644 --- a/admin/src/pages/examination/certificate/index.tsx +++ b/admin/src/pages/examination/certificate/index.tsx @@ -41,7 +41,7 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveCourse({ @@ -49,11 +49,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examination/option/index.tsx b/admin/src/pages/examination/option/index.tsx index c3ec467..6895407 100644 --- a/admin/src/pages/examination/option/index.tsx +++ b/admin/src/pages/examination/option/index.tsx @@ -27,7 +27,7 @@ import { ConsoleMessage } from 'puppeteer-core'; */ const handleUpdate = async (fields: FormValueType) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); console.log(fields, '111111111'); try { @@ -36,11 +36,11 @@ const handleUpdate = async (fields: FormValueType) => { }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examination/registration/index.tsx b/admin/src/pages/examination/registration/index.tsx index 9223898..2438142 100644 --- a/admin/src/pages/examination/registration/index.tsx +++ b/admin/src/pages/examination/registration/index.tsx @@ -43,7 +43,7 @@ const handleAdd = async (fields: TableListItem) => { */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveRegistration({ @@ -51,11 +51,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx index 3318d02..6a552df 100644 --- a/admin/src/pages/examinationrules/attestation/index.tsx +++ b/admin/src/pages/examinationrules/attestation/index.tsx @@ -42,7 +42,7 @@ const handleAdd = async (fields: TableListItem) => { */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveExamination({ @@ -50,11 +50,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; @@ -110,7 +110,7 @@ const ExaminationRules: React.FC = () => { width: 48, }, { - title: '资质考试名称', + title: '考试规则名称', dataIndex: 'rules_name', valueType: 'text', hideInTable: false, diff --git a/admin/src/pages/examinationrules/attestation/step/index.tsx b/admin/src/pages/examinationrules/attestation/step/index.tsx index 5a510c6..894fd42 100644 --- a/admin/src/pages/examinationrules/attestation/step/index.tsx +++ b/admin/src/pages/examinationrules/attestation/step/index.tsx @@ -50,6 +50,8 @@ export default () => { /** 试卷详情窗口 */ const [paperModalVisible, handlePaperModalVisible] = useState(false); + const [paperInfo, setPaperInfo] = useState({}) + /** 查看试卷 */ const { data: questions, run } = useRequest(async (params) => { console.log('questions', questions) @@ -60,6 +62,37 @@ export default () => { return result?.question_list; }}); + + + + // + 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]); + + + + /** 列表项定义 */ const columns: ProColumns[] = [ { @@ -192,6 +225,7 @@ export default () => { ) if(success){ message.success('试卷生成成功') + actionRef.current?.reload() }else{ message.success('试卷生成失败') } @@ -406,6 +440,7 @@ export default () => { onFinish={async () => { console.log(formRef.current?.getFieldsValue()); setCurrentStep(2) + runPaper({ rules_id: params?.id || rulesId }) return true; }} > @@ -506,12 +541,13 @@ export default () => { column={1} //actionRef={actionRef} title={false} - request={async () => { - const result = await queryRulesView(params) + request={async () => { + const result = await queryRulesView({id: rulesId}) console.log('queryRulesView', result) - const subjectInfo = await getSubjectInfo({subject_id: result.bean.subject_id}) + const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id }) console.log('subjectInfo', subjectInfo) - return {data: {...result.bean, subject_name: subjectInfo.data.subject_name}}; + return { data: { ...result.bean, subject_name: subjectInfo.data.subject_name } }; + }} extra={false} > @@ -520,20 +556,20 @@ export default () => { (`${text} 分钟`)} /> - { + { + {/** 从试卷中读取 临时卷必须保存后才进入此页 */ } return - 共 0 道题, 100 分 - 单选: 0 道题 单选: 0 道题 单选: 0 道题 - 通过线 60 分 + 共 {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 || '-'} 分 - - }} /> + }} /> - { - return
0 试卷数量是学生重复考试次数
+ { + return
{entity?.paper_count} 试卷数量是学生重复考试次数
}} /> - { - return
2020/03/01 超过试卷有效期将重新生成试卷
+ { + return
{/*entity?.start_time.substring(0,10)*/} {entity?.end_time.substring(0,10)} 超过试卷有效期将重新生成试卷
}} /> diff --git a/admin/src/pages/examinationrules/components/ScoreSetter.tsx b/admin/src/pages/examinationrules/components/ScoreSetter.tsx index 9253fb2..109d479 100644 --- a/admin/src/pages/examinationrules/components/ScoreSetter.tsx +++ b/admin/src/pages/examinationrules/components/ScoreSetter.tsx @@ -1,6 +1,6 @@ /** 模拟考试 | 资质考试选题 */ //import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons'; -import { Button, InputNumber, message, Space, Form} from 'antd'; +import { Button, InputNumber, message, Space, Form, Input} from 'antd'; //import { FooterToolbar, PageContainer } from '@ant-design/pro-layout'; //import { useRequest } from 'umi'; //import { queryFakeList } from './service'; @@ -194,6 +194,9 @@ const ScoreSetter = (props: any, ref: any) => { getValue: () => { return passScore; }, + getSum: () => { + return sumScore; + }, })); return ( diff --git a/admin/src/pages/examinationrules/normal/step/index.tsx b/admin/src/pages/examinationrules/normal/step/index.tsx index e7c2b56..4bb6c38 100644 --- a/admin/src/pages/examinationrules/normal/step/index.tsx +++ b/admin/src/pages/examinationrules/normal/step/index.tsx @@ -504,7 +504,10 @@ export default () => { //actionRef={actionRef} title={false} request={async () => { - const result = await queryRulesView(params) + console.log('rulesId...', rulesId) + //{rules_id: rulesId} + console.log('params...', params) + const result = await queryRulesView({id: rulesId}) console.log('queryRulesView', result) const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id }) console.log('subjectInfo', subjectInfo) @@ -590,23 +593,13 @@ export default () => { console.log('typeQuestionCount', typeQuestionCount) const values = setterRef.current?.getData() // 获取题型分值数据 const passSocre = setterRef.current?.getValue() // 获取通过分数线 - + const sumCore = setterRef.current?.getSum() // 获取总分 console.log('批量设置分值v::::2', values); // 题型分数 const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), 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 || rulesId), pass_socre: passSocre, sum_score: _sumScore }) - setSumScore(_sumScore) - console.log('paper', paper) + const { success } = await updateScore({ rules_id: Number(params?.id || rulesId), pass_socre: passSocre, sum_score: sumCore }) + //setSumScore(_sumScore) + //console.log('paper', paper) // setUuidPaper(paper?.paper_uuid) // message.success('提交成功'); handleScoreModalVisible(false) diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index d9e145a..f2e6d2c 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -40,18 +40,18 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveTrain({ ...currentRow, ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } };