forked from Gitlink/forgeplus-react
个人资料是否完善-弹框
This commit is contained in:
parent
3b03ead3af
commit
105e1c61b8
|
@ -25,7 +25,7 @@ if (isDev) {
|
|||
}
|
||||
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
||||
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student'
|
||||
}
|
||||
window._debugType = debugType;
|
||||
export function initAxiosInterceptors(props) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { AlignCenter } from '../layout';
|
||||
import { Modal , Button } from 'antd';
|
||||
import './Index.scss';
|
||||
import { Button } from 'antd';
|
||||
import Modals from '../PublicModal/Index';
|
||||
|
||||
function DeleteBox({
|
||||
visible ,
|
||||
|
@ -12,24 +12,22 @@ function DeleteBox({
|
|||
content
|
||||
}) {
|
||||
return(
|
||||
<Modal
|
||||
visible={visible}
|
||||
onCancel={onCancel}
|
||||
title={title}
|
||||
width="600px"
|
||||
className="deleteBox"
|
||||
footer={
|
||||
<Modals
|
||||
title={title}
|
||||
btn={
|
||||
<div>
|
||||
<Button size={'large'} onClick={onCancel}>取消</Button>
|
||||
<Button type={"danger"} size={"large"} onClick={onSuccess}>确认删除</Button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
onCancel={onCancel}
|
||||
visible={visible}
|
||||
>
|
||||
<div className="desc">
|
||||
<AlignCenter className="descMain"><i className="iconfont icon-shanchu_tc_icon mr10"></i>{content}</AlignCenter>
|
||||
<p>{subTitle}</p>
|
||||
<p>{subTitle}</p>
|
||||
</div>
|
||||
</Modal>
|
||||
</Modals>
|
||||
)
|
||||
}
|
||||
export default DeleteBox;
|
|
@ -1,6 +1,6 @@
|
|||
.ant-modal-mask{
|
||||
z-index: 1001;
|
||||
z-index: 1031;
|
||||
}
|
||||
.ant-modal-wrap{
|
||||
z-index: 1002;
|
||||
z-index: 1032;
|
||||
}
|
|
@ -1,16 +1,54 @@
|
|||
import React from 'react';
|
||||
import { Modal } from 'antd';
|
||||
import React , { useEffect , useState } from 'react';
|
||||
import Modals from '../PublicModal/Index';
|
||||
import { Button } from 'antd';
|
||||
import axios from 'axios';
|
||||
|
||||
import './Index.scss';
|
||||
|
||||
function ProfileModal({visible}) {
|
||||
function ProfileModal({visible,onCancel,history}) {
|
||||
const [ modalVis , setModalVis ] = useState(visible);
|
||||
|
||||
useEffect(()=>{
|
||||
axios.interceptors.response.use((response) => {
|
||||
if (response && response.data.status === 411) {
|
||||
setModalVis(true);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
return(
|
||||
<Modal
|
||||
visible={visible}
|
||||
width={"400px"}
|
||||
<Modals
|
||||
title="完善资料"
|
||||
onCancel={onNo}
|
||||
visible={modalVis}
|
||||
btn={
|
||||
<div>
|
||||
<Button size={"large"} onClick={onNo}>暂不补充</Button>
|
||||
<Button type={'primary'} size={"large"} onClick={onOk}>好的</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<p>您目前的个人资料不完整,需要补充资料以进行后续操作。是否前往补充个人信息?</p>
|
||||
</Modal>
|
||||
</Modals>
|
||||
)
|
||||
}
|
||||
export default ProfileModal;
|
|
@ -0,0 +1,17 @@
|
|||
import React from 'react';
|
||||
|
||||
function Profile({children,sureFunc,showCompeleteDialog , completeProfile, className}) {
|
||||
|
||||
function checkProfile() {
|
||||
if(!completeProfile){
|
||||
showCompeleteDialog && showCompeleteDialog();
|
||||
}else{
|
||||
sureFunc();
|
||||
}
|
||||
}
|
||||
|
||||
return(
|
||||
<a className={className} onClick={checkProfile}>{children}</a>
|
||||
)
|
||||
}
|
||||
export default Profile;
|
|
@ -0,0 +1,19 @@
|
|||
import React from 'react';
|
||||
import { Modal } from 'antd';
|
||||
import './Index.scss';
|
||||
|
||||
function Modals({title,children,btn,onCancel,visible}) {
|
||||
return(
|
||||
<Modal
|
||||
visible={visible}
|
||||
onCancel={onCancel}
|
||||
title={title}
|
||||
width="600px"
|
||||
className="deleteBox"
|
||||
footer={btn}
|
||||
>
|
||||
{children}
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
export default Modals;
|
|
@ -32,14 +32,23 @@
|
|||
border-top: none;
|
||||
text-align: center;
|
||||
padding-bottom: 40px;
|
||||
button{
|
||||
button,a{
|
||||
width: 120px;
|
||||
margin:0px 20px;
|
||||
&.ant-btn{
|
||||
border-color: #D0D0D0;
|
||||
color: #666;
|
||||
}
|
||||
&.ant-btn-danger{
|
||||
background-color: #fff;
|
||||
color: #DF0002;
|
||||
border-color: #D0D0D0;
|
||||
}
|
||||
&.ant-btn.ant-btn-primary{
|
||||
background-color: #fff;
|
||||
color: #466AFF;
|
||||
border-color: #D0D0D0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import React, { useState , forwardRef, useEffect } from 'react';
|
||||
import { Form , Modal , Input , Radio } from 'antd';
|
||||
import Axios from 'axios';
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
export default Form.create()(
|
||||
forwardRef((props)=>{
|
||||
|
@ -77,7 +78,7 @@ export default Form.create()(
|
|||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
<a onClick={()=>setVisible(true)}>加入项目</a>
|
||||
<CheckProfile {...props} sureFunc={()=>setVisible(true)}>加入项目</CheckProfile>
|
||||
</React.Fragment>
|
||||
)
|
||||
})
|
||||
|
|
|
@ -10,6 +10,7 @@ import HeadSearch from '../Component/HeadSearch';
|
|||
|
||||
import AddProjectModal from './AddProjectModal';
|
||||
import '../../modules/tpm/TPMIndex.css';
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
import './header.scss';
|
||||
const $ = window.$
|
||||
|
@ -225,15 +226,14 @@ class NewHeader extends Component {
|
|||
|
||||
checkProfile=(url)=>{
|
||||
const { showCompeleteDialog , completeProfile } = this.props;
|
||||
if(completeProfile){
|
||||
if(!completeProfile){
|
||||
showCompeleteDialog && showCompeleteDialog();
|
||||
}else{
|
||||
this.props.history.push(url);
|
||||
window.location.href(url);
|
||||
}
|
||||
}
|
||||
|
||||
addMenu=(list)=>{
|
||||
console.log(this.props);
|
||||
return(
|
||||
list && list.length >0 &&
|
||||
<div className="dropdownFlex">
|
||||
|
@ -242,11 +242,15 @@ class NewHeader extends Component {
|
|||
list.map((item,key)=>{
|
||||
return(
|
||||
(item.name !=="加入课堂" && item.name !=="加入开发项目") &&
|
||||
<Menu.Item key={item.name+key}><a onClick={this.checkProfile(item.url)}>{item.name}</a></Menu.Item>
|
||||
<Menu.Item key={item.name+key}>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{window.location.href=item.url}}>{item.name}</CheckProfile>
|
||||
</Menu.Item>
|
||||
)
|
||||
})
|
||||
}
|
||||
<Menu.Item><AddProjectModal showNotification={this.props.showNotification}/></Menu.Item>
|
||||
<Menu.Item>
|
||||
<AddProjectModal {...this.props} showNotification={this.props.showNotification}/>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -20,6 +20,7 @@ import DrawerPanel from '../Component/DrawerPanel';
|
|||
import UpdateDescModal from './sub/UpdateDescModal';
|
||||
import Nodata from '../Nodata';
|
||||
import Invite from './sub/Invite';
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
/**
|
||||
* projectDetail.type:0是托管项目,1是镜像项目,2是同步镜像项目(为2时不支持在线创建、在线上传、在线修改、在线删除、创建合并请求等功能)
|
||||
*/
|
||||
|
@ -364,11 +365,11 @@ function CoderDepot(props){
|
|||
<div className="mr20 addOptionBtn">
|
||||
{
|
||||
projectDetail.type !== 2 && pullsFlag &&
|
||||
<a onClick={()=>urlLink(`/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</a>
|
||||
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</CheckProfile>
|
||||
}
|
||||
{
|
||||
issuesFlag &&
|
||||
<a onClick={()=>urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 任务</a>
|
||||
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 任务</CheckProfile>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import MergeItem from "./MergeItem";
|
|||
import './Index.scss';
|
||||
|
||||
import axios from "axios";
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
const Search = Input.Search;
|
||||
/**
|
||||
|
@ -256,9 +257,9 @@ class merge extends Component {
|
|||
</div>
|
||||
{
|
||||
data && data.user_admin_or_developer &&
|
||||
<a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}>
|
||||
<CheckProfile {...this.props} className="topWrapper_btn ml10" sureFunc={() => this.checkOperation()}>
|
||||
+ 新建合并请求
|
||||
</a>
|
||||
</CheckProfile>
|
||||
}
|
||||
</div>
|
||||
<div className="f-wrap-between screenWrap">
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Dropdown, Icon, Menu, Pagination, Typography, Popconfirm, Spin } from '
|
|||
import NoneData from '../Nodata';
|
||||
import axios from 'axios';
|
||||
import './order.css';
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
|
@ -187,7 +188,7 @@ class Milepost extends Component {
|
|||
</ul>
|
||||
{
|
||||
data && data.user_admin_or_member ?
|
||||
<Link to={`/${owner}/${projectsId}/milestones/new`} className="topWrapper_btn">新的里程碑</Link>
|
||||
<CheckProfile {...this.props} className="topWrapper_btn" sureFunc={() => {this.props.history.push(`/${owner}/${projectsId}/milestones/new`)}}>新的里程碑</CheckProfile>
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React, { Component } from "react";
|
||||
import { Input, Dropdown, Menu, Icon, Pagination, Spin, DatePicker, Checkbox } from "antd";
|
||||
import { Link } from 'react-router-dom';
|
||||
import "./order.css";
|
||||
import './index.scss';
|
||||
import moment from 'moment';
|
||||
|
||||
import NoneData from "../Nodata";
|
||||
import OrderItem from "./OrderItem";
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
import axios from "axios";
|
||||
|
||||
|
@ -351,9 +351,9 @@ class order extends Component {
|
|||
if(data && data.user_admin_or_member){
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
return(
|
||||
<Link className="topWrapper_btn ml10" target="_blank" to={`/${owner}/${projectsId}/issues/new`}>
|
||||
<CheckProfile {...this.props} className="topWrapper_btn ml10" sureFunc={()=>{window.open(`/${owner}/${projectsId}/issues/new`,'_blank')}}>
|
||||
+ 创建易修
|
||||
</Link>
|
||||
</CheckProfile>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,6 @@
|
|||
}
|
||||
.deleteBox{
|
||||
.ant-modal-header{
|
||||
background-color: rgba(223, 0, 2, 0.06);
|
||||
border-bottom: none;
|
||||
.ant-modal-title{
|
||||
text-align: left;
|
||||
|
|
|
@ -6,6 +6,7 @@ import './Index.scss';
|
|||
import Item from './ListItem';
|
||||
import Right from './RightBox';
|
||||
import NoData from '../Nodata';
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
import { Menu , Pagination , Dropdown , Spin } from 'antd';
|
||||
import axios from 'axios';
|
||||
|
@ -61,8 +62,12 @@ function List(props){
|
|||
)
|
||||
const menu_new=(
|
||||
<Menu>
|
||||
<Menu.Item key="updated_on"><Link to={`/deposit/new/${OIdentifier}`}>新建托管项目</Link></Menu.Item>
|
||||
<Menu.Item key="created_on"><Link to={`/mirror/new/${OIdentifier}`}>新建镜像项目</Link></Menu.Item>
|
||||
<Menu.Item key="updated_on">
|
||||
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/deposit/new/${OIdentifier}`)}}>新建托管项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="created_on">
|
||||
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/mirror/new/${OIdentifier}`)}}>新建镜像项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
)
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ class comments extends Component {
|
|||
content: "",
|
||||
reply_content: undefined,
|
||||
});
|
||||
this.state.new_journal_id = result.data.id;
|
||||
this.getjournalslist(page, limit);
|
||||
this.setState({
|
||||
showFiles: false,
|
||||
content: "",
|
||||
|
@ -86,10 +88,13 @@ class comments extends Component {
|
|||
journal_spin: false,
|
||||
attachment_clean: false,
|
||||
});
|
||||
this.state.new_journal_id = result.data.id;
|
||||
this.getjournalslist(page, limit);
|
||||
}
|
||||
this.props.showNotification(result.data.message);
|
||||
this.setState({
|
||||
journal_spin: false
|
||||
});
|
||||
if(result && result.data.status !== 411){
|
||||
this.props.showNotification(result.data.message);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
|
|
|
@ -218,6 +218,7 @@ ul.ant-menu.menuStyle{
|
|||
border-bottom: 2px solid transparent!important;
|
||||
position: relative;
|
||||
a{
|
||||
font-size: 16px;
|
||||
& >i{
|
||||
font-size: 15px!important;
|
||||
margin-right: 8px;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { Component } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Menu, Input, Spin, Pagination, Popover, Button, Divider } from "antd";
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
import axios from "axios";
|
||||
import ListItem from "../Main/IndexItem";
|
||||
|
@ -115,14 +115,15 @@ class InfosUser extends Component {
|
|||
newItem =()=> (
|
||||
<Menu>
|
||||
<Menu.Item key="created_mirror">
|
||||
<Link to={`/projects/mirror/new`}>新建镜像项目</Link>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>新建镜像项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="created_deposit">
|
||||
<Link to={`/projects/deposit/new`}>新建托管项目</Link>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/deposit/new')}} >新建托管项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
|
||||
category_button=(category)=>{
|
||||
const { current_user, user } = this.props;
|
||||
const button_lists =
|
||||
|
@ -187,7 +188,7 @@ class InfosUser extends Component {
|
|||
{current_user && user && current_user.login === user.login && (
|
||||
<Popover
|
||||
content={this.newItem()}
|
||||
trigger={["click"]}
|
||||
trigger={["hover"]}
|
||||
placement="bottom"
|
||||
className="mr50"
|
||||
>
|
||||
|
|
|
@ -14,4 +14,11 @@
|
|||
.ant-form-item-label{
|
||||
width: 92px;
|
||||
}
|
||||
}
|
||||
.infosRightMenu{
|
||||
.ant-menu-item{
|
||||
a{
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import Search from '../Component/Search';
|
|||
import Item from './Team-item';
|
||||
import Nodata from '../Nodata';
|
||||
import axios from 'axios';
|
||||
import { Link } from 'react-router-dom';
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
|
||||
const limit = 15;
|
||||
function Team(props){
|
||||
|
@ -48,6 +48,7 @@ function Team(props){
|
|||
</Menu>
|
||||
)
|
||||
|
||||
|
||||
return(
|
||||
<div>
|
||||
<div className="headerbox">
|
||||
|
@ -57,7 +58,7 @@ function Team(props){
|
|||
<p>
|
||||
{
|
||||
checkIfLogin() &&
|
||||
<Link to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link>
|
||||
<CheckProfile {...props} sureFunc={()=>{this.props.history.push('/organize/new')}}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</CheckProfile>
|
||||
}
|
||||
<Dropdown overlay={menu}>
|
||||
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
|
||||
|
|
|
@ -155,7 +155,7 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
this.initCommonState(response.data)
|
||||
this.setState({
|
||||
tpmLoading: false,
|
||||
completeProfile:!response.data.profile_completed
|
||||
completeProfile:response.data.profile_completed
|
||||
})
|
||||
if (this.props.match.path === "/" && response.data.login) {
|
||||
this.props.history.push(`/${response.data.login}`);
|
||||
|
@ -226,7 +226,11 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
return (
|
||||
<div className="indexHOC">
|
||||
<EducoderAccount visible={giteaVisible} email={email} onOk={this.onOk}/>
|
||||
<ProfileModal visible={!completeProfile && showCP}/>
|
||||
<ProfileModal
|
||||
visible={!completeProfile && showCP}
|
||||
onCancel={()=>{this.setState({showCP:false})}}
|
||||
history={this.props.history}
|
||||
/>
|
||||
{isRender === true ? <LoginDialog
|
||||
Modifyloginvalue={() => this.hideLoginDialog()}
|
||||
{...this.props}
|
||||
|
|
Loading…
Reference in New Issue