diff --git a/src/forge/users/Material/Phone.jsx b/src/forge/users/Material/Phone.jsx index bc355542..3e9d04fb 100644 --- a/src/forge/users/Material/Phone.jsx +++ b/src/forge/users/Material/Phone.jsx @@ -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){ diff --git a/src/forge/users/contribution/index.jsx b/src/forge/users/contribution/index.jsx index 3fd80e11..fa1a15ed 100644 --- a/src/forge/users/contribution/index.jsx +++ b/src/forge/users/contribution/index.jsx @@ -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){
{item.name}
{item.balance}
- {getUser(item.id, login)}} width={"100%"} placeholder="搜索转账目标用户"/> + {getUser(item.id, login)}} width={"100%"} placeholder="搜索转账目标用户" value={userLogin[item.id]}/> {proId === item.id && error1 &&
{error1}
}
- {setToken(item.id, e.target.value)}} placeholder='请输入token数额'/> + {setToken(item.id, e.target.value)}} placeholder='请输入token数额'/> {proId === item.id && error2 &&
{error2}
}