Compare commits

..

No commits in common. 'c08a42fcf4cbe13a43def22b06188d16cc009022' and '6f4c56577e90c16d5a6a456282ee2fb3e4f40448' have entirely different histories.

@ -18,7 +18,8 @@ import { getInfo } from 'react-mediainfo';
import { v4 as uuidv4 } from 'uuid';
let uuid = uuidv4();
const uuid = uuidv4();
/**
@ -222,10 +223,9 @@ 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('uuid0000000000000',uuid),
// console.log('uploadFileExt000000000000',uploadFileExt),
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})) : []),
// item.initialValue.length===undefined?
<Upload
accept='.mp4'
@ -234,12 +234,14 @@ 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(".");
// 获取后缀
@ -248,6 +250,9 @@ const CourseList: React.FC = () => {
onRemove={()=>{
//createFormRef?.current?.setFieldsValue({attachment_json: ""})
}}
// this.setState({ fileList });
// console.log(999,fileList)
// }}
data={{
name: uploadFileName,
chunk: 0,
@ -259,11 +264,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;
}
@ -329,7 +334,6 @@ 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);
@ -374,6 +378,7 @@ 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;
@ -405,6 +410,7 @@ const CourseList: React.FC = () => {
const info= await saveCourse({
...fields,
});
console.log('info---',info)
if(info.code!==2000){
message.warning(info.msg);
return false;
@ -441,7 +447,6 @@ const CourseList: React.FC = () => {
type="primary"
key="primary"
onClick={() => {
uuid = uuidv4();
handleCreateModalVisible(true);
}}
>
@ -515,7 +520,7 @@ const CourseList: React.FC = () => {
footer={null}
centered
>
{/*{console.log('currentRow',currentRow)}*/}
{console.log('currentRow',currentRow)}
{currentRow?.course_id && (
<Row>
<Col span={14}>
@ -622,7 +627,6 @@ const CourseList: React.FC = () => {
formRef={createFormRef}
layout="horizontal"
layoutType="Form"
preserve={false}
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values: any) => {
@ -676,10 +680,11 @@ 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/:paperId',
path: '/dashboard/qualification/examAnswer/:examination_id/:rule_id/:examination_name/:time',
component: './dashboard/qualification/examAnswer',
hideInMenu: true,
},

@ -23,7 +23,6 @@ const CardList = () => {
const [currentLearning, SetCurrentLearning] = useState();
const [courseId, SetCourseId] = useState(ids[1]);
const [video, setVideo] = useState({});
const [videoInfo, setVideoInfo] = useState({});
const [nums,setNums]=useState(0);
let timer=useRef();
let video_second=0;
@ -63,7 +62,6 @@ const CardList = () => {
info.url= '/dsideal_yy/html/'+result.course.attachment_json.url;
info.img=result.course.attachment_json.img;
}
setVideoInfo(result)
}else {
console.log(2222)
@ -103,13 +101,11 @@ const CardList = () => {
play_second:info.time,//当前播放时间点(秒数)
subject_id:learning?.learning.subject_id,//主题id
video_second:video_second,//视频总长度
});
num=0;
})
}
/** 首次页面 当data 变化 执行run chapterCourse 变化 进行currentCourse赋值 */
useEffect(() => {
console.log(111111111)
if(data !== undefined && data !== null){
run({course_id:ids[1]});
SetCurrentLearning(learning)
@ -119,7 +115,6 @@ const CardList = () => {
/** run后 chapterCourse 变化 进行currentCourse赋值 */
useEffect(() => {
console.log(22222222222)
if(data !== undefined){
SetCurrentLearning(learning)
}
@ -130,7 +125,7 @@ const CardList = () => {
//const videoInfo = {url:'http://cctvalih5ca.v.myalicdn.com/live/cctv1_2/index.m3u8', img:''}
//const videoInfo = {url:'https://media.w3.org/2010/05/sintel/trailer_hd.mp4', img:''}
// const videoInfo = {url:'http://10.10.14.199/dsideal_yy/html/down/M3u8/2D/2D99BF1D-2F37-47FB-8A24-45112A236B8F.m3u8', img:''}//有视频
const videoInfo = {url:'http://10.10.14.199/dsideal_yy/html/down/M3u8/2D/2D99BF1D-2F37-47FB-8A24-45112A236B8F.m3u8', img:''}//有视频
// const videoInfo=learning?.course.attachment_json;isg
const nullData: Partial<CardListItemDataType> = {};
@ -205,37 +200,35 @@ const CardList = () => {
}
}}
onReady={(play: any) => {
//console.log('play====', play);
playerRef.current = play
// play.play();
play.on('loadedmetadata',function (event) {
playerRef?.current?.currentTime(videoInfo.learning.play_second);
})
play.on('play',function (event) {
console.log('播放-------------------------------')
num=0;
timer.current=setInterval(()=>{;
// console.log('timer-----------',timer)
num++
if (parseInt(play.currentTime())>0&&parseInt(play.currentTime()) % 15 === 0) { // 每15秒更新进度
saveProcess({time:play.currentTime(),num:15})
}
},1000)
})
play.on("timeupdate", function (event) {
//const _timeCurrent = Date.parse(new Date().toString()) / 1000; // 当前时间
//setTimeUpdateState(_timeCurrent); //timeUpdateState
if(play.currentTime()===this.duration()){
console.log('播放完了',num)
clearInterval(timer.current)
saveProcess({time:play.currentTime(),num:num})
}
;
// console.log('playcurrentTime--', play.currentTime())
console.log('playcurrentTime--', Math.floor(play.currentTime()))
// console.log('play-%-', parseInt(play.currentTime()) % 30)
if (parseInt(play.currentTime())>0&&parseInt(play.currentTime()) % 30 === 0) { // 每15秒更新进度
console.log(11111111111)
saveProcess({time:play.currentTime(),num:30})
}
//var currentTime = parseInt(this.currentTime()); //当前时间
video_second = this.duration(); //视频时常
// console.log('duration',duration)1.695401-1.9.
// console.log('duration',duration)
//var percent = (currentTime / duration * 100).toFixed(0) + "%";
//console.log('event',event);
//$("#current").text(this.currentTime());
@ -255,10 +248,10 @@ const CardList = () => {
{/*console.log('getData', data)*/}
{/*}}>videoRef get</a>*/}
<a onClick={()=>{
const data = playerRef?.current?.currentTime(25);
console.log('setData', data)
}}>videoRef set</a>
{/*<a onClick={()=>{*/}
{/*const data = videoRef?.current?.currentTime(300);*/}
{/*console.log('setData', data)*/}
{/*}}>videoRef set</a>*/}
</PageContainer>

@ -60,11 +60,10 @@ const formatSeconds = (value) => {
return result
}
const CardList = () => {
const params = useParams();
const formRef = useRef<ActionType>();
console.log('params0000000',params)
// 组卷详情查询
const [rulesPaperInfo, setRulesPaperInfo] = useState(params.paperId);
const [rulesPaperInfo, setRulesPaperInfo] = useState([]);
//规则
const [ruleId, setRuleId] = useState([]);
// 试题列表
@ -103,25 +102,25 @@ console.log('params0000000',params)
}, [])
// 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 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 personInfo = useRequest(() => {
return getExaminationPersonApplyInfo({
@ -161,160 +160,81 @@ console.log('params0000000',params)
}
});
const getQuestionList=useRequest(()=>{
return getPaperQuestionList({
paper_id:params.paperId
})
},{
// 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)
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
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: "" })
}
})
})
// 根据分类拆分试题 左侧答题卡 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]
// 根据答题卡生成考试顺序
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 || [])
setPaperInfo(questionInfo || [])
setQuestionNow(questionInfo[0] || [])
setQuestionTypeList(questionList || [])
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)
// }
// }
// });
setQuestioNum(questionInfo.length)
}
}
});

