diff --git a/web/config/config.ts b/web/config/config.ts index d1764ec..1432e30 100644 --- a/web/config/config.ts +++ b/web/config/config.ts @@ -92,13 +92,6 @@ export default defineConfig({ }, ] }, - { - name: '成功', - icon: 'smile', - path: '/registration/success', - component: './registration/success', - // hideInMenu: true, - }, { name: '课程学习', icon: 'table', @@ -115,12 +108,14 @@ export default defineConfig({ icon: 'smile', path: '/course/list/:msg', component: './course/list', + hideInMenu: true, }, { - name: '课程列表', + name: '课节列表', icon: 'smile', path: '/course/detail/:msg', component: './course/detail', + hideInMenu: true, }, ], }, @@ -170,6 +165,12 @@ export default defineConfig({ }, ], }, + { + name: '个人中心', + icon: 'dashboard', + path: '/personalCenter', + component: './personalCenter/index', + }, { name: 'analysis', icon: 'dashboard', diff --git a/web/src/pages/course/list/index.tsx b/web/src/pages/course/list/index.tsx index 913aa54..33760d1 100644 --- a/web/src/pages/course/list/index.tsx +++ b/web/src/pages/course/list/index.tsx @@ -90,7 +90,17 @@ const CardList = () => { 上次学习:{last_data?last_data.course_name:'--'} 主讲人:{last_data?last_data.lecture_teacher:'--'} - + + + @@ -131,8 +141,6 @@ const CardList = () => { - {console.log('chapterCourse', chapterCourse)} - {console.log('chapterCourse', typeof (chapterCourse))} { chapterCourse !== undefined &&chapterCourse !== ''? chapterCourse.map((item,index)=>{ diff --git a/web/src/pages/personalCenter/index.less b/web/src/pages/personalCenter/index.less new file mode 100644 index 0000000..d6d1559 --- /dev/null +++ b/web/src/pages/personalCenter/index.less @@ -0,0 +1,22 @@ +@import '~antd/es/style/themes/default.less'; + +.personalCenter{ + .condition{ + width:20rem; + margin-bottom: 2rem; + .condition-title{ + text-align: right; + width:5rem; + display: inline-block; + } + .condition-text{ + margin-left:2rem + } + } + .tip{ + color:red; + font-size:12px; + text-align: center; + margin-top:3rem + } +} diff --git a/web/src/pages/personalCenter/index.tsx b/web/src/pages/personalCenter/index.tsx new file mode 100644 index 0000000..c410a94 --- /dev/null +++ b/web/src/pages/personalCenter/index.tsx @@ -0,0 +1,198 @@ +import React, {useEffect, 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, + ProFormText, + ProFormDatePicker, + ProFormSelect, + ProFormDigit, + ProFormTextArea, + ProFormCheckbox, + ProFormDateRangePicker, +} from '@ant-design/pro-form'; +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 { queryPersonInfo,changePwd } from './service'; +import './index.less'; +import cookie from 'react-cookies'; +import { Tabs,Input,Button,message,Modal } from 'antd'; +import {saveTrain} from "../../../../admin/src/pages/training/option/service"; +import {outLogin} from "@/services/ant-design-pro/api"; +import {stringify} from "querystring"; +// import {savePersonSignUpInfo,changePwd} from "@/pages/registration/service"; +const { TabPane } = Tabs; +const { confirm } = Modal; + + +export default () => { + const [personInfo, setPersonInfo] = useState({}); + const [oldPassWord,setOldPassWord] = useState(''); + const [newPassWord,setNewPassWord] = useState(''); + const [secondNewPassWord,setSecondNewPassWord] = useState(''); + const data = useRequest(() => { + return queryPersonInfo({ + identity_id:cookie.load('identity_id'), + person_id:cookie.load('person_id') + }); + },{ + formatResult: (result) => { + setPersonInfo(result.table_List); + } + }); + + const showConfirm=async ()=>{ + confirm({ + title: '确认进行密码修改吗?', + centered:true, + onOk() { + savePassWord() + }, + onCancel() { + }, + }); + }; + + const loginOut = async () => { + await outLogin(); + const { query = {}, pathname } = history.location; + const { redirect } = query; + // Note: There may be security issues, please note + if (window.location.pathname !== '/user/login' && !redirect) { + history.replace({ + pathname: '/user/login', + search: stringify({ + redirect: pathname, + }), + }); + } + }; + + const savePassWord = async ()=>{ + // const success = await changePwd({ + // pwd_original:oldPassWord, + // pwd_new:newPassWord + // }); + try { + const code=await changePwd({ + pwd_original:oldPassWord, + pwd_new:newPassWord + }); + if(code.success){ + message.success('密码修改成功'); + loginOut(); + } + + return true; + } catch (error) { + if(error.response){ + message.error(error.response.info); + }else { + message.error('修改失败'); + } + + } + + }; + + return ( +
+ { + + }}> + +
+
+
考生姓名:
+ {personInfo?.person_name} +
+
+
所在学校:
+ {personInfo?.bureau_name}
+
+
性别:
+ {personInfo?.xb_name}
+
+
+ +
+
+
原始密码:
+
+ { + const strExp= /^[A-Za-z0-9]+$/; + if(strExp.test(e.target.value) || e.target.value===''){ + setOldPassWord(e.target.value); + return true; + }else { + message.warning('请输入英文或者是数字!'); + setOldPassWord(e.target.value.replace(/[\W]/g, '')); + } + }} + /> +
+
+
+
新密码:
+
+ { + const strExp= /^[A-Za-z0-9]+$/; + if(strExp.test(e.target.value) || e.target.value===''){ + setNewPassWord(e.target.value); + return true; + }else { + message.warning('请输入英文或者是数字!'); + setNewPassWord(e.target.value.replace(/[\W]/g, '')); + } + }} + /> +
+
+
+
确认密码:
+
+ { + const strExp= /^[A-Za-z0-9]+$/; + if(strExp.test(e.target.value) || e.target.value===''){ + setSecondNewPassWord(e.target.value); + return true; + }else { + message.warning('请输入英文或者是数字!'); + setSecondNewPassWord(e.target.value.replace(/[\W]/g, '')); + } + }} + /> +
+
+
提示:密码支持英文和数字,长度为6-12位
+
+ +
+
+ +
+
+
+ + ); +}; diff --git a/web/src/pages/personalCenter/service.ts b/web/src/pages/personalCenter/service.ts new file mode 100644 index 0000000..df39bc3 --- /dev/null +++ b/web/src/pages/personalCenter/service.ts @@ -0,0 +1,25 @@ +import { request } from 'umi'; +import type { ExaminationRuleType } from './data.d'; +import {TableListItem} from "../../../../admin/src/pages/course/option/data"; + + +// 获取人员信息 +export async function queryPersonInfo(params: { + identity_id: number; + person_id: number; + //count: number; +}) { + return request('/dsideal_yy/person/getPersonInfo', { + params, + }); +} + +// /dsideal_yy/ypt/personal/changePwd修改密码 +export async function changePwd(data: { [key: string]: any }, options?: { [key: string]: any }) { + return request('/dsideal_yy/ypt/personal/changePwd', { + data, + method: 'POST', + requestType: "form", + ...(options || {}), + }); +} diff --git a/web/src/pages/registration/index.less b/web/src/pages/registration/index.less index 85373f2..fb09bd7 100644 --- a/web/src/pages/registration/index.less +++ b/web/src/pages/registration/index.less @@ -9,3 +9,20 @@ font-weight: 500; font-size: 16px; } +.registration{ + +:global { + //.ant-pro-steps-form-step{ + // min-width: 960px; + //} + .ant-space-align-center{ + padding:24px; + display: block; + text-align: center; + .ant-space-item{ + display: inline-block; + margin-right: 1rem; + } + } +} +} diff --git a/web/src/pages/registration/index.tsx b/web/src/pages/registration/index.tsx index 93529d4..6abf292 100644 --- a/web/src/pages/registration/index.tsx +++ b/web/src/pages/registration/index.tsx @@ -18,6 +18,8 @@ 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'; + +import styles from './index.less' const waitTime = (time: number = 100) => { return new Promise((resolve) => { setTimeout(() => { @@ -42,7 +44,6 @@ export default () => { }); },{ formatResult: (result) => { - console.log('result',result); setBackInfo(result.table_List); } }); @@ -56,14 +57,13 @@ export default () => { // }); return ( - + formRef={formRef} + style={{textAlign:'center'}} onFinish={async () => { - const data = await waitTime(1000); - message.success('提交成功'); }} formProps={{ layout: "horizontal", @@ -83,9 +83,9 @@ export default () => { description: false, }} onFinish={async (values) => { - console.log('values',values); - console.log(formRef.current?.getFieldsValue()); - await waitTime(2000); + // console.log('values',values); + // console.log(formRef.current?.getFieldsValue()); + // await waitTime(2000); setBaseInfo(values); return true; }} @@ -126,9 +126,9 @@ export default () => { }} rules={[{ required: true, message: '请选择出生年月' }]} /> - + - + @@ -219,7 +219,7 @@ export default () => { //actionRef={actionRef} request={async (value) => { const data = await queryExaminationRule({ - examination_id: 1 + examination_id: 2 }); setTestInfo(data.bean); @@ -258,6 +258,7 @@ export default () => { onFinish={async () => { // console.log(formRef.current?.getFieldsValue()); // 跳转到指定路由 + try { const success = await savePersonSignUpInfo({ address:baseInfo?.address, birthday:baseInfo?.birthday, @@ -268,7 +269,7 @@ export default () => { district_id:backInfo?.district_id, district_name:backInfo?.district_name, education:baseInfo?.qualifications, - examination_id:1, + examination_id:2, gender:baseInfo?.sex, id_code:baseInfo?.idCard, identity_id:backInfo?.identity_id, @@ -281,31 +282,30 @@ export default () => { tel:baseInfo?.contact, university:baseInfo?.graduation, }); + const msg=testInfo.examination_start_time+','+testInfo.examination_end_time+','+testInfo.examination_name+','+success.admission_number; + history.push( '/registration/success/'+msg); + }catch (error) { + if(error.response){ + message.error(error.response.info); + }else { + message.error('报名失败'); + } - 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=JSON.stringify(msg); - // - // console.log('info',info); - // - // const aa=Base64.byteLength(info); - // console.log('msg',msg); - // // console.log('info',info); - // console.log('aa',aa) + // console.log('success',success); + // if (success.success) { + // // const msg='你已报名'+testInfo.examination_start_time+'-'+testInfo.examination_end_time+' '+testInfo.examination_name+',准考证号是'+success.admission_number+',请准时参加考试!'; + // const msg=testInfo.examination_start_time+','+testInfo.examination_end_time+','+testInfo.examination_name+','+success.admission_number; + // // const info=JSON.stringify(msg) + // console.log('mag',msg); + // history.push( '/registration/success/'+msg); + // + // }else { + // message.config('报名失败!') + // } - // return true; }} > @@ -316,14 +316,6 @@ export default () => { column={1} //actionRef={actionRef} request={async () => { - // console.log('testInfo---',testInfo) - // console.log('baseInfo----',baseInfo) - // return Promise.resolve({ - // success: true, - // data: { - // last_id:testInfo.id, - // }, - // }); }} extra={false} > diff --git a/web/src/pages/registration/success/index.tsx b/web/src/pages/registration/success/index.tsx index 709b581..f74828b 100644 --- a/web/src/pages/registration/success/index.tsx +++ b/web/src/pages/registration/success/index.tsx @@ -15,14 +15,14 @@ const extra = ( export default () => { const params=useParams(); - console.log('params',params); + const info=params.msg.split(','); return(