模拟答题

master
xialiang 3 years ago
parent 0446ac3d75
commit 6641a36622

@ -130,17 +130,30 @@ export default defineConfig({
path: '/mockExamination',
routes: [
{
name: '章节模拟练习',
name: '章节模拟练习-主题列表',
path: '/mockExamination/chapterExamination',
component: './mockExamination/chapterExamination',
},
{
name: '章节模拟练习-章节列表',
path: '/mockExamination/chapterList/:data_id/:data_type/:subject_id',
component: './mockExamination/chapterList',
hideInMenu: true,
},
{
name: '综合模拟考试',
icon: 'smile',
path: '/mockExamination/index',
component: './mockExamination/index',
},
{
name: '综合模拟考试答题',
icon: 'smile',
path: '/mockExamination/paper/:rules_id',
component: './mockExamination/paper',
hideInMenu: true,
},
]
},
{

@ -70,4 +70,27 @@ ol {
}
.ant-pro-global-header-logo a img{
filter: grayscale(100%) brightness(500%);
}
.pdefault{
margin: -1px;
border: #cccccc 1px solid;
border-radius: 5px;
color: #999999;
width: 40px;
height: 40px;
background-color: #ffffff;
text-align: center;
display:flex;
font-size: 18px;
justify-content: center;
align-items: center;
}
.pact{
border: #1895ff 1px solid;
color: #1895ff;
}
.pok{
border: aquamarine 1px solid;
color: aquamarine;
}

@ -1,9 +1,9 @@
import { AlignLeftOutlined, LaptopOutlined, NotificationOutlined, PlusOutlined, UserOutlined } from '@ant-design/icons';
import {useEffect, useState} from 'react';
import { useEffect, useState } from 'react';
import { Button, Card, Col, Layout, List, Menu, Progress, Row, Typography } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import {useParams, useRequest} from 'umi';
import { viewMyLearningSubject,listMyLearningChapterCourse } from './service';
import { useParams, useRequest } from 'umi';
import { viewMyLearningSubject, listMyLearningChapterCourse } from './service';
import type { CardListItemDataType } from './data.d';
import styles from './style.less';
import SubMenu from 'antd/lib/menu/SubMenu';
@ -29,7 +29,7 @@ import cookie from 'react-cookies';
const CardList = () => {
const params = useParams();
console.log('params',params);
console.log('params', params);
const ids = params.msg.split(',');
const [currentCourse, SetCurrentCourse] = useState()
@ -37,51 +37,51 @@ const CardList = () => {
/** 获取主题下课程 */
const { data } = useRequest(() => {
return viewMyLearningSubject({
identity_id:cookie.load('identity_id'),
person_id:cookie.load('person_id'),
data_id:ids[0],
data_type:ids[1],
subject_id:ids[2]
identity_id: cookie.load('identity_id'),
person_id: cookie.load('person_id'),
data_id: ids[0],
data_type: ids[1],
subject_id: ids[2]
});
});
const list = data?.list||[];
const subject_data=data?data.subject:[];
const last_data=data?data.last_learning_course:[];
const chapter_list=data?data.chapter_list:[];
const list = data?.list || [];
const subject_data = data ? data.subject : [];
const last_data = data ? data.last_learning_course : [];
const chapter_list = data ? data.chapter_list : [];
//console.log('currentCourse', currentCourse)
//console.log('currentCourse', currentCourse)
/** 获取课程详情 */
const {data: chapterCourse, run, loading } = useRequest((params:{subject_id:number, chapter_id:number}) => {
const { data: chapterCourse, run, loading } = useRequest((params: { subject_id: number, chapter_id: number }) => {
return listMyLearningChapterCourse({
identity_id:cookie.load('identity_id'),
person_id:cookie.load('person_id'),
subject_id: params?.subject_id,//chapter_list[0].subject_id
chapter_id: params?.chapter_id,//chapter_list[0].chapter_id
identity_id: cookie.load('identity_id'),
person_id: cookie.load('person_id'),
subject_id: params?.subject_id,//chapter_list[0].subject_id
chapter_id: params?.chapter_id,//chapter_list[0].chapter_id
});
});
/** 首次页面 当data 变化 执行run chapterCourse 变化 进行currentCourse赋值 */
/** 首次页面 当data 变化 执行run chapterCourse 变化 进行currentCourse赋值 */
useEffect(() => {
console.log('chapterCourse...', chapterCourse)
if(data !== undefined && data !== null){
run({subject_id:data?.chapter_list[0]?.subject_id, chapter_id:data?.chapter_list[0]?.chapter_id})
console.log('chapterCourse...', chapterCourse)
if (data !== undefined && data !== null) {
run({ subject_id: data?.chapter_list[0]?.subject_id, chapter_id: data?.chapter_list[0]?.chapter_id })
SetCurrentCourse(chapterCourse)
}
//setSelectedCourse({})
},[data]);
}, [data]);
/** run后 chapterCourse 变化 进行currentCourse赋值 */
/** run后 chapterCourse 变化 进行currentCourse赋值 */
useEffect(() => {
console.log('chapterCourse...', chapterCourse)
if(data !== undefined){
console.log('chapterCourse...', chapterCourse)
if (data !== undefined) {
console.log('data', data)
SetCurrentCourse(chapterCourse)
}
//setSelectedCourse({})
},[chapterCourse]);
}, [chapterCourse]);
// if(chapter_list.length!==0){
//
// // const msg = useRequest(() => {
@ -96,37 +96,37 @@ const CardList = () => {
// // console.log('msg',msg)
// }
// const msg = await listMyLearningChapterCourse({
// identity_id:cookie.load('identity_id'),
// person_id:cookie.load('person_id'),
// subject_id:chapter_list[0].subject_id,
// chapter_id:chapter_list[0].chapter_id,
// });
// console.log('msg======',msg)
// const msg = await listMyLearningChapterCourse({
// identity_id:cookie.load('identity_id'),
// person_id:cookie.load('person_id'),
// subject_id:chapter_list[0].subject_id,
// chapter_id:chapter_list[0].chapter_id,
// });
// console.log('msg======',msg)
const content = (
<div className={styles.pageHeaderContent}>
<Card
title={<a>{subject_data?subject_data.subject_name:'--'}</a>}
title={<a>{subject_data ? subject_data.subject_name : '--'}</a>}
hoverable={false}
className={styles.card}
actions={[]}
extra={<><span style={{padding:10}}>: {subject_data?subject_data.learning_start_time:'--'}</span><span style={{padding:10}}>{subject_data?subject_data.distance_end_time:'--'}</span><span style={{padding:10}}>{subject_data?subject_data.total_course_hours:'--'}</span></>}
extra={<><span style={{ padding: 10 }}>: {subject_data ? subject_data.learning_start_time : '--'}</span><span style={{ padding: 10 }}>{subject_data ? subject_data.distance_end_time : '--'}</span><span style={{ padding: 10 }}>{subject_data ? subject_data.total_course_hours : '--'}</span></>}
>
<Card.Meta
avatar={<img alt="" className={styles.cardAvatar} src={'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png'} style={{width:'270px', height:'150px', borderRadius:'10px'}} />}
avatar={<img alt="" className={styles.cardAvatar} src={'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png'} style={{ width: '270px', height: '150px', borderRadius: '10px' }} />}
title={false}
description={
<>
<Card.Grid hoverable={false} style={{width:'100%',padding:0, boxShadow:'none'}}>
<Paragraph className={styles.item} ellipsis={{ rows: 4 }} style={{paddingLeft:10}}>
{subject_data?subject_data.subject_describe:'--'}
<Card.Grid hoverable={false} style={{ width: '100%', padding: 0, boxShadow: 'none' }}>
<Paragraph className={styles.item} ellipsis={{ rows: 4 }} style={{ paddingLeft: 10 }}>
{subject_data ? subject_data.subject_describe : '--'}
</Paragraph>
<Row>
<Col span={16} style={{display:'inline-block', padding:10}}><span></span><span style={{display:'inline-block', width:'80%'}}><Progress percent={subject_data?subject_data.subject_learning_progress*100:0} /></span></Col>
<Col span={16} style={{ display: 'inline-block', padding: 10 }}><span></span><span style={{ display: 'inline-block', width: '80%' }}><Progress percent={subject_data ? subject_data.subject_learning_progress * 100 : 0} /></span></Col>
</Row>
<Row>
<Col span={10} style={{padding:10}}><span></span><span>{last_data?last_data.course_name:'--'}</span></Col> <Col span={10} style={{padding:10}}><span>{last_data?last_data.lecture_teacher:'--'}</span></Col> <Col span={4} style={{padding:10}}><Button type="primary">::</Button></Col>
<Col span={10} style={{ padding: 10 }}><span></span><span>{last_data ? last_data.course_name : '--'}</span></Col> <Col span={10} style={{ padding: 10 }}><span>{last_data ? last_data.lecture_teacher : '--'}</span></Col> <Col span={4} style={{ padding: 10 }}><Button type="primary">::</Button></Col>
</Row>
</Card.Grid>
</>
@ -137,32 +137,32 @@ const CardList = () => {
);
console.log('iddddddd',chapter_list.length!==0?chapter_list[0].chapter_id.toString():'')
console.log('iddddddd', chapter_list.length !== 0 ? chapter_list[0].chapter_id.toString() : '')
const nullData: Partial<CardListItemDataType> = {};
return (
<PageContainer content={content} extraContent={false}>
<Row>
<Col span={6} style={{paddingRight:24}}>
<Col span={6} style={{ paddingRight: 24 }}>
<Menu
mode="inline"
selectedKeys={[chapter_list.length!==0?chapter_list[0].chapter_id.toString():'']}
selectedKeys={[chapter_list.length !== 0 ? chapter_list[0].chapter_id.toString() : '']}
defaultOpenKeys={['sub1']}
style={{ height: '100%', width:'100%' }}
style={{ height: '100%', width: '100%' }}
>
<SubMenu key="sub1" icon={<AlignLeftOutlined />} title="章节目录">
{
chapter_list.length!==0?
chapter_list.map((item)=>{
return(
<Menu.Item
chapter_list.length !== 0 ?
chapter_list.map((item) => {
return (
<Menu.Item
key={item.chapter_id}
onClick={()=>{
run({subject_id:item.subject_id, chapter_id:item.chapter_id})
onClick={() => {
run({ subject_id: item.subject_id, chapter_id: item.chapter_id })
}}
>{item.chapter_name}</Menu.Item>
)
)
}):''
}) : ''
}
{/*<Menu.Item key="1">生涯规划理论</Menu.Item>*/}
{/*<Menu.Item key="2">生涯规划基本步骤</Menu.Item>*/}
@ -180,72 +180,72 @@ const CardList = () => {
</SubMenu>
</Menu>
</Col>
<Col span={18} style={{background:'#ffffff', padding:24}}>
<Col span={18} style={{ background: '#ffffff', padding: 24 }}>
{console.log('chapterCourse', chapterCourse)}
{
chapterCourse !== undefined ?
<>
<>{chapterCourse[0]?.course_name}</>
<>{chapterCourse[0]?.lecture_teacher}</>
</>
: <></>
}
{
chapterCourse !== undefined ?
<>
<>{chapterCourse[0]?.course_name}</>
<>{chapterCourse[0]?.lecture_teacher}</>
</>
: <></>
}
<List<Partial<CardListItemDataType>>
rowKey="id"
// loading={loading}
grid={{
gutter: 1,
xs: 1,
sm: 2,
md: 1,
lg: 1,
xl: 1,
xxl: 1,
}}
dataSource={[nullData, ...list]}
renderItem={(item) => {
if (item && item.id) {
return (
<List.Item key={item.id}>
<Card
hoverable={false}
className={styles.card}
actions={[]}
style={{background:'#f0f0f0'}}
>
<Card.Meta
avatar={false}
title={<a>{item.title}</a>}
description={
<Row>
<Col span={4} style={{padding:10}}>
1
</Col>
<Col span={8} style={{padding:10}}>
<Paragraph className={styles.item} ellipsis={{ rows: 3 }}>
{item.description}
</Paragraph>
</Col>
<Col span={4} style={{padding:10, textAlign:'center'}}>
23
</Col>
<Col span={4} style={{padding:10, textAlign:'center'}}>
<Progress percent={30} />
</Col>
<Col span={4} style={{padding:10, textAlign:'center'}}>
<Button type="primary"></Button>
</Col>
</Row>
}
/>
</Card>
</List.Item>
);
}
}}
/>
rowKey="id"
// loading={loading}
grid={{
gutter: 1,
xs: 1,
sm: 2,
md: 1,
lg: 1,
xl: 1,
xxl: 1,
}}
dataSource={[nullData, ...list]}
renderItem={(item) => {
if (item && item.id) {
return (
<List.Item key={item.id}>
<Card
hoverable={false}
className={styles.card}
actions={[]}
style={{ background: '#f0f0f0' }}
>
<Card.Meta
avatar={false}
title={<a>{item.title}</a>}
description={
<Row>
<Col span={4} style={{ padding: 10 }}>
1
</Col>
<Col span={8} style={{ padding: 10 }}>
<Paragraph className={styles.item} ellipsis={{ rows: 3 }}>
{item.description}
</Paragraph>
</Col>
<Col span={4} style={{ padding: 10, textAlign: 'center' }}>
23
</Col>
<Col span={4} style={{ padding: 10, textAlign: 'center' }}>
<Progress percent={30} />
</Col>
<Col span={4} style={{ padding: 10, textAlign: 'center' }}>
<Button type="primary"></Button>
</Col>
</Row>
}
/>
</Card>
</List.Item>
);
}
}}
/>
</Col>
</Row>

@ -2,7 +2,7 @@
import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { useRequest } from 'umi';
import { useParams, useRequest } from 'umi';
import { queryFakeList } from '../service';
import type { CardListItemDataType } from '../data';
import styles from './style.less';
@ -12,9 +12,10 @@ import ProCard from '@ant-design/pro-card';
const { Paragraph } = Typography;
const CardList = () => {
const params = useParams();
const { data, loading } = useRequest(() => {
return queryFakeList({
count: 8,
count: params.rules_id,
});
});
@ -31,17 +32,17 @@ const CardList = () => {
const numbers = [];
for(let i=0;i<50;i++){
numbers.push({id: `${i}`})
for (let i = 0; i < 50; i++) {
numbers.push({ id: `${i}` })
}
return (
<PageContainer content={content} extraContent={false}>
<Row>
<Col span={6} style={{paddingRight:24}}>
<Col span={6} style={{ paddingRight: 24 }}>
<ProCard
title="题号列表"
bordered
headStyle={{padding:24, border: '#d9d9d9 solid 1px'}}
headStyle={{ padding: 24, border: '#d9d9d9 solid 1px' }}
>
<List
header={<div>. </div>}
@ -53,7 +54,7 @@ const CardList = () => {
<Typography.Text mark={item.id === '3' ? false : true}><span className="number">{item.id}</span></Typography.Text>
</List.Item>
)}
style={{background:'#ffffff', margin:'-25px -24px 0 -24px'}}
style={{ background: '#ffffff', margin: '-25px -24px 0 -24px' }}
/>
<List
header={<div>. </div>}
@ -65,7 +66,7 @@ const CardList = () => {
<Typography.Text mark={item.id === '3' ? false : true}><span className="number">{item.id}</span></Typography.Text>
</List.Item>
)}
style={{background:'#ffffff', margin:'-1px -24px'}}
style={{ background: '#ffffff', margin: '-1px -24px' }}
/>
<List
header={<div>. </div>}
@ -77,11 +78,11 @@ const CardList = () => {
<Typography.Text mark={item.id === '3' ? false : true}><span className="number">{item.id}</span></Typography.Text>
</List.Item>
)}
style={{background:'#ffffff', margin:'-1px -24px -24px -24px'}}
style={{ background: '#ffffff', margin: '-1px -24px -24px -24px' }}
/>
</ProCard>
</Col>
<Col span={13} style={{background:'#ffffff', padding:0}}>
<Col span={13} style={{ background: '#ffffff', padding: 0 }}>
<ProCard
title="一. 单选题 共50分每题1分"
extra={false}
@ -89,58 +90,58 @@ const CardList = () => {
bordered
headerBordered
>
<Space direction="vertical" style={{width:'100%', padding: '24px 48px'}}>
<Space direction="vertical" style={{ width: '100%', padding: '24px 48px' }}>
<Typography style={{marginBottom:16, fontSize:18}}>
<Typography style={{ marginBottom: 16, fontSize: 18 }}>
4.
</Typography>
<Radio.Group onChange={()=>{return true}} value={0} size="large">
<Space direction="vertical" style={{fontSize:16}}>
<Radio value={1} style={{padding:5, fontSize:16}}>A. 退</Radio>
<Radio value={2} style={{padding:5, fontSize:16}}>B. </Radio>
<Radio value={3} style={{padding:5, fontSize:16}}>C. </Radio>
<Radio value={4} style={{padding:5, fontSize:16}}>D. </Radio>
<Radio.Group onChange={() => { return true }} value={0} size="large">
<Space direction="vertical" style={{ fontSize: 16 }}>
<Radio value={1} style={{ padding: 5, fontSize: 16 }}>A. 退</Radio>
<Radio value={2} style={{ padding: 5, fontSize: 16 }}>B. </Radio>
<Radio value={3} style={{ padding: 5, fontSize: 16 }}>C. </Radio>
<Radio value={4} style={{ padding: 5, fontSize: 16 }}>D. </Radio>
</Space>
</Radio.Group>
<Typography style={{marginBottom:16, fontSize:18}}>
<Typography style={{ marginBottom: 16, fontSize: 18 }}>
5. ()
</Typography>
<Checkbox.Group onChange={()=>{return true}}>
<Checkbox.Group onChange={() => { return true }}>
<Space direction="vertical" style={{}}>
<Checkbox value={1} style={{padding:5, fontSize:16}}>A. 退</Checkbox>
<Checkbox value={2} style={{padding:5, fontSize:16}}>B. </Checkbox>
<Checkbox value={3} style={{padding:5, fontSize:16}}>C. </Checkbox>
<Checkbox value={4} style={{padding:5, fontSize:16}}>D. </Checkbox>
<Checkbox value={1} style={{ padding: 5, fontSize: 16 }}>A. 退</Checkbox>
<Checkbox value={2} style={{ padding: 5, fontSize: 16 }}>B. </Checkbox>
<Checkbox value={3} style={{ padding: 5, fontSize: 16 }}>C. </Checkbox>
<Checkbox value={4} style={{ padding: 5, fontSize: 16 }}>D. </Checkbox>
</Space>
</Checkbox.Group>
<Typography style={{marginBottom:16, fontSize:18}}>
<Typography style={{ marginBottom: 16, fontSize: 18 }}>
6. 退
</Typography>
<Radio.Group onChange={()=>{return true}} value={0} size="large">
<Space direction="vertical" style={{fontSize:16}}>
<Radio value={1} style={{padding:5, fontSize:16}}></Radio>
<Radio value={2} style={{padding:5, fontSize:16}}></Radio>
<Radio.Group onChange={() => { return true }} value={0} size="large">
<Space direction="vertical" style={{ fontSize: 16 }}>
<Radio value={1} style={{ padding: 5, fontSize: 16 }}></Radio>
<Radio value={2} style={{ padding: 5, fontSize: 16 }}></Radio>
</Space>
</Radio.Group>
</Space>
</ProCard>
</Col>
<Col span={5} style={{paddingLeft:24}}>
<div style={{background:'#ffffff', padding:24}}>
<Space direction="vertical" style={{width:'100%'}}>
<Col span={5} style={{ paddingLeft: 24 }}>
<div style={{ background: '#ffffff', padding: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
<strong></strong>
<Typography>614</Typography>
<Divider style={{margin:'6px 0', opacity: 0.5}}/>
<Divider style={{ margin: '6px 0', opacity: 0.5 }} />
<strong></strong>
<Typography>14/80</Typography>
<Divider style={{margin:'6px 0', opacity: 0.5}}/>
<Divider style={{ margin: '6px 0', opacity: 0.5 }} />
<Button size="large" block></Button>
<Button size="large" block></Button>
<Button size="large" type="primary" block></Button>
</Space>
</div>
</div>
</Col>
</Row>
</PageContainer>

@ -1,7 +1,7 @@
import { PlusOutlined } from '@ant-design/icons';
import { Button, Card, List, Progress, Typography, Image } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { useRequest } from 'umi';
import { useRequest, history } from 'umi';
import { listMyLearningSubject } from './service';
import styles from './style.less';
@ -44,7 +44,7 @@ const SubjectList = () => {
hoverable
className={styles.card}
actions={[]}
extra={<><span style={{ padding: 10 }}>: ---</span><span style={{ padding: 10 }}>---</span><span style={{ padding: 10 }}>{item?.total_course_hours}</span></>}
extra={<><span style={{ padding: 10 }}>:{item?.learning_start_time}</span><span style={{ padding: 10 }}>{item?.distance_end_time}</span><span style={{ padding: 10 }}>{item?.total_course_hours}</span></>}
>
<Card.Meta
avatar={<Image preview={false} width={200} height={150} src={`${item.attachment_json.url}`} fallback="../fallback.svg" />}
@ -56,8 +56,13 @@ const SubjectList = () => {
{item.subject_describe}
</Paragraph>
</Card.Grid>
<Card.Grid hoverable={false} style={{ width: '30%', textAlign: 'center' }}><Progress type="circle" percent={75} /></Card.Grid>
<Card.Grid hoverable={false} style={{ width: '20%', textAlign: 'center' }}><Button type="primary"></Button></Card.Grid>
<Card.Grid hoverable={false} style={{ width: '30%', textAlign: 'center' }}><Progress type="circle" percent={item?.subject_learning_progress * 100} /></Card.Grid>
<Card.Grid hoverable={false} style={{ width: '20%', textAlign: 'center' }}>
<Button type="primary" onClick={() => {
const info = item.data_id + ',' + item.data_type + ',' + item.subject_id;
history.push(`/mockExamination/chapterList/${item.data_id}/${item.data_type}/${item.subject_id}`);
}}></Button>
</Card.Grid>
</>
}
/>

@ -0,0 +1,224 @@
import { AlignLeftOutlined, LaptopOutlined, NotificationOutlined, PlusOutlined, UserOutlined } from '@ant-design/icons';
import { useEffect, useState } from 'react';
import { Button, Card, Col, Layout, List, Menu, Progress, Row, Typography } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { useParams, useRequest } from 'umi';
import { viewMyLearningSubject, listMyLearningChapterCourse } from './service';
import type { CardListItemDataType } from './data.d';
import styles from './style.less';
import SubMenu from 'antd/lib/menu/SubMenu';
console.log('course/list')
const { Paragraph } = Typography;
import cookie from 'react-cookies';
// const getList = async (subject_id,chapter_id ) => {
// // const hide = message.loading('正在配置');
// try {
// const a=await listMyLearningChapterCourse({
// identity_id:cookie.load('identity_id'),
// person_id:cookie.load('person_id'),
// subject_id:subject_id,
// chapter_id:chapter_id,
// });
// // message.success('配置成功');
// return a;
// } catch (error) {
// // message.error('配置失败请重试!');
// return false;
// }
// };
const CardList = () => {
const params = useParams();
console.log('params', params);
// const ids = params.msg.split(',');
const [currentCourse, SetCurrentCourse] = useState()
/** 获取主题下课程 */
const { data } = useRequest(() => {
return viewMyLearningSubject({
identity_id: cookie.load('identity_id'),
person_id: cookie.load('person_id'),
data_id: params.data_id,
data_type: params.data_type,
subject_id: params.subject_id
});
});
const list = data?.list || [];
const subject_data = data ? data.subject : [];
const last_data = data ? data.last_learning_course : [];
const chapter_list = data ? data.chapter_list : [];
//console.log('currentCourse', currentCourse)
/** 获取课程详情 */
const { data: chapterCourse, run, loading } = useRequest((params: { subject_id: number, chapter_id: number }) => {
return listMyLearningChapterCourse({
identity_id: cookie.load('identity_id'),
person_id: cookie.load('person_id'),
subject_id: params?.subject_id,//chapter_list[0].subject_id
chapter_id: params?.chapter_id,//chapter_list[0].chapter_id
});
});
/** 首次页面 当data 变化 执行run chapterCourse 变化 进行currentCourse赋值 */
useEffect(() => {
console.log('chapterCourse...', chapterCourse)
if (data !== undefined && data !== null) {
run({ subject_id: data?.chapter_list[0]?.subject_id, chapter_id: data?.chapter_list[0]?.chapter_id })
SetCurrentCourse(chapterCourse)
}
}, [data]);
/** run后 chapterCourse 变化 进行currentCourse赋值 */
useEffect(() => {
console.log('chapterCourse...', chapterCourse)
if (data !== undefined) {
console.log('data', data)
SetCurrentCourse(chapterCourse)
}
}, [chapterCourse]);
const content = (
<div className={styles.pageHeaderContent}>
<Card
title={<a>{subject_data ? subject_data.subject_name : '--'}</a>}
hoverable={false}
className={styles.card}
actions={[]}
extra={<><span style={{ padding: 10 }}>: {subject_data ? subject_data.learning_start_time : '--'}</span><span style={{ padding: 10 }}>{subject_data ? subject_data.distance_end_time : '--'}</span><span style={{ padding: 10 }}>{subject_data ? subject_data.total_course_hours : '--'}</span></>}
>
<Card.Meta
avatar={<img alt="" className={styles.cardAvatar} src={'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png'} style={{ width: '270px', height: '150px', borderRadius: '10px' }} />}
title={false}
description={
<>
<Card.Grid hoverable={false} style={{ width: '100%', padding: 0, boxShadow: 'none' }}>
<Paragraph className={styles.item} ellipsis={{ rows: 4 }} style={{ paddingLeft: 10 }}>
{subject_data ? subject_data.subject_describe : '--'}
</Paragraph>
<Row>
<Col span={16} style={{ display: 'inline-block', padding: 10 }}><span></span><span style={{ display: 'inline-block', width: '80%' }}><Progress percent={subject_data ? subject_data.subject_learning_progress * 100 : 0} /></span></Col>
</Row>
<Row>
<Col span={10} style={{ padding: 10 }}><span></span><span>{last_data ? last_data.course_name : '--'}</span></Col> <Col span={10} style={{ padding: 10 }}><span>{last_data ? last_data.lecture_teacher : '--'}</span></Col> <Col span={4} style={{ padding: 10 }}><Button type="primary">::</Button></Col>
</Row>
</Card.Grid>
</>
}
/>
</Card>
</div>
);
console.log('iddddddd', chapter_list.length !== 0 ? chapter_list[0].chapter_id.toString() : '')
const nullData: Partial<CardListItemDataType> = {};
return (
<PageContainer content={content} extraContent={false}>
<Row>
<Col span={6} style={{ paddingRight: 24 }}>
<Menu
mode="inline"
selectedKeys={[chapter_list.length !== 0 ? chapter_list[0].chapter_id.toString() : '']}
defaultOpenKeys={['sub1']}
style={{ height: '100%', width: '100%' }}
>
<SubMenu key="sub1" icon={<AlignLeftOutlined />} title="章节目录">
{
chapter_list.length !== 0 ?
chapter_list.map((item) => {
return (
<Menu.Item
key={item.chapter_id}
onClick={() => {
run({ subject_id: item.subject_id, chapter_id: item.chapter_id })
}}
>{item.chapter_name}</Menu.Item>
)
}) : ''
}
</SubMenu>
</Menu>
</Col>
<Col span={18} style={{ background: '#ffffff', padding: 24 }}>
{console.log('chapterCourse', chapterCourse)}
{
chapterCourse !== undefined ?
<>
<>{chapterCourse[0]?.course_name}</>
<>{chapterCourse[0]?.lecture_teacher}</>
</>
: <></>
}
<List<Partial<CardListItemDataType>>
rowKey="id"
// loading={loading}
grid={{
gutter: 1,
xs: 1,
sm: 2,
md: 1,
lg: 1,
xl: 1,
xxl: 1,
}}
dataSource={[nullData, ...chapterCourse]}
renderItem={(item) => {
if (item && item.id) {
return (
<List.Item key={item.id}>
<Card
hoverable={false}
className={styles.card}
actions={[]}
style={{ background: '#f0f0f0' }}
>
<Card.Meta
avatar={false}
title={<a>{item.title}</a>}
description={
<Row>
<Col span={4} style={{ padding: 10 }}>
1
</Col>
<Col span={8} style={{ padding: 10 }}>
<Paragraph className={styles.item} ellipsis={{ rows: 3 }}>
{item.description}
</Paragraph>
</Col>
<Col span={4} style={{ padding: 10, textAlign: 'center' }}>
23
</Col>
<Col span={4} style={{ padding: 10, textAlign: 'center' }}>
<Progress percent={30} />
</Col>
<Col span={4} style={{ padding: 10, textAlign: 'center' }}>
<Button type="primary"></Button>
</Col>
</Row>
}
/>
</Card>
</List.Item>
);
}
}}
/>
</Col>
</Row>
</PageContainer>
);
};
export default CardList;

@ -1,71 +1,92 @@
import { PlusOutlined } from '@ant-design/icons';
import { Button, Card, List, Progress, Typography, Image } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { useRequest } from 'umi';
import { listMyLearningSubject } from './service';
import { history } from 'umi';
import { getRulesList } from './service';
import React, { useRef } from 'react';
import styles from './style.less';
import NumberInfo from './components/NumberInfo';
import cookie from 'react-cookies';
const { Paragraph } = Typography;
import ProTable from '@ant-design/pro-table';
const columns: ProColumns<GithubIssueItem>[] = [
{
dataIndex: 'index',
valueType: 'indexBorder',
width: 48,
},
{
title: '标题',
dataIndex: 'rules_name',
},
{
title: '考试时间',
key: 'examination_time',
dataIndex: 'examination_time',
valueType: 'text',
},
{
title: '总分',
key: 'sum_score',
dataIndex: 'sum_score',
valueType: 'text',
},
{
title: '及格',
key: 'pass_score',
dataIndex: 'pass_score',
valueType: 'text',
},
{
title: '操作',
valueType: 'option',
render: (text, record, _, action) => [
<a
key="editable"
onClick={() => {
history.push(`/mockExamination/paper/${record.id}`);
}}
>
</a>,
],
},
];
const SubjectList = () => {
/** 获取主题列表数据 */
const { loading: subjectListLoading, data: subjectList = [] } = useRequest(
() => listMyLearningSubject(
{
identity_id: cookie.load('identity_id'),
person_id: cookie.load('person_id')
}));
console.log(subjectList);
const actionRef = useRef<ActionType>();
return (
<PageContainer content={false} extraContent={false}>
<div className={styles.cardList}>
<List
rowKey="id"
loading={subjectListLoading}
grid={{
gutter: 16,
xs: 1,
sm: 1,
md: 1,
lg: 1,
xl: 1,
xxl: 1,
<ProTable<GithubIssueItem>
columns={columns}
actionRef={actionRef}
request={async (value) => {
const RulesData = await getRulesList({
...value,
b_use: 1,
rules_type: 0
})
console.log(RulesData.table_List)
return { data: RulesData.table_List }
}}
editable={{
type: 'multiple',
}}
dataSource={subjectList}
renderItem={(item: SubjectListItemDataType) => {
if (item && item.subject_id) {
return (
<List.Item key={item?.subject_id}>
<Card
title={<a>{item?.subject_name}</a>}
hoverable
className={styles.card}
actions={[]}
extra={<><span style={{ padding: 10 }}>: ---</span><span style={{ padding: 10 }}>---</span><span style={{ padding: 10 }}>{item?.total_course_hours}</span></>}
>
<Card.Meta
avatar={<Image preview={false} width={200} height={150} src={`${item.attachment_json.url}`} fallback="../fallback.svg" />}
title={false}
description={
<>
<Card.Grid hoverable={false} style={{ width: '50%', padding: 0 }}>
<Paragraph className={styles.item} ellipsis={{ rows: 4 }}>
{item.subject_describe}
</Paragraph>
</Card.Grid>
<Card.Grid hoverable={false} style={{ width: '30%', textAlign: 'center' }}><Progress type="circle" percent={75} /></Card.Grid>
<Card.Grid hoverable={false} style={{ width: '20%', textAlign: 'center' }}><Button type="primary"></Button></Card.Grid>
</>
}
/>
</Card>
</List.Item>
);
}
columnsState={{
persistenceKey: 'pro-table-singe-demos',
persistenceType: 'localStorage',
}}
search={false}
rowKey="id"
toolBarRender={false}
pagination={{
pageSize: 10,
}}
dateFormatter="string"
headerTitle="高级表格"
/>
</div>
</PageContainer>

@ -0,0 +1,29 @@
export type Member = {
avatar: string;
name: string;
id: string;
};
export type CardListItemDataType = {
id: string;
owner: string;
title: string;
avatar: string;
cover: string;
status: 'normal' | 'exception' | 'active' | 'success';
percent: number;
logo: string;
href: string;
body?: any;
updatedAt: number;
createdAt: number;
subDescription: string;
description: string;
activeUser: number;
newUser: number;
star: number;
like: number;
message: number;
content: string;
members: Member[];
};

@ -0,0 +1,290 @@
/** 资质考试 */
import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { useParams, useRequest } from 'umi';
import { useState } from 'react';
const { Text, Link } = Typography;
import { getRulesPaper, getPaperQuestionList } from '../service';
import type { CardListItemDataType } from '../data';
import styles from './style.less';
import SubMenu from 'antd/lib/menu/SubMenu';
import ProCard from '@ant-design/pro-card';
const { Paragraph } = Typography;
const CardList = () => {
// 组卷详情查询
const [rulesPaperInfo, setRulesPaperInfo] = useState([]);
// 试题列表
const [paperInfo, setPaperInfo] = useState([]);
//答题卡列表
const [questionTypeList, setQuestionTypeList] = useState([])
// 当前答题id
const [questionNow, setQuestionNow] = useState([])
const [parsingShow, setParsingShow] = useState(false)
const params = useParams();
const { loading, data } = useRequest(() => {
return getRulesPaper({
rules_id: params.rules_id
});
},
{
formatResult: (result) => {
return result;
},
onSuccess: (result) => {
if (result.success) {
setRulesPaperInfo(result.question_list || [])
console.log(result, 'result1')
run({ paper_id: result.question_list[0].paper_id, question_type_count: result.question_list[0].question_type_count })
// setQuestionTypeList(result.question_list[0].question_type_count)
}
}
});
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 qList = params[0].question_type_count
const questionList = []
qList.map((e, i) => {
if (e.count > 0) {
questionList.push({
children: [],
...e
})
}
})
// 根据分类拆分试题 左侧答题卡
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: "" })
}
})
})
// 根据答题卡生成考试顺序
const questionInfo = []
for (let i = 0; i < questionList.length; i++) {
console.log(questionList[i], 'iiii')
questionList[i].children.map((e, index) => {
console.log(e, "num");
questionInfo.push({ ...e, index: index })
})
}
setPaperInfo(questionInfo || [])
setQuestionNow(questionInfo[0] || [])
setQuestionTypeList(questionList || [])
}
}
});
const content = (
<div className={styles.pageHeaderContent}>
<p>
{rulesPaperInfo[0]?.rules_name}
</p>
</div>
);
// console.log(rulesPaperInfo, 'rulesPaperInfo', questionList)
const numbers = [];
for (let i = 0; i < 50; i++) {
numbers.push({ id: `${i}` })
}
const tiNum = (a: number) => {
switch (a) {
case 0:
return "A"
break;
case 1:
return "B"
break;
case 2:
return "C"
break;
case 3:
return "D"
break;
case 4:
return "E"
break;
case 5:
return "F"
break;
case 6:
return "G"
break;
case 7:
return "H"
break;
case 8:
return "I"
break;
case 9:
return "J"
break;
default:
return ""
break;
}
}
return (
<PageContainer content={content} extraContent={false}>
<Row>
<Col span={6} style={{ paddingRight: 24 }}>
<ProCard
title="题号列表"
bordered
headStyle={{ padding: 24, border: '#d9d9d9 solid 1px' }}
>
{console.log("当前题号:", questionNow, "试题顺序:", paperInfo)}
{
questionTypeList && (
questionTypeList.map((e, i) => {
console.log(e.children, 'e.children')
return <List
key={i}
header={e.type_name}
footer={false}
bordered
dataSource={e.children}
renderItem={(item, index) => {
console.log(item, 'list')
return <List.Item
id={item.id}
> <Button
className={
`pdefault ${questionNow.id === item.id ? "pact" : ""} ${item.answertrue === item.answerSelect ? "pok" : ""}`
}
onClick={() => {
setParsingShow(false)
setQuestionNow(item)
}}
>{index}</Button> </List.Item>
}}
style={{ background: '#ffffff', margin: '-25px -24px 24px -24px' }}
/>
}
)
)}
<List
header={<div>. </div>}
footer={false}
bordered
dataSource={numbers}
renderItem={item => (
<List.Item>
<Typography.Text mark={item.id === '3' ? false : true}><span className="number">{item.id}</span></Typography.Text>
</List.Item>
)}
style={{ background: '#ffffff', margin: '-1px -24px' }}
/>
</ProCard>
</Col>
<Col span={13} style={{ background: '#ffffff', padding: 0 }}>
<ProCard
title={
questionNow.question_type === 0 ? "一、单选器" : questionNow.question_type === 1 ? "二、多选题" : questionNow.question_type === 2 ? "判断题" : ""
}
extra={false}
split='vertical'
bordered
headerBordered
>
<Space direction="vertical" style={{ width: '100%', padding: '24px 48px' }}>
<Typography style={{ marginBottom: 16, fontSize: 18 }}>
{questionNow?.question_stem}
</Typography>
<Radio.Group onChange={() => { return true }} value={0} size="large">
<Space direction="vertical" style={{ fontSize: 16 }}>
{questionNow.question_type === 0 ?
(<Radio.Group><Space direction="vertical">{questionNow?.answers?.map((item, index) => {
return <Radio key={item.id} onChange={() => {
const qArr = []
questionNow?.answers?.map(() => {
qArr.push("0")
})
qArr[index] = item.is_true
const questionAnswer = qArr.join(",")
const paperInfoTemp = paperInfo
paperInfoTemp[questionNow.index].answerSelect = questionAnswer
setPaperInfo(paperInfoTemp || [])
console.log('0', paperInfoTemp, questionNow.index)
}} value={item.id} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Radio>
})}</Space></Radio.Group>) : questionNow.question_type === 1 ? questionNow?.answers?.map((item, index) => {
return <Checkbox key={item.id} value={1} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Checkbox>
}) : questionNow.question_type === 2 ? questionNow?.answers?.map((item, index) => {
return <Radio key={item.id} value={1} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Radio>
}) : ""}
</Space>
</Radio.Group>
<Radio.Group onChange={() => { return true }} value={0} size="large">
<Space direction="vertical" style={{ fontSize: 16 }}>
<Button type="primary" onClick={() => {
setParsingShow(!parsingShow)
}}></Button>
<div style={{ display: (parsingShow ? 'block' : 'none') }} dangerouslySetInnerHTML={{ __html: questionNow.parsing }} />
</Space>
</Radio.Group>
</Space>
</ProCard>
</Col>
<Col span={5} style={{ paddingLeft: 24 }}>
<div style={{ background: '#ffffff', padding: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
<strong></strong>
<Typography>614</Typography>
<Divider style={{ margin: '6px 0', opacity: 0.5 }} />
<strong></strong>
<Typography>14/80</Typography>
<Divider style={{ margin: '6px 0', opacity: 0.5 }} />
<Button size="large" block></Button>
<Button size="large" block></Button>
<Button size="large" type="primary" block></Button>
</Space>
</div>
</Col>
</Row >
</PageContainer >
);
};
export default CardList;

@ -0,0 +1,10 @@
import { request } from 'umi';
import type { CardListItemDataType } from './data.d';
export async function queryFakeList(params: {
count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/api/card_fake_list', {
params,
});
}

@ -0,0 +1,153 @@
@import '~antd/es/style/themes/default.less';
@import './utils/utils.less';
.cardList {
.card {
:global {
.ant-card-meta-title {
margin-bottom: 12px;
& > a {
display: inline-block;
max-width: 100%;
color: @heading-color;
}
}
.ant-card-body:hover {
.ant-card-meta-title > a {
color: @primary-color;
}
}
}
}
.item {
height: 64px;
}
}
:global {
.ant-list .ant-list-item-content-single {
max-width: 100%;
}
.ant-list-items{
display: block;
padding: 10px;
}
.ant-list-bordered .ant-list-item{
display: inline-block;
width: 50px;
height: 50px;
padding: 5px;
margin: 0;
.ant-typography:hover{
cursor: pointer;
}
.ant-typography{
color:#999999;
border: #CCCCCC 1px solid;
border-radius: 5px;
font-weight: bolder;
background-color: #f0f0f0;
display: inline-block;
width: 100%;
height: 100%;
font-size: 18px;
text-align: center;
vertical-align: middle;
span{
text-align: center;
display: block;
font-size: 18px;
line-height: 18px;
padding: 8px 8px;
}
mark{
margin: -1px;
border: #1890ff 1px solid;
border-radius: 5px;
color: #1890ff;
display: block;
width: 40px;
height: 40px;
background-color: #e6f7ff;
}
}
}
}
.extraImg {
width: 155px;
margin-top: -20px;
text-align: center;
img {
width: 100%;
}
}
.newButton {
width: 100%;
height: 201px;
color: @text-color-secondary;
background-color: @component-background;
border-color: @border-color-base;
}
.cardAvatar {
width: 48px;
height: 48px;
border-radius: 48px;
}
.cardDescription {
.textOverflowMulti();
}
.pageHeaderContent {
position: relative;
}
.contentLink {
margin-top: 16px;
a {
margin-right: 32px;
img {
width: 24px;
}
}
img {
margin-right: 8px;
vertical-align: middle;
}
}
@media screen and (max-width: @screen-lg) {
.contentLink {
a {
margin-right: 16px;
}
}
}
@media screen and (max-width: @screen-md) {
.extraImg {
display: none;
}
}
@media screen and (max-width: @screen-sm) {
.pageHeaderContent {
padding-bottom: 30px;
}
.contentLink {
position: absolute;
bottom: -4px;
left: 0;
width: 1000px;
a {
margin-right: 16px;
}
img {
margin-right: 4px;
}
}
}

@ -0,0 +1,50 @@
.textOverflow() {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
}
.textOverflowMulti(@line: 3, @bg: #fff) {
position: relative;
max-height: @line * 1.5em;
margin-right: -1em;
padding-right: 1em;
overflow: hidden;
line-height: 1.5em;
text-align: justify;
&::before {
position: absolute;
right: 14px;
bottom: 0;
padding: 0 1px;
background: @bg;
content: '...';
}
&::after {
position: absolute;
right: 14px;
width: 1em;
height: 1em;
margin-top: 0.2em;
background: white;
content: '';
}
}
// mixins for clearfix
// ------------------------
.clearfix() {
zoom: 1;
&::before,
&::after {
display: table;
content: ' ';
}
&::after {
clear: both;
height: 0;
font-size: 0;
visibility: hidden;
}
}

@ -11,7 +11,72 @@ export async function listMyLearningSubject(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request(' /dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject', {
return request('/dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject', {
params,
});
}
/**
* 6.5
* /dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject
* @param params
* @returns
*/
export async function getRulesList(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/rules/getRulesList', {
params,
});
}
/**
* 05
* /dsideal_yy/zygh/training/rules/getRulesPaper
* @param params
* @returns
*/
export async function getRulesPaper(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/rules/getRulesPaper', {
params,
});
}
/**
* 06
* /dsideal_yy/zygh/training/rules/getPaperQuestionList
* @param params
* @returns
*/
export async function getPaperQuestionList(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/rules/getPaperQuestionList', {
params,
});
}
export async function viewMyLearningSubject(params: {
identity_id: number;
person_id: number;
data_id: number;
data_type: number;
subject_id: number
}) {
return request(' /dsideal_yy/ypt/careerTraining/learning/viewMyLearningSubject', {
params,
});
}
export async function listMyLearningChapterCourse(params: {
chapter_id: number;
identity_id: number;
person_id: number;
subject_id: number
}) {
return request(' /dsideal_yy/ypt/careerTraining/learning/listMyLearningChapterCourse', {
params,
});
}
Loading…
Cancel
Save