@ -40,7 +40,6 @@ const Qualification = () => {
});
const paperInfo = useRequest(() => {
return getPersonPaperId({
examination_id:params.examination_id,
person_id:cookie.load('person_id')
@ -103,7 +102,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}/${paperId}`)
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.rules_id}/${examinationInfo.examination_name}/${time}`)
}catch (error) {
if(error.response){

@ -155,6 +155,7 @@ 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://待报名
@ -189,7 +190,7 @@ const Workplace: FC = () => {
const time_diff=(endTime-startTime)/1000;
console.log('time_diff',time_diff)
getExamInfo(record.examination_id,time_diff,info.bean.paper_id)
getExamInfo(record.examination_id,time_diff)
}else {
getParperId(record.examination_id)
}
@ -218,13 +219,13 @@ const Workplace: FC = () => {
},
},
];
const getExamInfo=async (id,time,paper_id)=>{
const getExamInfo=async (id,time)=>{
try {
const info=await getExaminationById({examination_id:id});
console.log('info--------------------',info)
console.log('paper_idpaper_idpaper_id',paper_id)
console.log('time',time)
history.push(`/dashboard/qualification/examAnswer/${id}/${info.bean.rules_id}/${info.bean.examination_name}/${time}/${paper_id}`)
history.push(`/dashboard/qualification/examAnswer/${id}/${info.bean.rules_id}/${info.bean.examination_name}/${time}`)
}catch (error) {
if(error.response){
@ -242,9 +243,7 @@ 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) {

@ -209,18 +209,6 @@ export default () => {
{
label: '地理',
value: '地理',
},{
label: '政治',
value: '政治',
},{
label: '体育',
value: '体育',
},{
label: '音乐',
value: '音乐',
},{
label: '信息技术',
value: '信息技术',
},
]}
placeholder="请选择"

Loading…
Cancel
Save