zhengpengju 3 years ago
parent 5b92f8a8c2
commit 39c2e09020

@ -266,7 +266,7 @@ const CourseList: React.FC = () => {
<Upload
accept='.mp4'
action='/dsideal_yy/res/plupload/'
defaultFileList={item.initialValue && console.log('item.initialValue',item.initialValue) ? [item.initialValue] : []}
defaultFileList={item.initialValue ? [item.initialValue.map(item=>({...item, url:'/dsideal_yy/html/' + item.url}))] : []}
beforeUpload={async (file) => {
/** 获取视频文件信息 */
const {media: {track:[General, Video, Audio]}} = await getInfo(file)

@ -13,14 +13,21 @@
// import { v4 as uuidv4 } from 'uuid';
// import { queryCourseList } from '../course/option/service';
import { useRequest } from "umi";
import { VideoJS } from "../course/option/components/VideoJS";
// import { useRequest } from 'umi';
export default () => {
console.log('start!')
/*
const { data } = useRequest(() => {
//return queryCurrent();
});*/
return<>
//down/Syzx/2c/2cff8e39-754d-4b85-90b0-74745f102f17.mp4
//http://10.10.24.121:8000/dsideal_yy/html/down/Syzx/2c/2cff8e39-754d-4b85-90b0-74745f102f17.mp4
{/*<video src="http://10.10.24.121:8000/dsideal_yy/html/down/Syzx/2c/2cff8e39-754d-4b85-90b0-74745f102f17.mp4" controls>no....</video>*/}
{/*
<VideoJS
height='100%'
style={{height:480}}
@ -42,5 +49,7 @@ return<>
],
}}
/>
*/}
</>
};

@ -628,6 +628,10 @@ export default () => {
onFinish={async () => {
const values = setterRef.current?.getData() // 获取题型分值数据
const passSocre = setterRef.current?.getValue() // 获取通过分数线
if(passSocre > sumCore){
message.error('通过分数线不能大于总分,请修改通过分数线');
return false;
}
console.log('批量设置分值v::::', values);
const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) })
console.log('paper', paper)

@ -19,6 +19,7 @@ import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { FooterToolbar } from '@ant-design/pro-layout';
import { constant } from 'lodash';
import { queryQuestionWithoutList } from '../service';
export type TableListItem = {
id: string;
@ -34,7 +35,7 @@ export type TableListItem = {
// React.forwardRef 接受渲染函数作为参数。React 将使用 props 和 ref 作为参数来调用此函数。此函数应返回 React 节点。
const QuestionSelector = (props: any, ref: any) => {
console.log('props', props)
const actionRef = useRef<ActionType>();
/** 列表项定义 */
const columns: ProColumns<TableListItem>[] | ProColumns<TableListItem>[] = [
@ -187,8 +188,10 @@ const QuestionSelector = (props: any, ref: any) => {
value.begin_time = create_time[0]
value.end_time = create_time[1]
}*/
const questions = await queryQuestionList({
const questions = await queryQuestionWithoutList({
...value,
rules_id: props?.data?.rules_id,
subject_id: props?.data?.subject_id,
type: type,
page_number: value?.current || 1,
page_size: value?.pageSize,

@ -75,20 +75,20 @@ const ScoreSetter = (props: any, ref: any) => {
render: (text, record, index) =>
<Space direction='horizontal'>
<span></span>
<Form.Item style={{margin:0}} name={`score[${index}]`}><Input
<Form.Item style={{margin:0}} name={`score[${index}]`}><Input
style={{width:100}}
min={0}
type="number"
onInput={(e)=>{
const val = `${e.currentTarget?.value}`;
e.currentTarget.value = val.replace(/[^\d]/,'0')
if(val.length > 2) {
e.currentTarget.value = val.slice(0,2)
e.currentTarget.value = val.replace(/[^\d,^\.]/,'0')
if(val.length > 3) {
e.currentTarget.value = val.slice(0,3)
}
}}
defaultValue={questionTypeValues ? questionTypeValues[index]?.score : 0}
placeholder="请输入"
size="small"
size="small"
onChange={(e)=>{
const value = e.currentTarget.value
console.log('row', index)

@ -30,18 +30,21 @@ import { forEach } from 'lodash';
*
* @param values
*/
const handleAppend = async (rules_id: number, rows: any[]) => {
const handleAppend = async (rules_id: number, rows: any[], paper_uuid: number) => {
const hide = message.loading('正在添加');
try {
const questions: { question_id: any; }[] = [];
rows?.forEach((key) => {
questions.push({ question_id: key })
})
const _data = await manualPaper({
const values = {
question_count: questions?.length || 0,
questions: JSON.stringify(questions),
rules_id: Number(rules_id)
});
}
const _data = await manualPaper(paper_uuid ? {...values, paper_uuid: paper_uuid} : values);
hide();
message.success('添加成功');
return _data;
@ -657,10 +660,11 @@ export default () => {
console.log('v::::', values.name);
const rows = selectorRef?.current?.getSelectedRowKeys()
console.log('rows::::', rows);
const { code, data: paper, msg } = await handleAppend(Number(params?.id || rulesId), rows)
const { code, data: paper, msg } = await handleAppend(Number(params?.id || rulesId), rows, uuidPaper)
console.log('paper', paper)
setUuidPaper(paper?.paper_uuid)
console.log('paper_uuid', paper?.paper_uuid)
/** 回显临时表 */
run({
paper_uuid: paper?.paper_uuid,
page_size: 1000,
@ -671,7 +675,7 @@ export default () => {
return true;
}}
>
{selectorModalVisible && <QuestionSelector ref={selectorRef} />}
{selectorModalVisible && <QuestionSelector data={{rules_id: Number(params?.id || rulesId), subject_id:subjectId, paper_uuid: uuidPaper}} ref={selectorRef} />}
</ModalForm>
<ModalForm
title={`系统组卷`}
@ -682,7 +686,7 @@ export default () => {
const values = autoRef?.current.getData()
console.log('data-v', values)
//const values = [{"question_type":0,"chapter_list": [{ "chapter_id":76, "count":1 },{ "chapter_id":77, "count":1 }]}]
const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(values)})
const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id || rulesId), auto_param: JSON.stringify(values)})
//console.log('paper', paper)
setUuidPaper(paper?.paper_uuid)
run({
@ -708,6 +712,10 @@ export default () => {
const values = setterRef.current?.getData() // 获取题型分值数据
const passSocre = setterRef.current?.getValue() // 获取通过分数线
const sumCore = setterRef.current?.getSum() // 获取总分
if(passSocre > sumCore){
message.error('通过分数线不能大于总分,请修改通过分数线');
return false;
}
console.log('批量设置分值v::::2', values);
// 题型分数
const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) })

Loading…
Cancel
Save