forgeplus-react/src/forge/Component/ProfileModal/Index.jsx

68 lines
1.7 KiB
React
Raw Normal View History

2021-09-01 17:46:58 +08:00
import React , { useEffect , useState } from 'react';
import Modals from '../PublicModal/Index';
import { Button } from 'antd';
import axios from 'axios';
2021-09-01 10:25:12 +08:00
import './Index.scss';
2021-09-01 17:46:58 +08:00
function ProfileModal({visible,onCancel,history}) {
const [ modalVis , setModalVis ] = useState(visible);
2021-09-02 14:13:16 +08:00
const [ addMemberCheck , setAddMemberCheck ] = useState(false);
2021-09-01 17:46:58 +08:00
useEffect(()=>{
axios.interceptors.response.use((response) => {
2021-09-02 14:13:16 +08:00
if (response && (response.data.status === 411 || response.data.status === 412)) {
2021-09-01 17:46:58 +08:00
setModalVis(true);
2021-09-02 14:13:16 +08:00
if(response.data.status === 412){
setAddMemberCheck(true);
}
2021-09-01 17:46:58 +08:00
}
return response;
}, (error) => {
});
},[])
useEffect(()=>{
setModalVis(visible);
},[visible])
function onOk(){
onCancel();
setModalVis(false);
setTimeout(function(){
window.open(`/settings/profile`,"_blank");
},200)
}
function onNo() {
onCancel();
setModalVis(false);
}
2021-09-01 10:25:12 +08:00
return(
2021-09-01 17:46:58 +08:00
<Modals
title="完善资料"
onCancel={onNo}
visible={modalVis}
btn={
2021-09-02 14:13:16 +08:00
addMemberCheck?
<div>
<Button type={'primary'} size={"large"} onClick={onNo}>好的</Button>
</div>
:
2021-09-01 17:46:58 +08:00
<div>
<Button size={"large"} onClick={onNo}>暂不补充</Button>
<Button type={'primary'} size={"large"} onClick={onOk}>好的</Button>
</div>
}
2021-09-01 10:25:12 +08:00
>
2021-09-02 14:13:16 +08:00
{
addMemberCheck ?
<p>目标用户个人资料不完整需提醒目标用户补充资料后以进行后续操作</p>
:
<p>您目前的个人资料不完整需要补充资料以进行后续操作是否前往补充个人信息</p>
}
2021-09-01 17:46:58 +08:00
</Modals>
2021-09-01 10:25:12 +08:00
)
}
export default ProfileModal;