This commit is contained in:
caishi 2021-06-09 11:52:36 +08:00
parent 0661c6b932
commit ccc6cb5d26
7 changed files with 120 additions and 170 deletions

View File

@ -45,7 +45,7 @@ function AddMember({getID,login}){
src={getImageUrl(`/${item && item.image_url}`)} src={getImageUrl(`/${item && item.image_url}`)}
alt="" alt=""
/> />
<span className="ml10" style={{ "vertical-align": "middle" }}> <span className="ml10" style={{ verticalAlign: "middle" }}>
{item.username} {item.username}
<span className="color-grey ml10">({item.login})</span> <span className="color-grey ml10">({item.login})</span>
</span> </span>

View File

@ -2,13 +2,12 @@ import React, { Component } from 'react';
import AccountProfile from "../../modules/user/AccountProfile"; import AccountProfile from "../../modules/user/AccountProfile";
import { getImageUrl } from 'educoder' import { getImageUrl } from 'educoder'
import axios from 'axios'; 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 LoginDialog from '../../modules/login/LoginDialog';
import GotoQQgroup from '../../modal/GotoQQgroup' import GotoQQgroup from '../../modal/GotoQQgroup'
import '../../modules/tpm/TPMIndex.css'; import '../../modules/tpm/TPMIndex.css';
import logo from '../../modules/tpm/images/logo.png';
import './header.scss'; import './header.scss';
const $ = window.$ const $ = window.$
@ -33,11 +32,9 @@ class NewHeader extends Component {
Checkboxteachertype: false, Checkboxteachertype: false,
Checkboxteachingtype: false, Checkboxteachingtype: false,
code_notice: false, code_notice: false,
checked_notice: false,
RadioGroupvalue: undefined, RadioGroupvalue: undefined,
submitapplications: false, submitapplications: false,
isRender: false, isRender: false,
showSearchOpentype: false,
showTrial: false, showTrial: false,
setevaluatinghides: false, setevaluatinghides: false,
occupation: 0, occupation: 0,
@ -45,7 +42,6 @@ class NewHeader extends Component {
headtypesonClickbool: false, headtypesonClickbool: false,
headtypess: "/", headtypess: "/",
settings: null, settings: null,
goshowqqgtounp: false,
visiblemyss: false, visiblemyss: false,
openSearch:false, openSearch:false,
} }
@ -108,7 +104,7 @@ class NewHeader extends Component {
} }
onGlobalSearch=(value,item)=>{ onGlobalSearch=(value,item)=>{
window.location.href=`${item && item.url}?value=` + value; window.location.href=`${item}?value=` + value;
} }
openNotification = (messge) => { 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 = () => { educoderlogin = () => {
//登录账号 //登录账号
this.setState({ 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 = () => { cancelModulationModels = () => {
this.setState({ isRenders: false }) this.setState({ isRenders: false })
@ -286,6 +229,7 @@ class NewHeader extends Component {
visiblemyss: boll, visiblemyss: boll,
}) })
} }
geturlsdata = () => { geturlsdata = () => {
let url = "/setting.json"; let url = "/setting.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
@ -312,14 +256,6 @@ class NewHeader extends Component {
} }
} }
// 处理弹框
setgoshowqqgtounp = (bool) => {
this.setState({
goshowqqgtounp: bool
})
}
addMenu=(list)=>{ addMenu=(list)=>{
return( return(
list && list.length >0 && list && list.length >0 &&
@ -337,19 +273,38 @@ class NewHeader extends Component {
) )
} }
renderMenu=(personal)=>{
const { current_user } = this.props;
return(
<Menu className="currentMenu">
<Menu.Item>
<span title={current_user && current_user.username}>{current_user && current_user.username}</span>
</Menu.Item>
{
personal && personal.length > 0 && personal.map((item,key)=>{
return(
<li key={key}><a href={item.url} target="_blank">{item.name}</a></li>
)
})
}
<Menu.Item><a onClick={() => this.educoderloginysl()}>退出</a></Menu.Item>
</Menu>
)
}
render() { render() {
const { match } = this.props; const { match} = this.props;
let current_user = this.props.user; let current_user = this.props.user;
let { let { Addcoursestypes,
tojoinitemtype,
tojoinclasstitle,
code_notice,
AccountProfiletype, AccountProfiletype,
submitapplications,
submitapplicationsvalue,
user, user,
isRender, isRender,
headtypesonClickbool, headtypesonClickbool,
headtypess, headtypess,
settings, settings,
goshowqqgtounp,
openSearch, openSearch,
} = this.state; } = this.state;
/*用户名称 用户头像url*/ /*用户名称 用户头像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 search_url = settings && settings.common && settings.common.search;
let notice_url = settings && settings.common && settings.common.length> 0 && settings.common.filter(item=>item.name==="通知"); let notice_url = settings && settings.common && settings.common.notice;
return ( return (
<div className="newHeaders" id="nHeader"> <div className="newHeaders" id="nHeader">
<div className="headerContent"> <div className="headerContent">
@ -446,11 +401,6 @@ class NewHeader extends Component {
{...this.props} {...this.props}
{...this.state} {...this.state}
/> : ""} /> : ""}
{
goshowqqgtounp === true ?
<GotoQQgroup {...this.state} {...this.props} setgoshowqqgtounp={(bool) => this.setgoshowqqgtounp(bool)}></GotoQQgroup>
:""
}
{ {
settings && settings.nav_logo_url ? settings && settings.nav_logo_url ?
<a href={settings && settings.new_course.default_url} className={"fl mr50"} style={{minWidth:"45px"}}> <a href={settings && settings.new_course.default_url} className={"fl mr50"} style={{minWidth:"45px"}}>
@ -497,7 +447,7 @@ class NewHeader extends Component {
} }
</div> </div>
<div className="head-right"> <div className="head-right">
{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)? current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)?
<Dropdown overlay={this.addMenu(settings && settings.add)} placement="bottomRight"> <Dropdown overlay={this.addMenu(settings && settings.add)} placement="bottomRight">
@ -505,10 +455,10 @@ class NewHeader extends Component {
</Dropdown>:"" </Dropdown>:""
} }
{this.props.user && this.props.user.login && (notice_url && notice_url.length>0) ? {this.props.user && this.props.user.login && notice_url ?
<div className="ml30 edu-menu-panel"> <div className="ml30 edu-menu-panel">
{user && user.login && {user && user.login &&
<a href={`${notice_url[0].url}`} style={{ position: 'relative' }}> <a href={`${notice_url}`} style={{ position: 'relative' }}>
<i className="iconfont icon-xiaoxilingdang color-grey-6"></i> <i className="iconfont icon-xiaoxilingdang color-grey-6"></i>
<span className="newslight" style={{ display: this.props.Headertop === undefined ? "none" : this.props.Headertop.new_message === true ? "block" : "none" }}> <span className="newslight" style={{ display: this.props.Headertop === undefined ? "none" : this.props.Headertop.new_message === true ? "block" : "none" }}>
</span> </span>
@ -516,32 +466,6 @@ class NewHeader extends Component {
} }
</div>:"" </div>:""
} }
<Modal
keyboard={false}
title="提示"
visible={submitapplications}
closable={false}
footer={null}
>
<div className="task_popup_con ml30">
<div className="mr15">
<ul>
<div className="task-popup-content">
<p className="task-popup-text-center font-16">
{submitapplicationsvalue}
</p>
</div>
<li className="clearfix mt10 edu-txt-center">
<a className="task-btn mr10"
onClick={this.hidesubmitapplications}>取消</a>
<a
className="task-btn task-btn-orange ml20"
onClick={this.submitsubmitapplications}>确定</a>
</li>
</ul>
</div>
</div>
</Modal>
</div> </div>
{!user || (user && !user.login) ? {!user || (user && !user.login) ?
<span className="font-15 ml30"> <span className="font-15 ml30">
@ -552,25 +476,11 @@ class NewHeader extends Component {
} }
</span> </span>
: :
<div className="ml30 edu-menu-panel" style={{ height: "70px", lineHeight: "70px" }}> <Dropdown placement={`bottomRight`} overlay={this.renderMenu(settings && settings.personal)}>
<a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}> <a href={`/users/${this.props.current_user && this.props.current_user.login}`}>
<img alt="头像" className="radius" height="34" id="nh_user_logo" name="avatar_image" src={getImageUrl(`/${user.image_url}`)} width="34"> <img alt="头像" src={getImageUrl(`/${user.image_url}`)} className="currentImg"></img>
</img>
</a> </a>
<ul className="edu-menu-list" style={{ top: '60px', textAlign: 'center' }}> </Dropdown>
<li className="bor-bottom-greyE" style={{cursor:"default",background:"#fff"}}>{this.props.current_user.username}</li>
{
settings && settings.personal && settings.personal.length > 0 && settings.personal.map((item,key)=>{
return(
<li key={key}><a href={item.url} target="_blank">{item.name}</a></li>
)
})
}
<li className="bor-top-greyE">
<a onClick={() => this.educoderloginysl()}>退出</a>
</li>
</ul>
</div>
} }
</div> </div>
</div> </div>

View File

@ -14,6 +14,45 @@
border:none; 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 { .newFooter {
position: absolute; position: absolute;

View File

@ -58,37 +58,37 @@ function Notify(props){
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
<div style={{minHeight:"400px"}}> <div style={{minHeight:"400px"}}>
{ {
list && list.length > 0 ? list && list.length > 0 ?
<ul className="notifyList"> <ul className="notifyList">
{ {
list.map((i,k)=>{ list.map((i,k)=>{
return( return(
<li> <li>
<Link to={`/users/${i.login}`}><img src={getImageUrl(`/${i.applied_user && i.applied_user.image_url}`)} alt="" className="notifyImg"/></Link> <Link to={`/users/${i.login}`}><img src={getImageUrl(`/${i.applied_user && i.applied_user.image_url}`)} alt="" className="notifyImg"/></Link>
<div className="notifyFlex"> <div className="notifyFlex">
<p className="notifyInfos"> <p className="notifyInfos">
<Link to={`/users/${i.applied_user && i.applied_user.login}`} className="font-15 mr20">{i.applied_user && i.applied_user.name}</Link> <Link to={`/users/${i.applied_user && i.applied_user.login}`} className="font-15 mr20">{i.applied_user && i.applied_user.name}</Link>
<span className="color-grey-9">{i.time_ago}</span> <span className="color-grey-9">{i.time_ago}</span>
</p> </p>
{renderStatus(i.status,i.applied)} {renderStatus(i.status,i.applied)}
</div> </div>
</li> </li>
) )
}) })
} }
</ul> </ul>
: :
"" ""
} }
{list && list.length === 0 && <Nodata _html="暂无通知" />}
{
total > limit &&
<div className="edu-txt-center pt20 pb20">
<Pagination simple pageSize={limit} total={total} current={page} onChange={(p)=>{setPage(p)}}/>
</div>
}
</div> </div>
</Spin> </Spin>
{list && list.length === 0 && <Nodata _html="暂无通知" />}
{
total > limit &&
<div className="edu-txt-center pt20 pb20">
<Pagination simple pageSize={limit} total={total} current={page} onChange={(p)=>{setPage(p)}}/>
</div>
}
</div> </div>
) )
} }

View File

@ -104,6 +104,7 @@ $flex:flex;
margin:10px 0px; margin:10px 0px;
word-break: break-all; word-break: break-all;
text-align: justify; text-align: justify;
font-size: 16px;
} }
.focusBox,.infoBox{ .focusBox,.infoBox{
width: 100%!important; width: 100%!important;

View File

@ -79,7 +79,7 @@ class Infos extends Component {
this.setState({menuKey:"1",route_type:undefined}); this.setState({menuKey:"1",route_type:undefined});
}else if(pathname.indexOf(`/users/${username}/projects`)>-1){ }else if(pathname.indexOf(`/users/${username}/projects`)>-1){
this.setState({menuKey:"2",route_type:undefined}); 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}); this.setState({menuKey:"3",route_type:undefined});
}else if(pathname.indexOf(`/users/${username}/devops`)>-1){ }else if(pathname.indexOf(`/users/${username}/devops`)>-1){
this.setState({menuKey:"4",route_type:undefined}); this.setState({menuKey:"4",route_type:undefined});
@ -183,18 +183,17 @@ class Infos extends Component {
this.props.history.push(`/users/${user && user.login}/organizes`) this.props.history.push(`/users/${user && user.login}/organizes`)
} }
resetUser=(data)=>{ resetUser=()=>{
this.setState({ const { resetUserInfo } = this.props;
user:data
}) this.fetchUser();
resetUserInfo && resetUserInfo();
} }
render() { render() {
const { current_user, mygetHelmetapi } = this.props; const { current_user, mygetHelmetapi , resetUserInfo } = this.props;
const { username } = this.props.match.params; const { username } = this.props.match.params;
const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state; const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state;
return ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
@ -214,7 +213,7 @@ class Infos extends Component {
</span> </span>
</span> </span>
<div className="text-center mt15 font-16 fwb"> <div className="text-center mt15 font-24 task-hide" title={user && user.username}>
{user && user.username} {user && user.username}
</div> </div>
<div className="userDescription"> <div className="userDescription">
@ -268,9 +267,9 @@ class Infos extends Component {
{ {
user && (user.province || user.custom_department || user.email) ? user && (user.province || user.custom_department || user.email) ?
<div className="infoBox"> <div className="infoBox">
{ user.province && <div><i className="iconfont icon-weizhi"></i><span>{user.province}</span><span>{user.city}</span></div> } { user.province && <div><i className="iconfont icon-weizhi"></i><span>{user.province}</span><span title={user.city}>{user.city}</span></div> }
{ user.custom_department && <div><i className="iconfont icon-danwei"></i><span>{user.custom_department}</span></div> } { user.custom_department && <div><i className="iconfont icon-danwei"></i><span title={user.custom_department}>{user.custom_department}</span></div> }
{ user.email && <div><i className="iconfont icon-youxiangrenzheng"></i><span>{user.email}</span></div> } { user.email && <div><i className="iconfont icon-youxiangrenzheng"></i><span title={user.email}>{user.email}</span></div> }
</div> </div>
:"" :""
} }
@ -301,7 +300,7 @@ class Infos extends Component {
<Route <Route
path="/users/:username/watchers" path="/users/:username/watchers"
render={() => { render={() => {
return <WatchsUser {...this.props} {...this.state} userType="watchers" />; return <WatchsUser {...this.props} {...this.state} userType="watchers" fetchUser={this.fetchUser}/>;
}} }}
></Route> ></Route>
<Route <Route
@ -313,7 +312,7 @@ class Infos extends Component {
<Route <Route
path="/users/:username/fan_users" path="/users/:username/fan_users"
render={() => { render={() => {
return <FanUser {...this.props} {...this.state} userType="fan_users"/>; return <FanUser {...this.props} {...this.state} userType="fan_users" fetchUser={this.fetchUser}/>;
}} }}
></Route> ></Route>
<Route <Route

View File

@ -45,6 +45,7 @@ export default Form.create()(
if(result && result.data){ if(result && result.data){
props.showNotification("资料修改成功!") props.showNotification("资料修改成功!")
resetUser && resetUser(result.data); resetUser && resetUser(result.data);
props.history.push(`/users/${username}`)
} }
}).catch(error=>{}) }).catch(error=>{})
} }