From 8ee12c8b868608f704f1d431b35b37836c8ebad5 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Mon, 21 Feb 2022 10:44:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/dashboard/workplace/index.tsx | 36 ++++++++++++-------- web/src/pages/dashboard/workplace/service.ts | 28 +++++++++++++++ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/web/src/pages/dashboard/workplace/index.tsx b/web/src/pages/dashboard/workplace/index.tsx index a3175a8..a391cd3 100644 --- a/web/src/pages/dashboard/workplace/index.tsx +++ b/web/src/pages/dashboard/workplace/index.tsx @@ -1,4 +1,5 @@ -import { FC, Suspense } from 'react'; +import type { FC } from 'react'; +import { Suspense } from 'react'; import { Avatar, Card, Col, List, Skeleton, Row, Statistic, Descriptions, Progress, Table, Button } from 'antd'; import { Line, Radar } from '@ant-design/charts'; import { Link, history, useRequest } from 'umi'; @@ -7,10 +8,11 @@ import moment from 'moment'; import EditableLinkGroup from './components/EditableLinkGroup'; import styles from './style.less'; import type { ActivitiesType, CurrentUser } from './data.d'; -import { queryProjectNotice, queryActivities, fakeChartData } from './service'; -import dataSource from 'mock/dataSource'; +import { personLastLearning, queryActivities, fakeChartData } from './service'; +import cookie from 'react-cookies'; import OfflineData from './components/OfflineData'; + const examinations = [ { key: '1', @@ -71,7 +73,7 @@ const examinationColumns = [ dataIndex: 'option', key: 'option', render: (_, record, index, action) => { - return record?.status === 0 ? : + return record?.status === 0 ? : }, }, ]; @@ -139,11 +141,17 @@ const certificates = [ ]; const Workplace: FC = () => { + // const { loading: lastLearningLoading, data: lastLearningList = [] } = useRequest( + // personLastLearning( + // { + // identity_id: cookie.load('identity_id'), + // person_id: cookie.load('person_id') + // })); const { loading: activitiesLoading, data: activities = [] } = useRequest(queryActivities); const { loading: offlineChartLoading, data: offlineChartData = [] } = useRequest(fakeChartData); - - const { data } = useRequest(fakeChartData); // 证书 + const { data } = useRequest(fakeChartData); // 证书 + console.log('lastLearningList', lastLearningList) return ( <> @@ -159,18 +167,18 @@ const Workplace: FC = () => { >
- +
-
- + { legend={{ position: 'top-center', }} - point={{size:5}} + point={{ size: 5 }} />
@@ -207,7 +215,7 @@ const Workplace: FC = () => { bodyStyle={{ padding: 0 }} >
- + { loading={data?.radarData?.length === 0} >
-
+
- + diff --git a/web/src/pages/dashboard/workplace/service.ts b/web/src/pages/dashboard/workplace/service.ts index dd4cc47..3d35af5 100644 --- a/web/src/pages/dashboard/workplace/service.ts +++ b/web/src/pages/dashboard/workplace/service.ts @@ -1,6 +1,34 @@ import { request } from 'umi'; import type { NoticeType, ActivitiesType, AnalysisData } from './data'; + +/** + * 【6.5】(教师首页)当前学习主题课程信息 + * /dsideal_yy/ypt/careerTraining/report/personLastLearning + * @param params + * @returns + */ +export async function personLastLearning(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/ypt/careerTraining/report/personLastLearning', { + params, + }); +} + + + + + + + + + + + + + export async function queryProjectNotice(): Promise<{ data: NoticeType[] }> { return request('/api/project/notice'); } From f2af123d417ae166070ed07101bea98e3fb84ad9 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Mon, 21 Feb 2022 16:18:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/config/config.ts | 2 +- web/src/pages/dashboard/workplace/index.tsx | 128 +++++++++++++------ web/src/pages/dashboard/workplace/service.ts | 44 ++++++- 3 files changed, 134 insertions(+), 40 deletions(-) diff --git a/web/config/config.ts b/web/config/config.ts index fb81209..5ccadc3 100644 --- a/web/config/config.ts +++ b/web/config/config.ts @@ -80,7 +80,7 @@ export default defineConfig({ { name: '报名', icon: 'smile', - path: '/registration', + path: '/registration/:examination_id', component: './registration', }, { diff --git a/web/src/pages/dashboard/workplace/index.tsx b/web/src/pages/dashboard/workplace/index.tsx index a391cd3..85d6bf2 100644 --- a/web/src/pages/dashboard/workplace/index.tsx +++ b/web/src/pages/dashboard/workplace/index.tsx @@ -1,5 +1,5 @@ import type { FC } from 'react'; -import { Suspense } from 'react'; +import { useEffect } from 'react'; import { Avatar, Card, Col, List, Skeleton, Row, Statistic, Descriptions, Progress, Table, Button } from 'antd'; import { Line, Radar } from '@ant-design/charts'; import { Link, history, useRequest } from 'umi'; @@ -8,7 +8,7 @@ import moment from 'moment'; import EditableLinkGroup from './components/EditableLinkGroup'; import styles from './style.less'; import type { ActivitiesType, CurrentUser } from './data.d'; -import { personLastLearning, queryActivities, fakeChartData } from './service'; +import { personLastLearning, personLearningDayStatistics, getPersonExaminationList, getExaminationList } from './service'; import cookie from 'react-cookies'; import OfflineData from './components/OfflineData'; @@ -55,25 +55,32 @@ const examinations = [ const examinationColumns = [ { title: '考试项目', - dataIndex: 'name', + dataIndex: 'examination_name', key: 'name', }, { title: '报名时间', dataIndex: 'appyTime', key: 'appyTime', + render: (dom, entity) => { + return
{entity.apply_start_time}
{entity.apply_end_time}
+ + }, }, { title: '考试时间', dataIndex: 'examTime', key: 'examTime', + render: (dom, entity) => { + return
{entity.examination_start_time}
{entity.examination_end_time}
+ }, }, { - title: '', + title: '操作', dataIndex: 'option', key: 'option', render: (_, record, index, action) => { - return record?.status === 0 ? : + return record?.status === 0 ? : }, }, ]; @@ -82,23 +89,33 @@ const examinationColumns = [ const certificateColumns = [ { title: '考试项目', - dataIndex: 'name', + dataIndex: 'examination_name', key: 'name', }, { title: '考试时间', dataIndex: 'examTime', key: 'examTime', + render: (dom, entity) => { + return
{entity.examination_start_time}
{entity.examination_end_time}
+ + }, }, { title: '通过情况', - dataIndex: 'statusExam', + dataIndex: 'is_pass', key: 'statusExam', + render: (dom, entity) => { + return entity.is_pass = 1 ? "已通过" : "未通过" + } }, { title: '证书情况', - dataIndex: 'statusCertificate', + dataIndex: 'accreditation_status', key: 'statusCertificate', + render: (dom, entity) => { + return entity.is_pass = 1 ? "已制证" : "未制证" + } }, ]; @@ -141,17 +158,54 @@ const certificates = [ ]; const Workplace: FC = () => { - // const { loading: lastLearningLoading, data: lastLearningList = [] } = useRequest( - // personLastLearning( - // { - // identity_id: cookie.load('identity_id'), - // person_id: cookie.load('person_id') - // })); - const { loading: activitiesLoading, data: activities = [] } = useRequest(queryActivities); - const { loading: offlineChartLoading, data: offlineChartData = [] } = useRequest(fakeChartData); - - const { data } = useRequest(fakeChartData); // 证书 - console.log('lastLearningList', lastLearningList) + + // 当前学习 + const { loading: lastLearningLoading, data: lastLearningList = [] } = useRequest( + () => personLastLearning( + { + identity_id: cookie.load('identity_id'), + person_id: cookie.load('person_id') + })); + + // 资质考试列表 + const { loading: lastexaminationLoading, data: examinationList } = useRequest( + () => getExaminationList( + { + person_id: cookie.load('person_id') + }), { + formatResult: (result) => { + return result.table_List; + } + }); + + // 学习概况 + const { loading: activitiesLoading, data: learningDayStatistics = [] } = useRequest( + () => personLearningDayStatistics( + { + identity_id: cookie.load('identity_id'), + person_id: cookie.load('person_id') + })); + + + // 证书查询 + const { loading: personExaminationLoading, data: personExaminationList = [] } = useRequest( + () => getPersonExaminationList( + { + identity_id: cookie.load('identity_id'), + person_id: cookie.load('person_id') + }), { + formatResult: (result) => { + return result.table_List; + } + }); + + + + + useEffect(() => { + console.log('lastLearningList', personExaminationList) + + }) return ( <> @@ -162,26 +216,24 @@ const Workplace: FC = () => { title="学习概况" bordered={false} extra={false} - loading={offlineChartLoading} + loading={activitiesLoading} bodyStyle={{ padding: 24 }} >
- -
-
- +
+
{ className={styles.studyCard} title="当前学习" loading={activitiesLoading} - cover={example} + cover={example} > - - 盖笑松 - 生涯决策 - 1234123421 - 40分钟 + + {lastLearningList?.lecture_teacher} + {lastLearningList?.chapter_name} + {lastLearningList?.subject_name} + {lastLearningList?.total_course_minutes}分钟 - +
@@ -214,17 +266,17 @@ const Workplace: FC = () => { bordered={false} bodyStyle={{ padding: 0 }} > -
+
-
+
diff --git a/web/src/pages/dashboard/workplace/service.ts b/web/src/pages/dashboard/workplace/service.ts index 3d35af5..e1d98c9 100644 --- a/web/src/pages/dashboard/workplace/service.ts +++ b/web/src/pages/dashboard/workplace/service.ts @@ -1,7 +1,20 @@ import { request } from 'umi'; import type { NoticeType, ActivitiesType, AnalysisData } from './data'; - +/** + * 【6.4】(教师首页)每日学习时长统计 + * /dsideal_yy/ypt/careerTraining/report/personLearningDayStatistics + * @param params + * @returns + */ +export async function personLearningDayStatistics(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/ypt/careerTraining/report/personLearningDayStatistics', { + params, + }); +} /** * 【6.5】(教师首页)当前学习主题课程信息 * /dsideal_yy/ypt/careerTraining/report/personLastLearning @@ -16,7 +29,36 @@ export async function personLastLearning(params: { params, }); } +/** + * 01 获取教师端考试列表 + * /dsideal_yy/zygh/training/examination/getExaminationList + * @param params + * @returns + */ +export async function getExaminationList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request(' /dsideal_yy/zygh/training/examination/getExaminationList', { + params, + }); +} + +/** + * 01 获取教师端考试列表 + * /dsideal_yy/zygh/training/examination/getPersonExaminationList + * @param params + * @returns + */ +export async function getPersonExaminationList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request(' /dsideal_yy/zygh/training/examination/getPersonExaminationList', { + params, + }); +} From 1c6082ce88076d1e0badcc9bbc30f9f6086dfb39 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Tue, 22 Feb 2022 16:20:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=80=83=E8=AF=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/config/config.ts | 26 +++- web/src/pages/dashboard/workplace/index.tsx | 31 +++- web/src/pages/examination/info.tsx | 154 ++++++++++++++++++++ web/src/pages/examination/service.ts | 27 +++- 4 files changed, 227 insertions(+), 11 deletions(-) create mode 100644 web/src/pages/examination/info.tsx diff --git a/web/config/config.ts b/web/config/config.ts index 5ccadc3..845566b 100644 --- a/web/config/config.ts +++ b/web/config/config.ts @@ -127,8 +127,23 @@ export default defineConfig({ { name: '模拟考试', icon: 'dashboard', - path: '/test', - component: './test', + path: '/RulesList', + routes: [ + { + name: '考试概况(暂时废弃)', + icon: 'smile', + path: '/examination/intro', + component: './examination/intro', + hideInMenu: true, + }, + { + name: '考试信息', + icon: 'smile', + path: '/examination/info/:examination_id', + component: './examination/info', + hideInMenu: true, + }, + ] }, { path: '/examination', @@ -142,6 +157,13 @@ export default defineConfig({ component: './examination/intro', hideInMenu: true, }, + { + name: '考试信息', + icon: 'smile', + path: '/examination/info/:examination_id', + component: './examination/info', + hideInMenu: true, + }, { name: '考试试卷', icon: 'smile', diff --git a/web/src/pages/dashboard/workplace/index.tsx b/web/src/pages/dashboard/workplace/index.tsx index 85d6bf2..3606ca5 100644 --- a/web/src/pages/dashboard/workplace/index.tsx +++ b/web/src/pages/dashboard/workplace/index.tsx @@ -63,7 +63,7 @@ const examinationColumns = [ dataIndex: 'appyTime', key: 'appyTime', render: (dom, entity) => { - return
{entity.apply_start_time}
{entity.apply_end_time}
+ return
开始时间:{entity.apply_start_time}
结束时间:{entity.apply_end_time}
}, }, @@ -72,7 +72,7 @@ const examinationColumns = [ dataIndex: 'examTime', key: 'examTime', render: (dom, entity) => { - return
{entity.examination_start_time}
{entity.examination_end_time}
+ return
开始时间:{entity.examination_start_time}
结束时间:{entity.examination_end_time}
}, }, { @@ -80,7 +80,26 @@ const examinationColumns = [ dataIndex: 'option', key: 'option', render: (_, record, index, action) => { - return record?.status === 0 ? : + // return record?.status === 0 ? : + switch (record.status_type) { + case 0: + return "待报名" + break; + case 1: + return "报名中" + break; + case 2: + return "待考试" + break; + case 3: + return + break; + case 4: + return "考试完成" + break; + default: + break; + } }, }, ]; @@ -97,7 +116,7 @@ const certificateColumns = [ dataIndex: 'examTime', key: 'examTime', render: (dom, entity) => { - return
{entity.examination_start_time}
{entity.examination_end_time}
+ return
开始时间:{entity.examination_start_time}
结束时间:{entity.examination_end_time}
}, }, @@ -209,7 +228,7 @@ const Workplace: FC = () => { return ( <> - + { - + { + const params = useParams(); + + + // 获取考试详情 + // const { loading: personExaminationLoading, data: examinationInfo = [] } = useRequest( + // () => getExaminationById( + // { + // examination_id: params.examination_id + // }), { + // formatResult: (result) => { + // return result.bean; + // } + // }); + + // useEffect(() => { + // console.log('examinationInfo', examinationInfo) + + // }) + + + + const actionRef = useRef(); + + + + + return ( + + + { + const examinationInfo = await getExaminationById({ examination_id: params.examination_id }) + + const rulesInfo = await getRulesById({ id: examinationInfo.bean.rules_id }) + + const exData = { data: { ...examinationInfo.bean, ...rulesInfo.bean } } + console.log("exData", exData); + + return exData; + }} + layout='horizontal' + columns={[ + { + title: '考试项目', + key: 'text', + dataIndex: 'examination_name', + }, + + { + title: '考试时间', + key: 'state2', + render: (dom, entity, index, action) => { + return entity.examination_start_time + " - " + entity.examination_end_time + }, + }, + { + title: '考试时长', + key: 'examination_time', + dataIndex: 'examination_time', + valueType: 'text', + render: (dom, entity, index, action) => { + // return entity.examination_start_time + " - " + entity.examination_start_time + const d1 = new Date(entity.examination_start_time); + const d2 = new Date(entity.examination_end_time); + const examination_time = parseInt((d2 - d1) / 1000 / 60) + return examination_time + "分钟" + }, + }, + { + title: '满分', + key: 'sum_score', + dataIndex: 'sum_score', + valueType: 'text', + + }, + { + title: '通过标准', + key: 'pass_score', + dataIndex: 'pass_score', + valueType: 'text', + }, + + { + title: '操作', + valueType: 'option', + render: () => [ + + 链路 + , + + 报警 + , + + 查看 + , + ], + }, + ]} + column={1} + > + + + + + + + + {/* + + {this.data.id} + + + + + + + + */} + + + + + ); +}; + +export default CardList; diff --git a/web/src/pages/examination/service.ts b/web/src/pages/examination/service.ts index fee9a31..67933d4 100644 --- a/web/src/pages/examination/service.ts +++ b/web/src/pages/examination/service.ts @@ -1,10 +1,31 @@ import { request } from 'umi'; import type { CardListItemDataType } from './data.d'; -export async function queryFakeList(params: { - count: number; +/** + * 获取考试详情 + * /dsideal_yy/zygh/training/examination/getExaminationById + * @param params + * @returns + */ +export async function getExaminationById(params: { + page_size: number; + //count: number; }): Promise<{ data: { list: CardListItemDataType[] } }> { - return request('/api/card_fake_list', { + return request('/dsideal_yy/zygh/training/examination/getExaminationById', { params, }); } +/** + * 获取考试规则详情 + * /dsideal_yy/zygh/training/rules/getRulesById + * @param params + * @returns + */ +export async function getRulesById(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/rules/getRulesById', { + params, + }); +} \ No newline at end of file