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] =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=BC=B9=E7=AA=97=E9=87=8C?=
=?UTF-8?q?=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 b98411237..79d23fb65 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 7d85f8093..1b9c486f2 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 218b16f5b..ea57af38c 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 06055044a..f7a1d8876 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) => {