From fa47ae9b5ed22829e48f008537b87a4afd82bba9 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 7 Jan 2022 11:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/layout.jsx | 2 + src/forge/SecuritySetting/Index.jsx | 25 ++++++- src/forge/SecuritySetting/Index.scss | 27 ++++++++ src/forge/Team/Component/AddMemberBox.jsx | 69 ++++++++++++++++++++ src/forge/Team/Index.scss | 44 +++++++++++++ src/forge/Team/Setting/TeamSettingMember.jsx | 10 ++- src/forge/Team/TeamMember.jsx | 16 ++++- 7 files changed, 188 insertions(+), 5 deletions(-) create mode 100644 src/forge/Team/Component/AddMemberBox.jsx diff --git a/src/forge/Component/layout.jsx b/src/forge/Component/layout.jsx index adaf4dbf..dcc133e8 100644 --- a/src/forge/Component/layout.jsx +++ b/src/forge/Component/layout.jsx @@ -7,6 +7,8 @@ export const Banner = styled.div`{ border-bottom:1px solid #eee; background-color:#fff; border-radius:5px 5px 0px 0px; + justify-content: space-between; + display: flex; }` export const AlignCenterBetween = styled.div`{ display:flex; diff --git a/src/forge/SecuritySetting/Index.jsx b/src/forge/SecuritySetting/Index.jsx index 3c843a08..1cfef0c3 100644 --- a/src/forge/SecuritySetting/Index.jsx +++ b/src/forge/SecuritySetting/Index.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import { Route, Switch } from "react-router-dom"; import { withRouter } from "react-router"; @@ -11,6 +11,7 @@ import Loading from "../../Loading"; import { Box , Gap , LongWidth } from '../Component/layout'; import { getImageUrl } from 'educoder'; import { Link } from 'react-router-dom'; +import Avatar from '../users/Avatar/Index'; import './Index.scss'; import { useEffect } from "react"; @@ -52,18 +53,38 @@ function Index(props){ const { pathname } = props.location; const notice_url = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice; + const [ avatarVisible , setAvatarVisible ] = useState(false); + useEffect(()=>{ if(checkIfLogin() === false){ props.history.push('/login'); } },[]) + + + function onCancelAvatar(){ + setAvatarVisible(false); + const { resetUserInfo } = props; + resetUserInfo && resetUserInfo(); + } return(
+ { + avatarVisible && + + }
- +
+ + setAvatarVisible(true)}>修改头像 +
{current_user && current_user.username}
    diff --git a/src/forge/SecuritySetting/Index.scss b/src/forge/SecuritySetting/Index.scss index ede91c86..7d299876 100644 --- a/src/forge/SecuritySetting/Index.scss +++ b/src/forge/SecuritySetting/Index.scss @@ -193,4 +193,31 @@ } .blue-Purple{ color: #466AFF !important; +} + +.userHeadPhoto{ + width: 48px; + position: relative; + margin:0px auto; + .userUpdateBox{ + font-size: 11px!important; + width: 100%; + height: 100%; + line-height: 48px; + text-align: center; + position: absolute; + left: 0px; + top:0px; + background-color: rgba(0, 0, 0, 0.2); + display: none!important; + color: white!important; + transition: 1s; + border-radius: 50%; + cursor: pointer; + } + &:hover{ + .userUpdateBox{ + display: block!important; + } + } } \ No newline at end of file diff --git a/src/forge/Team/Component/AddMemberBox.jsx b/src/forge/Team/Component/AddMemberBox.jsx new file mode 100644 index 00000000..65c16b9f --- /dev/null +++ b/src/forge/Team/Component/AddMemberBox.jsx @@ -0,0 +1,69 @@ +import React ,{ useState , useEffect } from 'react'; +import { Modal , Spin } from 'antd'; +import axios from 'axios'; + +function AddMemberBox({className,orzId,history,OIdentifier}){ + const [ visible , setVisible ] = useState(false); + const [ isSpin , setIsSpin ] = useState(true); + const [ list , setList ] = useState(undefined); + + useEffect(()=>{ + if(visible && orzId){ + InitData(); + } + },[orzId,visible]) + + function InitData(){ + const url = `/organizations/${orzId}/teams.json`; + axios.get(url,{ + params:{ + is_full:true + } + }).then(result=>{ + if(result){ + setList(result.data.teams); + setIsSpin(false); + } + }).catch(error=>{}) + } + + function chooseGroup(id){ + history.push(`/${OIdentifier}/teams/${id}/setting`); + } + return( +
    + setVisible(false)} + footer={null} + className="addMemberBody" + > +
    +

    请选择想要添加成员的组织团队

    + +
    + { + list && list.length > 0 ? +
      + { + list.map((i,k)=>{ + return( +
    • chooseGroup(i.id)}>{i.nickname}
    • + ) + }) + } +
    + :"" + } +
    +
    +
    +
    + setVisible(true)}>+ 添加成员 +
    + ) +} +export default AddMemberBox; \ No newline at end of file diff --git a/src/forge/Team/Index.scss b/src/forge/Team/Index.scss index 11237973..f188de05 100644 --- a/src/forge/Team/Index.scss +++ b/src/forge/Team/Index.scss @@ -369,4 +369,48 @@ } .hide{ display: none; +} + +.addMemberBtn{ + display: flex; + height: 34px; + line-height: 32px; + padding:0px 14px; + border-radius: 3px; + border:1px solid #d0d0d0; + font-size: 14px; + &:hover{ + border-color: #466AFF; + } +} + +.addMemberBody{ + .ant-modal-body{ + padding:0px; + } + .addForGroupList{ + padding:20px 40px; + max-height: 315px; + overflow-y: auto; + ul{ + display: flex; + flex-wrap: wrap; + width: 450px; + margin:0px auto; + } + li{ + cursor: pointer; + border:1px solid #d0d0d0; + border-radius:4px; + margin:0px 10px 15px 10px!important; + height: 40px; + line-height: 40px; + width: 130px; + text-align: center; + &.active,&:active{ + color: #fff; + background-color: rgba(65, 84, 241, 1); + } + } + } } \ No newline at end of file diff --git a/src/forge/Team/Setting/TeamSettingMember.jsx b/src/forge/Team/Setting/TeamSettingMember.jsx index 255897d6..9124390f 100644 --- a/src/forge/Team/Setting/TeamSettingMember.jsx +++ b/src/forge/Team/Setting/TeamSettingMember.jsx @@ -7,6 +7,7 @@ import styled from 'styled-components'; import { getImageUrl } from 'educoder'; import axios from 'axios'; import { Link } from 'react-router-dom'; +import AddMemberBox from '../Component/AddMemberBox'; const Img = styled.img`{ width:30px; @@ -14,7 +15,8 @@ const Img = styled.img`{ border-radius:50%; }` const limit = 15; -export default (({organizeDetail})=>{ +export default (({organizeDetail,history,match})=>{ + const OIdentifier = match.params.OIdentifier; const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); const [ search , setSearch ] = useState(undefined); @@ -116,6 +118,12 @@ export default (({organizeDetail})=>{ + 添加用户 */} +
    diff --git a/src/forge/Team/TeamMember.jsx b/src/forge/Team/TeamMember.jsx index 0a5abe1e..d21d514f 100644 --- a/src/forge/Team/TeamMember.jsx +++ b/src/forge/Team/TeamMember.jsx @@ -4,9 +4,11 @@ import Cards from '../Component/MemberCards'; import axios from 'axios'; import Nodata from '../Nodata'; import { Pagination , Spin } from 'antd'; +import AddMemberBox from './Component/AddMemberBox'; const limit = 15; -function TeamMember({organizeDetail,current_user}){ +function TeamMember({organizeDetail,current_user,history,match}){ + const OIdentifier = match.params.OIdentifier; const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); const [ isSpin , setIsSpin ] = useState(true); @@ -34,7 +36,17 @@ function TeamMember({organizeDetail,current_user}){ return( - 组织成员 + 组织成员 + { + organizeDetail && organizeDetail.is_admin && + + } +
    {