注册验证码与账号弹出,修改密码
This commit is contained in:
@ -6,7 +6,7 @@ import { HomeOutlined } from '@ant-design/icons';
|
|||||||
import DomesticForm from './supplier/DomesticForm';
|
import DomesticForm from './supplier/DomesticForm';
|
||||||
import ForeignForm from './supplier/ForeignForm';
|
import ForeignForm from './supplier/ForeignForm';
|
||||||
import Person from './supplier/Person';
|
import Person from './supplier/Person';
|
||||||
import { addAgent, coscoSupplierBaseAdd, fetchSurveyQuestions } from '@/servers/api/register';
|
import { addAgent, coscoSupplierBaseAdd, fetchSurveyQuestions, sendPhoneCode, sendEmailCode } from '@/servers/api/register';
|
||||||
import './register.less';
|
import './register.less';
|
||||||
|
|
||||||
interface supplierWithInputProps {
|
interface supplierWithInputProps {
|
||||||
@ -57,27 +57,56 @@ const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
|||||||
fetchQuestions();
|
fetchQuestions();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// 获取短信验证码
|
//倒计时
|
||||||
|
useEffect(() => {
|
||||||
|
if (countdown === 0) return;
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
setCountdown(c => {
|
||||||
|
if (c === 1) {
|
||||||
|
clearInterval(timer);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return c - 1;
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
return () => clearInterval(timer);
|
||||||
|
}, [countdown]);
|
||||||
|
|
||||||
|
// 获取短信与邮箱验证码
|
||||||
const handleGetCaptcha = () => {
|
const handleGetCaptcha = () => {
|
||||||
form
|
form
|
||||||
.validateFields(['contactPhone'])
|
.validateFields([['coscoSupplierBase']])
|
||||||
.then((values) => {
|
.then((values) => {
|
||||||
message.success(`验证码已发送至 ${values.contactPhone}`);
|
const supplierType = values.coscoSupplierBase?.supplierType;
|
||||||
let count = 60;
|
const contactsPhone = values.coscoSupplierBase?.contactsPhone;
|
||||||
setCountdown(count);
|
const contactsEmail = values.coscoSupplierBase?.contactsEmail;
|
||||||
|
const phonePattern = /^1[3-9]\d{9}$/;
|
||||||
const timer = setInterval(() => {
|
const emailPattern = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/;
|
||||||
count--;
|
|
||||||
setCountdown(count);
|
if (contactsPhone && phonePattern.test(contactsPhone) && supplierType === 'dvs') {
|
||||||
if (count === 0) {
|
// 发送手机验证码
|
||||||
clearInterval(timer);
|
sendPhoneCode(contactsPhone);
|
||||||
|
message.success(`验证码已发送至 ${contactsPhone}`);
|
||||||
|
setCountdown(60);
|
||||||
|
} else if (contactsEmail && emailPattern.test(contactsEmail) && supplierType === 'ovs' ) {
|
||||||
|
// 发送邮箱验证码
|
||||||
|
sendEmailCode(contactsEmail);
|
||||||
|
message.success(`验证码已发送至 ${contactsEmail}`);
|
||||||
|
setCountdown(60);
|
||||||
|
} else {
|
||||||
|
if (supplierType === 'dvs') {
|
||||||
|
message.error('请输入正确的手机号');
|
||||||
|
} else if (supplierType === 'ovs') {
|
||||||
|
message.error('请输入正确的邮箱');
|
||||||
}
|
}
|
||||||
}, 1000);
|
}
|
||||||
})
|
})
|
||||||
.catch((errorInfo) => {
|
.catch(() => {
|
||||||
message.error('请先输入正确的手机号');
|
message.error('请输入正确的信息');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const onFinishFailed = (errorInfo: any) => {
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
console.log('Failed:', errorInfo);
|
console.log('Failed:', errorInfo);
|
||||||
@ -114,19 +143,35 @@ const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
|||||||
window.location.href = redirectRef.current;
|
window.location.href = redirectRef.current;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!supplierWithInput) {
|
if (!supplierWithInput) {
|
||||||
message.success('注册成功,请登录');
|
Modal.success({
|
||||||
history.push('/login');
|
title: '注册成功,请登录',
|
||||||
|
content: (
|
||||||
|
<div>
|
||||||
|
<div>账号信息:{response.data}</div>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
onOk: () => {
|
||||||
|
// 确认后跳转
|
||||||
|
history.push('/login');
|
||||||
|
},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
message.success(`${exitId ? '修改成功' : '注册成功'}`);
|
Modal.success({
|
||||||
onOk?.();
|
title: exitId ? '修改成功' : '注册成功',
|
||||||
|
content: (
|
||||||
|
<div>
|
||||||
|
<div>账号信息:{response.data}</div>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
onOk: () => {
|
||||||
|
onOk?.();
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
message.error(response.message || '注册失败,请重试');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('注册出错:', error);
|
|
||||||
message.error('注册失败,请稍后重试');
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@ -260,7 +305,7 @@ const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
|||||||
okText="我知道了"
|
okText="我知道了"
|
||||||
cancelButtonProps={{ style: { display: 'none' } }}
|
cancelButtonProps={{ style: { display: 'none' } }}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
// maskClosable={false}
|
// maskClosable={false}
|
||||||
>
|
>
|
||||||
<div style={{ maxHeight: '60vh', overflow: 'auto' }}>
|
<div style={{ maxHeight: '60vh', overflow: 'auto' }}>
|
||||||
<p>尊敬的用户:</p>
|
<p>尊敬的用户:</p>
|
||||||
|
@ -298,7 +298,7 @@ const DomesticForm: React.FC<DomesticFormProps> = ({
|
|||||||
</Col>
|
</Col>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="captcha"
|
name="encryptValue"
|
||||||
label="验证码"
|
label="验证码"
|
||||||
rules={[{ required: true, message: '请输入验证码' }]}
|
rules={[{ required: true, message: '请输入验证码' }]}
|
||||||
>
|
>
|
||||||
|
@ -102,7 +102,8 @@ const ForeignForm: React.FC<ForeignFormProps> = ({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Form.Item name={['coscoSupplierBase', 'vat']} label="税号">
|
<Form.Item name={['coscoSupplierBase', 'vat']} label="税号"
|
||||||
|
rules={[{ required: true, message: '请输入税号' }]}>
|
||||||
<Input placeholder="请输入增值税号" />
|
<Input placeholder="请输入增值税号" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
@ -289,7 +290,7 @@ const ForeignForm: React.FC<ForeignFormProps> = ({
|
|||||||
</Col>
|
</Col>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="captcha"
|
name="encryptValue"
|
||||||
label="验证码"
|
label="验证码"
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: '请输入验证码' },
|
{ required: true, message: '请输入验证码' },
|
||||||
@ -308,8 +309,9 @@ const ForeignForm: React.FC<ForeignFormProps> = ({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col> */}
|
</Col> */}
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Form.Item name={['coscoSupplierBase', 'contactsPhone']} label="联系电话">
|
<Form.Item name={['coscoSupplierBase', 'contactsPhone']} label="联系电话"
|
||||||
<Input placeholder="请输入企业联系电话" />
|
rules={[{ required: true, message: '请输入联系电话' }]}>
|
||||||
|
<Input placeholder="请输入联系电话" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
{/* <Col span={8}>
|
{/* <Col span={8}>
|
||||||
|
@ -149,7 +149,7 @@ const SupplierEntryReview: React.FC = () => {
|
|||||||
render: (value: { item: string }[] = []) => {
|
render: (value: { item: string }[] = []) => {
|
||||||
if (!value || value.length === 0) return '-';
|
if (!value || value.length === 0) return '-';
|
||||||
if (value.length === 1) {
|
if (value.length === 1) {
|
||||||
return <span>{value[0].item}</span>;
|
return <span>{value[0]}</span>;
|
||||||
}
|
}
|
||||||
// 多于1条
|
// 多于1条
|
||||||
const allNames = value.map(item => item).join('、');
|
const allNames = value.map(item => item).join('、');
|
||||||
|
@ -120,7 +120,7 @@ const CooperateEnterprise: React.FC = () => {
|
|||||||
render: (value: { item: string }[] = []) => {
|
render: (value: { item: string }[] = []) => {
|
||||||
if (!value || value.length === 0) return '-';
|
if (!value || value.length === 0) return '-';
|
||||||
if (value.length === 1) {
|
if (value.length === 1) {
|
||||||
return <span>{value[0].item}</span>;
|
return <span>{value[0]}</span>;
|
||||||
}
|
}
|
||||||
// 多于1条
|
// 多于1条
|
||||||
const allNames = value.map(item => item).join('、');
|
const allNames = value.map(item => item).join('、');
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Form, Input, Button, message } from 'antd';
|
import { Form, Input, Button, message } from 'antd';
|
||||||
import { useIntl } from 'umi';
|
import { useIntl } from 'umi';
|
||||||
|
import { supplierUserPwd } from '../services'
|
||||||
|
|
||||||
const ChangePassword: React.FC = () => {
|
const ChangePassword: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
@ -12,9 +13,14 @@ const ChangePassword: React.FC = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 模拟提交
|
// 模拟提交
|
||||||
console.log('修改密码请求参数:', values);
|
supplierUserPwd({ password: values.newPassword }).then((res) => {
|
||||||
message.success(intl.formatMessage({ id: 'page.changePassword.success' }));
|
const { code } = res;
|
||||||
form.resetFields();
|
if(code == 200) {
|
||||||
|
message.success(intl.formatMessage({ id: 'page.changePassword.success' }));
|
||||||
|
form.resetFields();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -8,4 +8,16 @@ export async function getUserInfo() {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改密码
|
||||||
|
*/
|
||||||
|
interface supplierUser {
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
export async function supplierUserPwd(data: supplierUser) {
|
||||||
|
return request('/user/supplierUserPwd', {
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -177,8 +177,8 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
|
|||||||
},
|
},
|
||||||
{ title: '身份证号', dataIndex: 'idCard', key: 'idCard', align: 'center', ellipsis: true },
|
{ title: '身份证号', dataIndex: 'idCard', key: 'idCard', align: 'center', ellipsis: true },
|
||||||
{ title: '联系电话', dataIndex: 'personPhone', key: 'personPhone', align: 'center', ellipsis: true },
|
{ title: '联系电话', dataIndex: 'personPhone', key: 'personPhone', align: 'center', ellipsis: true },
|
||||||
{ title: '准入单位', dataIndex: 'orgName', key: 'orgName', align: 'center' },
|
{ title: '准入单位', dataIndex: 'orgName', key: 'orgName', align: 'center', width: 120, ellipsis: true },
|
||||||
{ title: '创建部门', dataIndex: 'deptName', key: 'deptName', align: 'center' },
|
{ title: '创建人', dataIndex: 'createName', key: 'createName', align: 'center', width: 120, ellipsis: true },
|
||||||
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', ellipsis: true },
|
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', ellipsis: true },
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@ -225,7 +225,7 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
|
|||||||
<Form.Item style={{ marginLeft: 'auto' }}>
|
<Form.Item style={{ marginLeft: 'auto' }}>
|
||||||
<Button className="buttonOther" type="primary" onClick={() => {
|
<Button className="buttonOther" type="primary" onClick={() => {
|
||||||
const values = form.getFieldsValue();
|
const values = form.getFieldsValue();
|
||||||
values.deptId = DeptId;
|
// values.deptId = DeptId;
|
||||||
values.orgId = DeptId? DeptId: currentUser.organizationId;
|
values.orgId = DeptId? DeptId: currentUser.organizationId;
|
||||||
downloadFile('/coscoSupplierBase/getPagePeExport', 'GET', values);
|
downloadFile('/coscoSupplierBase/getPagePeExport', 'GET', values);
|
||||||
}}>
|
}}>
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { request } from 'umi';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
// 供应商注册
|
// 供应商注册
|
||||||
export async function coscoSupplierBaseAdd(data: API.RegisterRequest) {
|
export async function coscoSupplierBaseAdd(data: API.RegisterRequest) {
|
||||||
return request('/api/coscoSupplierBase/add', {
|
return request('/coscoSupplierBase/add', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 代录供应商注册
|
// 代录供应商注册
|
||||||
export async function addAgent(data: API.RegisterRequest) {
|
export async function addAgent(data: API.RegisterRequest) {
|
||||||
return request('/api/coscoSupplierBase/addAgent', {
|
return request('/coscoSupplierBase/addAgent', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
@ -17,14 +17,14 @@ export async function addAgent(data: API.RegisterRequest) {
|
|||||||
|
|
||||||
// 获取调查问卷
|
// 获取调查问卷
|
||||||
export async function fetchSurveyQuestions(): Promise<API.APIResponse<API.SurveyQuestionResponse>> {
|
export async function fetchSurveyQuestions(): Promise<API.APIResponse<API.SurveyQuestionResponse>> {
|
||||||
return request('/api/coscoSurveyQuestion/list', {
|
return request('/coscoSurveyQuestion/list', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取省市县
|
// 获取省市县
|
||||||
export async function getRegionTree(){
|
export async function getRegionTree(){
|
||||||
return request('/api/cosco/dictRegion/region', {
|
return request('/cosco/dictRegion/region', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -32,14 +32,33 @@ interface getregionInternationalParams {
|
|||||||
pId: string | number;
|
pId: string | number;
|
||||||
}
|
}
|
||||||
export async function getregionInternational(params:getregionInternationalParams){
|
export async function getregionInternational(params:getregionInternationalParams){
|
||||||
return request('/api/v1/dictRegionInternational/getChild', {
|
return request('/v1/dictRegionInternational/getChild', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export async function getAllAreaList(){
|
export async function getAllAreaList(){
|
||||||
return request('/api/cosco/dictProject/getAllList/area', {
|
return request('/cosco/dictProject/getAllList/area', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信验证码
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export async function sendPhoneCode(contactsPhone: string){
|
||||||
|
return request(`/supplierRegistration/sendPhoneCode?contactsPhone=${contactsPhone}`, {
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱验证码
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export async function sendEmailCode(contactsEmail: string){
|
||||||
|
return request(`/supplierRegistration/sendEmailCode?contactsEmail=${contactsEmail}`, {
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user