diff --git a/src/AppConfig.js b/src/AppConfig.js index 034612ece..a9853e2ac 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -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) { diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index f991cc23f..5be749510 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -401,6 +401,7 @@ class Detail extends Component { const urlFlag = (urlArr.length === 3); const { projectsId , owner } = this.props.match.params; + const { current_user } = this.props; let pathname = checkPathname(projectsId,owner,url); const { state } = this.props.history.location; @@ -461,8 +462,8 @@ class Detail extends Component { firstSync ? "": { - projectDetail && projectDetail.type && projectDetail.type === 2 ? - 同步镜像 : "" + current_user && current_user.login && (projectDetail && projectDetail.type && projectDetail.type === 2) ? + 同步镜像 : "" } this.focusFunc(watched)}> diff --git a/src/forge/Utils/locData.js b/src/forge/Utils/locData.js index f1d38dbf3..5ebba6ccb 100644 --- a/src/forge/Utils/locData.js +++ b/src/forge/Utils/locData.js @@ -5338,10 +5338,10 @@ export const locData = Array.from(province.keys()).map(p=>({ label:p, children:Array.from(province.get(p).keys()).map((c,key)=>({ value:c, - label:c, - children:Array.from(area.keys())[key].map(a=>({ - value:a, - label:a, - })) + label:c, + // children:Array.from(area.keys())[key].map(a=>({ + // value:a, + // label:a, + // })) })) })); \ No newline at end of file diff --git a/src/forge/users/GeneralView/Index.jsx b/src/forge/users/GeneralView/Index.jsx index 47760da59..ded435827 100644 --- a/src/forge/users/GeneralView/Index.jsx +++ b/src/forge/users/GeneralView/Index.jsx @@ -48,6 +48,7 @@ function Index(props) { // 在贡献度日历表中选择一个时间 function chooseTime(data) { if(data){ + setPage(1); setActivityDate(data[0]); } } diff --git a/src/forge/users/Index.scss b/src/forge/users/Index.scss index bb49baa6e..d1821c47f 100644 --- a/src/forge/users/Index.scss +++ b/src/forge/users/Index.scss @@ -97,7 +97,61 @@ $flex:flex; } } } - +.userDescription{ + color: #666666; + line-height: 18px; + text-align: left; + margin:10px 0px; + word-break: break-all; + text-align: justify; +} +.focusBox,.infoBox{ + width: 100%!important; + display: inline-block; + margin-top: 30px; + padding-top: 30px; + border-top: 1px solid #f1f1f1; +} +.infoBox{ + padding-bottom: 10px; + text-align: left; + line-height: 28px; + color: #666; + margin-top: 20px; + i{ + color: #DEDEDE; + font-size: 15px!important; + } + span{ + margin-left:10px ; + } +} +.headimg{ + position: relative; + display: block; + img{ + width: 110px; + height: 110px; + border-radius: 50%; + } + span{ + position: absolute; + bottom: -6px; + right: 0px; + left: 65px; + i{ + font-size: 25px!important; + border-radius: 50%; + background-color: #fff; + &.icon-nan{ + color: #1890FF; + } + &.icon-nv{ + color: pink; + } + } + } +} ul.ant-menu.menuStyle{ padding:0px 30px; font-size: 16px; diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index ec8f7bf19..6317bff59 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -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 (
-
- - {user && user.user_identity && ( -
- {user && user.user_identity} -
- )} +
+ + + + { + user && user.gender===1? + + : + + } + + +
{user && user.username}
+
+ {user && user.description} +
{user && current_user && user.login === current_user.login && (
)}
-
+
{user && user.watched_count}
+ { + user && (user.province || user.custom_department || user.email) ? +
+ { user.province &&
{user.province}{user.city}
} + { user.custom_department &&
{user.custom_department}
} + { user.email &&
{user.email}
} +
+ :"" + }
- { !route_type && + { !route_type && menuKey && 概览 数据统计 @@ -330,6 +340,19 @@ class Infos extends Component { return ; }} > + { + return ; + }} + > + { + return ; + }} + > + { diff --git a/src/forge/users/Material/Base.jsx b/src/forge/users/Material/Base.jsx new file mode 100644 index 000000000..578ae97fd --- /dev/null +++ b/src/forge/users/Material/Base.jsx @@ -0,0 +1,132 @@ +import React , { forwardRef, useEffect } from 'react'; +import { Form , Checkbox , Input, Radio , Button , Cascader } from 'antd'; +import { AlignCenter } from '../../Component/layout'; +import './Index.scss'; +import { locData } from '../../Utils/locData'; +import Axios from 'axios'; + +const { TextArea } = Input; +export default Form.create()( + forwardRef((props)=>{ + const { getFieldDecorator, validateFields , setFieldsValue } = props && props.form; + const { username } = props && props.match && props.match.params; + const { current_user , resetUser } = props; + + useEffect(()=>{ + if(current_user && current_user.login){ + setFieldsValue({ + ...current_user, + location:current_user.province && [current_user.province,current_user.city] + }) + } + },[current_user]) + + function submit() { + validateFields((error,values)=>{ + if(!error){ + submitFunc(values); + } + }) + } + + function submitFunc(values) { + const url = `/users/${username}.json`; + const params={ + user: { + nickname: values.real_name, + user_extension_attributes: { + province: values.location && values.location[0], + city: values.location && values.location[1], + ...values + } + } + } + Axios.put(url,params).then(result=>{ + if(result && result.data){ + resetUser && resetUser(result.data); + } + }).catch(error=>{}) + } + + return( +
+ + {getFieldDecorator("email",{ + rules:[{required:true,message:"请输入邮箱账号"}] + })( + + )} + + + {getFieldDecorator("show_email",{ + rules:[], + valuePropName:"checked" + })( + 在个人主页展示 + )} + + + {getFieldDecorator("real_name",{ + rules:[{required:true,message:"请输入姓名"}] + })( + + )} + +
+ + {getFieldDecorator("gender",{ + rules:[{required:true,message:"请选择性别"}] + })( + + + + + )} + +
+ + {getFieldDecorator("custom_department",{ + rules:[{required:true,message:"请输入单位名称"}] + })( + + )} + + + {getFieldDecorator("show_department",{ + rules:[], + valuePropName:"checked" + })( + 在个人主页展示 + )} + + + {getFieldDecorator("location",{ + rules:[] + })( + + )} + + + {getFieldDecorator("show_location",{ + rules:[], + valuePropName:"checked" + })( + 在个人主页展示 + )} + + + {getFieldDecorator("description",{ + rules:[] + })( +