forked from Gitlink/forgeplus-react
issue
This commit is contained in:
parent
661c454dc9
commit
416f04c430
|
|
@ -20,7 +20,7 @@ export default Form.create()(
|
|||
function checkPsd(rule, value, callback){
|
||||
const map = passMap;
|
||||
if(value){
|
||||
current_user && value.length > 8 && Axios.post(`/v1/${current_user.login}/check_password.json`,{
|
||||
current_user && value.length > 7 && Axios.post(`/v1/${current_user.login}/check_password.json`,{
|
||||
password: value
|
||||
}).then(res=>{
|
||||
if(res && !res.data.status){
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ function Contribution(props){
|
|||
const [error2, setError2] = useState(undefined);
|
||||
// 操作仓库id
|
||||
const [proId, setProId] = useState(undefined);
|
||||
const { checkIfLogin , showLoginDialog , current_user:{user_id, login}, current_user } = props;
|
||||
console.log('current_user', current_user);
|
||||
const {current_user:{user_id, login}} = props;
|
||||
const {user} = props;
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -53,14 +52,15 @@ function Contribution(props){
|
|||
|
||||
// 目标转账用户
|
||||
function getUser(id, login){
|
||||
const userLoginObject = Object.assign(userLogin);
|
||||
// 使用JSON进行对象深拷贝
|
||||
const userLoginObject = JSON.parse(JSON.stringify(userLogin));
|
||||
userLoginObject[id] = login;
|
||||
setUserLogin(userLoginObject);
|
||||
}
|
||||
|
||||
// token转账值
|
||||
function setToken(id, token){
|
||||
const tokenCountObject = Object.assign(tokenCount);
|
||||
const tokenCountObject = JSON.parse(JSON.stringify(tokenCount));
|
||||
tokenCountObject[id] = token;
|
||||
setTokenCount(tokenCountObject);
|
||||
}
|
||||
|
|
@ -80,7 +80,6 @@ function Contribution(props){
|
|||
}else if(!/^[1-9]+[0-9]*]*$/.test(tokenCountById) || tokenCountById>max){
|
||||
setError2('转账token数额必须为不超过token总数的正整数');
|
||||
}else{
|
||||
console.log('userLogin', userLoginById, 'tokenCount', tokenCountById);
|
||||
axios.post(`/users/blockchain/transfer`, {
|
||||
owner_login: login,
|
||||
project_identifier: identifier,
|
||||
|
|
@ -90,8 +89,9 @@ function Contribution(props){
|
|||
payer_id: user_id,
|
||||
project_id: id
|
||||
}).then(res=>{
|
||||
console.log('res', res);
|
||||
if(res && res.data && res.data.status === 2){
|
||||
getUser(id, undefined);
|
||||
setToken(id, undefined);
|
||||
setReload(Math.random());
|
||||
message.success('转账成功');
|
||||
}
|
||||
|
|
@ -119,11 +119,11 @@ function Contribution(props){
|
|||
<div className='tableColumn1'>{item.name}</div>
|
||||
<div className='tableColumn2'>{item.balance}</div>
|
||||
<div className='tableColumn3'>
|
||||
<SearchUser getUser={(login)=>{getUser(item.id, login)}} width={"100%"} placeholder="搜索转账目标用户"/>
|
||||
<SearchUser getUser={(login)=>{getUser(item.id, login)}} width={"100%"} placeholder="搜索转账目标用户" value={userLogin[item.id]}/>
|
||||
{proId === item.id && error1 && <div className='errorTipTri'>{error1}</div>}
|
||||
</div>
|
||||
<div className='tableColumn4'>
|
||||
<Input onChange={(e)=>{setToken(item.id, e.target.value)}} placeholder='请输入token数额'/>
|
||||
<Input value={tokenCount[item.id]} onChange={(e)=>{setToken(item.id, e.target.value)}} placeholder='请输入token数额'/>
|
||||
{proId === item.id && error2 && <div className='errorTipTri'>{error2}</div>}
|
||||
</div>
|
||||
<div className='tableColumn5'><Button className='confirmTransfer' onClick={()=>{confirmTransfer(item.id, item.identifier, item.balance)}}>确认</Button></div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue