-
+
{item.user.name}
From f08c1404265fe6b62661d3992620d8ba5afa0a5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Fri, 27 Sep 2024 11:05:18 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=85=E5=8A=9E=E4=BA=8B=E9=A1=B9-?=
=?UTF-8?q?=E6=88=90=E5=91=98=E7=94=B3=E8=AF=B7=E9=A1=B5=E9=9D=A2=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E5=88=86=E9=A1=B5=E5=8F=82=E6=95=B0=E4=BC=A0=E5=8F=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Notice/Apply.jsx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/forge/Notice/Apply.jsx b/src/forge/Notice/Apply.jsx
index aeacd67a2..f16e9a34c 100644
--- a/src/forge/Notice/Apply.jsx
+++ b/src/forge/Notice/Apply.jsx
@@ -19,11 +19,15 @@ function Apply(props) {
setIsSpin(true);
getList();
}
- },[username])
+ },[username, page])
function getList() {
const url = `/users/${username}/applied_projects.json`;
- Axios.get(url).then(result=>{
+ Axios.get(url,{
+ params:{
+ page,per_page:limit
+ }
+ }).then(result=>{
if(result){
setList(result.data.applied_projects);
setTotal(result.data.total_count);
From 9c46682dcf9d53aec2d0841f2efd293e22ad9386 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Fri, 27 Sep 2024 11:06:05 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5-?=
=?UTF-8?q?=E5=8C=BA=E5=9D=97=E7=A1=AE=E6=9D=83=E6=B7=BB=E5=8A=A0=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E5=90=8D=E7=A7=B0=E6=90=9C=E7=B4=A2=EF=BC=8C=E5=90=8C?=
=?UTF-8?q?=E6=97=B6=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=E4=B8=8B=E6=8B=89?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=87=8F=E5=B0=91?=
=?UTF-8?q?list=E6=8E=A5=E5=8F=A3=E8=AF=B7=E6=B1=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Component/SearchUser.jsx | 30 ++++++++------------
src/forge/Divert/DivertModal.jsx | 14 ++++------
src/forge/users/contribution/index.jsx | 38 ++++++++++++++++++--------
3 files changed, 43 insertions(+), 39 deletions(-)
diff --git a/src/forge/Component/SearchUser.jsx b/src/forge/Component/SearchUser.jsx
index 79d23fb65..de8ea9a3a 100644
--- a/src/forge/Component/SearchUser.jsx
+++ b/src/forge/Component/SearchUser.jsx
@@ -5,25 +5,21 @@ import axios from 'axios';
const Option = AutoComplete.Option;
-export default ({ getUser , placeholder, width ,value })=>{
+export default ({ getUser , placeholder, width ,value, userList=[] })=>{
const [ source , setSource ] = useState(undefined);
- const [ searchKey , setSearchKey ] = useState(undefined);
-
useEffect(()=>{
- if(!value){
- setSearchKey(undefined);
+ if(userList && userList.length){
+ sourceOptions(userList);
+ }else{
+ getUserList();
}
- },[value])
-
- useEffect(()=>{
- getUserList();
- },[searchKey])
+ },[])
- function getUserList(e){
+ function getUserList(value){
const url = `/users/list.json`;
axios.get(url, {
params: {
- search: searchKey,
+ search: value,
},
}).then((result) => {
if (result) {
@@ -61,13 +57,9 @@ export default ({ getUser , placeholder, width ,value })=>{
setSource(s);
}
- function changeInputUser(e){
- setSearchKey(e);
- };
-
// 选择用户
function selectInputUser(e, option){
- setSearchKey(option.props.name);
+ getUserList(option.props.name);
getUser(option.props.login);
};
@@ -76,12 +68,12 @@ export default ({ getUser , placeholder, width ,value })=>{
trigger.parentNode}
dataSource={source}
- value={searchKey}
style={{ width: width || 300 }}
- onChange={changeInputUser}
+ onSearch={(value)=>{getUserList(value)}}
onSelect={selectInputUser}
placeholder={placeholder || "搜索需要添加的用户..."}
allowClear
+ optionLabelProp="name"
/>
)
diff --git a/src/forge/Divert/DivertModal.jsx b/src/forge/Divert/DivertModal.jsx
index d4c1f2014..27e3e4f79 100644
--- a/src/forge/Divert/DivertModal.jsx
+++ b/src/forge/Divert/DivertModal.jsx
@@ -8,14 +8,9 @@ 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(()=>{
- setFieldsValue({goal:cate})
- },[])
-
useEffect(()=>{
if(owner && repo && visible===true){
getTeam();
@@ -25,7 +20,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
owner_name:undefined,
identifier:undefined
})
- setValue(undefined)
+ setCate(0);
}
},[repo,owner,visible])
@@ -79,7 +74,6 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
};
function getUser(id){
- setValue(id);
setFieldsValue({
owner_name:id
})
@@ -94,6 +88,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
okText="确认转移"
cancelText={"取消"}
centered
+ destroyOnClose={true}
>
{
@@ -113,7 +108,8 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
{getFieldDecorator("goal",{
- rules:[]
+ rules:[],
+ initialValue: 0
})(
个人
@@ -128,7 +124,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
rules:[{required:true,message:"请输入目标用户名"}]
})(
//
-
+
)}
}
diff --git a/src/forge/users/contribution/index.jsx b/src/forge/users/contribution/index.jsx
index 381b474e3..aec4cb470 100644
--- a/src/forge/users/contribution/index.jsx
+++ b/src/forge/users/contribution/index.jsx
@@ -1,11 +1,8 @@
import React , { useEffect , useState } from 'react';
import { Button, Dropdown, Input, Menu , message, Pagination } from 'antd';
-import Search from '../../Component/Search';
-import Item from '../Team-item';
import Nodata from '../../Nodata';
import axios from 'axios';
-import CheckProfile from '../../Component/ProfileModal/Profile';
import './index.scss';
import SearchUser from '../../Component/SearchUser';
import { FlexAJ } from '../../Component/layout';
@@ -28,6 +25,10 @@ function Contribution(props){
const [error2, setError2] = useState(undefined);
// 操作仓库id
const [proId, setProId] = useState(undefined);
+ // 名称搜索
+ const [content, setContent] = useState(undefined);
+ // 平台用户列表
+ const [userList, setUserList] = useState([]);
const {current_user:{user_id, login, open_blockchain}, current_user} = props;
const {user} = props;
const username = props.match.params.username;
@@ -43,7 +44,8 @@ function Contribution(props){
axios.get(`/users/blockchain/balance.json`,{params: {
user_id,
limit,
- page
+ page,
+ keyword: content
}}).then(res=>{
if(res && res.data){
const {projects} = res.data;
@@ -63,7 +65,7 @@ function Contribution(props){
setTotal(res.data.total_count);
}
})
- }, [reload, page])
+ }, [reload, page, content])
useEffect(()=>{
if(user){
@@ -73,6 +75,16 @@ function Contribution(props){
}
},[user])
+ useEffect(()=>{
+ // 获取平台用户列表
+ const url = `/users/list.json`;
+ axios.get(url).then((result) => {
+ if (result) {
+ setUserList(result.data.users);
+ }
+ })
+ }, [])
+
// 目标转账用户
function getUser(id, login){
// 使用JSON进行对象深拷贝
@@ -113,7 +125,7 @@ function Contribution(props){
project_id: id
}).then(res=>{
if(res && res.data && res.data.status === 2){
- getUser(id, undefined);
+ // getUser(id, undefined);
setToken(id, undefined);
setReload(Math.random());
message.success('转账成功');
@@ -124,10 +136,14 @@ function Contribution(props){
return(
{/* 转账/记录切换 */}
- {/*
*/}
+
{/* token转账 */}
{type ?
{list && list.length > 0 &&
@@ -142,7 +158,7 @@ function Contribution(props){
{item.name}
{item.balance}
-
{getUser(item.id, login)}} width={"100%"} placeholder="搜索转账目标用户" value={userLogin[item.id]}/>
+ {getUser(item.id, login)}} width={"100%"} placeholder="搜索转账目标用户" userList={userList}/>
{proId === item.id && error1 && {error1}
}