修改资料+密码管理

This commit is contained in:
caishi 2021-06-04 09:43:38 +08:00
parent 8a968fbf04
commit 9feeaafaa2
5 changed files with 75 additions and 57 deletions

View File

@ -25,7 +25,7 @@ if (isDev) {
}
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student'
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {

View File

@ -462,7 +462,7 @@ class Detail extends Component {
firstSync ? "":
<span className="df mt25">
{
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
current_user && current_user.login && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
}
<span className="detail_tag_btn">
@ -639,11 +639,6 @@ class Detail extends Component {
}
></Route>
{/* 新建合并请求 */}
<Route path="/projects/:owner/:projectsId/pulls/new/:branch"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/new"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)

View File

@ -48,6 +48,7 @@ function Index(props) {
//
function chooseTime(data) {
if(data){
setPage(1);
setActivityDate(data[0]);
}
}

View File

@ -1,6 +1,6 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
import { Avatar, Tag, Button, Spin , Menu } from "antd";
import { Button, Spin , Menu } from "antd";
import FocusButton from "../UsersList/focus_button";
import axios from "axios";
@ -14,7 +14,10 @@ import './Index.scss';
import Loadable from "react-loadable";
import Loading from "../../Loading";
const UpdateInfo = Loadable({
loader: () => import("./Material/Index"),
loading: Loading,
});
const InfosDevOps = Loadable({
loader: () => import("./devOpsCI"),
loading: Loading,
@ -86,6 +89,8 @@ class Infos extends Component {
this.setState({menuKey:undefined,route_type:"watchers"});
}else if(pathname === `/users/${username}/fan_users`){
this.setState({menuKey:undefined,route_type:"fan_users"});
}else{
this.setState({menuKey:undefined,route_type:undefined});
}
}
@ -123,41 +128,25 @@ class Infos extends Component {
const { notice } = this.state;
let url = `/users/${username || (current_user && current_user.login)}.json`;
axios
.get(url)
.then((result) => {
let e = result.data && result.data.undo_events;
let p = result.data && result.data.undo_messages;
let n = notice || pathname === `/users/${username}/notice` ;
this.setState({
user: result.data,
isSpin: false,
undo_events:n ? (e-p) : e,
undo_messages:0,
notice:n
});
})
.catch((error) => {
this.setState({
isSpin: false,
});
axios.get(url).then((result) => {
let e = result.data && result.data.undo_events;
let p = result.data && result.data.undo_messages;
let n = notice || pathname === `/users/${username}/notice` ;
this.setState({
user: result.data,
isSpin: false,
undo_events:n ? (e-p) : e,
undo_messages:0,
notice:n
});
})
.catch((error) => {
this.setState({
isSpin: false,
});
});
};
// change_project_type = (type) => {
// const {user} = this.state
// this.setState({
// project_type: type ,
// route_type: undefined
// })
// let url = `/users/${user && user.login}`
// if (type){
// url = `/users/${user && user.login}/projects/${type}`
// }
// this.props.history.push(url)
// };
change_devops_type=(type)=>{
const {user} = this.state;
this.setState({
@ -194,39 +183,51 @@ class Infos extends Component {
this.props.history.push(`/users/${user && user.login}/organizes`)
}
resetUser=(data)=>{
this.setState({
user:data
})
}
render() {
const { current_user, mygetHelmetapi } = this.props;
const { username } = this.props.match.params;
const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state;
return (
<div className="newMain clearfix">
<Spin spinning={isSpin}>
<div className="new-content-flex">
<div className="list-left" style={{border:"none"}}>
<div className="bgcF">
<div className="list-l-Menu text-center pd20">
<Avatar size={110} src={getImageUrl(`/${user && user.image_url}`)} />
{user && user.user_identity && (
<div className="mt-n15 position-relative">
<Tag color="#FF6E21" style={{marginRight:"0px"}}>{user && user.user_identity}</Tag>
</div>
)}
<div className="list-l-Menu text-center" style={{padding:"20px 25px"}}>
<span className="headimg">
<img src={getImageUrl(`/${user && user.image_url}`)} alt=""/>
<span>
{
user && user.gender===1?
<i className="iconfont icon-nan"></i>
:
<i className="iconfont icon-nv"></i>
}
</span>
</span>
<div className="text-center mt15 font-16 fwb">
{user && user.username}
</div>
<div className="userDescription">
{user && user.description}
</div>
<div>
{user && current_user && user.login === current_user.login && (
<div className="user-info-star-button ">
<Button
block
className="text-button-grey"
href={`${
mygetHelmetapi &&mygetHelmetapi.new_course&&
mygetHelmetapi.new_course.edit_account
}`}
target="_blank"
onClick={()=>this.props.history.push(`/users/${user.login}/info`)}
type="primary"
>
{" "}
<i className="iconfont icon-shezhi4 font-15 mr5"></i>
@ -246,7 +247,7 @@ class Infos extends Component {
</div>
)}
</div>
<div className="width100 inline-block mt20">
<div className="focusBox">
<Link
to={`/users/${user && user.login}/watchers`}
className={`with50 text-center pull-left ${route_type === "watchers" ? "text-primary" : ""}`}
@ -264,11 +265,20 @@ class Infos extends Component {
<span>{user && user.watched_count}</span>
</Link>
</div>
{
user && (user.province || user.custom_department || user.email) ?
<div className="infoBox">
{ user.province && <div><i className="iconfont icon-weizhi"></i><span>{user.province}</span><span>{user.city}</span></div> }
{ user.custom_department && <div><i className="iconfont icon-danwei"></i><span>{user.custom_department}</span></div> }
{ user.email && <div><i className="iconfont icon-youxiangrenzheng"></i><span>{user.email}</span></div> }
</div>
:""
}
</div>
</div>
</div>
<div className="list-right">
{ !route_type &&
{ !route_type && menuKey &&
<Menu selectedKeys={[menuKey]} mode={`horizontal`} className="infosRightMenu">
<Menu.Item key="0"><Link to={`/users/${user && user.login}`}><i className="iconfont icon-gailan"></i></Link></Menu.Item>
<Menu.Item key="1"><Link to={`/users/${user && user.login}/statistics`}><i className="iconfont icon-shujutongji"></i></Link></Menu.Item>
@ -330,6 +340,19 @@ class Infos extends Component {
return <Organize {...this.props} {...this.state} />;
}}
></Route>
<Route
path="/users/:username/info"
render={() => {
return <UpdateInfo {...this.props} {...this.state} resetUser={this.resetUser}/>;
}}
></Route>
<Route
path="/users/:username/password"
render={() => {
return <UpdateInfo {...this.props} {...this.state}/>;
}}
></Route>
<Route
path="/users/:username/statistics"
render={(props) => {

View File

@ -43,7 +43,6 @@ export default Form.create()(
}
Axios.put(url,params).then(result=>{
if(result && result.data){
props.showNotification("资料修改成功!")
resetUser && resetUser(result.data);
}
}).catch(error=>{})