zhengpengju 3 years ago
parent ecc7ad190f
commit 65cd6ee6ca

@ -162,8 +162,8 @@ export default defineConfig({
component: './examinationrules/normal', component: './examinationrules/normal',
}, },
{ {
name: '创建模拟考试规则', //name: '创建模拟考试规则',
icon: 'smile', //icon: 'smile',
path: '/examinationrules/normal/step', path: '/examinationrules/normal/step',
component: './examinationrules/normal/step', component: './examinationrules/normal/step',
hideInMenu: true, hideInMenu: true,
@ -182,8 +182,8 @@ export default defineConfig({
component: './examinationrules/attestation', component: './examinationrules/attestation',
}, },
{ {
name: '新建资质考试规则', //name: '新建资质考试规则',
icon: 'smile', //icon: 'smile',
path: '/examinationrules/attestation/step', path: '/examinationrules/attestation/step',
component: './examinationrules/attestation/step', component: './examinationrules/attestation/step',
hideInMenu: true, hideInMenu: true,

@ -28,7 +28,7 @@ const uuid = uuidv4();
const handleAdd = async (fields: TableListItem) => { const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加'); const hide = message.loading('正在添加');
try { try {
await saveCourse({ ...fields, attachment_filesize: 0, }); await saveCourse({ ...fields });
hide(); hide();
message.success('添加成功'); message.success('添加成功');
return true; return true;
@ -45,7 +45,7 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields * @param fields
*/ */
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置'); const hide = message.loading('正在更新');
console.log('fields',fields) console.log('fields',fields)
try { try {
await saveCourse({ await saveCourse({
@ -53,11 +53,11 @@ console.log('fields',fields)
...fields, ...fields,
}); });
hide(); hide();
message.success('配置成功'); message.success('操作成功');
return true; return true;
} catch (error) { } catch (error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('操作失败请重试!');
return false; return false;
} }
}; };
@ -255,7 +255,8 @@ const CourseList: React.FC = () => {
beforeUpload={async (file) => { beforeUpload={async (file) => {
/** 获取视频文件信息 */ /** 获取视频文件信息 */
const {media: {track:[General, Video, Audio]}} = await getInfo(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') message.error('视频编码格式不正确视频采用AVC音频采用AAC')
return false; return false;
} }
@ -300,7 +301,7 @@ const CourseList: React.FC = () => {
hideInForm: true, hideInForm: true,
hideInSearch: true, hideInSearch: true,
width: 100, width: 100,
renderText: (val: string) => `${val} 字节`, renderText: (val: number) => `${(val / 1024).toFixed(2)} KB`,
formItemProps: { formItemProps: {
// 参照 https://ant.design/components/form-cn/#Rule // 参照 https://ant.design/components/form-cn/#Rule
rules: [ rules: [
@ -489,7 +490,7 @@ const CourseList: React.FC = () => {
fluid: true, // 当true时Video.js player将拥有流体大小。换句话说它将按比例缩放以适应其容器。 fluid: true, // 当true时Video.js player将拥有流体大小。换句话说它将按比例缩放以适应其容器。
sources: [ 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' type: 'application/x-mpegURL'
} }
], ],
@ -578,11 +579,12 @@ const CourseList: React.FC = () => {
//return false; //return false;
// values.attachment_json.response.file.response.url // values.attachment_json.response.file.response.url
//console.log('currentRow', currentRow) //console.log('currentRow', currentRow)
console.log('values00000000000ss',values) console.log('values00000000000ss',values)
await handleAdd({ await handleAdd({
...values, ...values,
//course_id: currentRow?.course_id, //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); // 隐藏创建窗口 handleCreateModalVisible(false); // 隐藏创建窗口
actionRef.current?.reloadAndRest?.(); actionRef.current?.reloadAndRest?.();

@ -104,18 +104,18 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields * @param fields
*/ */
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置'); const hide = message.loading('正在更新');
try { try {
await updateSubject({ await updateSubject({
...currentRow, ...currentRow,
...fields, ...fields,
}); });
hide(); hide();
message.success('配置成功'); message.success('操作成功');
return true; return true;
} catch (error) { } catch (error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('操作失败请重试!');
return false; return false;
} }
}; };

@ -41,7 +41,7 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields * @param fields
*/ */
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置'); const hide = message.loading('正在更新');
try { try {
await saveCourse({ await saveCourse({
@ -49,11 +49,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
...fields, ...fields,
}); });
hide(); hide();
message.success('配置成功'); message.success('操作成功');
return true; return true;
} catch (error) { } catch (error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('操作失败请重试!');
return false; return false;
} }
}; };

@ -27,7 +27,7 @@ import { ConsoleMessage } from 'puppeteer-core';
*/ */
const handleUpdate = async (fields: FormValueType) => { const handleUpdate = async (fields: FormValueType) => {
const hide = message.loading('正在配置'); const hide = message.loading('正在更新');
console.log(fields, '111111111'); console.log(fields, '111111111');
try { try {
@ -36,11 +36,11 @@ const handleUpdate = async (fields: FormValueType) => {
}); });
hide(); hide();
message.success('配置成功'); message.success('操作成功');
return true; return true;
} catch (error) { } catch (error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('操作失败请重试!');
return false; return false;
} }
}; };

@ -43,7 +43,7 @@ const handleAdd = async (fields: TableListItem) => {
*/ */
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置'); const hide = message.loading('正在更新');
try { try {
await saveRegistration({ await saveRegistration({
@ -51,11 +51,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
...fields, ...fields,
}); });
hide(); hide();
message.success('配置成功'); message.success('操作成功');
return true; return true;
} catch (error) { } catch (error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('操作失败请重试!');
return false; return false;
} }
}; };

@ -42,7 +42,7 @@ const handleAdd = async (fields: TableListItem) => {
*/ */
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置'); const hide = message.loading('正在更新');
try { try {
await saveExamination({ await saveExamination({
@ -50,11 +50,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
...fields, ...fields,
}); });
hide(); hide();
message.success('配置成功'); message.success('操作成功');
return true; return true;
} catch (error) { } catch (error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('操作失败请重试!');
return false; return false;
} }
}; };
@ -110,7 +110,7 @@ const ExaminationRules: React.FC = () => {
width: 48, width: 48,
}, },
{ {
title: '资质考试名称', title: '考试规则名称',
dataIndex: 'rules_name', dataIndex: 'rules_name',
valueType: 'text', valueType: 'text',
hideInTable: false, hideInTable: false,

@ -50,6 +50,8 @@ export default () => {
/** 试卷详情窗口 */ /** 试卷详情窗口 */
const [paperModalVisible, handlePaperModalVisible] = useState<boolean>(false); const [paperModalVisible, handlePaperModalVisible] = useState<boolean>(false);
const [paperInfo, setPaperInfo] = useState({})
/** 查看试卷 */ /** 查看试卷 */
const { data: questions, run } = useRequest(async (params) => { const { data: questions, run } = useRequest(async (params) => {
console.log('questions', questions) console.log('questions', questions)
@ -60,6 +62,37 @@ export default () => {
return result?.question_list; 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[] = [ const columns: ProColumns[] = [
{ {
@ -192,6 +225,7 @@ export default () => {
) )
if(success){ if(success){
message.success('试卷生成成功') message.success('试卷生成成功')
actionRef.current?.reload()
}else{ }else{
message.success('试卷生成失败') message.success('试卷生成失败')
} }
@ -406,6 +440,7 @@ export default () => {
onFinish={async () => { onFinish={async () => {
console.log(formRef.current?.getFieldsValue()); console.log(formRef.current?.getFieldsValue());
setCurrentStep(2) setCurrentStep(2)
runPaper({ rules_id: params?.id || rulesId })
return true; return true;
}} }}
> >
@ -506,12 +541,13 @@ export default () => {
column={1} column={1}
//actionRef={actionRef} //actionRef={actionRef}
title={false} title={false}
request={async () => { request={async () => {
const result = await queryRulesView(params) const result = await queryRulesView({id: rulesId})
console.log('queryRulesView', result) 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) 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} extra={false}
> >
@ -520,20 +556,20 @@ export default () => {
<ProDescriptions.Item dataIndex="subject_name" label="关联主题" valueType="text" /> <ProDescriptions.Item dataIndex="subject_name" label="关联主题" valueType="text" />
<ProDescriptions.Item dataIndex="examination_time" label="考试时长" valueType="text" renderText={(text)=>(`${text} 分钟`)} /> <ProDescriptions.Item dataIndex="examination_time" label="考试时长" valueType="text" renderText={(text)=>(`${text} 分钟`)} />
<ProDescriptions.Item dataIndex="grade" label="试卷信息" valueType="text" render={()=>{ <ProDescriptions.Item dataIndex="grade" label="试卷信息" valueType="text" render={() => {
{/** 从试卷中读取 临时卷必须保存后才进入此页 */ }
return <Space direction="vertical"> return <Space direction="vertical">
<span> 0 , 100 </span> <span> {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} , {paperInfo?.sum_score || '-'} </span>
<span>: 0 : 0 : 0 </span> <span>{paperInfo?.question_type_count?.map(item=>(<span style={{paddingRight:10}}>{`${item?.type_name} ${item?.count} 道题 `}</span>))}</span>
<span>线 60 </span> <span>线 {paperInfo?.pass_score || '-'} </span>
</Space> </Space>
}} />
}} />
<ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={()=>{ <ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={(dom,entity)=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>0</span> <span><ExclamationCircleOutlined /> </span></div> return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>{entity?.paper_count}</span> <span><ExclamationCircleOutlined /> </span></div>
}} /> }} />
<ProDescriptions.Item dataIndex="live_time" label="试卷有效期" valueType="text" render={()=>{ <ProDescriptions.Item dataIndex="live_time" label="试卷有效期" valueType="text" render={(dom,entity)=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>2020/03/01</span> <span><ExclamationCircleOutlined /> </span></div> return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>{/*entity?.start_time.substring(0,10)*/} {entity?.end_time.substring(0,10)}</span> <span><ExclamationCircleOutlined /> </span></div>
}} /> }} />
</ProDescriptions> </ProDescriptions>

@ -1,6 +1,6 @@
/** 模拟考试 | 资质考试选题 */ /** 模拟考试 | 资质考试选题 */
//import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons'; //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 { FooterToolbar, PageContainer } from '@ant-design/pro-layout';
//import { useRequest } from 'umi'; //import { useRequest } from 'umi';
//import { queryFakeList } from './service'; //import { queryFakeList } from './service';
@ -194,6 +194,9 @@ const ScoreSetter = (props: any, ref: any) => {
getValue: () => { getValue: () => {
return passScore; return passScore;
}, },
getSum: () => {
return sumScore;
},
})); }));
return ( return (

@ -504,7 +504,10 @@ export default () => {
//actionRef={actionRef} //actionRef={actionRef}
title={false} title={false}
request={async () => { 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) 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) console.log('subjectInfo', subjectInfo)
@ -590,23 +593,13 @@ export default () => {
console.log('typeQuestionCount', typeQuestionCount) console.log('typeQuestionCount', typeQuestionCount)
const values = setterRef.current?.getData() // 获取题型分值数据 const values = setterRef.current?.getData() // 获取题型分值数据
const passSocre = setterRef.current?.getValue() // 获取通过分数线 const passSocre = setterRef.current?.getValue() // 获取通过分数线
const sumCore = setterRef.current?.getSum() // 获取总分
console.log('批量设置分值v::::2', values); console.log('批量设置分值v::::2', values);
// 题型分数 // 题型分数
const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) }) const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) })
// 总分及通过分 const { success } = await updateScore({ rules_id: Number(params?.id || rulesId), pass_socre: passSocre, sum_score: sumCore })
let _sumScore = 0; //setSumScore(_sumScore)
values?.forEach((item) => { //console.log('paper', paper)
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)
// setUuidPaper(paper?.paper_uuid) // setUuidPaper(paper?.paper_uuid)
// message.success('提交成功'); // message.success('提交成功');
handleScoreModalVisible(false) handleScoreModalVisible(false)

@ -40,18 +40,18 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields * @param fields
*/ */
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置'); const hide = message.loading('正在更新');
try { try {
await saveTrain({ await saveTrain({
...currentRow, ...currentRow,
...fields, ...fields,
}); });
hide(); hide();
message.success('配置成功'); message.success('操作成功');
return true; return true;
} catch (error) { } catch (error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('操作失败请重试!');
return false; return false;
} }
}; };

Loading…
Cancel
Save