zhengpengju 3 years ago
parent ecc7ad190f
commit 65cd6ee6ca

@ -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,

@ -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?.();

@ -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;
}
};

@ -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;
}
};

@ -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;
}
};

@ -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;
}
};

@ -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,

@ -50,6 +50,8 @@ export default () => {
/** 试卷详情窗口 */
const [paperModalVisible, handlePaperModalVisible] = useState<boolean>(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 () => {
<ProDescriptions.Item dataIndex="subject_name" label="关联主题" valueType="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">
<span> 0 , 100 </span>
<span>: 0 : 0 : 0 </span>
<span>线 60 </span>
<span> {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} , {paperInfo?.sum_score || '-'} </span>
<span>{paperInfo?.question_type_count?.map(item=>(<span style={{paddingRight:10}}>{`${item?.type_name} ${item?.count} 道题 `}</span>))}</span>
<span>线 {paperInfo?.pass_score || '-'} </span>
</Space>
}} />
}} />
<ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={()=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>0</span> <span><ExclamationCircleOutlined /> </span></div>
<ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={(dom,entity)=>{
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={()=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>2020/03/01</span> <span><ExclamationCircleOutlined /> </span></div>
<ProDescriptions.Item dataIndex="live_time" label="试卷有效期" valueType="text" render={(dom,entity)=>{
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>

@ -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 (

@ -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)

@ -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;
}
};

Loading…
Cancel
Save