密码同步弹框出现条件

This commit is contained in:
caishi 2021-08-02 18:22:15 +08:00
parent e4d4d93e5e
commit 1155d7f7c6
10 changed files with 98 additions and 12 deletions

View File

@ -2,7 +2,7 @@ import React , {forwardRef, useEffect} from 'react';
import { Modal , Form , Input , Button } from 'antd';
import './EAccount.scss';
function EducoderAccount({form , visible , onOk , email}){
function EducoderAccount({form , visible , onOk , email , onCancel , match , unReload}){
const { getFieldDecorator, validateFields , setFieldsValue } = form;
useEffect(()=>{
@ -22,6 +22,10 @@ function EducoderAccount({form , visible , onOk , email}){
labelCol: { span: 5 },
wrapperCol: { span: 18 },
};
function Cancel() {
onCancel();
}
return(
<Modal
visible={visible}
@ -29,7 +33,10 @@ function EducoderAccount({form , visible , onOk , email}){
width="500px"
closable={false}
footer={
<Button type="primary" onClick={onSure}>确定</Button>
<div>
<Button onClick={Cancel}>暂不绑定随便看看</Button>
<Button type="primary" onClick={onSure}>绑定邮箱</Button>
</div>
}
centered
>

View File

@ -33,6 +33,14 @@ const Params = Loadable({
export default ((props)=>{
useEffect(()=>{
const { projectsId , owner } = props.match.params;
const { giteaVisible , showEABox } = props;
if(giteaVisible){
showEABox && showEABox(`/projects/${owner}/${projectsId}`);
}
},[])
return(
<WhiteBack className="opsPanel">
<Switch {...props}>

View File

@ -359,10 +359,14 @@ class Detail extends Component {
forkFunc = () => {
const { platform } = this.state;
if(!platform)return;
const { current_user , giteaVisible , showEABox } = this.props;
if(giteaVisible){
showEABox && showEABox();
return;
}
this.setState({
forkSpin:true
})
const { current_user } = this.props
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/forks.json`;
axios.post(url).then(result => {

View File

@ -32,12 +32,16 @@ class NewMerge extends Component {
}
componentDidMount = () => {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
this.getmergelist(projectsId);
// 监听回退事件
if (window.history && window.history.pushState) {
window.addEventListener('popstate', this.handleBack, false);
}
const { giteaVisible , showEABox } = this.props;
if(giteaVisible){
showEABox && showEABox(`/projects/${owner}/${projectsId}/pulls`);
}
};
componentDidUpdate=(preProps)=>{

View File

@ -48,6 +48,10 @@ class Index extends Component {
}
}
componentDidMount = () => {
const { giteaVisible , showEABox } = this.props;
if(giteaVisible){
showEABox && showEABox('/projects');
}
// 获取拥有者列表
this.getOwner();
// 获取项目类别
@ -272,7 +276,6 @@ class Index extends Component {
const { getFieldDecorator } = this.props.form;
// 项目类型deposit-托管项目mirror-镜像项目
const { projectsType } = this.props.match.params;
const {
CategoryList,
LanguageList,

View File

@ -14,6 +14,14 @@ class Index extends Component {
};
}
componentDidMount=()=>{
const { projectsId , owner } = this.props.match.params;
const { giteaVisible , showEABox } = this.props;
if(giteaVisible){
showEABox && showEABox(`/projects/${owner}/${projectsId}`);
}
}
// 命名文件
changeFileName = (e) => {
this.setState({

View File

@ -15,6 +15,14 @@ class UploadFile extends Component {
};
}
componentDidMount=()=>{
const { projectsId , owner } = this.props.match.params;
const { giteaVisible , showEABox } = this.props;
if(giteaVisible){
showEABox && showEABox(`/projects/${owner}/${projectsId}`);
}
}
// 获取上传后的文件id数组
UploadFunc = (fileList) => {
this.setState({

View File

@ -1,4 +1,4 @@
import React, { Component } from "react";
import React, { Component, useEffect } from "react";
import { Link, Route, Switch } from "react-router-dom";
import "../css/index.scss";
@ -37,11 +37,22 @@ const ManageNew = Loadable({
loading: Loading,
});
class Index extends Component {
componentDidMount = () => {
const { projectsId , owner } = this.props.match.params;
const { giteaVisible , showEABox } = this.props;
if(giteaVisible){
showEABox && showEABox(`/projects/${owner}/${projectsId}`);
}
}
render() {
const { projectsId , owner } = this.props.match.params;
const { pathname } = this.props.history.location;
const flag = pathname === `/projects/${owner}/${projectsId}/setting`;
return (
<Box className="ProjectListIndex">
<Short>

View File

@ -15,7 +15,7 @@ const { Option } = AutoComplete;
export default Form.create()(
forwardRef(
(
{ form, projectDetail , match, showNotification, history },
{ form, projectDetail , match, showNotification, history , giteaVisible , showEABox },
ref
) => {
const { getFieldDecorator, validateFields, setFieldsValue } = form;
@ -29,6 +29,13 @@ export default Form.create()(
const repo_id = projectDetail && projectDetail.repo_id;
const { projectsId, versionId , owner } = match.params;
useEffect(()=>{
if(giteaVisible){
showEABox && showEABox(`/projects/${owner}/${projectsId}/releases`);
}
},[])
useEffect(()=>{
getBranchs(projectsId,owner);
},[projectsId])

View File

@ -25,7 +25,9 @@ export function TPMIndexHOC(WrappedComponent) {
mygetHelmetapi: null,
giteaVisible:false,
email:undefined,
is_sync_pwd:undefined
is_sync_pwd:undefined,
EAVisible:false,
unReload:{}
}
}
@ -198,7 +200,7 @@ export function TPMIndexHOC(WrappedComponent) {
}).then(result=>{
if(result && result.data && result.data.status === 0){
this.setState({
giteaVisible:false,
EAVisible:false,
email:undefined
})
window.location.reload();
@ -206,17 +208,41 @@ export function TPMIndexHOC(WrappedComponent) {
}).catch(error=>{})
}
onCancel=()=>{
const {unReload} = this.state;
this.setState({
EAVisible:false
})
unReload && this.props.history.push(unReload);
}
showEABox=(url)=>{
this.setState({
EAVisible:true,
unReload:url
})
}
render() {
let { isRender , current_user , giteaVisible , email } = this.state;
let { isRender , current_user , giteaVisible , email , EAVisible , unReload } = this.state;
const common = {
showLoginDialog: this.showLoginDialog,
showEABox:this.showEABox,
checkIfLogin: this.checkIfLogin,
resetUserInfo:this.fetchUsers
resetUserInfo:this.fetchUsers,
giteaVisible
};
return (
<div className="indexHOC">
<EducoderAccount visible={giteaVisible} email={email} onOk={this.onOk}/>
<EducoderAccount
visible={giteaVisible && EAVisible}
email={email}
onOk={this.onOk}
onCancel={this.onCancel}
match={this.props.match}
unReload={unReload}
/>
{isRender === true ? <LoginDialog
Modifyloginvalue={() => this.hideLoginDialog()}
{...this.props}