加入项目、新建项目要判断是否登录

This commit is contained in:
caishi 2022-04-14 17:26:57 +08:00
parent fe8494ec17
commit 6218fe83ed
4 changed files with 11 additions and 20 deletions

View File

@ -8,12 +8,12 @@ function Profile({
showCompeleteDialog ,
completeProfile,
className ,
current_user
current_user,checkIfLogin,showLoginDialog
}) {
const [ giteaVisible , setGiteaVisible ] = useState(false);
function checkProfile() {
if(current_user && current_user.login){
function checkProfile() {
if(checkIfLogin()){
if(!current_user.has_gitea_user || (current_user.has_gitea_user && !current_user.is_sync_pwd)){
setGiteaVisible(true);
}else{
@ -23,6 +23,8 @@ function Profile({
sureFunc();
}
}
}else{
showLoginDialog();
}
}

View File

@ -78,7 +78,7 @@ function AddProjectModal(props){
</Form.Item>
</Form>
</Modal>
<CheckProfile {...props} sureFunc={()=>setVisible(true)}>加入项目</CheckProfile>
<CheckProfile {...props} sureFunc={()=>setVisible(true)}><i class="iconfont icon-jiaruketang1"></i>加入项目</CheckProfile>
</React.Fragment>
)
}

View File

@ -129,13 +129,9 @@ class NewHeader extends Component {
educoderlogin = () => {
//登录账号
if(window.location.pathname === "/"){
window.location.href="/login";
}else{
this.setState({
isRender: true
})
}
this.setState({
isRender: true
})
}
educoderloginysl = () => {
//退出账号时清除登录页面的下次自动登录(用户再次打开登录页面时下次自动登录框不勾选)
@ -362,8 +358,6 @@ class NewHeader extends Component {
}
render() {
const { resetUserInfo ,showNotification,publicNav} = this.props;
const { match } = this.props;
let current_user = this.props.user;
let {
QQVisible,

View File

@ -275,7 +275,6 @@ class Index extends Component {
render() {
const { current_user , mygetHelmetapi } = this.props;
const { projectsList , recommendList , languageList , languageId ,
isSpin, total, search, limit, page, typeList, categoryList ,
recommendOriList , CategoryList , category_id } = this.state;
@ -305,13 +304,9 @@ class Index extends Component {
</span>
</div>
<CheckProfile {...this.props} sureFunc={()=>this.props.history.push("/projects/deposit/new")}>
<i class="iconfont icon-xinjianxiangmu"></i>
<a>新建项目</a>
<i class="iconfont icon-xinjianxiangmu"></i>
</CheckProfile>
<a>
<i class="iconfont icon-jiaruketang1"></i>
<AddProjectModal {...this.props} showNotification={this.props.showNotification}/>
</a>
<AddProjectModal {...this.props} showNotification={this.props.showNotification}/>
<a href="https://data.educoder.net/api/attachments/1955244?disposition=inline" target="_blank">
<i class="iconfont icon-xinshouzhiyin"></i>
</a>