zhengpengju 3 years ago
parent 4f9b041b0f
commit 41520e5cf9

@ -1,5 +1,5 @@
import { DingdingOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm } from 'antd';
import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm, Menu } from 'antd';
import { Fragment, useEffect, useRef, useState } from 'react';
import { GridContent } from '@ant-design/pro-layout';
import { Line } from '@ant-design/charts';
@ -10,6 +10,8 @@ import 'react-quill/dist/quill.snow.css'
import ProDescriptions, { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import { TableListItem } from '../ListTableList2';
import { v4 as uuidv4 } from 'uuid';
import { queryCourseList } from '../course/option/service';
import { useRequest } from 'umi';
const { Step } = Steps;
@ -124,18 +126,58 @@ export default () => {
{}
];
const [chartData, setChartData] = useState([data, data]);
const [selectedCourse, setSelectedCourse] = useState(0);
const [menu, setMenu] = useState();
/** 获取课程数据 */
const { data: listData } = useRequest(() => {
return queryCourseList();
});
useEffect(() => {
console.log('listData', listData)
setInterval(() => {
setChartData(Math.random() > 0.5 ? [data, data] : [data2, data2]);
}, 1000);
}, []);
/** 生成菜单 */
const menuItems = [];
if(listData?.length > 0){
console.log('push');
listData.list.forEach((item: {code: number, name: string})=>{
menuItems.push(<Menu.Item key={item?.course_id}>{item?.course_name}</Menu.Item>)
})
}
setMenu(
<Menu onClick={(value)=>{
console.log('menu11', value);
console.log('menu11', value.key);
//setMenu({ name: listData[Number(value?.key)]?.name, value: Number(value?.key)});
}}
>
{menuItems}
</Menu>
);
}, [listData, selectedCourse]);
const config = {
data: chartData,
xField: "year",
yField: ["value", "count"]
};
return(
<>
{menu}
<Input value={123} ref={saveInputRef} />
<a onClick={()=>{
saveInputRef.current.focus({})

@ -33,6 +33,7 @@ const handleUpdate = async (fields: FormValueType) => {
try {
await updateExamination({
...fields,
});
hide();
message.success('配置成功');
@ -523,7 +524,6 @@ const ExaminationList: React.FC = () => {
delete params.course_time
delete params.examination_time
await handleUpdate(params);
handleCreateModalVisible(false);
actionRef.current?.reloadAndRest?.();
@ -596,8 +596,21 @@ const ExaminationList: React.FC = () => {
console.log('values', values);
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
//console.log('url', url)
await handleUpdate({
const params = {
...values,
apply_start_time: values?.apply_time[0],
apply_end_time: values?.apply_time[1],
course_start_time: values?.course_time[0],
course_end_time: values?.course_time[1],
examination_start_time: values?.examination_time[0],
examination_end_time: values?.examination_time[1]
}
delete params.apply_time
delete params.course_time
delete params.examination_time
await handleUpdate({
...params,
examination_id: currentRow?.examination_id,
});
handleUpdateModalVisible(false); // 隐藏编辑窗口

@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
import { TinyArea, TinyColumn } from '@ant-design/charts';
import { Card, Col, Progress, Row, Tabs, DatePicker, Select, Form, Statistic, Button } from 'antd';
import { Card, Col, Progress, Row, Tabs, DatePicker, Select, Form, Statistic, Button, Spin, Space } from 'antd';
import numeral from 'numeral';
import { ChartCard, Field } from './Charts';
import type { DataItem } from '../data.d';
@ -12,6 +12,7 @@ import styles from '../style.less';
import ProForm, { ProFormSelect } from '@ant-design/pro-form';
import { useRequest } from 'umi';
const { RangePicker } = DatePicker;
const topColResponsiveProps = {
xs: 24,
sm: 4,
@ -27,9 +28,6 @@ const layout = {
wrapperCol: { span: 16 },
};
const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: DataItem[] }) => {
const [provinceId, setProvinceId] = useState("100007")
const [cityList, setCityList] = useState([]);
@ -37,6 +35,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
const [schoolList, setSchoolList] = useState([]);
const [options, setOptions] = useState([]);
const [fetching, setFetching] = useState(false);
const fetchRef = useRef(0);
const { loading: courseBrowseTimesLoading, data: eduUnitList = null } = useRequest(() => getEduUnitList({
random_num: 277470,
area_id: provinceId,
@ -55,31 +57,30 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
});
const [form] = Form.useForm();
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(async () => {
const cityData = await getAsyncOrgTree({
// 获取市数据
const { data: cityData, loading: cityLoading } = useRequest(() => {
return getAsyncOrgTree({
org_id: provinceId,
org_type: 1,
get_next: 1
});
setCityList(cityData || []);
},{
formatResult: (result) => {
console.log('result')
return result;
}
});
const [form] = Form.useForm();
}, []);
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => {
console.log('cityData', cityData);
setCityList(cityData || []);
}, [cityData]);
const getAreaData = async (e) => {
const getAreaData = async (e: any) => {
// console.log(e, 'eeeeeeeeeeeee2ee');
const areaData = await getAsyncOrgTree({
org_id: e,
@ -88,17 +89,11 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
});
form.setFieldsValue({ area: 0 })
setAreaList(areaData || []);
}
let timeout: NodeJS.Timeout | null;
const getSchoolData = async (e, callback) => {
const getSchoolData = async () => {
// timeout = setTimeout(async () => {
try {
schoolData = await getEduUnitList({
const schoolData = await getEduUnitList({
random_num: 277470,
area_id: provinceId,
edu_type: -1,
@ -109,21 +104,8 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
pageSize: 1000,
school_type: -1,
showPassWord: true,
}).then((e) => {
callback(e.table_List)
console.log(e.table_List);
setSchoolList(e.table_List || [])
});
} catch (error) {
// error.message; // "Oops!"
}
// }, 500);
// console.log(schoolList, 'schoolList 1');
})
retrun [{label:'aaaa', value:'1111'},{label:'aaaa', value:'1111'}]
}
@ -137,35 +119,56 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
};
return (
<Card loading={loading} bordered={false} bodyStyle={{ padding: 0, marginBottom: '24px' }}>
<div className={styles.salesCard}>
<Tabs
tabBarExtraContent={<div className={styles.salesExtraWrap}>
<div className={styles.salesExtra}>
<Form {...layout} form={form} name="control-hooks" onFinish={onFinish}>
<Form.Item name="city" label="市" style={{ float: "left" }}>
/**
*
* @param value
*/
const handleSearch = async (value: any) => {
if (value >= 'a' && value <= 'z') {
return false;
}
if (value) {
console.log('value::', value)
// setOptions([{ORG_NAME:"aaa", ORG_ID:"111"},{ORG_NAME:"aab", ORG_ID:"112"}])
const { table_List } = await getEduUnitList({
random_num: 277470,
area_id: provinceId,
edu_type: -1,
// main_school_id: 200125116,
org_name: value,
org_type: 2,
pageNumber: 1,
pageSize: 1000,
school_type: -1,
showPassWord: true,
});
setOptions(table_List);
} else {
setOptions([]);
}
};
return (
<Card loading={loading} bordered={false} bodyStyle={{ padding: 0, marginBottom: '24px' }}>
<Row gutter={16}>
<Col>
<Form form={form} name="control-hooks" onFinish={onFinish} layout='inline' style={{padding:'24px 24px 0px 24px'}}>
<Form.Item name="city" label="市" >
<Select
style={{ width: 120 }}
onChange={(id) => { getAreaData(id) }}
// defaultValue={provinceId}
>
<Option key={provinceId} value={provinceId}></Option>
{/* {cityList.map((e, i) => {
return <Option key={e.id} value={e.id}>{e.name}</Option>
})} */}
{
cityList.forEach((e) => {
return <Option key={e?.id} value={e?.id}>{e?.name}</Option>
})
}
</Select>
</Form.Item>
<Form.Item name="area" label="区" style={{ float: "left" }}>
<Form.Item name="area" label="区" >
<Select
style={{ width: 120 }}
// defaultValue={0}
@ -177,12 +180,8 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
return <Option key={e.id} value={e.id}>{e.name}</Option>
})} */}
</Select>
</Form.Item>
<Form.Item name="school" label="学校">
<Select
showSearch
style={{ width: 220 }}
@ -190,52 +189,46 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
// placeholder={this.props.placeholder}
// style={this.props.style}
// defaultActiveFirstOption={true}
defaultActiveFirstOption={false}
showArrow={true}
filterOption={true}
// onSearch={this.handleSearch}
filterOption={false}
// onChange={getSchoolData}
notFoundContent={fetching ? <Spin size="small" /> : null}
fieldNames={{ value: "ORG_ID", label: "ORG_NAME" }}
onSearch={(value) => getSchoolData(value)}
notFoundContent={null}
options={schoolList}
onSearch={handleSearch}
options={options}
/>
{console.log(schoolList, 'schoolList111')}
</Form.Item>
<Button></Button>
</Form>
</div>
</div>
}
size="large"
tabBarStyle={{ marginBottom: 24 }}
/>
</div>
<Row />
<Row gutter={16}>
<Col {...topColResponsiveProps}>
<Statistic title="资质考试数" value={93} />
</Col>
<Col {...topColResponsiveProps}>
<Statistic title="累计报名人数" value={93} suffix="人" />
</Row>
<Row gutter={[24, 0]} style={{padding:'0 24px 10px 24px'}}>
<Col xs={14} sm={14} md={14} lg={14} xl={14} style={{padding:12}}>
<Row gutter={24} style={{padding:12, border:'solid 1px #f0f0f0', height:'100%'}} >
<Col xs={8} sm={8} md={8} lg={8} xl={8}>
<Statistic title="资质考试数" value={93} suffix="次" style={{fontSize:16,fontWeight:500}} />
</Col>
<Col xs={8} sm={8} md={8} lg={8} xl={8}>
<Statistic title="累计报名人数" value={93} suffix="人" style={{fontSize:16,fontWeight:500}} />
</Col>
<Col {...topColResponsiveProps}>
<Statistic title="取得证书人数" value={93} suffix="人" />
<Col xs={8} sm={8} md={8} lg={8} xl={8}>
<Statistic title="取得证书人数" value={93} suffix="人" style={{fontSize:16,fontWeight:500}} />
</Col>
</Row>
</Col>
<Col {...topColResponsiveProps}>
<Col xs={10} sm={10} md={10} lg={10} xl={10} style={{padding:12}}>
<ChartCard
bordered={false}
loading={loading}
title={`通过率`}
title={<span style={{fontSize:16,fontWeight:500}}></span>}
action={false}
// total={`${numeral(6560).format('0,0')}`}
footer={false}
contentHeight={92}
style={{ textAlign: 'center', marginBottom: 0 }}
style={{ textAlign: 'center', marginBottom: 0 , padding:12, border:'solid 1px #f0f0f0'}}
bodyStyle={{padding:0}}
>
<Progress type="circle" percent={75} width={80} strokeWidth={10} style={{ position: 'relative', margin: '15px auto 0 auto' }} />
</ChartCard>

@ -187,3 +187,16 @@
}
}
}
:global {
.ant-statistic-title{
font-size: 16px !important;
}
.ant-statistic-content-value-int{
color:#1890ff;
font-size: 50px !important;
}
.ant-statistic-content-suffix{
color:#cccccc;
}
}

@ -1,5 +1,5 @@
import { AlignLeftOutlined, LaptopOutlined, NotificationOutlined, PlusOutlined, UserOutlined } from '@ant-design/icons';
import {useEffect} 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';
@ -28,9 +28,13 @@ import cookie from 'react-cookies';
// };
const CardList = () => {
const params=useParams();
const params = useParams();
console.log('params',params);
const ids=params.msg.split(',');
const ids = params.msg.split(',');
const [currentCourse, SetCurrentCourse] = useState()
/** 获取主题下课程 */
const { data } = useRequest(() => {
return viewMyLearningSubject({
identity_id:cookie.load('identity_id'),
@ -47,26 +51,37 @@ const CardList = () => {
const last_data=data?data.last_learning_course:[];
const chapter_list=data?data.chapter_list:[];
const aa = useRequest(() => {
//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:2,//chapter_list[0].subject_id
chapter_id:2,//chapter_list[0].chapter_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('getList',getList)
// const a=await listMyLearningChapterCourse({
// identity_id:cookie.load('identity_id'),
// person_id:cookie.load('person_id'),
// subject_id:subject_id,
// chapter_id: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]);
/** run后 chapterCourse 变化 进行currentCourse赋值 */
useEffect(() => {
console.log('chapterCourse...', chapterCourse)
if(data !== undefined){
console.log('data', data)
SetCurrentCourse(chapterCourse)
}
//setSelectedCourse({})
},[chapterCourse]);
// if(chapter_list.length!==0){
//
// // const msg = useRequest(() => {
@ -111,7 +126,7 @@ const CardList = () => {
<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>
</>
@ -139,12 +154,11 @@ const CardList = () => {
chapter_list.length!==0?
chapter_list.map((item)=>{
return(
<Menu.Item key={item.chapter_id}
<Menu.Item
key={item.chapter_id}
onClick={()=>{
run({subject_id:item.subject_id, chapter_id:item.chapter_id})
}}
>{item.chapter_name}</Menu.Item>
)
@ -167,6 +181,17 @@ const CardList = () => {
</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}

Loading…
Cancel
Save