代码库、易修页面未登录状态创建修改跳登录框代码层面优化,之后可实现复用

This commit is contained in:
谢思 2021-11-19 11:11:14 +08:00
parent fe0fab7b61
commit 7934f07cea
5 changed files with 11 additions and 45 deletions

View File

@ -32,7 +32,7 @@ export default ({history}) => {
/>
</div>
:
<i className="iconfont icon-sousuo font-18 ml30" onClick={() => {
<i className="iconfont icon-sousuo font-18 ml30" style={{color:"#a5a5a5"}} onClick={() => {
setOpenSearch(true)
}} />
}

View File

@ -23,7 +23,6 @@ import Nodata from '../Nodata';
import Invite from './sub/Invite';
import CheckProfile from '../Component/ProfileModal/Profile';
import RenderHtml from '../../components/render-html';
import LoginDialog from '../../modules/login/LoginDialog'
/**
* projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能)
*/
@ -70,7 +69,6 @@ function CoderDepot(props){
const [ pullsFlag , setPullsFlag ] = useState(true);
const [ issuesFlag , setIssuesFlag ] = useState(true);
const [ releaseVersions , setReleaseVersions] = useState(undefined);
const [ isRender , setIsRender] = useState(false);//
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
@ -340,16 +338,11 @@ function CoderDepot(props){
})
}
//
function Modifyloginvalue(){
setIsRender(false);
}
function createIssue(){
if(baseOper){
window.open(`/${owner}/${projectsId}/issues/new`,'_blank')
window.open(`/${owner}/${projectsId}/issues/new`,'_blank');
}else{
setIsRender(true);
props.showLoginDialog(`/${owner}/${projectsId}/issues/new`);
}
}
@ -363,12 +356,6 @@ function CoderDepot(props){
return(
<WhiteBack>
{isRender && <LoginDialog
{...props}
isRender={isRender}
Modifyloginvalue={Modifyloginvalue}
goPage={`/${owner}/${projectsId}/issues/new`}
/>}
<UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/>
<Spin spinning={isSpin}>
{

View File

@ -7,7 +7,6 @@ import moment from 'moment';
import NoneData from "../Nodata";
import OrderItem from "./OrderItem";
import CheckProfile from '../Component/ProfileModal/Profile';
import LoginDialog from '../../modules/login/LoginDialog';
import axios from "axios";
@ -73,7 +72,6 @@ class order extends Component {
page: 1,
limit: 15,
},
isRender:false,//是否显示登录弹框
};
}
@ -345,20 +343,13 @@ class order extends Component {
});
};
islogin=()=>{
this.props.showLoginDialog();
}
createIssue = () => {
const { data } = this.state;
const { projectsId , owner } = this.props.match.params;
if(data && data.user_admin_or_member){
window.open(`/${owner}/${projectsId}/issues/new`,'_blank')
window.open(`/${owner}/${projectsId}/issues/new`,'_blank');
}else{
console.log('aaa');
this.setState({
isRender:true,
})
this.props.showLoginDialog(`/${owner}/${projectsId}/issues/new`);
}
}
@ -520,16 +511,8 @@ class order extends Component {
</Menu>
);
//修改登录方法
Modifyloginvalue = () => {
this.setState({
isRender: false,
})
}
render() {
const { current_user } = this.props;
const { projectsId , owner } = this.props.match.params;
const {
issue_chosen,
issues,
@ -546,12 +529,6 @@ class order extends Component {
return (
<div className="main" style={{padding:"0px"}}>
<div style={{padding:"10px 20px 0px 20px"}}>
{this.state.isRender && <LoginDialog
{...this.props}
{...this.state}
Modifyloginvalue={() => this.Modifyloginvalue()}
goPage={`/${owner}/${projectsId}/issues/new`}
/>}
<div className="topWrapper" style={{ paddingTop: "10px" }}>
<ul className="topWrapper_type">
<li>

View File

@ -396,7 +396,7 @@ class LoginDialog extends Component {
isRender: false
})
this.props.Modifyloginvalue(response.data);
this.props.goPage ? window.location.href = this.props.goPage : window.location.reload()
this.props.gopage ? (window.location.href = this.props.gopage) : window.location.reload()
// window.location.reload();
}
}).catch((error) => {

View File

@ -29,7 +29,8 @@ export function TPMIndexHOC(WrappedComponent) {
email:undefined,
completeProfile:false,
showCP:false,
showNotice:true
showNotice:true,
gopage: undefined,
}
}
@ -196,10 +197,11 @@ export function TPMIndexHOC(WrappedComponent) {
})
}
showLoginDialog = () => {
showLoginDialog = (gopage) => {
this.setState({
isRender: true,
isloginCancel: "iscancel"
isloginCancel: "iscancel",
gopage: gopage,
})
}
//验证登录是否成功方法