From 9755cfe9e6f40a84d8dc764174fcad0b970bb113 Mon Sep 17 00:00:00 2001 From: Administrator <123456> Date: Mon, 21 Feb 2022 10:38:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=80=83=E8=AF=95=E6=8A=A5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/config/config.ts | 11 +- web/src/pages/registration/data.d.ts | 52 ++++ web/src/pages/registration/index.tsx | 265 ++++++++++++++----- web/src/pages/registration/service.ts | 52 ++++ web/src/pages/registration/success/index.tsx | 37 +-- 5 files changed, 326 insertions(+), 91 deletions(-) create mode 100644 web/src/pages/registration/data.d.ts create mode 100644 web/src/pages/registration/service.ts diff --git a/web/config/config.ts b/web/config/config.ts index 1b57cae..fb81209 100644 --- a/web/config/config.ts +++ b/web/config/config.ts @@ -86,12 +86,19 @@ export default defineConfig({ { name: '成功', icon: 'smile', - path: '/registration/success', + path: '/registration/success/:msg', component: './registration/success', hideInMenu: true, }, ] }, + { + name: '成功', + icon: 'smile', + path: '/registration/success', + component: './registration/success', + // hideInMenu: true, + }, { name: '课程学习', icon: 'table', @@ -149,7 +156,7 @@ export default defineConfig({ path: '/dashboard/analysis', component: './dashboard/analysis', hideInMenu: true, - }, + }, { path: '/profile', name: 'profile', diff --git a/web/src/pages/registration/data.d.ts b/web/src/pages/registration/data.d.ts new file mode 100644 index 0000000..871abf1 --- /dev/null +++ b/web/src/pages/registration/data.d.ts @@ -0,0 +1,52 @@ +export type Member = { + avatar: string; + name: string; + id: string; +}; + +/** 主题列表项数据类型声明 */ +export type SubjectListItemDataType = { + "b_use": number; // 是否启用(临时保存为草稿状态,完成时为启用状态) + "total_course_minutes": number; // 总学时(分钟) + "update_time": string; // 修改时间 + "subject_name": string; // 主题名称 + "create_time": string; // 创建时间 + "total_course_hours": number; // 总学时(小时) + "is_deleted": number; // 删除状态:0-未删除;1-已删除 + "attachment_json": Attachment; // 附件信息(主题封面,保存前端需要的所有信息) + "total_course_number": number; + "subject_id": 2; // 主题id + "total_chapter_number": number; // 章节数 + "subject_describe": string; // 主题简介 +}; + +/** 主题附件声明 */ +export type Attachment = { + name: string; // 原文件名 + ext: string; // 原文件名 + url: 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[]; +}; diff --git a/web/src/pages/registration/index.tsx b/web/src/pages/registration/index.tsx index 495f493..f23ce44 100644 --- a/web/src/pages/registration/index.tsx +++ b/web/src/pages/registration/index.tsx @@ -1,5 +1,6 @@ -import React, { useRef } from 'react'; -import { history } from 'umi'; +import React, { useRef,useState } from 'react'; +import { history,useRequest } from 'umi'; +import Base64 from 'base64-js'; import { ProFormInstance, ProFormRadio } from '@ant-design/pro-form'; import ProForm, { StepsForm, @@ -14,7 +15,8 @@ import ProCard from '@ant-design/pro-card'; import { Button, Col, message, Row } from 'antd'; import { PageContainer } from '@ant-design/pro-layout'; import ProDescriptions from '@ant-design/pro-descriptions'; - +import { queryExaminationRule,queryPersonInfo,savePersonSignUpInfo } from './service'; +import cookie from 'react-cookies'; const waitTime = (time: number = 100) => { return new Promise((resolve) => { setTimeout(() => { @@ -23,9 +25,35 @@ const waitTime = (time: number = 100) => { }); }; + + + export default () => { const formRef = useRef(); + const [baseInfo, setBaseInfo] = useState({}); + const [testInfo, setTestInfo] = useState({}); + const [backInfo, setBackInfo] = useState({}); + const data = useRequest(() => { + return queryPersonInfo({ + identity_id:cookie.load('identity_id'), + person_id:cookie.load('person_id') + }); + },{ + formatResult: (result) => { + console.log('result',result); + setBackInfo(result.table_List); + } + }); + // /** 获取题型 */ + // const { data } = useRequest(() => { + // return queryExaminationRule(); + // },{ + // formatResult: (result) => { + // return result; + // } + // }); + console.log('valu111111111111e',backInfo); return ( @@ -34,7 +62,7 @@ export default () => { }> formRef={formRef} onFinish={async () => { - await waitTime(1000); + const data = await waitTime(1000); message.success('提交成功'); }} formProps={{ @@ -54,9 +82,11 @@ export default () => { stepProps={{ description: false, }} - onFinish={async () => { + onFinish={async (values) => { + console.log('values',values); console.log(formRef.current?.getFieldsValue()); await waitTime(2000); + setBaseInfo(values); return true; }} > @@ -68,76 +98,104 @@ export default () => { width="md" // tooltip="最长为 6 位汉字,需要与考生身份证一致" placeholder="请输入姓名" + value={backInfo?.person_name} // rules={[{ required: true }]} - value="锦书" disabled /> - - - + + ]} + placeholder="请选择" + /> + + - + - + - - + + - + { description: false, }} onFinish={async () => { - console.log(formRef.current?.getFieldsValue()); + // console.log('1111s',formRef.current?.getFieldsValue()); + await waitTime(2000); return true; }} > @@ -157,12 +216,25 @@ export default () => { layout='horizontal' column={1} //actionRef={actionRef} - title="高级定义列表 request" - request={async () => { - return Promise.resolve({ + request={async (value) => { + const data = await queryExaminationRule({ + examination_id: 1 + }); + + setTestInfo(data.bean); + const dom=data.bean.examination_start_time+'-'+data.bean.examination_end_time; + return Promise.resolve({ success: true, - data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 }, - }); + data: { id: data?.bean.id, + object:data?.bean.examination_name, + date:data?dom:'--', + duration:data?.bean.examination_time+'分钟', + grade:data?.bean.sum_score+'分', + through:data?.bean.pass_score+'分', + learn:data?'在线学习时长不低于'+data.bean.learning_time+'分钟':'--', + }, + }) + }} extra={false} > @@ -173,7 +245,6 @@ export default () => { - @@ -186,59 +257,107 @@ export default () => { onFinish={async () => { console.log(formRef.current?.getFieldsValue()); // 跳转到指定路由 - history.push('/registration/success'); - return true; + // const success = await savePersonSignUpInfo({ + // address:baseInfo?.address, + // birthday:baseInfo?.birthday, + // bureau_id:backInfo?.bureau_id, + // bureau_name:backInfo?.bureau_name, + // city_id:backInfo?.city_id, + // city_name:backInfo?.city_name, + // district_id:backInfo?.district_id, + // district_name:backInfo?.district_name, + // education:baseInfo?.qualifications, + // examination_id:1, + // gender:baseInfo?.sex, + // id_code:baseInfo?.idCard, + // identity_id:backInfo?.identity_id, + // major:baseInfo?.major, + // person_id:backInfo?.person_id, + // person_name:backInfo?.person_name, + // province_id:backInfo?.province_id, + // province_name:backInfo?.province_name, + // subject:baseInfo?.subject, + // tel:baseInfo?.contact, + // university:baseInfo?.graduation, + // }); + + // console.log('success',success); + + // if (success) { + // const msg='你已报名'+testInfo.examination_start_time+'-'+testInfo.examination_end_time+' '+testInfo.examination_name+',准考证号是'+success.admission_number+',请准时参加考试!'; + // const info=JSON.stringify(msg) + // console.log('msg',msg); + // console.log('info',info); + // history.push( '/registration/success/'+info); + // + // // history.push('/registration/success'); + // } + + const msg='你已报名'+testInfo.examination_start_time+'-'+testInfo.examination_end_time+' '+testInfo.examination_name+',准考证号是'+',请准时参加考试!'; + const info=Base64.toByteArray(msg.toString()); + console.log('info',info); + const aa=Base64.decode(info); + console.log('msg',msg); + // console.log('info',info); + console.log('aa',aa) + + + // return true; }} > - + { - return Promise.resolve({ - success: true, - data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 }, - }); + console.log('testInfo---',testInfo) + console.log('baseInfo----',baseInfo) + // return Promise.resolve({ + // success: true, + // data: { + // last_id:testInfo.id, + // }, + // }); }} extra={false} > - - - - - - - - - + {testInfo?.id} + {backInfo?.person_name} + {baseInfo?.sex} + {baseInfo?.idCard} + {baseInfo?.birthday} + {baseInfo?.address} + {baseInfo?.contact} + {testInfo?.examination_name} + {testInfo?.examination_time+'分钟'} + {testInfo?.pass_score+'分'} + { - return Promise.resolve({ - success: true, - data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 }, - }); - + // return Promise.resolve({ + // success: true, + // data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 }, + // }); + }} extra={false} > - - - - - - - + {backInfo?.bureau_name} + {baseInfo?.qualifications} + {baseInfo?.graduation} + {baseInfo?.major} + {baseInfo?.subject} + {testInfo?.examination_start_time}-{testInfo?.examination_end_time} + {testInfo?.sum_score+'分'} @@ -248,4 +367,4 @@ export default () => { ); -}; \ No newline at end of file +}; diff --git a/web/src/pages/registration/service.ts b/web/src/pages/registration/service.ts new file mode 100644 index 0000000..ff0d162 --- /dev/null +++ b/web/src/pages/registration/service.ts @@ -0,0 +1,52 @@ +import { request } from 'umi'; +import type { ExaminationRuleType } from './data.d'; +import {TableListItem} from "../../../../admin/src/pages/course/option/data"; +/** + * 获取考試規則 + * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 + * @param params + * @returns + */ +export async function queryExaminationRule(params: { + examination_id: 1; + //count: number; +}) + // : Promise<{ data: { list: CardListItemDataType[] } }> +{ + return request('/dsideal_yy/zygh/training/person/getExaminationRuleById', { + params, + }); +} + +// export async function queryPersonInfo(params: { +// identity_id: number; +// person_id:number +// //count: number; +// }) +// // : Promise<{ data: { list: CardListItemDataType[] } }> +// { +// return request('/dsideal_yy/person/getPersonInfo', { +// params, +// }); +// } + +// 获取人员信息 +export async function queryPersonInfo(params: { + identity_id: number; + person_id: number; + //count: number; +}) { + return request('/dsideal_yy/person/getPersonInfo', { + params, + }); +} + +//保存报名 +export async function savePersonSignUpInfo(data: { [key: string]: any }, options?: { [key: string]: any }) { + return request('/dsideal_yy/zygh/training/person/savePersonSignUpInfo', { + data, + method: 'POST', + requestType: "form", + ...(options || {}), + }); +} diff --git a/web/src/pages/registration/success/index.tsx b/web/src/pages/registration/success/index.tsx index c788a06..709b581 100644 --- a/web/src/pages/registration/success/index.tsx +++ b/web/src/pages/registration/success/index.tsx @@ -2,7 +2,7 @@ import { DingdingOutlined } from '@ant-design/icons'; import { Button, Card, Steps, Result, Descriptions } from 'antd'; import { Fragment } from 'react'; import { GridContent } from '@ant-design/pro-layout'; - +import { history, useParams, useRequest } from 'umi'; import styles from './index.less'; const { Step } = Steps; @@ -10,21 +10,26 @@ const { Step } = Steps; const extra = ( - - ); -export default () => ( - - - - - -); +export default () => { + const params=useParams(); + console.log('params',params); + return( + + + + + + ) + +} + + From e27d144741dd4f20c47ab34baf63092d96f8f711 Mon Sep 17 00:00:00 2001 From: Administrator <123456> Date: Mon, 21 Feb 2022 10:41:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=80=83=E8=AF=95=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/package.json b/web/package.json index 885ee1a..df8b9ee 100644 --- a/web/package.json +++ b/web/package.json @@ -66,6 +66,7 @@ "ahooks": "^3.0.5", "ahooks-v2": "^2.10.15", "antd": "^4.14.0", + "base-64": "^1.0.0", "bizcharts": "^3.5.3-beta.0", "bizcharts-plugin-slider": "^2.1.1-beta.1", "classnames": "^2.2.6", @@ -77,6 +78,7 @@ "nzh": "^1.0.3", "omit.js": "^2.0.2", "react": "^17.0.0", + "react-cookies": "^0.1.1", "react-dev-inspector": "^1.1.1", "react-dom": "^17.0.0", "react-fittext": "^1.0.0",