From ccc6cb5d26a86ff050363310471c0c5198d1e5f2 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 9 Jun 2021 11:52:36 +0800 Subject: [PATCH] merge --- src/forge/Component/AddMember.jsx | 2 +- src/forge/Head/Header.js | 162 +++++++----------------------- src/forge/Head/header.scss | 39 +++++++ src/forge/Notice/Notify.jsx | 58 +++++------ src/forge/users/Index.scss | 1 + src/forge/users/Infos.js | 27 +++-- src/forge/users/Material/Base.jsx | 1 + 7 files changed, 120 insertions(+), 170 deletions(-) diff --git a/src/forge/Component/AddMember.jsx b/src/forge/Component/AddMember.jsx index 2c4de6177..f1c14f07f 100644 --- a/src/forge/Component/AddMember.jsx +++ b/src/forge/Component/AddMember.jsx @@ -45,7 +45,7 @@ function AddMember({getID,login}){ src={getImageUrl(`/${item && item.image_url}`)} alt="" /> - + {item.username} ({item.login}) diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 61c0d90d3..8c4cdd15a 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -2,13 +2,12 @@ import React, { Component } from 'react'; import AccountProfile from "../../modules/user/AccountProfile"; import { getImageUrl } from 'educoder' import axios from 'axios'; -import { Modal, Input, message, notification , Dropdown , Menu } from 'antd'; +import { Input , notification , Dropdown , Menu } from 'antd'; import LoginDialog from '../../modules/login/LoginDialog'; import GotoQQgroup from '../../modal/GotoQQgroup' import '../../modules/tpm/TPMIndex.css'; -import logo from '../../modules/tpm/images/logo.png'; import './header.scss'; const $ = window.$ @@ -33,11 +32,9 @@ class NewHeader extends Component { Checkboxteachertype: false, Checkboxteachingtype: false, code_notice: false, - checked_notice: false, RadioGroupvalue: undefined, submitapplications: false, isRender: false, - showSearchOpentype: false, showTrial: false, setevaluatinghides: false, occupation: 0, @@ -45,7 +42,6 @@ class NewHeader extends Component { headtypesonClickbool: false, headtypess: "/", settings: null, - goshowqqgtounp: false, visiblemyss: false, openSearch:false, } @@ -108,7 +104,7 @@ class NewHeader extends Component { } onGlobalSearch=(value,item)=>{ - window.location.href=`${item && item.url}?value=` + value; + window.location.href=`${item}?value=` + value; } openNotification = (messge) => { @@ -130,43 +126,7 @@ class NewHeader extends Component { } } - submitsubmitapplications = () => { - let { - submitapplicationssum, - submitapplicationsvaluedata - } = this.state; - this.setState({ - submitapplications: false, - RadioGroupvalue: undefined - }) - if (submitapplicationssum === 0) { - if (submitapplicationsvaluedata !== undefined) { - window.location.href = "/courses/" + submitapplicationsvaluedata; - } - } else if (submitapplicationssum === 1) { - if (submitapplicationsvaluedata !== undefined) { - window.location.href = "/projects/" + submitapplicationsvaluedata; - } - } - } - hidesubmitapplications = () => { - this.setState({ - Addcoursestypes: false, - tojoinitemtype: false, - tojoinclasstitle: undefined, - rolearr: ["", ""], - Checkboxteacherchecked: false, - Checkboxstudentchecked: false, - Checkboxteachingchecked: false, - Checkboxteachertype: false, - Checkboxteachingtype: false, - code_notice: false, - checked_notice: false, - submitapplications: false, - RadioGroupvalue: undefined - }) - } educoderlogin = () => { //登录账号 this.setState({ @@ -205,23 +165,6 @@ class NewHeader extends Component { }; - hidetojoinclass = () => { - this.setState({ - tojoinclasstype: false, - tojoinitemtype: false, - tojoinclasstitle: undefined, - rolearr: ["", ""], - Checkboxteacherchecked: false, - Checkboxstudentchecked: false, - Checkboxteachingchecked: false, - Checkboxteachertype: false, - Checkboxteachingtype: false, - code_notice: false, - checked_notice: false, - RadioGroupvalue: undefined - }) - } - // 关闭 cancelModulationModels = () => { this.setState({ isRenders: false }) @@ -286,6 +229,7 @@ class NewHeader extends Component { visiblemyss: boll, }) } + geturlsdata = () => { let url = "/setting.json"; axios.get(url).then((response) => { @@ -312,14 +256,6 @@ class NewHeader extends Component { } } - - // 处理弹框 - setgoshowqqgtounp = (bool) => { - this.setState({ - goshowqqgtounp: bool - }) - } - addMenu=(list)=>{ return( list && list.length >0 && @@ -337,19 +273,38 @@ class NewHeader extends Component { ) } + renderMenu=(personal)=>{ + const { current_user } = this.props; + return( + + + {current_user && current_user.username} + + { + personal && personal.length > 0 && personal.map((item,key)=>{ + return( +
  • {item.name}
  • + ) + }) + } + this.educoderloginysl()}>退出 +
    + ) + } + render() { - const { match } = this.props; + const { match} = this.props; let current_user = this.props.user; - let { + let { Addcoursestypes, + tojoinitemtype, + tojoinclasstitle, + code_notice, AccountProfiletype, - submitapplications, - submitapplicationsvalue, user, isRender, headtypesonClickbool, headtypess, settings, - goshowqqgtounp, openSearch, } = this.state; /*用户名称 用户头像url*/ @@ -428,8 +383,8 @@ class NewHeader extends Component { }) } - let search_url = settings && settings.common && settings.common.length> 0 && settings.common.filter(item=>item.name==="搜索"); - let notice_url = settings && settings.common && settings.common.length> 0 && settings.common.filter(item=>item.name==="通知"); + let search_url = settings && settings.common && settings.common.search; + let notice_url = settings && settings.common && settings.common.notice; return (
    @@ -446,11 +401,6 @@ class NewHeader extends Component { {...this.props} {...this.state} /> : ""} - { - goshowqqgtounp === true ? - this.setgoshowqqgtounp(bool)}> - :"" - } { settings && settings.nav_logo_url ? @@ -497,7 +447,7 @@ class NewHeader extends Component { }
    - {search_url && search_url.length>0 ? this.SearchInput(openSearch,search_url[0]):""} + {search_url ? this.SearchInput(openSearch,search_url):""} { current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)? @@ -505,10 +455,10 @@ class NewHeader extends Component { :"" } - {this.props.user && this.props.user.login && (notice_url && notice_url.length>0) ? + {this.props.user && this.props.user.login && notice_url ?
    {user && user.login && - + @@ -516,32 +466,6 @@ class NewHeader extends Component { }
    :"" } - -
    -
    - -
    -
    -
    {!user || (user && !user.login) ? @@ -552,25 +476,11 @@ class NewHeader extends Component { } : -
    - - - + + + 头像 -
      -
    • {this.props.current_user.username}
    • - { - settings && settings.personal && settings.personal.length > 0 && settings.personal.map((item,key)=>{ - return( -
    • {item.name}
    • - ) - }) - } -
    • - this.educoderloginysl()}>退出 -
    • -
    -
    + }
    diff --git a/src/forge/Head/header.scss b/src/forge/Head/header.scss index 0ae8f48e2..507262e37 100644 --- a/src/forge/Head/header.scss +++ b/src/forge/Head/header.scss @@ -14,6 +14,45 @@ border:none; } } +.currentImg{ + width: 34px; + height: 34px; + border-radius: 50%; + margin-left: 30px; +} +.currentMenu{ + width: 120px; + text-align: center; + padding:0px; + li{ + height: 40px; + line-height: 40px; + padding:0px; + cursor: default; + &:hover{ + background-color: #fff; + } + &:first-child{ + border-bottom: 1px solid #eee; + } + &:last-child{ + border-top: 1px solid #eee; + a{ + border-radius: 0px 0px 4px 4px; + } + } + a{ + padding:0px; + margin:0px; + display: block; + color: #666; + &:hover{ + color: #fff; + background: #4CACFF; + } + } + } +} .newFooter { position: absolute; diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index c68271b38..3aad55ae5 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -58,37 +58,37 @@ function Notify(props){
    { - list && list.length > 0 ? -
      - { - list.map((i,k)=>{ - return( -
    • - -
      -

      - {i.applied_user && i.applied_user.name} - {i.time_ago} -

      - {renderStatus(i.status,i.applied)} -
      -
    • - ) - }) - } -
    - : - "" - } + list && list.length > 0 ? +
      + { + list.map((i,k)=>{ + return( +
    • + +
      +

      + {i.applied_user && i.applied_user.name} + {i.time_ago} +

      + {renderStatus(i.status,i.applied)} +
      +
    • + ) + }) + } +
    + : + "" + } + {list && list.length === 0 && } + { + total > limit && +
    + {setPage(p)}}/> +
    + }
    - {list && list.length === 0 && } - { - total > limit && -
    - {setPage(p)}}/> -
    - } ) } diff --git a/src/forge/users/Index.scss b/src/forge/users/Index.scss index d1821c47f..b35d45850 100644 --- a/src/forge/users/Index.scss +++ b/src/forge/users/Index.scss @@ -104,6 +104,7 @@ $flex:flex; margin:10px 0px; word-break: break-all; text-align: justify; + font-size: 16px; } .focusBox,.infoBox{ width: 100%!important; diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 6317bff59..77ab795a1 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -79,7 +79,7 @@ class Infos extends Component { this.setState({menuKey:"1",route_type:undefined}); }else if(pathname.indexOf(`/users/${username}/projects`)>-1){ this.setState({menuKey:"2",route_type:undefined}); - }else if(pathname === `/users/${username}/notice`){ + }else if(pathname.indexOf(`/users/${username}/notice`)>-1){ this.setState({menuKey:"3",route_type:undefined}); }else if(pathname.indexOf(`/users/${username}/devops`)>-1){ this.setState({menuKey:"4",route_type:undefined}); @@ -183,18 +183,17 @@ class Infos extends Component { this.props.history.push(`/users/${user && user.login}/organizes`) } - resetUser=(data)=>{ - this.setState({ - user:data - }) + resetUser=()=>{ + const { resetUserInfo } = this.props; + + this.fetchUser(); + resetUserInfo && resetUserInfo(); } - render() { - const { current_user, mygetHelmetapi } = this.props; + const { current_user, mygetHelmetapi , resetUserInfo } = this.props; const { username } = this.props.match.params; const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state; - return (
    @@ -214,7 +213,7 @@ class Infos extends Component { -
    +
    {user && user.username}
    @@ -268,9 +267,9 @@ class Infos extends Component { { user && (user.province || user.custom_department || user.email) ?
    - { user.province &&
    {user.province}{user.city}
    } - { user.custom_department &&
    {user.custom_department}
    } - { user.email &&
    {user.email}
    } + { user.province &&
    {user.province}{user.city}
    } + { user.custom_department &&
    {user.custom_department}
    } + { user.email &&
    {user.email}
    }
    :"" } @@ -301,7 +300,7 @@ class Infos extends Component { { - return ; + return ; }} > { - return ; + return ; }} > {}) }