Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
checkError(){
if (this.props.hasError){
const error = this.props.lastError.message;
let message = i18n.t("login_validationMessage");
console.log(error);
// Add a Toast on screen.
Toast.show(message, {
duration: Toast.durations.SHORT,
position: Toast.positions.BOTTOM,
shadow: true,
animation: true,
hideOnPress: true,
onHidden: () => {
this.props.resetLoginControlVars();
}
});
}
}
render() {
duration: Toast.durations.SHORT,
position: Toast.positions.CENTER,
})
return
}
if (/^[\u3220-\uFA29]+$/.test(userName)) {
Toast.show('账号请输入英文字符', {
duration: Toast.durations.SHORT,
position: Toast.positions.CENTER,
})
return
}
if (!this.state.domain) {
Toast.show('域名不可空!', {
duration: Toast.durations.SHORT,
position: Toast.positions.CENTER,
})
return
}
if (!userName) {
Toast.show('账号不可空!', {
duration: Toast.durations.SHORT,
position: Toast.positions.CENTER,
})
return
}
if (!password) {
Toast.show('密码不可空!', {
duration: Toast.durations.SHORT,
position: Toast.positions.CENTER,
})
return
onError={(e) => {
console.log(e)
Toast.show('mp3资源出错',{
position: Toast.positions.CENTER,
onHidden: () => {
let index = this.state.songs.indexOf(this.state.currentSong)
index = index == this.state.songs.length-1 ? 0 : index+1
this.setState({
currentSong: this.state.songs[index],
sliderValue: 0,
current: '00:00',
})
}
})
}}
/>
duration: Toast.durations.SHORT,
position: Toast.positions.BOTTOM,
shadow: true,
animation: true,
hideOnPress: true,
delay: 0
});
setTimeout(function () {
Toast.hide(toast);
}, 2000);
} else {
this.props.tracker.trackEvent('Favourites', 'Removed');
this.props.favouritesActions.removeFavourites(info.account_id);
let toast = Toast.show('Removed from Favourites', {
duration: Toast.durations.SHORT,
position: Toast.positions.BOTTOM,
shadow: true,
animation: true,
hideOnPress: true,
delay: 0
});
setTimeout(function () {
Toast.hide(toast);
}, 2000);
}
setTimeout(() => {
var favouritesString = JSON.stringify(this.props.favourites);
AsyncStorage.setItem("favourites", favouritesString);
}, 1000);
}
const timer = setTimeout(() => {
Loading.hidden()
Toast.show('请求超时,请烧后重试!', {
duration: Toast.durations.SHORT,
position: Toast.positions.CENTER,
})
}, 30000)
BackAndroid.addEventListener('hardwareBackPress', (()=> {
let routes = _navigator.getCurrentRoutes();
if (routes.length>0) {
_navigator.pop();
if(routes.length==2){
Toast.show(Di18n.tr('再按一次退出程序'),{
duration:Toast.durations.SHORT,
position:Toast.positions.CENTER,
animation:true
});
}else if(routes.length==1){
BackAndroid.exitApp();
}
return true;
}else{
return false;
}
}));
}
_register(){
let {mobile, password, code} = this.state;
if (!mobile.length) {
Toast.show('请输入正确的手机号', {position:Toast.positions.CENTER});
return;
}
if (password.length < 6) {
Toast.show('密码必须大于6位', {position:Toast.positions.CENTER});
return;
}
if (!code.length) {
Toast.show('请输入验证码', {position:Toast.positions.CENTER});
return;
}
InteractionManager.runAfterInteractions(() => {
const {dispatch} = this.props;
dispatch(userRegister(mobile, password, code));
});
};
showWarning: (msg, options) => {
let toast = RootToast.show(
Platform.OS === 'ios' ?
: msg, {
duration: RootToast.durations.SHORT,
position: RootToast.positions.CENTER,
...options,
})
setTimeout(function () {
RootToast.hide(toast)
}, RootToast.durations.SHORT + 500)
},
})
this.setState(
{
fixVersions:
formatFixVersions.length > 0 ? formatFixVersions : null,
projectData: value,
customItems: customItems.length === 0 ? null : customItems,
subCustomItems: subCustomItems,
},
() => this.searchAssignee('')
)
} else {
Loading.hidden()
Toast.show('该项目信息异常,请检查配置!', {
duration: Toast.durations.SHORT,
position: Toast.positions.CENTER,
})
}
})
}
_login(){
let {mobile, password} = this.state;
if (!mobile.length) {
Toast.show('请输入正确的手机号', {position:Toast.positions.CENTER});
return;
}
if (!password.length) {
Toast.show('请输入密码', {position:Toast.positions.CENTER});
return;
}
InteractionManager.runAfterInteractions(() => {
const {dispatch} = this.props;
dispatch(userLogin(mobile, password));
});
}