+
:""
}
diff --git a/src/forge/Order/order.css b/src/forge/Order/order.css
index 60bb5d2bb..c35a18274 100644
--- a/src/forge/Order/order.css
+++ b/src/forge/Order/order.css
@@ -232,6 +232,9 @@
border-bottom: 1px solid #eee;
padding: 16px 0px 16px 20px;
}
+.issueItem:last-child{
+ border-bottom: none;
+}
.issueNo {
padding: 0px 5px;
border-radius: 4px;
diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js
index 8a7bc9287..17cee7051 100644
--- a/src/forge/Order/order.js
+++ b/src/forge/Order/order.js
@@ -852,7 +852,7 @@ class order extends Component {
)}
{
search_count > select_params.limit ?
-
+
{
+ if(avatarImg){
+ setAvatarPhoto(avatarImg);
+ }
+ },[avatarImg])
+
+ const cropper = useRef();
+
+ const saveAvatar = async () => {
+ const imgUrl = cropper.current.cropper.getCroppedCanvas().toDataURL("image/jpeg");
+ if (!imgUrl) {
+ message.info('请先上传图片');
+ }
+ const url = `/users/${login}/update_image.json`;
+ axios.put(url,{
+ image:imgUrl
+ }).then(result=>{
+ if(result){
+ message.success("头像修改成功!");
+ onCancel(true);
+ }
+ }).catch(error=>{})
+ }
+
+ function onChange(e){
+
+ let files;
+ if (e.dataTransfer) {
+ files = e.dataTransfer.files;
+ } else if (e.target) {
+ files = e.target.files;
+ }
+
+ if (!files || (files && files.length===0)) {
+ return;
+ }
+ const file = files[0];
+ if (!/^image\/\w+/.test(file.type)) {
+ message.info('请选择一个图片格式的文件');
+ return;
+ }
+
+ if (file.size > 2 * 1024 * 1024) {
+ message.info('仅支持文件大小小于2M的文件');
+ return;
+ }
+
+ const reader = new FileReader();
+ reader.onload = () => {
+ setAvatarPhoto(reader.result);
+ };
+ reader.readAsDataURL(files[0]);
+ }
+
+ return(
+ onCancel(false)}
+ className="avatarBox"
+ >
+
+
+
+ {/* 仅支持JPG、GIF、PNG,且文件小于2M */}
+
+
+
+
+ )
+}
+export default Index;
\ No newline at end of file
diff --git a/src/forge/users/Avatar/Index.scss b/src/forge/users/Avatar/Index.scss
new file mode 100644
index 000000000..8b7c1b17c
--- /dev/null
+++ b/src/forge/users/Avatar/Index.scss
@@ -0,0 +1,66 @@
+.avatarBox{
+ position: relative;
+ .ant-modal-header{
+ background-color: rgba(242, 242, 255, 1);
+ .ant-modal-title{
+ text-align: left;
+ }
+ }
+
+ .ant-modal-body{
+ position: relative;
+ }
+ .avatarDiv{
+ display: flex;
+ .previewBox{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: space-between;
+ margin-left: 30px;
+ .uploadBtn{
+ margin-bottom: 30px;
+ display: flex;
+ a,label{
+ cursor: pointer;
+ display: block;
+ height: 32px;
+ line-height: 30px;
+ margin:0px 10px;
+ width: 100px;
+ border:1px solid rgba(208, 208, 208, 1);
+ background-color: white;
+ border-radius:4px;
+ text-align: center;
+ color:#666666;
+ span{
+ display: block;
+ .ant-upload.ant-upload-select {
+ width: 100%;
+ height: 32px;
+ }
+ .ant-upload-list{
+ display: none;
+ }
+ }
+ }
+ a{
+ background-color: rgba(65, 84, 241, 1);
+ color: white;
+ border-color: rgba(65, 84, 241, 1);
+ &:hover{
+ color: white!important;
+ }
+ }
+ }
+ }
+ .previewImg{
+ overflow: hidden;
+ background-color: #fff;
+ border-radius: 50%;
+ text-align: center;
+ width: 100px!important;
+ height: 100px!important;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/forge/users/Index.css b/src/forge/users/Index.css
index 280cce1b3..8cad4168d 100644
--- a/src/forge/users/Index.css
+++ b/src/forge/users/Index.css
@@ -137,7 +137,6 @@
.infoBox span {
margin-left: 10px;
}
-
.headimg {
position: relative;
display: block;
@@ -150,8 +149,7 @@
.headimg span {
position: absolute;
bottom: -6px;
- right: 0px;
- left: 65px;
+ right: -16px;
}
.headimg span i {
font-size: 25px !important;
diff --git a/src/forge/users/Index.scss b/src/forge/users/Index.scss
index 8139ebaec..e523323d2 100644
--- a/src/forge/users/Index.scss
+++ b/src/forge/users/Index.scss
@@ -133,6 +133,32 @@ $flex:flex;
margin-left:10px ;
}
}
+
+.headimg-div{
+ width: 110px;
+ height: 110px;
+ margin:0px auto;
+ position: relative;
+ .updateAvatar{
+ cursor: pointer;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ border-radius: 50%;
+ content: "";
+ left: 0px;
+ top:0px;
+ background-color: rgba(0,0,0,0.2);
+ display: none;
+ align-items: center;
+ justify-content: center;
+ color: white;
+ transition: 1s;
+ }
+ &:hover .updateAvatar{
+ display: flex;
+ }
+}
.headimg{
position: relative;
display: block;
@@ -145,7 +171,7 @@ $flex:flex;
position: absolute;
bottom: -6px;
right: 0px;
- left: 65px;
+ z-index: 11;
i{
font-size: 25px!important;
border-radius: 50%;
diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js
index 00b03310b..ad339cf04 100644
--- a/src/forge/users/Infos.js
+++ b/src/forge/users/Infos.js
@@ -1,11 +1,12 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
-import { Button, Spin , Menu } from "antd";
+import { Spin , Menu } from "antd";
import FocusButton from "../UsersList/focus_button";
import axios from "axios";
import { getImageUrl } from "educoder";
import { Route, Switch } from "react-router-dom";
+import Avatar from './Avatar/Index';
import "./new_user.css";
import "../css/index.scss";
@@ -14,10 +15,10 @@ import './Index.scss';
import Loadable from "react-loadable";
import Loading from "../../Loading";
-const UpdateInfo = Loadable({
- loader: () => import("./Material/Index"),
- loading: Loading,
-});
+// const UpdateInfo = Loadable({
+// loader: () => import("./Material/Index"),
+// loading: Loading,
+// });
const InfosDevOps = Loadable({
loader: () => import("./devOpsCI"),
loading: Loading,
@@ -66,7 +67,8 @@ class Infos extends Component {
project_type: undefined,
route_type: undefined,
undo_events:0,
- menuKey:"0"
+ menuKey:"0",
+ avatarVisible:false
};
}
@@ -193,29 +195,54 @@ class Infos extends Component {
})
}
+ onCancelAvatar=(reset)=>{
+ this.setState({
+ avatarVisible:false
+ })
+ if(reset){
+ this.fetchUser();
+ const { resetUserInfo } = this.props;
+ resetUserInfo && resetUserInfo();
+ }
+ }
+
render() {
const { current_user } = this.props;
const { username } = this.props.match.params;
- const { user, isSpin, route_type , undo_events , menuKey } = this.state;
+ const { user, isSpin, route_type , undo_events , menuKey , avatarVisible } = this.state;
return (
+ {
+ avatarVisible &&
+
+ }
-
-
-
- {
- user && user.gender===1?
-
- :
-
- }
+
+
+
+
+ {
+ user && user.gender===1?
+
+ :
+
+ }
+
-
-
+ {
+ current_user && current_user.login && current_user.login === username ?
+
{this.setState({avatarVisible:true})}}>修改头像
+ :""
+ }
+
{user && user.username}