Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
form.validateFields((error, value) => {
if (!error) {
if (this.state.teamid) {
postRecruit({
teamid: this.state.teamid,
contact: this.state.contact,
title: this.state.title,
description: this.state.description,
endDate: this.state.endDate
})
} else {
Toast.fail('请选择战队', 1.5)
}
} else {
Toast.fail('格式错误,请检查后提交', 1.5)
}
})
}
return async dispatch => {
if (!user || !pwd) {
Toast.fail("请输入帐号密码", 1);
} else {
try {
const res = await axios.post("/user/register", { user, pwd, type });
if (res.status === 200 && res.data.code === 0) {
dispatch({ type: REGISTER, payload: res.data.data });
setToken(res.data.token);
}
} catch (error) {
console.log(error)
}
}
};
}
saveHandle(){
const info = Object.values(this.state);
for(let i =0;i{
this.props.history.push("/genius")
});
}
this.allReplies.push({
id: data.data.reply_id,
author: {
loginname: session.loginname,
avatar_url: session.avatar_url
},
content,
ups: [],
create_at: new Date(),
reply_id: reply_id ? reply_id : null,
is_uped: false
});
});
Toast.success(successInfo, 1);
} catch (err) {
Toast.fail(errorInfo, 1);
} finally {
status.setSubmitting(false);
}
}
cb: (isSuccess, msg) => {
if (isSuccess) {
Toast.success(msg, 1);
router.replace('/me');
} else {
Toast.fail(msg, 1);
}
}
}
failToast(value) {
Toast.fail(value, 2);
}
if (team.length < currentUser.get('teamLimit')) {
const response = yield call(teamsService.cerateTeam, payload, currentUser)
yield put(action.postTeamsSuccess(response))
Toast.success('提交成功', 1)
yield delay(1000)
yield put(NavigationActions.back())
} else {
yield put(action.postTeamsFailed())
Toast.fail(
'提交失败,每位用户最多可创建一支战队,若想创建多支战队,请联系管理员963577494@qq.com',
3
)
}
} catch (error) {
yield put(action.postTeamsFailed())
Toast.fail('提交失败', 1)
}
}
http.get('register_agreement').then((response) => {
if (response.code === 200 && response.success) {
const agreeCon = response.data.register_agreement.register_agreement
this.setState(() => ({ agreeCon }))
} else {
Toast.fail(response.msg ? response.msg : '获取异常,请稍后再试。')
}
}).catch(() => { Toast.offline('抱歉,网络错误,请稍后再试!') })
})
function failToast() {
Toast.fail('Load failed !!!');
}
async fetchCartNum () {
try {
const {errno, errmsg, cartTotal} = await http.getCartNum({})
if(errno===401){
Toast.fail(errmsg, .5,() => {
this.props.actions.loginFailure()
})
}else{
this.setState({goodsCount:cartTotal.goodsCount})
}
} catch (e) {
throw e
}
}
/*添加到我喜欢*/