master
zhengpengju 3 years ago
parent c20ae81309
commit 94c74db3c7

@ -73,6 +73,7 @@
"gg-editor": "^2.0.2",
"lodash": "^4.17.11",
"lodash-decorators": "^6.0.0",
"mediainfo.js": "^0.1.7",
"moment": "^2.25.3",
"numeral": "^2.0.6",
"nzh": "^1.0.3",
@ -83,6 +84,7 @@
"react-dom": "^17.0.0",
"react-fittext": "^1.0.0",
"react-helmet-async": "^1.0.4",
"react-mediainfo": "^0.0.42",
"react-quill": "^1.3.5",
"react-router": "^4.3.1",
"umi": "^3.5.20",

@ -2,6 +2,7 @@ import { DingdingOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm, Menu, Radio } from 'antd';
import { Fragment, useEffect, useRef, useState } from 'react';
import { GridContent } from '@ant-design/pro-layout';
import { getInfo } from 'react-mediainfo';
import { Line } from '@ant-design/charts';
import { DualAxes } from "@ant-design/charts";
import styles from './index.less';
@ -57,12 +58,12 @@ const formatSeconds= (value)=>{
// if (day > 0) {
// result = '' + parseInt(day) + '天' + result
// }
console.log('result', result)
//console.log('result', result)
return result
}
export default () => {
const uuid = uuidv4()
console.log('uuid', uuidv4());
//console.log('uuid', uuidv4());
const data = [
{
year: "1991",
@ -194,10 +195,11 @@ export default () => {
return queryCourseList();
});
useEffect(() => {
console.log('listData', listData)
//console.log('listData', listData)
/*
setInterval(() => {
setChartData(Math.random() > 0.5 ? [data, data] : [data2, data2]);
}, 1000);
}, 1000);*/
@ -205,7 +207,7 @@ export default () => {
const menuItems = [];
if(listData?.length > 0){
console.log('push');
//console.log('push');
listData.list.forEach((item: {code: number, name: string})=>{
menuItems.push(<Menu.Item key={item?.course_id}>{item?.course_name}</Menu.Item>)
})
@ -234,7 +236,7 @@ export default () => {
<Input value={123} ref={saveInputRef} />
<a onClick={()=>{
saveInputRef.current.focus({})
console.log('ref', saveInputRef.current)
//console.log('ref', saveInputRef.current)
}}></a>
<a onClick={()=>{handleModalVisible(true)}}></a>
<p>uuid: {uuidv4()}</p>
@ -256,6 +258,18 @@ export default () => {
<Upload
showUploadList={false}
action="/dsideal_yy/res/plupload/"
beforeUpload={async (file)=>{
const {media: {track:[General, Video, Audio]}} = await getInfo(file)
console.log('General:', General)
console.log('Video:', Video)
console.log('Video:', Video.format) // AVC
console.log('Audio:', Audio.format) // AAC
/*
console.log('info:', media)
console.log('track[0]:', media.track[0])
console.log('track[1]:', media.track[1])
console.log('track[2]:', media.track[2])*/
}}
data={
{
name: '4.jpg',
@ -305,10 +319,9 @@ export default () => {
<Popconfirm title="Are you sure" okText="Yes" cancelText="No">
<a href="#">Delete</a>
</Popconfirm>
{/*
<DualAxes {...config} />
*/}
<Radio.Group onChange={()=>{
}}>
<Radio value={1}>A</Radio>

@ -119,6 +119,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '考试时长',
width: 80,
dataIndex: 'examination_time',
valueType: 'text',
sorter: false,
@ -171,6 +172,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '试卷数量',
width: 80,
dataIndex: 'paper_count',
sorter: false,
valueType: 'text',
@ -181,6 +183,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '总分',
width: 50,
dataIndex: 'sum_score',
sorter: false,
valueType: 'text',
@ -190,6 +193,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '通过线',
width: 60,
dataIndex: 'pass_score',
sorter: false,
valueType: 'text',
@ -201,6 +205,7 @@ const ExaminationRules: React.FC = () => {
title: '操作',
dataIndex: 'option',
valueType: 'option',
width: 100,
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => {
console.log(record, 'record')
return [

@ -167,6 +167,7 @@ const ExaminationRules: React.FC = () => {
title: '操作',
dataIndex: 'option',
valueType: 'option',
width: 160,
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => {
return [
// <a

@ -3,17 +3,9 @@ import { history, useParams, useRequest } from 'umi';
import type { ProFormInstance } from '@ant-design/pro-form';
import { ModalForm } from '@ant-design/pro-form';
import { ProFormRadio } from '@ant-design/pro-form';
import ProForm, {
StepsForm,
ProFormText,
ProFormDatePicker,
ProFormSelect,
ProFormTextArea,
ProFormCheckbox,
ProFormDateRangePicker,
} from '@ant-design/pro-form';
import ProForm, {StepsForm, ProFormText, ProFormDatePicker, ProFormSelect, ProFormTextArea, ProFormCheckbox, ProFormDateRangePicker,} from '@ant-design/pro-form';
import ProCard from '@ant-design/pro-card';
import { Button, Checkbox, Col, Divider, Dropdown, Form, Input, List, Menu, message, Modal, Radio, Row, Space, Table, Typography, Upload } from 'antd';
import { Button, Checkbox, Col, Divider, Dropdown, Form, Input, List, Menu, message, Modal, Radio, Row, Space, Table, Typography, Upload, Empty } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import ProDescriptions from '@ant-design/pro-descriptions';
import styles from './index.less'
@ -221,7 +213,7 @@ export default () => {
}}
formProps={{
layout: "horizontal",
labelCol: { span: 8 },
labelCol: { span: 7 },
wrapperCol: { span: 12 },
validateMessages: {
required: '此项为必填项',
@ -266,7 +258,7 @@ export default () => {
<ProFormText
name="rules_name"
label="考试名称"
width="md"
width="lg"
initialValue={ruleData?.rules_name}
// tooltip="最长为 6 位汉字,需要与考生身份证一致"
placeholder="请输入名称"
@ -282,7 +274,7 @@ export default () => {
/>
<ProFormSelect
width="md"
width="lg"
initialValue={ruleData?.subject_id}
request={async () => {
return querySubjectList().then(({ data }) => {
@ -306,8 +298,23 @@ export default () => {
name="subject_id"
label="关联主题"
/>
<ProFormText addonAfter={`分钟`} name="examination_time" label="考试时长"
width="md"
<ProFormText
width="lg"
addonAfter={`分钟`}
name="examination_time"
label="考试时长"
fieldProps={{
type: 'number',
allowClear: false,
width: 'large',
onInput:(e)=>{
const val = `${e.currentTarget?.value}`;
if(val.length > 3) {
e.currentTarget.value = val.slice(0,3)
}
}
//style:{width: '100%'}
}}
initialValue={ruleData?.examination_time}
rules={[
{
@ -318,7 +325,7 @@ export default () => {
pattern: /^[^\s]*$/,
message: '禁止输入空格'
}]}
tooltip="单位(分钟)" />
/>
</>
)}
</Col>
@ -344,6 +351,7 @@ export default () => {
}}
>
<div style={{ margin: '0' }}>
<Typography style={{ padding: 24, fontSize: 24, textAlign: 'center' }}>{rulesName}</Typography>
{/** 一旦录入另一项将禁用,清空组卷后可选另一项 */}
<Radio.Group size='large' value={createType} onChange={(e) => {
@ -358,7 +366,7 @@ export default () => {
<Row>
<Col span={18} style={{ background: '#ffffff', padding: 0 }}>
<Empty style={{minHeight:360,padding:60,verticalAlign:'middle'}} />
<ProCard
title=""
extra={false}

@ -124,7 +124,7 @@ const QuestionBank = () => {
sorter: false,
hideInTable: true,
hideInForm: false,
hideInSearch: false,
hideInSearch: true,
fieldProps: {
mode: "multiple"
},
@ -136,7 +136,11 @@ const QuestionBank = () => {
},
]
},
renderText: (val: string) => `${val}`,
/*
renderFormItem:(item,{ type, defaultRender, formItemProps, fieldProps, ...rest },form)=>{
return defaultRender
},*/
//renderText: (val: string) => `${val}`,
request: async () => {
const { data: Items } = await queryTagList({});
console.log('queryTagList...')
@ -155,7 +159,7 @@ const QuestionBank = () => {
sorter: false,
hideInTable: false,
hideInForm: false,
hideInSearch: false,
hideInSearch: true,
fieldProps: {
//mode: "multiple"
},
@ -188,7 +192,7 @@ const QuestionBank = () => {
hideInTable: false,
hideInDescriptions: false,
hideInForm: false,
hideInSearch: false,
hideInSearch: true,
formItemProps: {
rules: [
{
@ -302,19 +306,7 @@ const QuestionBank = () => {
/>
),
},
{
title: '创建时间',
dataIndex: 'create_time',
valueType: 'text',
sorter: false,
hideInTable: true,
hideInForm: true,
hideInSearch: false,
// renderText: (val: string) => (<div dangerouslySetInnerHTML={{__html: val}} />),
renderFormItem: (item, { defaultRender, ...rest }, form) => (
<></>
),
},
]
@ -351,7 +343,9 @@ const QuestionBank = () => {
showSizeChanger: false,
showQuickJumper: true
}}
search={{}}
search={{
labelWidth: 120,
}}
toolBarRender={() => {
const menuItems = [];
console.log('toolBarRender', questionType);
@ -487,10 +481,14 @@ const QuestionBank = () => {
showExtra="always"
metas={{
title: {
title: '题干',
search: false,
dataIndex: 'question_stem',
render: (text: React.ReactNode, record: T, index: number) => (<><Text code style={{width:80, fontSize:10, color:'bfbfbf'}}>{record?.id}</Text> {text}</>),
},
avatar: {
title: '题型',
search: false,
dataIndex: 'question_type',
valueType: 'text',
render: (text: React.ReactNode, record: T, index: number) => {
@ -506,6 +504,7 @@ const QuestionBank = () => {
},
},
description: {
search: false,
dataIndex: 'answers',
valueType: 'checkbox',
render: (text: React.ReactNode, record: T, index: number) => {
@ -528,8 +527,11 @@ const QuestionBank = () => {
);
},
},
subTitle: { },
subTitle: {
search: false
},
content: {
search: false,
render: (text: React.ReactNode, record: T, index: number) => {
let answer = '';
const answertrue = record?.answertrue?.split(',');
@ -567,6 +569,7 @@ const QuestionBank = () => {
},
},
actions: {
search: false,
cardActionProps: 'extra',
render: (text: React.ReactNode, record: T, _index: number) => {
let eye
@ -638,6 +641,75 @@ const QuestionBank = () => {
)
}
},
/** 搜索定义 */
question_type:{
title: '题型',
valueType: 'select',
search: true,
dataIndex: 'question_type',
request: async () => {
const { list: Items } = await queryQuestionType();
console.log('queryQuestionType...', Items)
const types = []
for (let i = 0; i < Items.length; i++) {
types.push({ label: Items[i]?.name, value: Items[i]?.code })
}
console.log(types, 'types:::');
return types;
},
},
tags: {
title: '标签',
search: true,
valueType: 'select',
dataIndex: 'tag_ids',
fieldProps: {
mode: "multiple"
},
request: async () => {
const { data: Items } = await queryTagList({});
console.log('queryTagList...')
const tags = []
for (let i = 0; i < Items.length; i++) {
tags.push({ label: Items[i]?.tag_name, value: Items[i]?.tag_id })
}
console.log(tags, 'tags:::');
return tags;
},
},
course_id: {
title: '课程',
search: true,
valueType: 'select',
dataIndex: 'course_id',
fieldProps: {
//mode: "multiple"
},
dependencies: ['tag_ids'],
request: async (params) => {
const {tag_ids} = params;
const { data: Items } = await queryCourseListByTag({tag_ids: tag_ids?.toString()});
console.log('queryCourseListByTag...')
const courses = []
for (let i = 0; i < Items?.length; i++) {
courses.push({ label: Items[i]?.course_name, value: Items[i]?.course_id })
}
console.log(courses, 'courses:::');
return courses;
}
},
question_stem: {
title: '搜索', // 题干
search: true,
dataIndex: 'question_stem',
valueType: 'text',
},
create_time: {
title: '创建时间',
search: true,
dataIndex: 'create_time',
valueType: 'dateRange',
},
}}
/>
<Modal

Loading…
Cancel
Save