From 09065383c1483c7f2e1da4d6ecd9b7a974040c86 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sun, 25 Apr 2021 17:38:47 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E9=A1=B9=E7=9B=AE-?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E5=B7=B2=E7=94=BB=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/EAccount.scss | 4 +- src/forge/Divert/DivertModal.jsx | 96 +++++++++++++++++++++++++++++++ src/forge/Divert/Index.scss | 12 ++++ src/forge/Notice/Index.jsx | 58 +++++++++++++++++++ src/forge/Notice/Index.scss | 36 ++++++++++++ src/forge/Notice/Notify.jsx | 64 +++++++++++++++++++++ src/forge/Notice/UndoEvent.jsx | 81 ++++++++++++++++++++++++++ src/forge/Settings/Setting.js | 31 +++++++++- src/forge/users/Infos.js | 60 ++++++++++--------- src/forge/users/undo_events.js | 16 ------ 10 files changed, 411 insertions(+), 47 deletions(-) create mode 100644 src/forge/Divert/DivertModal.jsx create mode 100644 src/forge/Divert/Index.scss create mode 100644 src/forge/Notice/Index.jsx create mode 100644 src/forge/Notice/Index.scss create mode 100644 src/forge/Notice/Notify.jsx create mode 100644 src/forge/Notice/UndoEvent.jsx delete mode 100644 src/forge/users/undo_events.js diff --git a/src/forge/Component/EAccount.scss b/src/forge/Component/EAccount.scss index 6f0bb97f..4bcd6b91 100644 --- a/src/forge/Component/EAccount.scss +++ b/src/forge/Component/EAccount.scss @@ -1,8 +1,8 @@ .ant-modal-mask{ - z-index: 10000; + z-index: 1001; } .ant-modal-wrap{ - z-index: 10001; + z-index: 1002; .ant-form-explain{ position: absolute; } diff --git a/src/forge/Divert/DivertModal.jsx b/src/forge/Divert/DivertModal.jsx new file mode 100644 index 00000000..914f92f2 --- /dev/null +++ b/src/forge/Divert/DivertModal.jsx @@ -0,0 +1,96 @@ +import React ,{ forwardRef, useEffect, useState } from 'react'; +import { Modal , Form , Input , Radio , Select } from 'antd'; +import './Index.scss'; + +const { Option } = Select; +function DivertModal({form , visible , onSuccess , onCancel}){ + const { getFieldDecorator, validateFields , setFieldsValue } = form; + const [ cate , setCate ] = useState(0); + + useEffect(()=>{ + setFieldsValue({goal:cate}) + },[]) + + function onOk(){ + validateFields((error,values)=>{ + if(!error){ + onSuccess(); + } + }) + + } + function changeType(e){ + setCate(e.target.value); + } + const layout = { + labelCol: { span: 5 }, + wrapperCol: { span: 18 }, + }; + return( + +
+ { + cate === 0 ? + + : + + } +
+ + {getFieldDecorator("goal",{ + rules:[] + })( + + 个人 + 组织 + + )} + + + {getFieldDecorator("username",{ + rules:[{required:true,message:"请输入目标用户名"}] + })( + + )} + + + {getFieldDecorator("identitfy", + {rules:[{required:true,message:"请输入目标组织"}]} + )( + + )} + + + {getFieldDecorator("username", + {rules:[{required:true,message:"请输入仓库标识"}]} + )( + + )} + +
+
+
+ ) +} +export default Form.create()(forwardRef(DivertModal)); \ No newline at end of file diff --git a/src/forge/Divert/Index.scss b/src/forge/Divert/Index.scss new file mode 100644 index 00000000..0a39e4e2 --- /dev/null +++ b/src/forge/Divert/Index.scss @@ -0,0 +1,12 @@ +.diverModal{ + .descUl{ + background-color: #fffae6; + border-radius: 4px; + padding:10px 15px; + color: #efc16b; + border:1px solid #efc16b; + } + .ant-form-item-required::before{ + content: ""; + } +} \ No newline at end of file diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx new file mode 100644 index 00000000..8135c72f --- /dev/null +++ b/src/forge/Notice/Index.jsx @@ -0,0 +1,58 @@ +import React, { useEffect, useState } from "react"; +import { Menu } from 'antd'; +import { Link } from 'react-router-dom'; +import './Index.scss'; + +import Loadable from "react-loadable"; +import Loading from "../../Loading"; +import { Route, Switch } from "react-router-dom"; + +const Notify = Loadable({ + loader: () => import("./Notify"), + loading: Loading, +}); +const UndoEvent = Loadable({ + loader: () => import("./UndoEvent"), + loading: Loading, +}); +function Index(props){ + const username = props.match.params.username; + const pathname = props.history.location.pathname; + const [ menu , setMenu ] = useState("notify"); + + useEffect(()=>{ + if(pathname && username){ + if(pathname === `/users/${username}/notice`){ + setMenu("notify"); + } + if(pathname === `/users/${username}/notice/undo`){ + setMenu("undo"); + } + } + },[pathname]) + + + return ( +
+ + 通知 + 接收仓库 + + + { + return ; + }} + > + { + return ; + }} + > + +
+ ); +} +export default Index; diff --git a/src/forge/Notice/Index.scss b/src/forge/Notice/Index.scss new file mode 100644 index 00000000..ccce3398 --- /dev/null +++ b/src/forge/Notice/Index.scss @@ -0,0 +1,36 @@ +.noticeMenu{ + .ant-menu-item{ + font-size: 16px; + padding:0px; + margin:0px 20px!important; + height: 54px; + line-height: 54px; + } +} +.notifyList{ + padding:0px 20px; + min-height: 400px; + li{ + display: flex; + border-bottom: 1px solid #eee; + padding:20px 0px; + .notifyImg{ + width: 48px; + height: 48px; + border-radius: 50%; + margin-right: 15px; + } + .notifyFlex{ + flex:1; + p{ + margin:0px; + } + .notifyInfos{ + margin-bottom: 8px; + } + } + &:last-child{ + border-bottom: none; + } + } +} \ No newline at end of file diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx new file mode 100644 index 00000000..2b5b71dc --- /dev/null +++ b/src/forge/Notice/Notify.jsx @@ -0,0 +1,64 @@ +import React, { useEffect, useState } from "react"; +import Nodata from '../Nodata'; +import { Skeleton , Pagination } from 'antd'; +import { Link } from 'react-router-dom'; +import { getImageUrl } from 'educoder'; + +let l= [ + { + name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", + type:"moving",time:"几分钟前",login:"innov" + }, + { + name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", + type:"moving",time:"几分钟前",login:"innov" + } +] +const limit = 15; +function Notify(props){ + const [ list , setList ] = useState(undefined); + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + + useEffect(()=>{ + setList(l); + },[]) + + return( +
+ { + list && list.length > 0 ? +
+ +
+ : + + } + {list && list.length === 0 && } + { + total > limit && +
+ {setPage(p)}}/> +
+ } +
+ ) +} +export default Notify; \ No newline at end of file diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx new file mode 100644 index 00000000..9bb7b972 --- /dev/null +++ b/src/forge/Notice/UndoEvent.jsx @@ -0,0 +1,81 @@ +import React, { useEffect, useState } from "react"; +import Nodata from '../Nodata'; +import { FlexAJ } from '../Component/layout'; +import { Skeleton , Pagination } from 'antd'; +import { Link } from 'react-router-dom'; +import { getImageUrl } from 'educoder'; + +let l= [ + { + name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", + type:"moving",time:"几分钟前",login:"innov" + }, + { + name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", + type:"moving",time:"几分钟前",login:"innov" + } +] +const limit = 15; +function UndoEvent(props){ + const [ list , setList ] = useState(undefined); + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + + useEffect(()=>{ + setList(l); + },[]) + + // 接受 + function acceptDivert(){ + + } + + // 拒绝 + function revertDivert(){ + + } + + return( +
+ { + list && list.length > 0 ? +
+ +
+ : + + } + {list && list.length === 0 && } + { + total > limit && +
+ {setPage(p)}}/> +
+ } +
+ ) +} +export default UndoEvent; \ No newline at end of file diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index a85e159b..e266ae05 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -2,6 +2,7 @@ import React, { Component } from "react"; import { Form, Input, Checkbox, Select , Spin } from "antd"; import Title from '../Component/Title'; import {WhiteBack} from '../Component/layout'; +import DivertModal from '../Divert/DivertModal'; import axios from "axios"; import "./setting.scss"; const { TextArea } = Input; @@ -25,7 +26,8 @@ class Setting extends Component { LanguageList: undefined, private_check: undefined, loading:true, - project_units:['home',"activity","code"] + project_units:['home',"activity","code"], + divertVisible:false }; } @@ -186,12 +188,28 @@ class Setting extends Component { }); }; + // 转移仓库 + DivertProject=()=>{ + this.setState({ + divertVisible:true + }) + } + // 取消仓库转移 + CancelDivertProject=()=>{ + + } + // 确定转移仓库 + onSuccess=()=>{ + + } + render() { const { getFieldDecorator } = this.props.form; - const { CategoryList, LanguageList, private_check ,loading } = this.state; + const { CategoryList, LanguageList, private_check ,loading , divertVisible } = this.state; return (
+ {this.setState({divertVisible:false})}}/> 基本设置 @@ -282,6 +300,15 @@ class Setting extends Component {
危险操作区
+
+
+

转移仓库

+

+ 将此仓库转移给其他用户或组织 +

+
+ 转移 +

删除本仓库

diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index e3febfce..f9cd60ad 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -41,8 +41,8 @@ const FanUser = Loadable({ loading: Loading, }) -const UndoEvents = Loadable({ - loader: () => import("./undo_events"), +const Notice = Loadable({ + loader: () => import("../Notice/Index"), loading: Loading, }) class Infos extends Component { @@ -116,9 +116,10 @@ class Infos extends Component { undo_link = () => { const {user} = this.state this.setState({ - route_type: undefined + route_type: undefined, + project_type:"notice" }) - this.props.history.push(`/users/${user && user.login}/undo_events`) + this.props.history.push(`/users/${user && user.login}/notice`) } route_link = (type) => { @@ -130,7 +131,8 @@ class Infos extends Component { organize_link = () => { const {user} = this.state this.setState({ - route_type: undefined + route_type: undefined, + project_type:"organizes" }) this.props.history.push(`/users/${user && user.login}/organizes`) } @@ -211,21 +213,23 @@ class Infos extends Component {
- {/* {current_user && user && current_user.id === user.id && ( + {current_user && user && current_user.id === user.id && (
-

this.undo_link()}> - - - 待办事项 - - - {user.undo_events} - -

+
  • +

    this.undo_link()}> + + + 待办事项 + + + {user.undo_events} + +

    +
  • - )} */} + )}
      @@ -289,15 +293,17 @@ class Infos extends Component {
      -

      this.organize_link()} > - - - 组织 - - - {user && user.user_org_count} - -

      +
    • +

      this.organize_link()} > + + + 组织 + + + {user && user.user_org_count} + +

      +
    @@ -312,9 +318,9 @@ class Infos extends Component { }} > { - return ; + return ; }} > -
    -

    待办事项

    -
    - -
    - ); - } -} -export default UndoEvents; From 4e48b0b363acca2644069c80f5ad64b1cde588c4 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 26 Apr 2021 14:59:19 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=BD=AC=E7=A7=BB--?= =?UTF-8?q?=E6=95=B4=E4=BD=93=E6=95=B0=E6=8D=AE=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppConfig.js | 2 +- src/forge/Divert/DivertModal.jsx | 105 ++++++++++++++++++++++++------- src/forge/Notice/Index.scss | 1 + src/forge/Notice/Notify.jsx | 46 ++++++++------ src/forge/Notice/UndoEvent.jsx | 89 ++++++++++++++++++-------- src/forge/Settings/Setting.js | 95 +++++++++++++++++++--------- src/forge/users/Infos.js | 6 +- 7 files changed, 241 insertions(+), 103 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index bd24bb7d..87a7e886 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/Divert/DivertModal.jsx b/src/forge/Divert/DivertModal.jsx index 914f92f2..ab61147b 100644 --- a/src/forge/Divert/DivertModal.jsx +++ b/src/forge/Divert/DivertModal.jsx @@ -1,27 +1,66 @@ import React ,{ forwardRef, useEffect, useState } from 'react'; import { Modal , Form , Input , Radio , Select } from 'antd'; import './Index.scss'; +import Axios from 'axios'; const { Option } = Select; -function DivertModal({form , visible , onSuccess , onCancel}){ +function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ const { getFieldDecorator, validateFields , setFieldsValue } = form; const [ cate , setCate ] = useState(0); + const [ organizations , setOrganizations ] = useState(undefined); useEffect(()=>{ setFieldsValue({goal:cate}) },[]) + useEffect(()=>{ + if(owner && repo && visible===true){ + getTeam(); + } + },[repo,owner,visible]) + + function getTeam(){ + const url = `/${owner}/${repo}/applied_transfer_projects/organizations.json`; + Axios.get(url).then(result=>{ + if(result){ + setOrganizations(result.data.organizations); + } + }).catch(error=>{}) + } + + // 确认转移 function onOk(){ validateFields((error,values)=>{ if(!error){ - onSuccess(); + const url = `/${owner}/${repo}/applied_transfer_projects.json`; + Axios.post(url,{ + ...values + }).then(result=>{ + if(result){ + onSuccess(); + } + }).catch(error=>{}) } }) } function changeType(e){ setCate(e.target.value); + setFieldsValue({ + owner_name:undefined + }) } + + function checkIdentifier(rule, value, callback){ + if(!value){ + callback(); + } + if (repo && value !== repo) { + callback("请输入当前项目的标识!"); + } + callback(); + } + const layout = { labelCol: { span: 5 }, wrapperCol: { span: 18 }, @@ -33,7 +72,7 @@ function DivertModal({form , visible , onSuccess , onCancel}){ title="转移仓库" onCancel={onCancel} onOk={onOk} - okText="转移" + okText="确认转移" cancelText={"取消"} centered > @@ -63,27 +102,47 @@ function DivertModal({form , visible , onSuccess , onCancel}){ )} - - {getFieldDecorator("username",{ - rules:[{required:true,message:"请输入目标用户名"}] - })( - - )} - - - {getFieldDecorator("identitfy", - {rules:[{required:true,message:"请输入目标组织"}]} - )( - - )} - + { + cate === 0 && + + {getFieldDecorator("owner_name",{ + rules:[{required:true,message:"请输入目标用户名"}] + })( + + )} + + } + { + cate === 1 && + + {getFieldDecorator("owner_name", + {rules:[{required:true,message:"请选择目标组织"}]} + )( + + )} + + } + - {getFieldDecorator("username", - {rules:[{required:true,message:"请输入仓库标识"}]} + {getFieldDecorator("identifier", + { + rules:[ + {required:true,message:"请输入仓库标识"}, + { + validator:checkIdentifier + } + ] + } )( )} diff --git a/src/forge/Notice/Index.scss b/src/forge/Notice/Index.scss index ccce3398..a3c00f9e 100644 --- a/src/forge/Notice/Index.scss +++ b/src/forge/Notice/Index.scss @@ -1,4 +1,5 @@ .noticeMenu{ + padding:0px 20px; .ant-menu-item{ font-size: 16px; padding:0px; diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index 2b5b71dc..6ed82786 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -1,28 +1,36 @@ import React, { useEffect, useState } from "react"; import Nodata from '../Nodata'; -import { Skeleton , Pagination } from 'antd'; +import {Pagination } from 'antd'; import { Link } from 'react-router-dom'; import { getImageUrl } from 'educoder'; +import Axios from "axios"; -let l= [ - { - name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", - type:"moving",time:"几分钟前",login:"innov" - }, - { - name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", - type:"moving",time:"几分钟前",login:"innov" - } -] const limit = 15; function Notify(props){ + const username = props.match.params.username; const [ list , setList ] = useState(undefined); const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); useEffect(()=>{ - setList(l); - },[]) + if(username){ + getList(); + } + },[username,page]) + + function getList(){ + const url = `/users/${username}/applied_messages.json`; + Axios.get(url,{ + params:{ + page,per_page:limit + } + }).then(result=>{ + if(result){ + setList(result.data.applied_messages); + setTotal(result.data.total_count); + } + }).catch(error=>{}) + } return(
    @@ -34,13 +42,13 @@ function Notify(props){ list.map((i,k)=>{ return(
  • - +

    - {i.name} - {i.time} + {i.applied_user && i.applied_user.name} + {i.time_ago}

    -

    正在将仓库转移给【某某某】

    +

    {i.name}

  • ) @@ -49,9 +57,9 @@ function Notify(props){
    : - + "" } - {list && list.length === 0 && } + {list && list.length === 0 && } { total > limit &&
    diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index 9bb7b972..5bfac3ca 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -1,38 +1,57 @@ import React, { useEffect, useState } from "react"; import Nodata from '../Nodata'; import { FlexAJ } from '../Component/layout'; -import { Skeleton , Pagination } from 'antd'; +import { Pagination , Popconfirm } from 'antd'; import { Link } from 'react-router-dom'; import { getImageUrl } from 'educoder'; +import Axios from 'axios'; -let l= [ - { - name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", - type:"moving",time:"几分钟前",login:"innov" - }, - { - name:"创新使者",image_url:"system/lets/letter_avatars/2/D/169_162_140/120.png", - type:"moving",time:"几分钟前",login:"innov" - } -] const limit = 15; function UndoEvent(props){ + const username = props.match.params.username; const [ list , setList ] = useState(undefined); const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); + useEffect(()=>{ - setList(l); - },[]) + if(username){ + getList(); + } + },[username,page]) + + function getList(){ + const url = `/users/${username}/applied_transfer_projects.json`; + Axios.get(url,{ + params:{ + page,per_page:limit + } + }).then(result=>{ + if(result){ + setList(result.data.applied_transfer_projects); + setTotal(result.data.total_count); + } + }).catch(error=>{}) + } // 接受 - function acceptDivert(){ - + function acceptDivert(id){ + const url = `/users/${username}/applied_transfer_projects/${id}/accept.json`; + Axios.post(url).then(result=>{ + if(result && result.data){ + getList(); + } + }).catch(error=>{}) } // 拒绝 - function revertDivert(){ - + function revertDivert(id){ + const url = `/users/${username}/applied_transfer_projects/${id}/refuse.json`; + Axios.post(url).then(result=>{ + if(result && result.data){ + getList(); + } + }).catch(error=>{}) } return( @@ -45,18 +64,34 @@ function UndoEvent(props){ list.map((i,k)=>{ return(
  • - +

    - {i.name} - {i.time} + {i.user && i.user.name} + {i.time_ago}

    -

    请求将仓库转移给【用户名】,是否接受?

    - - 接受 - 拒绝 - +

    请求将仓库转移给【{i.owner && i.owner.name}】,是否接受?

    + { + i.status === "common" && + + acceptDivert(i.id)}> + 接受 + + revertDivert(i.id)}> + 拒绝 + + + } + { + i.status === "canceled" && 对方已取消转移 + } + { + i.status === "accept" && 已接受 + } + { + i.status === "refused" && 已拒绝 + }
  • @@ -66,9 +101,9 @@ function UndoEvent(props){
    : - + "" } - {list && list.length === 0 && } + {list && list.length === 0 && } { total > limit &&
    diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index e266ae05..0584e206 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -27,7 +27,9 @@ class Setting extends Component { private_check: undefined, loading:true, project_units:['home',"activity","code"], - divertVisible:false + divertVisible:false, + is_transfering:undefined, + permission:undefined }; } @@ -75,7 +77,9 @@ class Setting extends Component { this.setState({ private_check: result.data.private, loading:false, - project_units:units + project_units:units, + is_transfering:result.data.is_transfering, + permission:result.data.permission }); } }) @@ -196,20 +200,44 @@ class Setting extends Component { } // 取消仓库转移 CancelDivertProject=()=>{ + this.props.confirm({ + content: "是否确认取消将此项目转移给他人?", + onOk: () => { + const { projectsId , owner } = this.props.match.params; + const url = `/${owner}/${projectsId}/applied_transfer_projects/cancel.json`; + axios.post(url).then(result=>{ + if(result && result.data){ + this.setState({ + is_transfering:false + }) + } + }).catch(error=>{}) + }, + }); } // 确定转移仓库 onSuccess=()=>{ - + this.setState({ + is_transfering:true, + divertVisible:false + }) } render() { const { getFieldDecorator } = this.props.form; + const { projectsId , owner } = this.props.match.params; - const { CategoryList, LanguageList, private_check ,loading , divertVisible } = this.state; + const { CategoryList, LanguageList, private_check ,loading , divertVisible , permission , is_transfering } = this.state; return (
    - {this.setState({divertVisible:false})}}/> + {this.setState({divertVisible:false})}} + /> 基本设置 @@ -297,32 +325,41 @@ class Setting extends Component { {/* 镜像设置部分,暂无接口,先不显示 */} {/* */} - -
    -
    危险操作区
    -
    + { + permission && (permission === "Admin" || permission === "Owner")? +
    -

    转移仓库

    -

    - 将此仓库转移给其他用户或组织 -

    +
    危险操作区
    +
    +
    +

    转移仓库

    +

    + 将此仓库转移给其他用户或组织 +

    +
    + { + is_transfering ? + 取消转移 + : + 转移 + } +
    +
    +
    +

    删除本仓库

    +

    + 删除仓库是永久性的, + 无法撤消,且删除后,与仓库关联的项目/任务/合并请求/版本发布等,均会被删除 +

    +
    + + 删除本仓库 + +
    - 转移 -
    -
    -
    -

    删除本仓库

    -

    - 删除仓库是永久性的, - 无法撤消,且删除后,与仓库关联的项目/任务/合并请求/版本发布等,均会被删除 -

    -
    - - 删除本仓库 - -
    -
    -
    + + :"" + }
    ); diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index f9cd60ad..2248eca2 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -213,7 +213,7 @@ class Infos extends Component {
    - {current_user && user && current_user.id === user.id && ( + {current_user && user && user.login === current_user.login ? (
  • @@ -229,7 +229,7 @@ class Infos extends Component {
  • - )} + ):""}
      @@ -289,8 +289,6 @@ class Infos extends Component {
    } - -
  • From 631b05dfd629f48472f2c6b92f45ccb83ba150cb Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sun, 25 Apr 2021 17:46:38 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=BA=93=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=96=87=E4=BB=B6-=E5=88=87=E6=8D=A2=E5=88=B0?= =?UTF-8?q?=E5=85=B6=E5=AE=83=E7=9B=AE=E5=BD=95=E5=90=8E=E8=A6=81=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=B0=86=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=98=BE=E7=A4=BA=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/CoderDepot.jsx | 2 ++ src/forge/Main/Index.scss | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 5a993a45..86a33246 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -97,6 +97,7 @@ function CoderDepot(props){ setLastCommit(c && c.commit); setLastCommitAuthor(c && c.committer); setMainFlag(true); + setReadOnly(true); } setTimeout(function(){setIsSpin(false);},500); }).catch(error=>{setIsSpin(false);}) @@ -138,6 +139,7 @@ function CoderDepot(props){ setLastCommit(c && c.commit); setLastCommitAuthor(c && c.committer); setMainFlag(false); + setReadOnly(true); } setTimeout(function(){setIsSpin(false);},500) }).catch(error=>{setIsSpin(false);}) diff --git a/src/forge/Main/Index.scss b/src/forge/Main/Index.scss index 0af78cfa..8d074b65 100644 --- a/src/forge/Main/Index.scss +++ b/src/forge/Main/Index.scss @@ -223,6 +223,9 @@ .listtablebody{ li.listtablepath{ a{color: #40a9ff;} + p{ + margin-bottom: 0px!important; + } } li{ height: 42px; From 0636e0a9254ce94499d2b2b56fa1af519b871834 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 26 Apr 2021 16:17:04 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E9=A1=B9=E7=9B=AE-?= =?UTF-8?q?=E4=BF=AE=E6=94=B91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppConfig.js | 2 +- src/forge/Notice/Notify.jsx | 2 +- src/forge/Notice/UndoEvent.jsx | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index 87a7e886..bd24bb7d 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 || 'student' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index 6ed82786..f4ab2446 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -42,7 +42,7 @@ function Notify(props){ list.map((i,k)=>{ return(
  • - +

    {i.applied_user && i.applied_user.name} diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index 5bfac3ca..ddf9838c 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -64,14 +64,14 @@ function UndoEvent(props){ list.map((i,k)=>{ return(

  • - +

    {i.user && i.user.name} {i.time_ago}

    -

    请求将仓库转移给【{i.owner && i.owner.name}】,是否接受?

    +

    请求将仓库【{i.project && i.project.name}】转移给【{i.owner && i.owner.name}】,是否接受?

    { i.status === "common" && @@ -87,7 +87,7 @@ function UndoEvent(props){ i.status === "canceled" && 对方已取消转移 } { - i.status === "accept" && 已接受 + i.status === "accepted" && 已接受 } { i.status === "refused" && 已拒绝 From 2bd6f9cb1ec9a63779c761ca7a120f14266034c9 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 26 Apr 2021 16:17:21 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E7=BB=84=E7=BB=87-=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=92=8C=E7=BD=91=E5=9D=80=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/Cards.jsx | 3 ++- src/forge/Team/Sub/Detail.jsx | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/forge/Component/Cards.jsx b/src/forge/Component/Cards.jsx index 498b375c..f9a3d52e 100644 --- a/src/forge/Component/Cards.jsx +++ b/src/forge/Component/Cards.jsx @@ -3,7 +3,7 @@ import { getImageUrl } from 'educoder'; import { Link } from 'react-router-dom'; import './Component.scss'; -function Cards({img , title, desc , rightBtn , src}){ +function Cards({img , title, desc , rightBtn , src , bottomInfos}){ return(
    {img &&
    } @@ -15,6 +15,7 @@ function Cards({img , title, desc , rightBtn , src}){
    {desc}
    + {bottomInfos}
    ) diff --git a/src/forge/Team/Sub/Detail.jsx b/src/forge/Team/Sub/Detail.jsx index bba0b7de..f2df0dbd 100644 --- a/src/forge/Team/Sub/Detail.jsx +++ b/src/forge/Team/Sub/Detail.jsx @@ -83,10 +83,9 @@ function Detail(props){ img={detail.avatar_url} rightBtn={ - {flag && !buttonflag && detail.is_admin ? - 设置 - - :""} + {flag && !buttonflag && detail.is_admin ? + 设置 + :""} {buttonflag && 组织成员{detail.num_users && {detail.num_users}} @@ -95,6 +94,12 @@ function Detail(props){ } } + bottomInfos={ + !buttonflag &&
    + {detail.location} + {detail.website} +
    + } /> } From 0cdb491433e2a560a1c131031657aa1a6616987f Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 26 Apr 2021 16:31:26 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E6=AD=A3=E5=88=99=E5=92=8C=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E7=9A=84=E9=A1=B5=E9=9D=A2=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/Setting/TeamSettingCommon.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index 1a48c7f7..2aeb0742 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -99,8 +99,8 @@ export default Form.create()( if(!value){ callback(); } - if(value && !value.match(/^[a-zA-Z][a-zA-Z\d]{3,14}$/)){ - callback("只能使用英文字母和数字,以字母开头,长度为4到15个字符"); + if(value && !value.match(/^[a-zA-Z][a-zA-Z0-9_-]{3,19}$/)){ + callback("只能使用以字母开头,包含字母、数字、下划线、横杠等,长度4到20个字符"); } callback(); } From c0ddd6eaeea7873470e149db38428ebb0e26f2f1 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 26 Apr 2021 17:20:54 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E7=BB=84=E7=BB=87-=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BAname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/ListItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Team/ListItem.jsx b/src/forge/Team/ListItem.jsx index 767a23c2..3c2cf3f4 100644 --- a/src/forge/Team/ListItem.jsx +++ b/src/forge/Team/ListItem.jsx @@ -7,7 +7,7 @@ function ListItem({item,key,OIdentifier}) {

    - {item.identifier} + {item.name} { item.forked_from_project_id && } { item.type && item.type !== 0 ? From e10f9893e0ddb6e0e47f09796b94130da4a5a18d Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 09:45:14 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9B=A2=E9=98=9F-?= =?UTF-8?q?=E6=97=A0=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/TeamGroupItems.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Team/TeamGroupItems.jsx b/src/forge/Team/TeamGroupItems.jsx index b3b4a371..e96a310d 100644 --- a/src/forge/Team/TeamGroupItems.jsx +++ b/src/forge/Team/TeamGroupItems.jsx @@ -105,7 +105,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){ }

    } - { list && list.length > 0 && } + { list && list.length === 0 && } { total > limit &&
    From 4ba63fd8fafdff8fa963afe0c98dd3fc2877400a Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 13:50:05 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=BD=AC=E7=A7=BB-?= =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Settings/Setting.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index 0584e206..57ea399f 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -29,7 +29,6 @@ class Setting extends Component { project_units:['home',"activity","code"], divertVisible:false, is_transfering:undefined, - permission:undefined }; } @@ -79,7 +78,6 @@ class Setting extends Component { loading:false, project_units:units, is_transfering:result.data.is_transfering, - permission:result.data.permission }); } }) @@ -227,8 +225,9 @@ class Setting extends Component { render() { const { getFieldDecorator } = this.props.form; const { projectsId , owner } = this.props.match.params; + const { projectDetail } = this.props; - const { CategoryList, LanguageList, private_check ,loading , divertVisible , permission , is_transfering } = this.state; + const { CategoryList, LanguageList, private_check ,loading , divertVisible , is_transfering } = this.state; return (
    */} { - permission && (permission === "Admin" || permission === "Owner")? + projectDetail && projectDetail.permission && (projectDetail.permission === "Admin" || projectDetail.permission === "Owner")?
    危险操作区
    From 8d509f14739bcb255329b01c128811f83ba0ad4f Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 17:11:37 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E3=80=81website=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E8=87=B3develop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/SearchUser.jsx | 71 ++++++++++++++++++------------ src/forge/Main/CoderDepot.jsx | 4 +- src/forge/Team/Sub/Detail.jsx | 10 ++++- 3 files changed, 53 insertions(+), 32 deletions(-) diff --git a/src/forge/Component/SearchUser.jsx b/src/forge/Component/SearchUser.jsx index 0203d24f..b9841123 100644 --- a/src/forge/Component/SearchUser.jsx +++ b/src/forge/Component/SearchUser.jsx @@ -1,45 +1,43 @@ -import React , { useState } from 'react'; +import React , { useState , useEffect } from 'react'; import { AutoComplete } from 'antd'; import { getImageUrl } from "educoder"; import axios from 'axios'; const Option = AutoComplete.Option; -export default ({ getUser })=>{ +export default ({ getUser , placeholder, width })=>{ + const [ source , setSource ] = useState(undefined); const [ searchKey , setSearchKey ] = useState(undefined); - const [ userDataSource , setUserDataSource ] = useState(undefined); + + useEffect(()=>{ + getUserList(); + },[searchKey]) function getUserList(e){ const url = `/users/list.json`; axios.get(url, { params: { - search: e, + search: searchKey, }, - }) - .then((result) => { + }).then((result) => { if (result) { - setUserDataSource(result.data.users); + sourceOptions(result.data.users); } }) .catch((error) => { console.log(error); }); }; - - function changeInputUser(value){ - setSearchKey(value); - getUserList(value); - } - function selectInputUser(id, option){ - setSearchKey(option.props.value); - getUserList(option.props.value); - getUser && getUser(id); - } - const source = - userDataSource && userDataSource.map((item, key) => { + function sourceOptions(userDataSource){ + const s = userDataSource && userDataSource.map((item, key) => { return ( - ); }); + setSource(s); + } + + function changeInputUser(e){ + setSearchKey(e); + }; + + // 选择用户 + function selectInputUser(e, option){ + setSearchKey(option.props.name); + getUser(option.props.login); + }; + return( - +
    + trigger.parentNode} + dataSource={source} + value={searchKey} + style={{ width: width || 300 }} + onChange={changeInputUser} + onSelect={selectInputUser} + placeholder={placeholder || "搜索需要添加的用户..."} + allowClear + /> +
    ) } \ No newline at end of file diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 86a33246..15073e83 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -305,12 +305,12 @@ function CoderDepot(props){ urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务
    { type === "dir" && projectDetail.type !== 2 && - + } - + diff --git a/src/forge/Team/Sub/Detail.jsx b/src/forge/Team/Sub/Detail.jsx index f2df0dbd..6e048a05 100644 --- a/src/forge/Team/Sub/Detail.jsx +++ b/src/forge/Team/Sub/Detail.jsx @@ -96,8 +96,14 @@ function Detail(props){ } bottomInfos={ !buttonflag &&
    - {detail.location} - {detail.website} + { + detail.location && + {detail.location} + } + { + detail.website && + {detail.website} + }
    } /> From 1474f5d3fe81427d97ceb807b5a60ec2e0dac3f4 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 17:12:00 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E9=A1=B9=E7=9B=AE-bug?= =?UTF-8?q?=E5=92=8C=E4=BF=AE=E6=94=B9=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Divert/DivertModal.jsx | 15 +++++++++--- src/forge/Notice/Index.jsx | 41 ++++++++++++++++++++++++++------ src/forge/Notice/Index.scss | 39 ++++++++++++++++++++++++++++-- src/forge/Notice/Notify.jsx | 23 ++++++++++++++++-- src/forge/Notice/UndoEvent.jsx | 7 ++++-- src/forge/Settings/Setting.js | 19 +++++++++++---- src/forge/users/Infos.js | 14 +++++++---- 7 files changed, 134 insertions(+), 24 deletions(-) diff --git a/src/forge/Divert/DivertModal.jsx b/src/forge/Divert/DivertModal.jsx index ab61147b..7d85f809 100644 --- a/src/forge/Divert/DivertModal.jsx +++ b/src/forge/Divert/DivertModal.jsx @@ -1,5 +1,6 @@ import React ,{ forwardRef, useEffect, useState } from 'react'; import { Modal , Form , Input , Radio , Select } from 'antd'; +import SearchUser from '../Component/SearchUser'; import './Index.scss'; import Axios from 'axios'; @@ -31,13 +32,14 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ // 确认转移 function onOk(){ validateFields((error,values)=>{ + console.log(...values); if(!error){ const url = `/${owner}/${repo}/applied_transfer_projects.json`; Axios.post(url,{ ...values }).then(result=>{ if(result){ - onSuccess(); + onSuccess(result.data && result.data.owner); } }).catch(error=>{}) } @@ -65,6 +67,12 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ labelCol: { span: 5 }, wrapperCol: { span: 18 }, }; + + function getUser(id){ + setFieldsValue({ + owner_name:id + }) + } return( + // + )} } @@ -118,7 +127,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ {getFieldDecorator("owner_name", {rules:[{required:true,message:"请选择目标组织"}]} )( - trigger.parentNode}> { organizations && organizations.length > 0 ? organizations.map((i,k)=>{ diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index 8135c72f..e222d7b8 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -1,5 +1,4 @@ import React, { useEffect, useState } from "react"; -import { Menu } from 'antd'; import { Link } from 'react-router-dom'; import './Index.scss'; @@ -18,7 +17,18 @@ const UndoEvent = Loadable({ function Index(props){ const username = props.match.params.username; const pathname = props.history.location.pathname; + const user = props.user; + const [ menu , setMenu ] = useState("notify"); + const [ undo_messages , setMessages ] = useState("notify"); + const [ undo_transfer_projects , setTransferProjects ] = useState("notify"); + + useEffect(()=>{ + if(user){ + setMessages(user.undo_messages); + setTransferProjects(user.undo_transfer_projects); + } + },[user]) useEffect(()=>{ if(pathname && username){ @@ -31,24 +41,41 @@ function Index(props){ } },[pathname]) + function fetchUser(){ + props && props.fetchUser(); + } + + function changeNum(){ + fetchUser(); + } return (
    - - 通知 - 接收仓库 - +
      +
    • + + 通知 + {undo_messages ? {undo_messages}:""} + +
    • +
    • + + 接收仓库 + {undo_transfer_projects ? {undo_transfer_projects}:""} + +
    • +
    { - return ; + return ; }} > { - return ; + return ; }} > diff --git a/src/forge/Notice/Index.scss b/src/forge/Notice/Index.scss index a3c00f9e..c7bb50eb 100644 --- a/src/forge/Notice/Index.scss +++ b/src/forge/Notice/Index.scss @@ -1,11 +1,46 @@ .noticeMenu{ padding:0px 20px; - .ant-menu-item{ + display: flex; + border-bottom: 1px solid #eee; + height: 54px; + line-height: 54px; + li{ font-size: 16px; padding:0px; - margin:0px 20px!important; + margin:0px 30px 0px 20px!important; height: 54px; line-height: 54px; + position: relative; + transform: none; + a{ + display: flex; + &>span{ + position: relative; + } + } + &.active a span:first-child::after{ + position: absolute; + bottom: 0px; + height: 2px; + left: 0px; + content: ""; + background-color: #1890ff; + width: 100%; + } + .unNum{ + color: #d38900; + font-size: 12px; + border-radius: 13px; + height: 16px; + line-height: 16px; + padding:0px 4px; + min-width: 23px; + text-align: center; + background-color: #ffe4b3; + margin-top: 19px; + margin-left: 10px; + display: block; + } } } .notifyList{ diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index f4ab2446..c4ac6699 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -32,6 +32,25 @@ function Notify(props){ }).catch(error=>{}) } + function renderStatus(status,applied){ + let { project , owner} = applied + if(status){ + switch(status){ + case 'canceled': + return `取消转移【${project && project.name}】仓库` + case 'common': + return `正在将【${project && project.name}】仓库转移给【${owner && owner.name}】` + case 'successed': + return `【${project && project.name}】仓库成功转移给【${owner && owner.name}】` + default: + return `拒绝转移【${project && project.name}】仓库` + } + + }else{ + return "" + } + } + return(
    { @@ -48,7 +67,7 @@ function Notify(props){ {i.applied_user && i.applied_user.name} {i.time_ago}

    -

    {i.name}

    +

    {renderStatus(i.status,i.applied)}

  • ) @@ -59,7 +78,7 @@ function Notify(props){ : "" } - {list && list.length === 0 && } + {list && list.length === 0 && } { total > limit &&
    diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index ddf9838c..4f105141 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -40,6 +40,7 @@ function UndoEvent(props){ Axios.post(url).then(result=>{ if(result && result.data){ getList(); + props && props.fetchUser(); } }).catch(error=>{}) } @@ -50,6 +51,7 @@ function UndoEvent(props){ Axios.post(url).then(result=>{ if(result && result.data){ getList(); + props && props.fetchUser(); } }).catch(error=>{}) } @@ -71,7 +73,8 @@ function UndoEvent(props){ {i.time_ago}

    -

    请求将仓库【{i.project && i.project.name}】转移给【{i.owner && i.owner.name}】,是否接受?

    +

    请求将仓库【{i.project && i.project.name}】 + 转移给【{i.owner && i.owner.name}】,是否接受?

    { i.status === "common" && @@ -103,7 +106,7 @@ function UndoEvent(props){ : "" } - {list && list.length === 0 && } + {list && list.length === 0 && } { total > limit &&
    diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index 57ea399f..05b9967c 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -3,6 +3,7 @@ import { Form, Input, Checkbox, Select , Spin } from "antd"; import Title from '../Component/Title'; import {WhiteBack} from '../Component/layout'; import DivertModal from '../Divert/DivertModal'; +import { Link } from 'react-router-dom'; import axios from "axios"; import "./setting.scss"; const { TextArea } = Input; @@ -77,6 +78,7 @@ class Setting extends Component { private_check: result.data.private, loading:false, project_units:units, + transfer:result.data.transfer, is_transfering:result.data.is_transfering, }); } @@ -215,10 +217,11 @@ class Setting extends Component { } // 确定转移仓库 - onSuccess=()=>{ + onSuccess=(owner)=>{ this.setState({ is_transfering:true, - divertVisible:false + divertVisible:false, + transfer:owner }) } @@ -227,7 +230,8 @@ class Setting extends Component { const { projectsId , owner } = this.props.match.params; const { projectDetail } = this.props; - const { CategoryList, LanguageList, private_check ,loading , divertVisible , is_transfering } = this.state; + const { CategoryList, LanguageList, private_check ,loading , divertVisible , is_transfering, transfer } = this.state; + console.log(transfer); return (

    转移仓库

    - 将此仓库转移给其他用户或组织 + { + is_transfering ? + 此仓库正在转移给【 + {transfer && {transfer.name}} + 】,请联系对方接收此仓库。 + : + `将此仓库转移给其他用户或组织` + }

    { diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 2248eca2..0759a6a9 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -52,7 +52,8 @@ class Infos extends Component { isSpin: false, user: undefined, project_type: undefined, - route_type: undefined + route_type: undefined, + undo_events:0 }; } @@ -73,14 +74,19 @@ class Infos extends Component { }); const { current_user } = this.props; const { username } = this.props.match.params; + const { pathname } = this.props.location; 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 notice = p !== 0 ? pathname === `/users/${username}/notice` :false; this.setState({ user: result.data, isSpin: false, + undo_events:notice ? (e-p) : e }); }) .catch((error) => { @@ -142,7 +148,7 @@ class Infos extends Component { const { current_user, mygetHelmetapi } = this.props; const { username } = this.props.match.params; - const { user, isSpin, project_type, route_type } = this.state; + const { user, isSpin, project_type, route_type , undo_events } = this.state; return (
    @@ -223,7 +229,7 @@ class Infos extends Component { 待办事项 - {user.undo_events} + {undo_events}

    @@ -318,7 +324,7 @@ class Infos extends Component { { - return ; + return ; }} > Date: Tue, 27 Apr 2021 17:23:58 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E4=B8=8D=E8=83=BD=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/Setting/TeamSettingCommon.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index 2aeb0742..6a94beb5 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -119,7 +119,7 @@ export default Form.create()( validator:checkname } ], - ,true + ,true )} {helper( "组织名称:", From ae34240bfbb3fff5f7687adbbbc7dcbe09d4a2db Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 17:46:05 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E9=80=9A=E7=9F=A5-=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Notice/Index.jsx | 15 ++++++++------- src/forge/Notice/Notify.jsx | 10 +++++----- src/forge/Notice/UndoEvent.jsx | 1 - src/forge/users/Infos.js | 10 ++++++---- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index e222d7b8..218b16f5 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -18,17 +18,18 @@ function Index(props){ const username = props.match.params.username; const pathname = props.history.location.pathname; const user = props.user; + const undo_messages = props.undo_messages; const [ menu , setMenu ] = useState("notify"); - const [ undo_messages , setMessages ] = useState("notify"); - const [ undo_transfer_projects , setTransferProjects ] = useState("notify"); + const [ messages , setMessages ] = useState(0); + const [ transferProjects , setTransferProjects ] = useState(0); useEffect(()=>{ - if(user){ - setMessages(user.undo_messages); + if(user && undo_messages){ + setMessages(undo_messages); setTransferProjects(user.undo_transfer_projects); } - },[user]) + },[user,undo_messages]) useEffect(()=>{ if(pathname && username){ @@ -55,13 +56,13 @@ function Index(props){
  • 通知 - {undo_messages ? {undo_messages}:""} + {messages ? {messages}:""}
  • 接收仓库 - {undo_transfer_projects ? {undo_transfer_projects}:""} + {transferProjects ? {transferProjects}:""}
  • diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index c4ac6699..d927f56f 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -37,13 +37,13 @@ function Notify(props){ if(status){ switch(status){ case 'canceled': - return `取消转移【${project && project.name}】仓库` + return

    取消转移【{project && project.name}】仓库

    case 'common': - return `正在将【${project && project.name}】仓库转移给【${owner && owner.name}】` + return

    正在将【{project && project.name}】仓库转移给【{owner && owner.name}】

    case 'successed': - return `【${project && project.name}】仓库成功转移给【${owner && owner.name}】` + return

    {project && project.name}】仓库成功转移给【{owner && owner.name}】

    default: - return `拒绝转移【${project && project.name}】仓库` + return

    拒绝转移【{project && project.name}】仓库

    } }else{ @@ -67,7 +67,7 @@ function Notify(props){ {i.applied_user && i.applied_user.name} {i.time_ago}

    -

    {renderStatus(i.status,i.applied)}

    + {renderStatus(i.status,i.applied)}
    ) diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index 4f105141..afb5c706 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -13,7 +13,6 @@ function UndoEvent(props){ const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); - useEffect(()=>{ if(username){ getList(); diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 0759a6a9..06055044 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -53,7 +53,8 @@ class Infos extends Component { user: undefined, project_type: undefined, route_type: undefined, - undo_events:0 + undo_events:0, + undo_messages:0 }; } @@ -86,7 +87,8 @@ class Infos extends Component { this.setState({ user: result.data, isSpin: false, - undo_events:notice ? (e-p) : e + undo_events:notice ? (e-p) : e, + undo_messages:notice ? result.data && result.data.undo_messages : 0 }); }) .catch((error) => { @@ -123,7 +125,7 @@ class Infos extends Component { const {user} = this.state this.setState({ route_type: undefined, - project_type:"notice" + project_type:"notice", }) this.props.history.push(`/users/${user && user.login}/notice`) } @@ -148,7 +150,7 @@ class Infos extends Component { const { current_user, mygetHelmetapi } = this.props; const { username } = this.props.match.params; - const { user, isSpin, project_type, route_type , undo_events } = this.state; + const { user, isSpin, project_type, route_type , undo_events , undo_messages } = this.state; return (
    From 79d8f4e5adbb3e8210e15c0bd0640039f0eebd09 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 18:27:56 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E9=87=8C=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/SearchUser.jsx | 8 +++++++- src/forge/Divert/DivertModal.jsx | 12 +++++++++++- src/forge/Notice/Index.jsx | 2 +- src/forge/users/Infos.js | 15 ++++++++++----- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/forge/Component/SearchUser.jsx b/src/forge/Component/SearchUser.jsx index b9841123..79d23fb6 100644 --- a/src/forge/Component/SearchUser.jsx +++ b/src/forge/Component/SearchUser.jsx @@ -5,9 +5,15 @@ import axios from 'axios'; const Option = AutoComplete.Option; -export default ({ getUser , placeholder, width })=>{ +export default ({ getUser , placeholder, width ,value })=>{ const [ source , setSource ] = useState(undefined); const [ searchKey , setSearchKey ] = useState(undefined); + + useEffect(()=>{ + if(!value){ + setSearchKey(undefined); + } + },[value]) useEffect(()=>{ getUserList(); diff --git a/src/forge/Divert/DivertModal.jsx b/src/forge/Divert/DivertModal.jsx index 7d85f809..1b9c486f 100644 --- a/src/forge/Divert/DivertModal.jsx +++ b/src/forge/Divert/DivertModal.jsx @@ -8,6 +8,8 @@ const { Option } = Select; function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ const { getFieldDecorator, validateFields , setFieldsValue } = form; const [ cate , setCate ] = useState(0); + const [ value , setValue ] = useState(undefined); + const [ organizations , setOrganizations ] = useState(undefined); useEffect(()=>{ @@ -18,6 +20,13 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ if(owner && repo && visible===true){ getTeam(); } + if(!visible){ + setFieldsValue({ + owner_name:undefined, + identifier:undefined + }) + setValue(undefined) + } },[repo,owner,visible]) function getTeam(){ @@ -69,6 +78,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ }; function getUser(id){ + setValue(id); setFieldsValue({ owner_name:id }) @@ -117,7 +127,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ rules:[{required:true,message:"请输入目标用户名"}] })( // - + )} } diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index 218b16f5..ea57af38 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -19,7 +19,7 @@ function Index(props){ const pathname = props.history.location.pathname; const user = props.user; const undo_messages = props.undo_messages; - + const [ menu , setMenu ] = useState("notify"); const [ messages , setMessages ] = useState(0); const [ transferProjects , setTransferProjects ] = useState(0); diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 06055044..f7a1d887 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -76,6 +76,7 @@ class Infos extends Component { const { current_user } = this.props; const { username } = this.props.match.params; const { pathname } = this.props.location; + const { notice } = this.state; let url = `/users/${username || (current_user && current_user.login)}.json`; axios @@ -83,12 +84,13 @@ class Infos extends Component { .then((result) => { let e = result.data && result.data.undo_events; let p = result.data && result.data.undo_messages; - let notice = p !== 0 ? pathname === `/users/${username}/notice` :false; + let n = notice || pathname === `/users/${username}/notice` ; this.setState({ user: result.data, isSpin: false, - undo_events:notice ? (e-p) : e, - undo_messages:notice ? result.data && result.data.undo_messages : 0 + undo_events:n ? (e-p) : e, + undo_messages:0, + notice:n }); }) .catch((error) => { @@ -122,12 +124,15 @@ class Infos extends Component { } undo_link = () => { - const {user} = this.state + const {user } = this.state; this.setState({ route_type: undefined, project_type:"notice", + notice:true + },()=>{ + this.props.history.push(`/users/${user && user.login}/notice`); + this.fetchUser(); }) - this.props.history.push(`/users/${user && user.login}/notice`) } route_link = (type) => { From 93a53e2c7f5ff3dc4777a02043ddd5ba3b4e5641 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 27 Apr 2021 18:44:40 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E9=A1=B9=E7=9B=AE-bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/sub/DetailBanner.jsx | 4 ++-- src/forge/Notice/Index.jsx | 8 +++++--- src/forge/Settings/Setting.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/forge/Main/sub/DetailBanner.jsx b/src/forge/Main/sub/DetailBanner.jsx index 331790c8..aa801773 100644 --- a/src/forge/Main/sub/DetailBanner.jsx +++ b/src/forge/Main/sub/DetailBanner.jsx @@ -75,7 +75,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa :"" } - { + {/* { item.menu_name === "resources" &&
  • @@ -84,7 +84,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa {projectDetail && projectDetail.source_count ? {projectDetail.source_count} :""}
  • - } + } */} { item.menu_name === "versions" &&
  • diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index ea57af38..d9d04d59 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -19,16 +19,18 @@ function Index(props){ const pathname = props.history.location.pathname; const user = props.user; const undo_messages = props.undo_messages; - + const [ menu , setMenu ] = useState("notify"); const [ messages , setMessages ] = useState(0); const [ transferProjects , setTransferProjects ] = useState(0); useEffect(()=>{ - if(user && undo_messages){ - setMessages(undo_messages); + if(user){ setTransferProjects(user.undo_transfer_projects); } + if(undo_messages){ + setMessages(undo_messages); + } },[user,undo_messages]) useEffect(()=>{ diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index 05b9967c..4c719968 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -15,7 +15,7 @@ const menu = [ {name:"易修 (Issue)",index:"issues"}, {name:"合并请求",index:"pulls"}, {name:"工作流(beta版)",index:"devops"}, - {name:"资源库",index:"resources"}, + // {name:"资源库",index:"resources"}, {name:"里程碑",index:"versions"}, {name:"动态",index:"activity"}, ] From 2fcb645d42945b863ce1abd2972d9cf0163d0269 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 28 Apr 2021 20:17:30 +0800 Subject: [PATCH 16/16] =?UTF-8?q?04-28=E4=BC=91=E5=81=87=E6=9C=9F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9issue=20--=E9=9C=80=E5=90=88=E5=B9=B6=E8=87=B3?= =?UTF-8?q?=E5=85=B6=E5=AE=83=E5=88=86=E6=94=AF=EF=BC=88=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=9B=B8=E5=85=B3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Merge/NewMerge.js | 2 +- src/forge/Merge/merge_form.js | 14 ++++++++------ src/forge/Order/MilepostDetail.js | 2 +- src/forge/Order/order.js | 4 ++-- src/forge/Order/order_form.js | 4 ++-- src/forge/Team/Group/GroupDetails.jsx | 5 +++-- src/modules/tpm/TPMBanner.js | 2 +- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/forge/Merge/NewMerge.js b/src/forge/Merge/NewMerge.js index 2ef27efa..3cbe4ddc 100644 --- a/src/forge/Merge/NewMerge.js +++ b/src/forge/Merge/NewMerge.js @@ -178,7 +178,7 @@ class NewMerge extends Component { let arr = projects_names && projects_names.filter(item=>item.id===value); let identifier = arr && arr[0].project_id; let login = arr && arr[0].project_user_login; - let is_fork_id = parseInt(value) !== parseInt(id) + let is_fork_id = parseInt(value) !== parseInt(id); this.setState({ isSpin: true, merge_head: is_fork_id, diff --git a/src/forge/Merge/merge_form.js b/src/forge/Merge/merge_form.js index 57886d04..1c75a9f9 100644 --- a/src/forge/Merge/merge_form.js +++ b/src/forge/Merge/merge_form.js @@ -34,17 +34,19 @@ class MergeForm extends Component { this.set_defatul(); }; componentDidUpdate=(prevPros)=>{ + const { projectsId ,owner } = this.props.match.params; + const pId = prevPros.match.params.projectsId; + const oId = prevPros.match.params.owner; + if(pId !== projectsId || oId !== owner ){ + // console.log("切换了项目分支···········"); + this.get_default_selects(); + } if(prevPros && this.props && !this.props.checkIfLogin()){ this.props.history.push("/403") return } } - // check_is_login =() =>{ - // if(!this.props.checkIfLogin()){ - // this.props.history.push("/403") - // return - // } - // }; + get_default_selects = () => { const { projectsId ,owner } = this.props.match.params; this.setState({ isSpin: true }); diff --git a/src/forge/Order/MilepostDetail.js b/src/forge/Order/MilepostDetail.js index 2cfb2f89..7954630d 100644 --- a/src/forge/Order/MilepostDetail.js +++ b/src/forge/Order/MilepostDetail.js @@ -218,7 +218,7 @@ class MilepostDetail extends Component {
    编辑里程碑 - 创建任务 + 创建易修
  • diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js index ac9e7a0e..8875aa85 100644 --- a/src/forge/Order/order.js +++ b/src/forge/Order/order.js @@ -352,12 +352,12 @@ class order extends Component { if (this.props.checkIfLogin()) { return( - + 创建任务 + + 创建易修 ) }else{ return( - + 创建任务 + + 创建易修 ) } } diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js index db36c3ea..ed8d4d8b 100644 --- a/src/forge/Order/order_form.js +++ b/src/forge/Order/order_form.js @@ -310,14 +310,14 @@ class order_form extends Component {

    - {form_type === "new" ? "新建" :( form_type === "copy" ? "复制" : "编辑")}任务 + {form_type === "new" ? "新建" :( form_type === "copy" ? "复制" : "编辑")}易修

    {getFieldDecorator("subject", { rules: [ { required: true, - message: "请填写任务标题", + message: "请填写易修标题", }, ] })()} diff --git a/src/forge/Team/Group/GroupDetails.jsx b/src/forge/Team/Group/GroupDetails.jsx index 8d1c519b..49720c17 100644 --- a/src/forge/Team/Group/GroupDetails.jsx +++ b/src/forge/Team/Group/GroupDetails.jsx @@ -84,11 +84,12 @@ export default ((props) => { // 移除成员 function removeUser(username) { - const url = `/organizations/${OIdentifier}/teams/${groupId}/team_users/${username}.json`; if (username) { + const url = `/organizations/${OIdentifier}/teams/${groupId}/team_users/quit.json`; axios.delete(url).then((result) => { if (result && result.data) { - + props.showNotification(`已成功退出团队!`); + props.history.push(`/organize/${OIdentifier}`); } }).catch((error) => { }); } diff --git a/src/modules/tpm/TPMBanner.js b/src/modules/tpm/TPMBanner.js index 3f591a40..6760fe04 100644 --- a/src/modules/tpm/TPMBanner.js +++ b/src/modules/tpm/TPMBanner.js @@ -1062,7 +1062,7 @@ class TPMBanner extends Component {
    :

    - 尚未创建任务的实训,不能申请发布 + 尚未创建易修的实训,不能申请发布

    }