测试bug修改

master
wangxi 3 years ago
parent 6f4c56577e
commit 1ccad14781

@ -18,8 +18,7 @@ import { getInfo } from 'react-mediainfo';
import { v4 as uuidv4 } from 'uuid';
const uuid = uuidv4();
let uuid = uuidv4();
/**
@ -223,9 +222,10 @@ const CourseList: React.FC = () => {
hideInSearch: true,
hideInDescriptions: true,
renderFormItem: (item, { defaultRender, ...rest }, form) => (
console.log('item.initialValue',item.initialValue),
console.log('dfeededed',item.initialValue ?item.initialValue.length===undefined? [item.initialValue].map(i=>({...i, url:'/dsideal_yy/html/' + i.url})):item.initialValue.map(i=>({...i, url:'/dsideal_yy/html/' + i.url})) : []),
// console.log('item.initialValue',item.initialValue),
// console.log('dfeededed',item.initialValue ?item.initialValue.length===undefined? [item.initialValue].map(i=>({...i, url:'/dsideal_yy/html/' + i.url})):item.initialValue.map(i=>({...i, url:'/dsideal_yy/html/' + i.url})) : []),
// console.log('uuid0000000000000',uuid),
// console.log('uploadFileExt000000000000',uploadFileExt),
// item.initialValue.length===undefined?
<Upload
accept='.mp4'
@ -234,14 +234,12 @@ const CourseList: React.FC = () => {
beforeUpload={async (file) => {
/** 获取视频文件信息 */
const {media: {track:[General, Video, Audio]}} = await getInfo(file)
console.log('media',General,Video,Audio)
// console.log('media',General,Video,Audio)
if(Video.Format !== 'AVC' || Audio.Format !== 'AAC'){
message.error('视频编码格式不正确视频采用AVC音频采用AAC')
return false;
}
console.log('filename', file?.name)
// 获取文件名
SetUploadFileName(file?.name);
// 获取最后一个.的位置
const index = file?.name.lastIndexOf(".");
// 获取后缀
@ -250,9 +248,6 @@ const CourseList: React.FC = () => {
onRemove={()=>{
//createFormRef?.current?.setFieldsValue({attachment_json: ""})
}}
// this.setState({ fileList });
// console.log(999,fileList)
// }}
data={{
name: uploadFileName,
chunk: 0,
@ -264,11 +259,11 @@ const CourseList: React.FC = () => {
>
<Button icon={<UploadOutlined />}></Button>
</Upload>
),
formItemProps: {
// 参照 https://ant.design/components/form-cn/#Rule
getValueFromEvent:(e: any)=>{
console.log('Upload event:', e);
if (Array.isArray(e)) {
return e;
}
@ -334,6 +329,7 @@ const CourseList: React.FC = () => {
<a
key="update"
onClick={async() => {
uuid = uuidv4();
const info= await viewCourse({course_id:record.course_id});
setCurrentRow(info.data);
handleUpdateModalVisible(true);
@ -378,7 +374,6 @@ const CourseList: React.FC = () => {
const handleAdd = async (fields: TableListItem) => {
const info= await saveCourse({ ...fields });
console.log('info---',info);
if(info.code!==2000){
message.warning(info.msg);
return false;
@ -410,7 +405,6 @@ const CourseList: React.FC = () => {
const info= await saveCourse({
...fields,
});
console.log('info---',info)
if(info.code!==2000){
message.warning(info.msg);
return false;
@ -447,6 +441,7 @@ const CourseList: React.FC = () => {
type="primary"
key="primary"
onClick={() => {
uuid = uuidv4();
handleCreateModalVisible(true);
}}
>
@ -520,7 +515,7 @@ const CourseList: React.FC = () => {
footer={null}
centered
>
{console.log('currentRow',currentRow)}
{/*{console.log('currentRow',currentRow)}*/}
{currentRow?.course_id && (
<Row>
<Col span={14}>
@ -627,6 +622,7 @@ const CourseList: React.FC = () => {
formRef={createFormRef}
layout="horizontal"
layoutType="Form"
preserve={false}
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values: any) => {
@ -680,11 +676,10 @@ const CourseList: React.FC = () => {
formRef={updateFormRef}
layout="horizontal"
layoutType="Form"
preserve={false}
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values: any) => {
console.log('values',values)
console.log('currentRow',currentRow)
await handleUpdate({
...values,
attachment_json: `[{"img":"", "name": "${values?.attachment_json[0]?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}]`,

@ -82,7 +82,7 @@ export default defineConfig({
{
name: '资质考试答题',
icon: 'dashboard',
path: '/dashboard/qualification/examAnswer/:examination_id/:rule_id/:examination_name/:time',
path: '/dashboard/qualification/examAnswer/:examination_id/:rule_id/:examination_name/:time/:paperId',
component: './dashboard/qualification/examAnswer',
hideInMenu: true,
},

@ -60,10 +60,11 @@ const formatSeconds = (value) => {
return result
}
const CardList = () => {
const params = useParams();
const formRef = useRef<ActionType>();
console.log('params0000000',params)
// 组卷详情查询
const [rulesPaperInfo, setRulesPaperInfo] = useState([]);
const [rulesPaperInfo, setRulesPaperInfo] = useState(params.paperId);
//规则
const [ruleId, setRuleId] = useState([]);
// 试题列表
@ -102,25 +103,25 @@ const CardList = () => {
}, [])
const params = useParams();
const { loading, data } = useRequest(() => {
return getPersonPaperId({
examination_id: params.examination_id,
person_id: cookie.load('person_id')
});
},
{
formatResult: (result) => {
return result;
},
onSuccess: (result) => {
if (result.success) {
setRulesPaperInfo(result.paper_id)
run({ paper_id: result.paper_id })
// setQuestionTypeList(result.question_list[0].question_type_count)
}
}
});
// const { loading, data } = useRequest(() => {
// return getPersonPaperId({
// examination_id: params.examination_id,
// person_id: cookie.load('person_id')
// });
// },
// {
// formatResult: (result) => {
// return result;
// },
// onSuccess: (result) => {
// if (result.success) {
// setRulesPaperInfo(result.paper_id)
// run({ paper_id: result.paper_id })
// // setQuestionTypeList(result.question_list[0].question_type_count)
// }
// }
// });
const personInfo = useRequest(() => {
return getExaminationPersonApplyInfo({
@ -160,10 +161,12 @@ const CardList = () => {
}
});
const { run } = useRequest(getPaperQuestionList,
{
refreshDeps: [rulesPaperInfo],
manual: true,
const getQuestionList=useRequest(()=>{
return getPaperQuestionList({
paper_id:params.paperId
})
},{
// manual: true,
formatResult: (result) => {
return result;
},
@ -234,7 +237,84 @@ const CardList = () => {
setQuestioNum(questionInfo.length)
}
}
});
}
)
// const { run } = useRequest(getPaperQuestionList,
// {
// refreshDeps: [rulesPaperInfo],
// manual: true,
// formatResult: (result) => {
// return result;
// },
// onSuccess: (result, params) => {
// // setRulesPaperInfo(result || [])
// if (result.success) {
// // 试题列表
//
// const paperList = result.question_list;
// const arr = [[], [], []];
// const question_type_count = [
// { count: 0, question_type: 0, type_name: '单选' },
// { count: 0, question_type: 1, type_name: '多选' },
// { count: 0, question_type: 2, type_name: '判断' },
// ];
// if (result.question_list.length !== 0) {
// setRuleId(result.question_list[0].rules_id)
// result.question_list.forEach((item) => {
// if (item.question_type === 0) {
// arr[0].push(item)
// } else if (item.question_type === 1) {
// arr[1].push(item)
// } else {
// arr[2].push(item)
// }
// })
// }
// question_type_count[0].count = arr[0].length;
// question_type_count[1].count = arr[1].length;
// question_type_count[2].count = arr[2].length;
// setQuestionType(question_type_count);
// const qList = question_type_count
// const questionList: any[] = []
// qList.map((e, i) => {
// if (e.count > 0) {
// questionList.push({
// children: [],
// ...e
// })
// }
// })
//
//
// // 根据分类拆分试题 左侧答题卡 state:0 未答题 1 已答题
// paperList.map((e) => {
// questionList.map((item, index) => {
// if (item.question_type == e.question_type) {
// questionList[index].children.push({ ...e, question_type: item.question_type, answerSelect: "", state: 0, answerId: "" })
// }
// })
// })
//
// // 根据答题卡生成考试顺序
// const questionInfo = []
// for (let i = 0; i < questionList.length; i++) {
// questionList[i].children.map((e, index) => {
// questionInfo.push({ ...e, index: [i, index] })
// questionList[i].children[index].index = [i, index]
//
// })
// }
//
//
// setPaperInfo(questionInfo || [])
// setQuestionNow(questionInfo[0] || [])
// setQuestionTypeList(questionList || [])
//
// setQuestioNum(questionInfo.length)
// }
// }
// });

@ -40,6 +40,7 @@ const Qualification = () => {
});
const paperInfo = useRequest(() => {
return getPersonPaperId({
examination_id:params.examination_id,
person_id:cookie.load('person_id')
@ -102,7 +103,7 @@ const Qualification = () => {
// const time = await getCurrentDate();
// getTime(time);
const time=rule.examination_time*60;
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.rules_id}/${examinationInfo.examination_name}/${time}`)
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.rules_id}/${examinationInfo.examination_name}/${time}/${paperId}`)
}catch (error) {
if(error.response){

@ -155,7 +155,6 @@ const Workplace: FC = () => {
dataIndex: 'option',
key: 'option',
render: (_, record, index, action) => {
console.log('record',record)
// return record?.status === 0 ? <Button type="primary" onClick={() => { history.push('/registration' + record.examination_id) }}>去报名</Button> : <Button type="primary" onClick={() => { history.push('/examination/paper') }}> 参加考试</Button >
switch (record.status_type) {
case 0://待报名
@ -190,7 +189,7 @@ const Workplace: FC = () => {
const time_diff=(endTime-startTime)/1000;
console.log('time_diff',time_diff)
getExamInfo(record.examination_id,time_diff)
getExamInfo(record.examination_id,time_diff,info.bean.paper_id)
}else {
getParperId(record.examination_id)
}
@ -219,13 +218,13 @@ const Workplace: FC = () => {
},
},
];
const getExamInfo=async (id,time)=>{
const getExamInfo=async (id,time,paper_id)=>{
try {
const info=await getExaminationById({examination_id:id});
console.log('info--------------------',info)
console.log('time',time)
console.log('paper_idpaper_idpaper_id',paper_id)
history.push(`/dashboard/qualification/examAnswer/${id}/${info.bean.rules_id}/${info.bean.examination_name}/${time}`)
history.push(`/dashboard/qualification/examAnswer/${id}/${info.bean.rules_id}/${info.bean.examination_name}/${time}/${paper_id}`)
}catch (error) {
if(error.response){
@ -243,7 +242,9 @@ const Workplace: FC = () => {
if(info.paper_id===''){
message.warning('考试失败!')
}else {
history.push('/dashboard/qualification/' + id)
// history.push(`/dashboard/qualification/${id}/${info.paper_id}`)
}
}catch (error) {

Loading…
Cancel
Save